MOBILE-3026 core: Fix back online message displayed on resume

main
Dani Palou 2019-10-22 15:34:15 +02:00
parent 4c03c0174a
commit 71ab092e02
2 changed files with 10 additions and 5 deletions

View File

@ -115,14 +115,19 @@ export class MoodleMobileApp implements OnInit {
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);
const isOnline = this.appProvider.isOnline(),
hadOfflineMessage = document.body.classList.contains('core-offline');
document.body.classList.toggle('core-offline', !isOnline);
if (isOnline && hadOfflineMessage) {
document.body.classList.add('core-online');
if (isOnline) {
setTimeout(() => {
document.body.classList.remove('core-online');
}, 3000);
} else if (!isOnline) {
document.body.classList.remove('core-online');
}
});
});

View File

@ -1316,7 +1316,7 @@
"core.back": "Back",
"core.block.blocks": "Blocks",
"core.cancel": "Cancel",
"core.cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle 2.4 or later.",
"core.cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle 3.1 or later.",
"core.cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
"core.captureaudio": "Record audio",
"core.capturedimage": "Taken picture.",