From c9720dc104cce78ae1a422d5efed7b8a58946836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jovan=20Kruni=C4=87?= Date: Wed, 9 Feb 2022 20:44:43 +0100 Subject: [PATCH] fix: omit sync native calendar when no uuids Related to #177 --- .../background/schedule/schedule-sync.service.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/modules/background/schedule/schedule-sync.service.ts b/src/app/modules/background/schedule/schedule-sync.service.ts index 3a7e7693..9ddbf53b 100644 --- a/src/app/modules/background/schedule/schedule-sync.service.ts +++ b/src/app/modules/background/schedule/schedule-sync.service.ts @@ -38,6 +38,7 @@ import { CALENDAR_SYNC_ENABLED_KEY, CALENDAR_SYNC_SETTINGS_KEY, } from '../../settings/page/calendar-sync-settings-keys'; +import {filter} from 'rxjs/operators'; @Injectable() export class ScheduleSyncService implements OnDestroy { @@ -49,10 +50,12 @@ export class ScheduleSyncService implements OnDestroy { private durationFormatPipe: DurationPipe, private calendar: CalendarService, ) { - this.scheduleProvider.uuids$.subscribe(uuids => { - this.uuids = uuids; - void this.syncNativeCalendar(); - }); + this.scheduleProvider.uuids$ + .pipe(filter(uuids => uuids?.length > 0)) + .subscribe(uuids => { + this.uuids = uuids; + void this.syncNativeCalendar(); + }); } uuids: SCUuid[];