mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
added the edit and delete event offline
This commit is contained in:
+12
-28
@@ -23,7 +23,7 @@ import { Network } from '@ionic-native/network/ngx';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
import { OfflineManagerService } from 'src/app/services/offline-manager.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { EventsService} from 'src/app/services/events.service';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -81,11 +81,10 @@ export class HomePage implements OnInit {
|
||||
private inativityService: InativityService,
|
||||
private storageService: StorageService,
|
||||
private webNotificationPopupService: WebNotificationPopupService,
|
||||
private network: Network,
|
||||
private backgroundservice: BackgroundService,
|
||||
private offlinemanager: OfflineManagerService,
|
||||
private storage: Storage,
|
||||
private eventservice: EventsService ) {
|
||||
private eventservice: EventsService) {
|
||||
|
||||
this.webNotificationPopupService.askNotificationPermission()
|
||||
|
||||
@@ -118,37 +117,20 @@ export class HomePage implements OnInit {
|
||||
window.addEventListener('online', () => {
|
||||
console.log('Became online')
|
||||
this.backgroundservice.online()
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.webnotification.webconnection();
|
||||
this.webnotification.register();
|
||||
} else {
|
||||
this.mobilefirstConnect();
|
||||
this.notificationsService.onReceviNotification();
|
||||
this.offlinemanager.synchnize()
|
||||
}
|
||||
});
|
||||
window.addEventListener('offline', () => {
|
||||
console.log('Became offline')
|
||||
this.backgroundservice.offline()
|
||||
});
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.webnotification.webconnection();
|
||||
this.webnotification.register();
|
||||
} else {
|
||||
window.addEventListener('online', (on) => {
|
||||
console.log('Became online',on)
|
||||
this.storage.get('storedreq').then((req) =>{
|
||||
console.log('STORED REQUEST', req)
|
||||
req.forEach(element => {
|
||||
this.eventservice.editEvent(element,2,3).subscribe((res) =>{
|
||||
console.log('REQUEST RESULT', res)
|
||||
})
|
||||
});
|
||||
|
||||
})
|
||||
this.backgroundservice.online()
|
||||
});
|
||||
window.addEventListener('offline', (off) => {
|
||||
console.log('Became offline',off)
|
||||
this.backgroundservice.offline()
|
||||
});
|
||||
this.mobilefirstConnect();
|
||||
this.notificationsService.onReceviNotification();
|
||||
}
|
||||
|
||||
this.updateList()
|
||||
|
||||
var myWorker = new Worker(new URL('./nice.worker.js', import.meta.url));
|
||||
@@ -197,6 +179,8 @@ export class HomePage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
updateList() {
|
||||
|
||||
this.notificationsService.registerCallback(
|
||||
|
||||
Reference in New Issue
Block a user