Initial revision.
This commit is contained in:
11
pwa/templates/manifest.json
Normal file
11
pwa/templates/manifest.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{% load pwa %}
|
||||
{
|
||||
"name": {{ PWA_APP_NAME|js }},
|
||||
"short_name": {{ PWA_APP_NAME|js }},
|
||||
"description": {{ PWA_APP_DESCRIPTION|js }},
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#fff",
|
||||
"theme_color": {{ PWA_APP_THEME_COLOR|js }},
|
||||
"icons": {{ PWA_APP_ICONS|js }}
|
||||
}
|
||||
27
pwa/templates/pwa.html
Normal file
27
pwa/templates/pwa.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!-- Path to manifest.json -->
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
|
||||
<!-- Icons for Apple Devices -->
|
||||
{% for icon in PWA_APP_ICONS %}
|
||||
<link rel="apple-touch-icon" href="{{ icon.src }}" sizes="{{ icon.sizes }}">
|
||||
{% endfor %}
|
||||
|
||||
<meta name="theme-color" content="{{ PWA_APP_THEME_COLOR }}">
|
||||
<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-status-bar-style" content="default">
|
||||
|
||||
<script type="text/javascript">
|
||||
// Initialize the service worker
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function () {
|
||||
navigator.serviceWorker.register('/serviceworker.js').then(function (registration) {
|
||||
// Registration was successful
|
||||
console.log('django-progressive-web-app: ServiceWorker registration successful with scope: ', registration.scope);
|
||||
}).catch(function (err) {
|
||||
// registration failed :(
|
||||
console.log('django-progressive-web-app: ServiceWorker registration failed: ', err);
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
2
pwa/templates/serviceworker.js
Normal file
2
pwa/templates/serviceworker.js
Normal file
@@ -0,0 +1,2 @@
|
||||
// Empty Service Worker implementation. To use your own Service Worker, set the PWA_SERVICE_WORKER_PATH variable in
|
||||
// settings.py
|
||||
Reference in New Issue
Block a user