MOBILE-3026 core: Fix back online message displayed on resume
This commit is contained in:
		
							parent
							
								
									4c03c0174a
								
							
						
					
					
						commit
						71ab092e02
					
				@ -115,14 +115,19 @@ export class MoodleMobileApp implements OnInit {
 | 
				
			|||||||
            this.network.onchange().subscribe(() => {
 | 
					            this.network.onchange().subscribe(() => {
 | 
				
			||||||
                // Execute the callback in the Angular zone, so change detection doesn't stop working.
 | 
					                // Execute the callback in the Angular zone, so change detection doesn't stop working.
 | 
				
			||||||
                this.zone.run(() => {
 | 
					                this.zone.run(() => {
 | 
				
			||||||
                    const isOnline = this.appProvider.isOnline();
 | 
					                    const isOnline = this.appProvider.isOnline(),
 | 
				
			||||||
                    document.body.classList.toggle('core-offline', !isOnline);
 | 
					                        hadOfflineMessage = document.body.classList.contains('core-offline');
 | 
				
			||||||
                    document.body.classList.toggle('core-online', isOnline);
 | 
					
 | 
				
			||||||
 | 
					                    document.body.classList.toggle('core-offline', !isOnline);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (isOnline && hadOfflineMessage) {
 | 
				
			||||||
 | 
					                        document.body.classList.add('core-online');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (isOnline) {
 | 
					 | 
				
			||||||
                        setTimeout(() => {
 | 
					                        setTimeout(() => {
 | 
				
			||||||
                            document.body.classList.remove('core-online');
 | 
					                            document.body.classList.remove('core-online');
 | 
				
			||||||
                        }, 3000);
 | 
					                        }, 3000);
 | 
				
			||||||
 | 
					                    } else if (!isOnline) {
 | 
				
			||||||
 | 
					                        document.body.classList.remove('core-online');
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
				
			|||||||
@ -1316,7 +1316,7 @@
 | 
				
			|||||||
    "core.back": "Back",
 | 
					    "core.back": "Back",
 | 
				
			||||||
    "core.block.blocks": "Blocks",
 | 
					    "core.block.blocks": "Blocks",
 | 
				
			||||||
    "core.cancel": "Cancel",
 | 
					    "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.cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
 | 
				
			||||||
    "core.captureaudio": "Record audio",
 | 
					    "core.captureaudio": "Record audio",
 | 
				
			||||||
    "core.capturedimage": "Taken picture.",
 | 
					    "core.capturedimage": "Taken picture.",
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user