Introduce Progressive Web App feature to EGroupware

This commit is contained in:
Hadi Nategh 2019-12-04 15:00:59 +01:00
parent b760fcf857
commit 6e43453714
6 changed files with 51 additions and 0 deletions

View File

@ -59,3 +59,14 @@ egw_LAB.wait(function()
]);
});
});
// register service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./service-worker.js', {scope:"/egroupware/"})
.then(function(registration) {
console.log('Registration successful, scope is:', registration.scope);
})
.catch(function(error) {
console.log('Service worker registration failed, error:', error);
});
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

27
manifest.json Normal file
View File

@ -0,0 +1,27 @@
{
"short_name": "EGroupware",
"name": "EGroupware",
"category": ["business", "education"],
"description": "EGroupware is an online open-source enterprise software for business use and provides the services by using cutting edge collaboration technologies which allow organisations to collaborate in a secure and function rich environment, supporting integrated project teams across and within organisation boundaries.",
"orientation": "landscape-primary",
"icons": [
{
"src": "api/templates/default/images/logo_192x192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "api/templates/default/images/logo_512x512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": "index.php",
"background_color": "#fafafa",
"display": "standalone",
"scope": "/egroupware",
"theme_color": "#0073ae",
"serviceworker": {
"src": "/service-worker.js"
}
}

View File

@ -11,6 +11,7 @@
<meta name="author" content="EGroupware GmbH http://www.egroupware.org" />
{pngfix}
{meta_robots}
<link rel="manifest" href="{webserver_url}/manifest.json"/>
<link rel="icon" href="{img_icon}" type="image/x-ico" />
<link rel="shortcut icon" href="{img_shortcut}" />
<link rel="stylesheet" href="{webserver_url}/api/js/offline/themes/offline-theme-slide.css">

12
service-worker.js Normal file
View File

@ -0,0 +1,12 @@
/**
* EGroupware service worker
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @author Hadi Nategh <hn-At-egroupware.org>
* @copyright (c) 2019 by Hadi Nategh <hn-At-egroupware.org>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
*/
this.addEventListener('fetch', function (event) {
// temporary just to ommit error app not installable
});