Skip to content

Commit

Permalink
Updated manifest.json and serviceworker by adding scope parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
silviolleite committed Mar 7, 2019
1 parent f2fdf0c commit ed8dc19
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,10 @@

### Fixed
- Fix problem of multiple service workers being registered over multiple URLs

## 1.0.5

### Added
- Updated manifest.json by adding scope parameter.
- Updated serviceworker.js add scope dynamic parameter

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ PWA_APP_DESCRIPTION = "My app description"
PWA_APP_THEME_COLOR = '#0A0302'
PWA_APP_BACKGROUND_COLOR = '#ffffff'
PWA_APP_DISPLAY = 'standalone'
PWA_APP_SCOPE = '/',
PWA_APP_ORIENTATION = 'any'
PWA_APP_START_URL = '/'
PWA_APP_ICONS = [
Expand Down
1 change: 1 addition & 0 deletions pwa/app_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
PWA_APP_THEME_COLOR = getattr(settings, 'PWA_APP_THEME_COLOR', '#000')
PWA_APP_BACKGROUND_COLOR = getattr(settings, 'PWA_APP_BACKGROUND_COLOR', '#fff')
PWA_APP_DISPLAY = getattr(settings, 'PWA_APP_DISPLAY', 'standalone')
PWA_APP_SCOPE = getattr(settings, 'PWA_APP_SCOPE', '/')
PWA_APP_ORIENTATION = getattr(settings, 'PWA_APP_ORIENTATION', 'any')
PWA_APP_START_URL = getattr(settings, 'PWA_APP_START_URL', '/')
PWA_APP_FETCH_URL = getattr(settings, 'PWA_APP_FETCH_URL', '/')
Expand Down
1 change: 1 addition & 0 deletions pwa/templates/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"description": {{ PWA_APP_DESCRIPTION|js }},
"start_url": {{ PWA_APP_START_URL|js }},
"display": {{ PWA_APP_DISPLAY|js }},
"scope": {{ PWA_APP_SCOPE|js }},
"orientation": {{ PWA_APP_ORIENTATION|js }},
"background_color": {{ PWA_APP_BACKGROUND_COLOR|js }},
"theme_color": {{ PWA_APP_THEME_COLOR|js }},
Expand Down
2 changes: 1 addition & 1 deletion pwa/templates/pwa.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
// Initialize the service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/serviceworker.js', {
scope: '/'
scope: '{{ PWA_APP_SCOPE }}'
}).then(function (registration) {
// Registration was successful
console.log('django-pwa: ServiceWorker registration successful with scope: ', registration.scope);
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

setup(
name='django-pwa',
version='1.0.4',
version='1.0.5',
packages=find_packages(),
install_requires=install_requirements,
include_package_data=True,
Expand Down
1 change: 1 addition & 0 deletions tests/test_settings_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def test_has_defined(self):
'PWA_APP_ROOT_URL',
'PWA_APP_THEME_COLOR',
'PWA_APP_BACKGROUND_COLOR',
'PWA_APP_SCOPE',
'PWA_APP_DISPLAY',
'PWA_APP_ORIENTATION',
'PWA_APP_START_URL',
Expand Down
1 change: 1 addition & 0 deletions tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_manifest_contains(self):
'"description":',
'"start_url":',
'"display":',
'"scope":',
'"background_color":',
'"theme_color":',
'"orientation":',
Expand Down

0 comments on commit ed8dc19

Please sign in to comment.