Skip to content
This repository was archived by the owner on Sep 10, 2022. It is now read-only.

Commit d12a81b

Browse files
author
Matt Gaunt
committed
Deleting files we don't use and fixing up layouts to share majority code
2 parents 1291030 + 60007f6 commit d12a81b

File tree

9 files changed

+45
-576
lines changed

9 files changed

+45
-576
lines changed

server/views/layouts/app-shell.handlebars

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
</main>
55

6+
<aside class="toast-view js-toast-view"></aside>
7+
68
<!-- Loading Dialog For use by Activities -->
79
<div class="loader js-global-loader is-hidden">
810
<svg viewBox="0 0 32 32" width="32" height="32">

server/views/partials/close-page.handlebars

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
</div>
1515
</section>
1616

17+
<aside class="toast-view js-toast-view"></aside>
18+
1719
{{> async-css }}
1820

1921
{{#each remoteScripts}}

src/scripts/config/Config.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/scripts/controller/Controller.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

18+
import ToasterSingleton from '../libs/ToasterSingleton';
19+
1820
export default class Controller {
1921

2022
constructor(registerServiceWorker = true) {
@@ -33,6 +35,33 @@ export default class Controller {
3335
scope: '/'
3436
}).then((registration) => {
3537
console.log('Service worker is registered.');
38+
39+
var isUpdate = false;
40+
41+
// If this fires we should check if there's a new Service Worker
42+
// waiting to be activated. If so, ask the user to force refresh.
43+
if (registration.active) {
44+
isUpdate = true;
45+
}
46+
47+
registration.onupdatefound = function(updateEvent) {
48+
console.log('A new Service Worker version has been found...');
49+
50+
// If an update is found the spec says that there is a new Service
51+
// Worker installing, so we should wait for that to complete then
52+
// show a notification to the user.
53+
registration.installing.onstatechange = function(event) {
54+
if (this.state === 'installed') {
55+
if (isUpdate) {
56+
ToasterSingleton.getToaster().toast(
57+
'App updated. Restart for the new version.');
58+
} else {
59+
ToasterSingleton.getToaster().toast(
60+
'App ready for offline use.');
61+
}
62+
}
63+
};
64+
};
3665
})
3766
.catch((err) => {
3867
console.log('Unable to register service worker.', err);

src/scripts/libs/ConfigManager.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/scripts/libs/Database.js

Lines changed: 0 additions & 254 deletions
This file was deleted.

0 commit comments

Comments
 (0)