From 922429e0d12eae48857b4ebeade10e2583ae7500 Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Tue, 1 Oct 2019 15:31:52 +0200 Subject: [PATCH] MOBILE-2890 calendar: Confirm delete reminder --- src/addon/calendar/pages/event/event.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/addon/calendar/pages/event/event.ts b/src/addon/calendar/pages/event/event.ts index 8a0df6fb0..83047a9e2 100644 --- a/src/addon/calendar/pages/event/event.ts +++ b/src/addon/calendar/pages/event/event.ts @@ -344,10 +344,22 @@ export class AddonCalendarEventPage implements OnDestroy { e.preventDefault(); e.stopPropagation(); - this.calendarProvider.deleteEventReminder(id).then(() => { - this.calendarProvider.getEventReminders(this.eventId).then((reminders) => { - this.reminders = reminders; + const message = this.translate.instant('core.areyousure'); + const okText = this.translate.instant('core.delete'); + + this.domUtils.showConfirm(message, undefined, okText).then(() => { + const modal = this.domUtils.showModalLoading('core.deleting', true); + this.calendarProvider.deleteEventReminder(id).then(() => { + this.calendarProvider.getEventReminders(this.eventId).then((reminders) => { + this.reminders = reminders; + }); + }).catch((error) => { + this.domUtils.showErrorModalDefault(error, 'Error deleting reminder'); + }).finally(() => { + modal.dismiss(); }); + }).catch(() => { + // Cancelled. }); }