2021-10-18 07:44:24 +01:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
|
import { Storage } from '@ionic/storage';
|
|
|
|
|
import { Observable, from, of, forkJoin } from 'rxjs';
|
|
|
|
|
import { switchMap, finalize } from 'rxjs/operators';
|
|
|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
|
import { ToastController } from '@ionic/angular';
|
2021-10-20 11:06:00 +01:00
|
|
|
import { BackgroundService } from 'src/app/services/background.service';
|
|
|
|
|
import { EventsService } from 'src/app/services/events.service';
|
|
|
|
|
|
|
|
|
|
|
2021-10-18 07:44:24 +01:00
|
|
|
@Injectable({
|
|
|
|
|
providedIn: 'root'
|
|
|
|
|
})
|
|
|
|
|
export class OfflineManagerService {
|
2021-10-20 11:06:00 +01:00
|
|
|
/* eventservice: EventsService */
|
|
|
|
|
|
|
|
|
|
|
2021-10-18 07:44:24 +01:00
|
|
|
constructor(
|
2021-10-20 11:06:00 +01:00
|
|
|
private storage: Storage,
|
|
|
|
|
/* private backgroundservice: BackgroundService */) { }
|
|
|
|
|
|
|
|
|
|
synchnize() {
|
|
|
|
|
/* this.backgroundservice.registerBackService('Online', () => {
|
|
|
|
|
this.storage.get('eventEdit').then((req) => {
|
|
|
|
|
JSON.parse(req).forEach(element => {
|
|
|
|
|
this.eventservice.editEvent(element, 2, 3).subscribe((res) => {
|
|
|
|
|
this.storage.remove('eventEdit')
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2021-10-20 11:06:00 +01:00
|
|
|
})
|
|
|
|
|
});
|
2021-10-18 07:44:24 +01:00
|
|
|
})
|
2021-10-20 11:06:00 +01:00
|
|
|
}) */
|
2021-10-18 07:44:24 +01:00
|
|
|
}
|
2021-10-20 11:06:00 +01:00
|
|
|
|
|
|
|
|
storeRequestData(key, data) {
|
|
|
|
|
return this.storage.set(key, JSON.stringify(data));
|
2021-10-18 07:44:24 +01:00
|
|
|
}
|
2021-10-20 11:06:00 +01:00
|
|
|
|
|
|
|
|
sendRequestData(key) {
|
|
|
|
|
return this.storage.get(key)
|
2021-10-18 07:44:24 +01:00
|
|
|
}
|
2021-10-20 11:06:00 +01:00
|
|
|
|
2021-10-18 07:44:24 +01:00
|
|
|
}
|