MOBILE-3936 calendar: Move default reminder setting to reminders

main
Pau Ferrer Ocaña 2022-11-09 11:41:49 +01:00
parent 9f154a7bb6
commit 109d4bd2c5
13 changed files with 165 additions and 121 deletions

View File

@ -147,7 +147,6 @@
"addon.calendar.sunday": "calendar",
"addon.calendar.thu": "calendar",
"addon.calendar.thursday": "calendar",
"addon.calendar.timebefore": "local_moodlemobileapp",
"addon.calendar.today": "calendar",
"addon.calendar.tomorrow": "calendar",
"addon.calendar.tue": "calendar",
@ -161,7 +160,6 @@
"addon.calendar.typeopen": "calendar",
"addon.calendar.typesite": "calendar",
"addon.calendar.typeuser": "calendar",
"addon.calendar.units": "qtype_numerical",
"addon.calendar.upcomingevents": "calendar",
"addon.calendar.userevents": "calendar",
"addon.calendar.wed": "calendar",
@ -2150,6 +2148,15 @@
"core.rating.ratings": "rating",
"core.redirectingtosite": "local_moodlemobileapp",
"core.refresh": "moodle",
"core.reminders.atthetime": "local_moodlemobileapp",
"core.reminders.custom": "local_moodlemobileapp",
"core.reminders.customreminder": "local_moodlemobileapp",
"core.reminders.daybefore": "local_moodlemobileapp",
"core.reminders.daysbefore": "local_moodlemobileapp",
"core.reminders.delete": "moodle",
"core.reminders.setareminder": "local_moodlemobileapp",
"core.reminders.timebefore": "local_moodlemobileapp",
"core.reminders.units": "qtype_numerical",
"core.remove": "moodle",
"core.removefiles": "local_moodlemobileapp",
"core.required": "moodle",

View File

@ -113,7 +113,7 @@
</ng-container>
<!-- Reminders. Right now, only allow adding them here for new events. -->
<ng-container *ngIf="notificationsEnabled && !eventId">
<ng-container *ngIf="remindersEnabled && !eventId">
<ion-item-divider class="addon-calendar-reminders-title">
<ion-label>
<p class="item-heading">{{ 'addon.calendar.reminders' | translate }}</p>

View File

@ -86,7 +86,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
descriptionControl: FormControl;
// Reminders.
notificationsEnabled = false;
remindersEnabled = false;
reminders: AddonCalendarEventCandidateReminder[] = [];
protected courseId!: number;
@ -101,7 +101,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
protected fb: FormBuilder,
) {
this.currentSite = CoreSites.getRequiredCurrentSite();
this.notificationsEnabled = CoreLocalNotifications.isAvailable();
this.remindersEnabled = CoreReminders.isEnabled();
this.errors = {
required: Translate.instant('core.required'),
};
@ -647,13 +647,13 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
*/
protected async initReminders(): Promise<void> {
// Don't init reminders when editing an event. Right now, only allow adding reminders for new events.
if (!this.notificationsEnabled || this.eventId) {
if (!this.remindersEnabled || this.eventId) {
return;
}
// Check if default reminders are enabled.
const defaultTime = await AddonCalendar.getDefaultNotificationTime(this.currentSite.getId());
if (defaultTime === AddonCalendarProvider.DEFAULT_NOTIFICATION_DISABLED) {
const defaultTime = await CoreReminders.getDefaultNotificationTime(this.currentSite.getId());
if (defaultTime === CoreRemindersService.DISABLED) {
return;
}

View File

@ -127,7 +127,7 @@
</ion-item>
</ion-list>
<ion-card *ngIf="notificationsEnabled && event">
<ion-card *ngIf="remindersEnabled && event">
<ion-item>
<ion-label>
<h2>{{ 'addon.calendar.reminders' | translate }}</h2>

View File

@ -41,7 +41,7 @@ import { CoreConstants } from '@/core/constants';
import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/routed-items-manager-sources-tracker';
import { AddonCalendarEventsSource } from '@addons/calendar/classes/events-source';
import { CoreSwipeNavigationItemsManager } from '@classes/items-management/swipe-navigation-items-manager';
import { CoreReminders } from '@features/reminders/services/reminders';
import { CoreReminders, CoreRemindersService } from '@features/reminders/services/reminders';
import { CoreRemindersSetReminderMenuComponent } from '@features/reminders/components/set-reminder-menu/set-reminder-menu';
/**
@ -72,7 +72,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
courseName = '';
groupName?: string;
courseUrl = '';
notificationsEnabled = false;
remindersEnabled = false;
moduleUrl = '';
categoryPath = '';
currentTime = -1;
@ -85,7 +85,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
constructor(
protected route: ActivatedRoute,
) {
this.notificationsEnabled = CoreLocalNotifications.isAvailable();
this.remindersEnabled = CoreReminders.isEnabled();
this.siteHomeId = CoreSites.getCurrentSiteHomeId();
this.currentSiteId = CoreSites.getCurrentSiteId();
@ -132,7 +132,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
});
// Reload reminders if default notification time changes.
this.defaultTimeChangedObserver = CoreEvents.on(AddonCalendarProvider.DEFAULT_NOTIFICATION_TIME_CHANGED, () => {
this.defaultTimeChangedObserver = CoreEvents.on(CoreRemindersService.DEFAULT_NOTIFICATION_TIME_CHANGED, () => {
this.loadReminders();
}, this.currentSiteId);
@ -149,7 +149,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
* @return Promise resolved when done.
*/
protected async loadReminders(): Promise<void> {
if (!this.notificationsEnabled || !this.event) {
if (!this.remindersEnabled || !this.event) {
return;
}

View File

@ -13,18 +13,10 @@
// limitations under the License.
import { Component, OnInit } from '@angular/core';
import {
AddonCalendar,
AddonCalendarProvider,
} from '../../services/calendar';
import { CoreEvents } from '@singletons/events';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import {
CoreReminders,
CoreRemindersService,
CoreRemindersUnits,
CoreReminderValueAndUnit,
} from '@features/reminders/services/reminders';
import { CoreRemindersSetReminderMenuComponent } from '@features/reminders/components/set-reminder-menu/set-reminder-menu';
@ -39,10 +31,7 @@ export class AddonCalendarSettingsPage implements OnInit {
defaultTimeLabel = '';
protected defaultTime: CoreReminderValueAndUnit = {
value: 0,
unit: CoreRemindersUnits.MINUTE,
};
protected defaultTime?: number;
/**
* @inheritdoc
@ -76,24 +65,18 @@ export class AddonCalendarSettingsPage implements OnInit {
return;
}
await AddonCalendar.setDefaultNotificationTime(reminderTime.timeBefore);
await CoreReminders.setDefaultNotificationTime(reminderTime.timeBefore ?? CoreRemindersService.DISABLED);
this.updateDefaultTimeLabel();
CoreEvents.trigger(
AddonCalendarProvider.DEFAULT_NOTIFICATION_TIME_CHANGED,
{ time: reminderTime.timeBefore },
CoreSites.getCurrentSiteId(),
);
}
/**
* Update default time label.
*/
async updateDefaultTimeLabel(): Promise<void> {
const defaultTime = await AddonCalendar.getDefaultNotificationTime();
this.defaultTime = await CoreReminders.getDefaultNotificationTime();
this.defaultTime = CoreRemindersService.convertSecondsToValueAndUnit(defaultTime);
this.defaultTimeLabel = CoreReminders.getUnitValueLabel(this.defaultTime.value, this.defaultTime.unit);
const defaultTime = CoreRemindersService.convertSecondsToValueAndUnit(this.defaultTime);
this.defaultTimeLabel = CoreReminders.getUnitValueLabel(defaultTime.value, defaultTime.unit);
}
}

View File

@ -333,10 +333,10 @@ export class AddonCalendarHelperProvider {
return [];
}
const defaultTime = await AddonCalendar.getDefaultNotificationTime(siteId);
const defaultTime = await CoreReminders.getDefaultNotificationTime(siteId);
let defaultLabel: string | undefined;
if (defaultTime > AddonCalendarProvider.DEFAULT_NOTIFICATION_DISABLED) {
if (defaultTime > CoreRemindersService.DISABLED) {
const data = CoreRemindersService.convertSecondsToValueAndUnit(defaultTime);
defaultLabel = CoreReminders.getUnitValueLabel(data.value, data.unit, true);
}

View File

@ -38,7 +38,6 @@ import { SafeUrl } from '@angular/platform-browser';
import { CoreNavigator } from '@services/navigator';
import { AddonCalendarFilter } from './calendar-helper';
import { AddonCalendarSyncEvents, AddonCalendarSyncProvider } from './calendar-sync';
import { CoreEvents } from '@singletons/events';
import { CoreText } from '@singletons/text';
import { CorePlatform } from '@services/platform';
import {
@ -103,8 +102,7 @@ export class AddonCalendarProvider {
static readonly DAYS_INTERVAL = 30;
static readonly COMPONENT = 'AddonCalendarEvents';
static readonly DEFAULT_NOTIFICATION_TIME_CHANGED = 'AddonCalendarDefaultNotificationTimeChangedEvent';
static readonly DEFAULT_NOTIFICATION_TIME_SETTING = 'mmaCalendarDefaultNotifTime';
static readonly STARTING_WEEK_DAY = 'addon_calendar_starting_week_day';
static readonly NEW_EVENT_EVENT = 'addon_calendar_new_event';
static readonly NEW_EVENT_DISCARDED_EVENT = 'addon_calendar_new_event_discarded';
@ -116,8 +114,6 @@ export class AddonCalendarProvider {
static readonly CALENDAR_TF_24 = '%H:%M'; // Calendar time in 24 hours format.
static readonly CALENDAR_TF_12 = '%I:%M %p'; // Calendar time in 12 hours format.
static readonly DEFAULT_NOTIFICATION_DISABLED = -1;
protected weekDays: AddonCalendarWeekDaysTranslationKeys[] = [
{
shortname: 'addon.calendar.sun',
@ -293,7 +289,6 @@ export class AddonCalendarProvider {
* @return Promise resolved when done.
*/
async initialize(): Promise<void> {
CoreLocalNotifications.registerClick<CoreRemindersPushNotificationData>(
AddonCalendarProvider.COMPONENT,
async (notification) => {
@ -302,22 +297,6 @@ export class AddonCalendarProvider {
this.notificationClicked(notification);
},
);
if (!CoreLocalNotifications.isAvailable()) {
return;
}
CoreEvents.on(AddonCalendarProvider.DEFAULT_NOTIFICATION_TIME_CHANGED, async (data) => {
const site = await CoreSites.getSite(data.siteId);
const siteId = site.getId();
// Get all the events that have a default reminder.
const reminders = await CoreReminders.getRemindersWithDefaultTime(AddonCalendarProvider.COMPONENT, siteId);
// Reschedule all the default reminders.
reminders.forEach((reminder) =>
CoreReminders.scheduleNotification(reminder, siteId));
});
}
/**
@ -602,13 +581,10 @@ export class AddonCalendarProvider {
*
* @param siteId ID of the site. If not defined, use current site.
* @return Promise resolved with the default time (in seconds).
* @deprecated since 4.1 Use CoreReminders.getDefaultNotificationTime instead.
*/
async getDefaultNotificationTime(siteId?: string): Promise<number> {
siteId = siteId || CoreSites.getCurrentSiteId();
const key = AddonCalendarProvider.DEFAULT_NOTIFICATION_TIME_SETTING + '#' + siteId;
return CoreConfig.get(key, CoreConstants.CONFIG.calendarreminderdefaultvalue || 3600);
return CoreReminders.getDefaultNotificationTime(siteId);
}
/**
@ -1492,13 +1468,10 @@ export class AddonCalendarProvider {
* @param time New default time.
* @param siteId ID of the site. If not defined, use current site.
* @return Promise resolved when stored.
* @deprecated since 4.1 Use CoreReminders.setDefaultNotificationTime.
*/
async setDefaultNotificationTime(time: number, siteId?: string): Promise<void> {
siteId = siteId || CoreSites.getCurrentSiteId();
const key = AddonCalendarProvider.DEFAULT_NOTIFICATION_TIME_SETTING + '#' + siteId;
await CoreConfig.set(key, time);
await CoreReminders.setDefaultNotificationTime(time, siteId);
}
/**

View File

@ -13,10 +13,11 @@
// limitations under the License.
import { SQLiteDB } from '@classes/sqlitedb';
import { CoreRemindersService, CoreReminders } from '@features/reminders/services/reminders';
import { CoreConfig } from '@services/config';
import { CoreSiteSchema } from '@services/sites';
import { CoreUtils } from '@services/utils/utils';
import { AddonCalendar, AddonCalendarEventType, AddonCalendarProvider } from '../calendar';
import { AddonCalendarEventType } from '../calendar';
/**
* Database variables for AddonCalendarProvider service.
@ -180,20 +181,39 @@ export const CALENDAR_SITE_SCHEMA: CoreSiteSchema = {
},
],
async migrate(db: SQLiteDB, oldVersion: number, siteId: string): Promise<void> {
if (oldVersion < 4) {
// Migrate default notification time if it was changed.
// Don't use getDefaultNotificationTime to be able to detect if the value was changed or not.
const key = AddonCalendarProvider.DEFAULT_NOTIFICATION_TIME_SETTING + '#' + siteId;
const defaultTime = await CoreUtils.ignoreErrors(CoreConfig.get(key, null));
if (defaultTime) {
// Convert from minutes to seconds.
AddonCalendar.setDefaultNotificationTime(defaultTime * 60, siteId);
}
if (oldVersion < 5) {
await migrateDefaultTime(siteId, oldVersion < 4);
}
},
};
/**
* Migrate default notification time if it was changed.
* Don't use getDefaultNotificationTime to be able to detect if the value was changed or not.
*
* @param siteId Site ID to migrate.
* @param convertToSeconds If true, time will be converted to seconds.
*/
const migrateDefaultTime = async (siteId: string, convertToSeconds = false): Promise<void> => {
const key = 'mmaCalendarDefaultNotifTime#' + siteId;
try {
let defaultTime = await CoreConfig.get<number>(key);
await CoreUtils.ignoreErrors(CoreConfig.delete(key));
if (defaultTime <= 0) {
defaultTime = CoreRemindersService.DISABLED;
} else if (convertToSeconds) {
// Convert from minutes to seconds.
defaultTime = defaultTime * 60;
}
CoreReminders.setDefaultNotificationTime(defaultTime, siteId);
} catch {
// Ignore errors, already migrated.
}
};
export type AddonCalendarEventDBRecord = {
id: number;
name: string;

View File

@ -24,8 +24,7 @@
<ion-icon name="fas-check" *ngIf="currentValue === 'custom'" slot="end"></ion-icon>
</ion-item>
<ion-item *ngIf="noReminderLabel" button class="ion-text-wrap text-danger border-top" (click)="setReminder('disabled')"
detail="false">
<ion-item *ngIf="noReminderLabel" button class="ion-text-wrap text-danger border-top" (click)="disableReminder()" detail="false">
<ion-label>
<p class="item-heading">{{ noReminderLabel | translate }}</p>
</ion-label>

View File

@ -12,9 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { AddonCalendarProvider } from '@addons/calendar/services/calendar';
import { Component, Input, OnInit } from '@angular/core';
import { CoreReminders, CoreRemindersUnits, CoreReminderValueAndUnit } from '@features/reminders/services/reminders';
import {
CoreReminders,
CoreRemindersService,
CoreRemindersUnits,
CoreReminderValueAndUnit,
} from '@features/reminders/services/reminders';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@services/utils/utils';
import { PopoverController } from '@singletons';
@ -29,7 +33,7 @@ import { CoreRemindersSetReminderCustomComponent } from '../set-reminder-custom/
})
export class CoreRemindersSetReminderMenuComponent implements OnInit {
@Input() initialValue?: CoreReminderValueAndUnit;
@Input() initialValue?: number;
@Input() noReminderLabel = '';
currentValue = '0m';
@ -73,26 +77,25 @@ export class CoreRemindersSetReminderMenuComponent implements OnInit {
option.label = CoreReminders.getUnitValueLabel(option.value, option.unit);
});
if (!this.initialValue) {
const initialValue = CoreRemindersService.convertSecondsToValueAndUnit(this.initialValue);
if (initialValue.value === CoreRemindersService.DISABLED) {
this.currentValue = 'disabled';
return;
}
if (this.initialValue.value === AddonCalendarProvider.DEFAULT_NOTIFICATION_DISABLED) {
this.currentValue = 'disabled';
} else {
// Search if it's one of the preset options.
const option = this.presetOptions.find(option =>
option.value === this.initialValue?.value && option.unit === this.initialValue.unit);
// Search if it's one of the preset options.
const option = this.presetOptions.find(option =>
option.value === initialValue?.value && option.unit === initialValue.unit);
if (option) {
this.currentValue = option.radioValue;
} else {
// It's a custom value.
this.currentValue = 'custom';
this.customValue = this.initialValue.value;
this.customUnits = this.initialValue.unit;
this.customLabel = CoreReminders.getUnitValueLabel(this.customValue, this.customUnits);
}
if (option) {
this.currentValue = option.radioValue;
} else {
// It's a custom value.
this.currentValue = 'custom';
this.customValue = initialValue.value;
this.customUnits = initialValue.unit;
this.customLabel = CoreReminders.getUnitValueLabel(this.customValue, this.customUnits);
}
}
@ -101,14 +104,7 @@ export class CoreRemindersSetReminderMenuComponent implements OnInit {
*
* @param value Value to set.
*/
setReminder(value: string): void {
// Return it as an object because 0 means undefined if not.
if (value === 'disabled') {
PopoverController.dismiss({ timeBefore: AddonCalendarProvider.DEFAULT_NOTIFICATION_DISABLED });
return;
}
setReminder(value?: string): void {
const option = this.presetOptions.find(option => option.radioValue === value);
if (!option) {
return;
@ -117,6 +113,13 @@ export class CoreRemindersSetReminderMenuComponent implements OnInit {
PopoverController.dismiss({ timeBefore: option.unit * option.value });
}
/**
* Disable the reminder.
*/
disableReminder(): void {
PopoverController.dismiss({ timeBefore: undefined });
}
/**
* Custom value input clicked.
*

View File

@ -36,7 +36,7 @@ export const CORE_REMINDERS_SERVICES: Type<unknown>[] = [
provide: APP_INITIALIZER,
multi: true,
useValue: async () => {
CoreReminders.scheduleAllNotifications();
await CoreReminders.initialize();
},
},
],

View File

@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { AddonCalendar, AddonCalendarProvider } from '@addons/calendar/services/calendar';
import { Injectable } from '@angular/core';
import { CoreLocalNotifications } from '@services/local-notifications';
import { CoreSites } from '@services/sites';
@ -22,6 +21,8 @@ import { CoreReminderDBRecord, REMINDERS_TABLE } from './database/reminders';
import { ILocalNotification } from '@ionic-native/local-notifications';
import { CorePlatform } from '@services/platform';
import { CoreConstants } from '@/core/constants';
import { CoreConfig } from '@services/config';
import { CoreEvents } from '@singletons/events';
/**
* Units to set a reminder.
@ -55,6 +56,35 @@ const REMINDER_UNITS_LABELS = {
export class CoreRemindersService {
static readonly DEFAULT_REMINDER_TIMEBEFORE = -1;
static readonly DISABLED = -1;
static readonly DEFAULT_NOTIFICATION_TIME_SETTING = 'CoreRemindersDefaultNotification';
static readonly DEFAULT_NOTIFICATION_TIME_CHANGED = 'CoreRemindersDefaultNotificationChangedEvent';
/**
* Initialize the service.
*
* @return Promise resolved when done.
*/
async initialize(): Promise<void> {
if (!CoreLocalNotifications.isAvailable()) {
return;
}
this.scheduleAllNotifications();
CoreEvents.on(CoreRemindersService.DEFAULT_NOTIFICATION_TIME_CHANGED, async (data) => {
const site = await CoreSites.getSite(data.siteId);
const siteId = site.getId();
// Get all the events that have a default reminder.
const reminders = await this.getRemindersWithDefaultTime(siteId);
// Reschedule all the default reminders.
reminders.forEach((reminder) =>
this.scheduleNotification(reminder, siteId));
});
}
/**
* Returns if Reminders are enabled.
@ -131,7 +161,7 @@ export class CoreRemindersService {
* @param siteId ID of the site the reminder belongs to. If not defined, use current site.
* @return Promise resolved when the reminder data is retrieved.
*/
async getAllReminders( siteId?: string): Promise<CoreReminderDBRecord[]> {
async getAllReminders(siteId?: string): Promise<CoreReminderDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return site.getDb().getRecords(REMINDERS_TABLE, undefined, 'time ASC');
@ -153,16 +183,15 @@ export class CoreRemindersService {
/**
* Get all reminders of a component with default time.
*
* @param component Component.
* @param siteId ID of the site the reminder belongs to. If not defined, use current site.
* @return Promise resolved when the reminder data is retrieved.
*/
async getRemindersWithDefaultTime(component: string, siteId?: string): Promise<CoreReminderDBRecord[]> {
protected async getRemindersWithDefaultTime(siteId?: string): Promise<CoreReminderDBRecord[]> {
const site = await CoreSites.getSite(siteId);
return site.getDb().getRecords<CoreReminderDBRecord>(
REMINDERS_TABLE,
{ component, timebefore: CoreRemindersService.DEFAULT_REMINDER_TIMEBEFORE },
{ timebefore: CoreRemindersService.DEFAULT_REMINDER_TIMEBEFORE },
'time ASC',
);
}
@ -241,10 +270,10 @@ export class CoreRemindersService {
siteId = siteId || CoreSites.getCurrentSiteId();
const timebefore = reminder.timebefore === CoreRemindersService.DEFAULT_REMINDER_TIMEBEFORE
? await AddonCalendar.getDefaultNotificationTime(siteId)
? await this.getDefaultNotificationTime(siteId)
: reminder.timebefore;
if (timebefore === AddonCalendarProvider.DEFAULT_NOTIFICATION_DISABLED) {
if (timebefore === CoreRemindersService.DISABLED) {
// Notification disabled. Cancel.
return this.cancelReminder(reminder.id, reminder.component, siteId);
}
@ -309,8 +338,7 @@ export class CoreRemindersService {
* @return Translated label.
*/
getUnitValueLabel(value: number, unit: CoreRemindersUnits, addDefaultLabel = false): string {
if (value === AddonCalendarProvider.DEFAULT_NOTIFICATION_DISABLED) {
// TODO: It will need a migration of date to set 0 to -1 when needed.
if (value === CoreRemindersService.DISABLED) {
return Translate.instant('core.settings.disabled');
}
@ -343,7 +371,7 @@ export class CoreRemindersService {
static convertSecondsToValueAndUnit(seconds?: number): CoreReminderValueAndUnit {
if (seconds === undefined || seconds < 0) {
return {
value: AddonCalendarProvider.DEFAULT_NOTIFICATION_DISABLED,
value: CoreRemindersService.DISABLED,
unit: CoreRemindersUnits.MINUTE,
};
} else if (seconds === 0) {
@ -374,6 +402,37 @@ export class CoreRemindersService {
}
}
/**
* Get the configured default notification time.
*
* @param siteId ID of the site. If not defined, use current site.
* @return Promise resolved with the default time (in seconds).
*/
async getDefaultNotificationTime(siteId?: string): Promise<number> {
siteId = siteId || CoreSites.getCurrentSiteId();
const key = CoreRemindersService.DEFAULT_NOTIFICATION_TIME_SETTING + '#' + siteId;
return CoreConfig.get(key, CoreConstants.CONFIG.calendarreminderdefaultvalue || 3600);
}
/**
* Set the default notification time.
*
* @param time New default time.
* @param siteId ID of the site. If not defined, use current site.
* @return Promise resolved when stored.
*/
async setDefaultNotificationTime(time: number, siteId?: string): Promise<void> {
siteId = siteId || CoreSites.getCurrentSiteId();
const key = CoreRemindersService.DEFAULT_NOTIFICATION_TIME_SETTING + '#' + siteId;
await CoreConfig.set(key, time);
CoreEvents.trigger(CoreRemindersService.DEFAULT_NOTIFICATION_TIME_CHANGED, { time }, siteId);
}
}
export const CoreReminders = makeSingleton(CoreRemindersService);