This commit is contained in:
ivan gomes
2021-11-30 09:26:36 +01:00
49 changed files with 472 additions and 238 deletions
+15 -9
View File
@@ -11,8 +11,12 @@ import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-pick
import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service';
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
<<<<<<< HEAD
import { Directory, Filesystem } from '@capacitor/filesystem';
=======
import { StorageService } from 'src/app/services/storage.service';
>>>>>>> 6a912b740d97159664c5fe5dff07ac378b028771
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
@@ -44,7 +48,11 @@ export class AppComponent {
private screenOrientation: ScreenOrientation,
private sqliteservice: SqliteService,
private backgroundservice: BackgroundService,
<<<<<<< HEAD
=======
private storageservice: StorageService
>>>>>>> 6a912b740d97159664c5fe5dff07ac378b028771
) {
this.createCacheFolder()
this.initializeApp();
@@ -79,17 +87,15 @@ export class AppComponent {
}
}
window.addEventListener('online', () => {
console.log('Became online')
this.backgroundservice.online()
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storageservice.get('networkCheckStore').then((network) => {
if(network === 'online') {
console.log('Network app componente check', network)
this.backgroundservice.online()
} else {
console.log('Network app componente check', network)
this.backgroundservice.offline();
}
});
window.addEventListener('offline', () => {
console.log('Became offline')
this.backgroundservice.offline()
});
})
});
}