mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 08:33:11 +00:00
Resolve "Error: Database not created"
This commit is contained in:
@@ -35,7 +35,7 @@ import {hashStringToInt} from './hash';
|
||||
import {
|
||||
CALENDAR_NOTIFICATIONS_ENABLED_KEY,
|
||||
CALENDAR_SYNC_ENABLED_KEY,
|
||||
CALENDAR_SYNC_SETTINGS_KEY,
|
||||
getCalendarSetting,
|
||||
} from '../../settings/page/calendar-sync-settings-keys';
|
||||
import {filter} from 'rxjs/operators';
|
||||
import {Capacitor} from '@capacitor/core';
|
||||
@@ -49,7 +49,9 @@ export class ScheduleSyncService implements OnDestroy {
|
||||
private dateFormatPipe: DateFormatPipe,
|
||||
private durationFormatPipe: DurationPipe,
|
||||
private calendar: CalendarService,
|
||||
) {
|
||||
) {}
|
||||
|
||||
init() {
|
||||
this.scheduleProvider.uuids$
|
||||
.pipe(filter(uuids => uuids?.length > 0))
|
||||
.subscribe(uuids => {
|
||||
@@ -67,14 +69,13 @@ export class ScheduleSyncService implements OnDestroy {
|
||||
}
|
||||
|
||||
private async isSyncEnabled(): Promise<boolean> {
|
||||
return await this.storageProvider.get(
|
||||
`${CALENDAR_SYNC_SETTINGS_KEY}.${CALENDAR_SYNC_ENABLED_KEY}`,
|
||||
);
|
||||
return getCalendarSetting(this.storageProvider, CALENDAR_SYNC_ENABLED_KEY);
|
||||
}
|
||||
|
||||
private async isNotificationsEnabled(): Promise<boolean> {
|
||||
return await this.storageProvider.get(
|
||||
`${CALENDAR_SYNC_SETTINGS_KEY}.${CALENDAR_NOTIFICATIONS_ENABLED_KEY}`,
|
||||
return getCalendarSetting(
|
||||
this.storageProvider,
|
||||
CALENDAR_NOTIFICATIONS_ENABLED_KEY,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -84,9 +85,10 @@ export class ScheduleSyncService implements OnDestroy {
|
||||
await BackgroundFetch.stop();
|
||||
|
||||
if (
|
||||
[this.isSyncEnabled, this.isNotificationsEnabled].some(
|
||||
async it => await it(),
|
||||
)
|
||||
[
|
||||
this.isSyncEnabled.bind(this),
|
||||
this.isNotificationsEnabled.bind(this),
|
||||
].some(async it => await it())
|
||||
) {
|
||||
const status = await BackgroundFetch.configure(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user