refactor: migrate all cordova plugins to capacitor

This commit is contained in:
Thea Schöbl
2022-02-17 08:37:32 +00:00
committed by Rainer Killinger
parent cdb6ac4084
commit 75f4644940
36 changed files with 677 additions and 1118 deletions

View File

@@ -21,7 +21,6 @@ import {
ScheduleProvider,
} from '../../calendar/schedule.provider';
import {SCDateSeries, SCThingType, SCUuid} from '@openstapps/core';
import {Device} from '@capacitor/device';
import {LocalNotifications} from '@capacitor/local-notifications';
import {ThingTranslateService} from '../../../translation/thing-translate.service';
import {DateFormatPipe, DurationPipe} from 'ngx-moment';
@@ -39,6 +38,7 @@ import {
CALENDAR_SYNC_SETTINGS_KEY,
} from '../../settings/page/calendar-sync-settings-keys';
import {filter} from 'rxjs/operators';
import {Capacitor} from '@capacitor/core';
@Injectable()
export class ScheduleSyncService implements OnDestroy {
@@ -79,7 +79,7 @@ export class ScheduleSyncService implements OnDestroy {
}
async enable() {
if ((await Device.getInfo()).platform === 'web') return;
if (!Capacitor.isNativePlatform()) return;
await BackgroundFetch.stop();
@@ -189,9 +189,7 @@ export class ScheduleSyncService implements OnDestroy {
);
if (differences.length === 0) return;
if ((await Device.getInfo()).platform === 'web') {
// TODO: Implement web notification
} else {
if (Capacitor.isNativePlatform()) {
await LocalNotifications.schedule({
notifications: differences.map(it => ({
title: it.new.event.name,
@@ -199,6 +197,8 @@ export class ScheduleSyncService implements OnDestroy {
id: hashStringToInt(it.new.uid),
})),
});
} else {
// TODO: Implement desktop notifications
}
}
}