Skip to content

Commit

Permalink
fix(*): prevent error log message about serviceworker not available
Browse files Browse the repository at this point in the history
  • Loading branch information
sleidig committed Jun 14, 2020
1 parent c67e5f0 commit a2eebf9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/core/latest-changes/update-manager.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export class UpdateManagerService {
* Display a notification to the user in case a new app version is detected by the ServiceWorker.
*/
public notifyUserWhenUpdateAvailable() {
if (!this.updates.isEnabled) {
return;
}

this.updates.available.subscribe(() => {
this.showUpdateNotification();
});
Expand All @@ -53,6 +57,10 @@ export class UpdateManagerService {
* Schedule a regular check with the server for updates.
*/
public regularlyCheckForUpdates() {
if (!this.updates.isEnabled) {
return;
}

// Allow the app to stabilize first, before starting polling for updates with `interval()`.
const appIsStable$ = this.appRef.isStable.pipe(
first((isStable) => isStable === true)
Expand Down

0 comments on commit a2eebf9

Please sign in to comment.