From 7365bc708c5107029b309672dbd296f58b2bd7b3 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 15 Oct 2019 15:22:29 +0200 Subject: [PATCH] MOBILE-3026 core: Fix plugin_not_installed error in iOS --- src/app/app.component.ts | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 439ce5867..a1d80d530 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -110,19 +110,21 @@ export class MoodleMobileApp implements OnInit { this.loginHelper.sitePolicyNotAgreed(data.siteId); }); - // Refresh online status when changes. - this.network.onchange().subscribe(() => { - // Execute the callback in the Angular zone, so change detection doesn't stop working. - this.zone.run(() => { - const isOnline = this.appProvider.isOnline(); - document.body.classList.toggle('core-offline', !isOnline); - document.body.classList.toggle('core-online', isOnline); + this.platform.ready().then(() => { + // Refresh online status when changes. + this.network.onchange().subscribe(() => { + // Execute the callback in the Angular zone, so change detection doesn't stop working. + this.zone.run(() => { + const isOnline = this.appProvider.isOnline(); + document.body.classList.toggle('core-offline', !isOnline); + document.body.classList.toggle('core-online', isOnline); - if (isOnline) { - setTimeout(() => { - document.body.classList.remove('core-online'); - }, 3000); - } + if (isOnline) { + setTimeout(() => { + document.body.classList.remove('core-online'); + }, 3000); + } + }); }); });