Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d4488a0c5 | ||
|
|
8e39aebe17 | ||
|
|
43a8131e8e | ||
|
|
61cdbf6727 | ||
|
|
67cf917a08 | ||
|
|
63139af3f3 |
@@ -54,6 +54,7 @@ PWA_APP_DISPLAY = 'standalone'
|
|||||||
PWA_APP_SCOPE = '/'
|
PWA_APP_SCOPE = '/'
|
||||||
PWA_APP_ORIENTATION = 'any'
|
PWA_APP_ORIENTATION = 'any'
|
||||||
PWA_APP_START_URL = '/'
|
PWA_APP_START_URL = '/'
|
||||||
|
PWA_APP_STATUS_BAR_COLOR = 'default'
|
||||||
PWA_APP_ICONS = [
|
PWA_APP_ICONS = [
|
||||||
{
|
{
|
||||||
'src': '/static/images/my_app_icon.png',
|
'src': '/static/images/my_app_icon.png',
|
||||||
|
|||||||
@@ -2,8 +2,12 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.shortcuts import resolve_url
|
from django.shortcuts import resolve_url
|
||||||
from django.urls import get_script_prefix
|
from django.urls import get_script_prefix
|
||||||
|
from django.utils.functional import lazy
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
# Lazy-evaluate URLs so including pwa.urls in root urlconf works
|
||||||
|
resolve_url = lazy(resolve_url, str)
|
||||||
|
|
||||||
# Get script prefix for apps not mounted under /
|
# Get script prefix for apps not mounted under /
|
||||||
_PWA_SCRIPT_PREFIX = get_script_prefix()
|
_PWA_SCRIPT_PREFIX = get_script_prefix()
|
||||||
|
|
||||||
@@ -23,6 +27,7 @@ PWA_APP_DEBUG_MODE = getattr(settings, 'PWA_APP_DEBUG_MODE', True)
|
|||||||
PWA_APP_ORIENTATION = getattr(settings, 'PWA_APP_ORIENTATION', 'any')
|
PWA_APP_ORIENTATION = getattr(settings, 'PWA_APP_ORIENTATION', 'any')
|
||||||
PWA_APP_START_URL = resolve_url(getattr(settings, 'PWA_APP_START_URL', _PWA_SCRIPT_PREFIX))
|
PWA_APP_START_URL = resolve_url(getattr(settings, 'PWA_APP_START_URL', _PWA_SCRIPT_PREFIX))
|
||||||
PWA_APP_FETCH_URL = resolve_url(getattr(settings, 'PWA_APP_FETCH_URL', _PWA_SCRIPT_PREFIX))
|
PWA_APP_FETCH_URL = resolve_url(getattr(settings, 'PWA_APP_FETCH_URL', _PWA_SCRIPT_PREFIX))
|
||||||
|
PWA_APP_STATUS_BAR_COLOR = getattr(settings, 'PWA_APP_STATUS_BAR_COLOR', 'default')
|
||||||
PWA_APP_ICONS = getattr(settings, 'PWA_APP_ICONS', [
|
PWA_APP_ICONS = getattr(settings, 'PWA_APP_ICONS', [
|
||||||
{
|
{
|
||||||
'src': '/static/images/icons/icon-72x72.png',
|
'src': '/static/images/icons/icon-72x72.png',
|
||||||
@@ -102,5 +107,3 @@ PWA_APP_SPLASH_SCREEN = getattr(settings, 'PWA_APP_SPLASH_SCREEN', [
|
|||||||
])
|
])
|
||||||
PWA_APP_DIR = getattr(settings, 'PWA_APP_DIR', 'auto')
|
PWA_APP_DIR = getattr(settings, 'PWA_APP_DIR', 'auto')
|
||||||
PWA_APP_LANG = getattr(settings, 'PWA_APP_LANG', 'en-US')
|
PWA_APP_LANG = getattr(settings, 'PWA_APP_LANG', 'en-US')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
"orientation": {{ PWA_APP_ORIENTATION|js }},
|
"orientation": {{ PWA_APP_ORIENTATION|js }},
|
||||||
"background_color": {{ PWA_APP_BACKGROUND_COLOR|js }},
|
"background_color": {{ PWA_APP_BACKGROUND_COLOR|js }},
|
||||||
"theme_color": {{ PWA_APP_THEME_COLOR|js }},
|
"theme_color": {{ PWA_APP_THEME_COLOR|js }},
|
||||||
|
"status_bar": {{ PWA_APP_STATUS_BAR_COLOR|js }},
|
||||||
"icons": {{ PWA_APP_ICONS|js }},
|
"icons": {{ PWA_APP_ICONS|js }},
|
||||||
"dir": {{ PWA_APP_DIR|js }},
|
"dir": {{ PWA_APP_DIR|js }},
|
||||||
"lang": {{ PWA_APP_LANG|js }}
|
"lang": {{ PWA_APP_LANG|js }}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<!-- Add to homescreen for Safari on iOS -->
|
<!-- Add to homescreen for Safari on iOS -->
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-title" content="{{ PWA_APP_NAME }}">
|
<meta name="apple-mobile-web-app-title" content="{{ PWA_APP_NAME }}">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
<meta name="apple-mobile-web-app-status-bar-style" content="{{ PWA_APP_STATUS_BAR_COLOR }}">
|
||||||
|
|
||||||
{% if PWA_APP_ICONS_APPLE %}
|
{% if PWA_APP_ICONS_APPLE %}
|
||||||
{% for icon in PWA_APP_ICONS_APPLE %}
|
{% for icon in PWA_APP_ICONS_APPLE %}
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -22,7 +22,7 @@ install_requirements = [
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='django-pwa',
|
name='django-pwa',
|
||||||
version='1.0.6',
|
version='1.0.9',
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
install_requires=install_requirements,
|
install_requires=install_requirements,
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ class AppSettingsTest(TestCase):
|
|||||||
'PWA_APP_FETCH_URL',
|
'PWA_APP_FETCH_URL',
|
||||||
'PWA_APP_ICONS',
|
'PWA_APP_ICONS',
|
||||||
'PWA_APP_DIR',
|
'PWA_APP_DIR',
|
||||||
'PWA_APP_LANG'
|
'PWA_APP_LANG',
|
||||||
|
'PWA_APP_STATUS_BAR_COLOR'
|
||||||
]
|
]
|
||||||
for attr in attributes:
|
for attr in attributes:
|
||||||
with self.subTest():
|
with self.subTest():
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ class ManifestTest(TestCase):
|
|||||||
'"orientation":',
|
'"orientation":',
|
||||||
'"icons":',
|
'"icons":',
|
||||||
'"dir":',
|
'"dir":',
|
||||||
'"lang":'
|
'"lang":',
|
||||||
|
'"status_bar":'
|
||||||
]
|
]
|
||||||
for expected in contents:
|
for expected in contents:
|
||||||
with self.subTest():
|
with self.subTest():
|
||||||
|
|||||||
Reference in New Issue
Block a user