@@ -26,72 +26,76 @@ export class AppComponent implements OnInit {
2626 private snackBar : MatSnackBar ,
2727 private releaseMigrationService : ReleaseInfoService ,
2828 private store : Store ,
29- private swUpdates : SwUpdate ,
29+ // Commented as long as serviceWorker is reinstalled
30+ // Issue: https://github.com/T-Systems-MMS/phonebook/issues/87
31+ // private swUpdates: SwUpdate,
3032 private matDialog : MatDialog ,
3133 private i18n : I18n ,
3234 private platform : Platform
3335 ) { }
3436
3537 public ngOnInit ( ) {
3638 this . store . dispatch ( new InitTheme ( ) ) ;
37- // Checking if the Service Worker was installed correctly.
38- if ( ! this . store . selectSnapshot ( AppState . serviceWorkerNotificationDisplayed ) ) {
39- if ( 'serviceWorker' in navigator ) {
40- this . swUpdates . activated . subscribe ( active => {
41- if ( active . current ) {
42- this . snackBar . open (
43- this . i18n ( {
44- value : 'Hurray! You can use this Website offline.' ,
45- description : 'Message indicating the service worker was successfully installed' ,
46- id : 'AppComponentServiceWorkerSuccessMessage' ,
47- meaning : 'AppComponent'
48- } ) ,
49- '' ,
50- { duration : 3000 }
51- ) ;
52- this . store . dispatch ( new ServiceWorkerNotificationDisplayed ( ) ) ;
53- }
54- } ) ;
55- } else {
56- this . snackBar . open (
57- this . i18n ( {
58- value : 'Your Browser does not support Offline Apps!' ,
59- description : 'Message indicating the service worker was not installed' ,
60- id : 'AppComponentServiceWorkerErrorMessage' ,
61- meaning : 'AppComponent'
62- } ) ,
63- '' ,
64- {
65- duration : 3000
66- }
67- ) ;
68- this . store . dispatch ( new ServiceWorkerNotificationDisplayed ( ) ) ;
69- }
70- }
39+ // Commented as long as serviceWorker is reinstalled
40+ // Issue: https://github.com/T-Systems-MMS/phonebook/issues/87
41+ // //Checking if the Service Worker was installed correctly.
42+ // if (!this.store.selectSnapshot(AppState.serviceWorkerNotificationDisplayed)) {
43+ // if ('serviceWorker' in navigator) {
44+ // this.swUpdates.activated.subscribe(active => {
45+ // if (active.current) {
46+ // this.snackBar.open(
47+ // this.i18n({
48+ // value: 'Hurray! You can use this Website offline.',
49+ // description: 'Message indicating the service worker was successfully installed',
50+ // id: 'AppComponentServiceWorkerSuccessMessage',
51+ // meaning: 'AppComponent'
52+ // }),
53+ // '',
54+ // { duration: 3000 }
55+ // );
56+ // this.store.dispatch(new ServiceWorkerNotificationDisplayed());
57+ // }
58+ // });
59+ // } else {
60+ // this.snackBar.open(
61+ // this.i18n({
62+ // value: 'Your Browser does not support Offline Apps!',
63+ // description: 'Message indicating the service worker was not installed',
64+ // id: 'AppComponentServiceWorkerErrorMessage',
65+ // meaning: 'AppComponent'
66+ // }),
67+ // '',
68+ // {
69+ // duration: 3000
70+ // }
71+ // );
72+ // this.store.dispatch(new ServiceWorkerNotificationDisplayed());
73+ // }
74+ // }
7175
72- // Check if a new Update for the Service worker is available
73- if ( this . swUpdates . isEnabled ) {
74- this . swUpdates . available . subscribe ( ( ) => {
75- const updateNotification = this . snackBar . open (
76- this . i18n ( {
77- value : 'A newer version is available. Do you want to update straight away?' ,
78- description : 'Message indicating the app can be updated and question if it should be updated' ,
79- id : 'AppComponentServiceWorkerUpdateMessage' ,
80- meaning : 'AppComponent'
81- } ) ,
82- this . i18n ( {
83- value : 'Update!' ,
84- description : 'Button Text for updating the app' ,
85- id : 'AppComponentServiceWorkerUpdateButtonMessage' ,
86- meaning : 'AppComponent'
87- } ) ,
88- { duration : 4000 }
89- ) ;
90- updateNotification . onAction ( ) . subscribe ( onAction => {
91- window . location . reload ( ) ;
92- } ) ;
93- } ) ;
94- }
76+ // // Check if a new Update for the Service worker is available
77+ // if (this.swUpdates.isEnabled) {
78+ // this.swUpdates.available.subscribe(() => {
79+ // const updateNotification = this.snackBar.open(
80+ // this.i18n({
81+ // value: 'A newer version is available. Do you want to update straight away?',
82+ // description: 'Message indicating the app can be updated and question if it should be updated',
83+ // id: 'AppComponentServiceWorkerUpdateMessage',
84+ // meaning: 'AppComponent'
85+ // }),
86+ // this.i18n({
87+ // value: 'Update!',
88+ // description: 'Button Text for updating the app',
89+ // id: 'AppComponentServiceWorkerUpdateButtonMessage',
90+ // meaning: 'AppComponent'
91+ // }),
92+ // { duration: 4000 }
93+ // );
94+ // updateNotification.onAction().subscribe(onAction => {
95+ // window.location.reload();
96+ // });
97+ // });
98+ // }
9599
96100 // Ask for Permission to send Bug reports
97101 const test = this . store . selectSnapshot ( AppState . sendFeedback ) ;
0 commit comments