@ebarooni/capacitor-calendar 6.1.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/schemas/enums/calendar-chooser-display-style.js","esm/schemas/enums/calendar-chooser-selection-style.js","esm/schemas/enums/plugin-permission.js","esm/schemas/enums/reminder-recurrence-frequency.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Enum representing the display styles for the calendar chooser.\n *\n * @enum CalendarChooserDisplayStyle\n * @platform iOS\n */\nexport var CalendarChooserDisplayStyle;\n(function (CalendarChooserDisplayStyle) {\n /**\n * Display all calendars available for selection.\n */\n CalendarChooserDisplayStyle[CalendarChooserDisplayStyle[\"ALL_CALENDARS\"] = 0] = \"ALL_CALENDARS\";\n /**\n * Display only writable calendars available for selection.\n */\n CalendarChooserDisplayStyle[CalendarChooserDisplayStyle[\"WRITABLE_CALENDARS_ONLY\"] = 1] = \"WRITABLE_CALENDARS_ONLY\";\n})(CalendarChooserDisplayStyle || (CalendarChooserDisplayStyle = {}));\n//# sourceMappingURL=calendar-chooser-display-style.js.map","/**\n * Enum representing the selection style for the calendar chooser.\n *\n * @enum CalendarChooserSelectionStyle\n * @platform iOS\n */\nexport var CalendarChooserSelectionStyle;\n(function (CalendarChooserSelectionStyle) {\n /**\n * Allows only a single selection in the calendar chooser.\n */\n CalendarChooserSelectionStyle[CalendarChooserSelectionStyle[\"SINGLE\"] = 0] = \"SINGLE\";\n /**\n * Allows multiple selections in the calendar chooser.\n */\n CalendarChooserSelectionStyle[CalendarChooserSelectionStyle[\"MULTIPLE\"] = 1] = \"MULTIPLE\";\n})(CalendarChooserSelectionStyle || (CalendarChooserSelectionStyle = {}));\n//# sourceMappingURL=calendar-chooser-selection-style.js.map","/**\n * Enum representing the available runtime permissions for the plugin.\n *\n * @enum PluginPermission\n * @platform iOS, Android\n */\nexport var PluginPermission;\n(function (PluginPermission) {\n /**\n * Represents the permission state for reading calendar.\n *\n * @platform iOS, Android\n * @permissions\n * <h3>Manifest Permissions:</h3>\n * <ul>\n * <li><strong>iOS 17 &le;:</strong> NSCalendarsFullAccessUsageDescription</li>\n * <li><strong>13 &le; iOS &le; 16:</strong> NSCalendarsUsageDescription</li>\n * <li><strong>Android:</strong> android.permission.READ_CALENDAR</li>\n * </ul>\n */\n PluginPermission[\"READ_CALENDAR\"] = \"readCalendar\";\n /**\n * Represents the permission state for writing calendar.\n *\n * @platform iOS, Android\n * @permissions\n * <h3>Manifest Permissions:</h3>\n * <ul>\n * <li><strong>iOS 17 &le;:</strong> NSCalendarsWriteOnlyAccessUsageDescription</li>\n * <li><strong>13 &le; iOS &le; 16:</strong> NSCalendarsUsageDescription</li>\n * <li><strong>Android:</strong> android.permission.WRITE_CALENDAR</li>\n * </ul>\n */\n PluginPermission[\"WRITE_CALENDAR\"] = \"writeCalendar\";\n /**\n * Represents the permission state for reading reminders.\n *\n * @platform iOS\n * @permissions\n * <h3>Manifest Permissions:</h3>\n * <ul>\n * <li><strong>iOS 17 &le;:</strong> NSRemindersFullAccessUsageDescription</li>\n * <li><strong>10 &le; iOS &le; 16:</strong> NSRemindersUsageDescription</li>\n * </ul>\n */\n PluginPermission[\"READ_REMINDERS\"] = \"readReminders\";\n /**\n * Represents the permission state for writing reminders.\n *\n * @platform iOS\n * @permissions\n * <h3>Manifest Permissions:</h3>\n * <ul>\n * <li><strong>iOS 17 &le;:</strong> NSRemindersFullAccessUsageDescription</li>\n * <li><strong>13 &le; iOS &le; 16:</strong> NSRemindersUsageDescription</li>\n * </ul>\n */\n PluginPermission[\"WRITE_REMINDERS\"] = \"writeReminders\";\n})(PluginPermission || (PluginPermission = {}));\n//# sourceMappingURL=plugin-permission.js.map","/**\n * Enum representing the repeating frequency of the reminder.\n *\n * @enum ReminderRecurrenceFrequency\n * @platform iOS\n */\nexport var ReminderRecurrenceFrequency;\n(function (ReminderRecurrenceFrequency) {\n /**\n * The reminder repeats on a daily basis\n */\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"DAILY\"] = 0] = \"DAILY\";\n /**\n * The reminder repeats on a weekly basis\n */\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"WEEKLY\"] = 1] = \"WEEKLY\";\n /**\n * The reminder repeats on a monthly basis\n */\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"MONTHLY\"] = 2] = \"MONTHLY\";\n /**\n * The reminder repeats on a yearly basis\n */\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"YEARLY\"] = 3] = \"YEARLY\";\n})(ReminderRecurrenceFrequency || (ReminderRecurrenceFrequency = {}));\n//# sourceMappingURL=reminder-recurrence-frequency.js.map","import { registerPlugin } from '@capacitor/core';\nimport { CalendarChooserDisplayStyle } from './schemas/enums/calendar-chooser-display-style';\nimport { CalendarChooserSelectionStyle } from './schemas/enums/calendar-chooser-selection-style';\nimport { PluginPermission } from './schemas/enums/plugin-permission';\nimport { ReminderRecurrenceFrequency } from './schemas/enums/reminder-recurrence-frequency';\nconst CapacitorCalendar = registerPlugin('CapacitorCalendar', {\n web: () => import('./web').then((m) => new m.CapacitorCalendarWeb()),\n});\nexport * from './definitions';\nexport { CalendarChooserSelectionStyle, CalendarChooserDisplayStyle, PluginPermission, ReminderRecurrenceFrequency, CapacitorCalendar, };\n//# sourceMappingURL=index.js.map","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { WebPlugin } from '@capacitor/core';\nexport class CapacitorCalendarWeb extends WebPlugin {\n checkPermission(_options) {\n throw this.unimplemented(`${this.checkPermission.name} is not implemented on the web`);\n }\n checkAllPermissions() {\n throw this.unimplemented(`${this.checkAllPermissions.name} is not implemented on the web`);\n }\n requestPermission(_options) {\n throw this.unimplemented(`${this.requestPermission.name} is not implemented on the web`);\n }\n requestAllPermissions() {\n throw this.unimplemented(`${this.requestAllPermissions.name} is not implemented on the web`);\n }\n createEventWithPrompt(_options) {\n throw this.unimplemented(`${this.createEventWithPrompt.name} is not implemented on the web`);\n }\n selectCalendarsWithPrompt() {\n throw this.unimplemented(`${this.createEventWithPrompt.name} is not implemented on the web`);\n }\n listCalendars() {\n throw this.unimplemented(`${this.listCalendars.name} is not implemented on the web`);\n }\n getDefaultCalendar() {\n throw this.unimplemented(`${this.getDefaultCalendar.name} is not implemented on the web`);\n }\n createEvent(_options) {\n throw this.unimplemented(`${this.createEvent.name} is not implemented on the web`);\n }\n createReminder(_options) {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n getDefaultRemindersList() {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n getRemindersLists() {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n openCalendar(_options) {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n openReminders() {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n listEventsInRange(_options) {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n deleteEventsById(_options) {\n throw this.unimplemented(`${this.deleteEventsById.name} is not implemented on the web`);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["CalendarChooserDisplayStyle","CalendarChooserSelectionStyle","PluginPermission","ReminderRecurrenceFrequency","registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;IACA;IACA;AACWA,iDAA4B;IACvC,CAAC,UAAU,2BAA2B,EAAE;IACxC;IACA;IACA;IACA,IAAI,2BAA2B,CAAC,2BAA2B,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,eAAe,CAAC;IACpG;IACA;IACA;IACA,IAAI,2BAA2B,CAAC,2BAA2B,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC,GAAG,yBAAyB,CAAC;IACxH,CAAC,EAAEA,mCAA2B,KAAKA,mCAA2B,GAAG,EAAE,CAAC,CAAC;;IChBrE;IACA;IACA;IACA;IACA;IACA;AACWC,mDAA8B;IACzC,CAAC,UAAU,6BAA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AM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAC9F,KAAK;IACL,IAAI,aAAa,GAAG;IACpB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAC9F,KAAK;IACL,IAAI,iBAAiB,CAAC,QAAQ,EAAE;IAChC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAC9F,KAAK;IACL,IAAI,gBAAgB,CAAC,QAAQ,EAAE;IAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAChG,KAAK;IACL;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/schemas/enums/calendar-chooser-display-style.js","esm/schemas/enums/calendar-chooser-selection-style.js","esm/schemas/enums/plugin-permission.js","esm/schemas/enums/reminder-recurrence-frequency.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Enum representing the display styles for the calendar chooser.\n *\n * @enum CalendarChooserDisplayStyle\n * @platform iOS\n */\nexport var CalendarChooserDisplayStyle;\n(function (CalendarChooserDisplayStyle) {\n /**\n * Display all calendars available for selection.\n */\n CalendarChooserDisplayStyle[CalendarChooserDisplayStyle[\"ALL_CALENDARS\"] = 0] = \"ALL_CALENDARS\";\n /**\n * Display only writable calendars available for selection.\n */\n CalendarChooserDisplayStyle[CalendarChooserDisplayStyle[\"WRITABLE_CALENDARS_ONLY\"] = 1] = \"WRITABLE_CALENDARS_ONLY\";\n})(CalendarChooserDisplayStyle || (CalendarChooserDisplayStyle = {}));\n//# sourceMappingURL=calendar-chooser-display-style.js.map","/**\n * Enum representing the selection style for the calendar chooser.\n *\n * @enum CalendarChooserSelectionStyle\n * @platform iOS\n */\nexport var CalendarChooserSelectionStyle;\n(function (CalendarChooserSelectionStyle) {\n /**\n * Allows only a single selection in the calendar chooser.\n */\n CalendarChooserSelectionStyle[CalendarChooserSelectionStyle[\"SINGLE\"] = 0] = \"SINGLE\";\n /**\n * Allows multiple selections in the calendar chooser.\n */\n CalendarChooserSelectionStyle[CalendarChooserSelectionStyle[\"MULTIPLE\"] = 1] = \"MULTIPLE\";\n})(CalendarChooserSelectionStyle || (CalendarChooserSelectionStyle = {}));\n//# sourceMappingURL=calendar-chooser-selection-style.js.map","/**\n * Enum representing the available runtime permissions for the plugin.\n *\n * @enum PluginPermission\n * @platform iOS, Android\n */\nexport var PluginPermission;\n(function (PluginPermission) {\n /**\n * Represents the permission state for reading calendar.\n *\n * @platform iOS, Android\n * @permissions\n * <h3>Manifest Permissions:</h3>\n * <ul>\n * <li><strong>iOS 17 &le;:</strong> NSCalendarsFullAccessUsageDescription</li>\n * <li><strong>13 &le; iOS &le; 16:</strong> NSCalendarsUsageDescription</li>\n * <li><strong>Android:</strong> android.permission.READ_CALENDAR</li>\n * </ul>\n */\n PluginPermission[\"READ_CALENDAR\"] = \"readCalendar\";\n /**\n * Represents the permission state for writing calendar.\n *\n * @platform iOS, Android\n * @permissions\n * <h3>Manifest Permissions:</h3>\n * <ul>\n * <li><strong>iOS 17 &le;:</strong> NSCalendarsWriteOnlyAccessUsageDescription</li>\n * <li><strong>13 &le; iOS &le; 16:</strong> NSCalendarsUsageDescription</li>\n * <li><strong>Android:</strong> android.permission.WRITE_CALENDAR</li>\n * </ul>\n */\n PluginPermission[\"WRITE_CALENDAR\"] = \"writeCalendar\";\n /**\n * Represents the permission state for reading reminders.\n *\n * @platform iOS\n * @permissions\n * <h3>Manifest Permissions:</h3>\n * <ul>\n * <li><strong>iOS 17 &le;:</strong> NSRemindersFullAccessUsageDescription</li>\n * <li><strong>10 &le; iOS &le; 16:</strong> NSRemindersUsageDescription</li>\n * </ul>\n */\n PluginPermission[\"READ_REMINDERS\"] = \"readReminders\";\n /**\n * Represents the permission state for writing reminders.\n *\n * @platform iOS\n * @permissions\n * <h3>Manifest Permissions:</h3>\n * <ul>\n * <li><strong>iOS 17 &le;:</strong> NSRemindersFullAccessUsageDescription</li>\n * <li><strong>13 &le; iOS &le; 16:</strong> NSRemindersUsageDescription</li>\n * </ul>\n */\n PluginPermission[\"WRITE_REMINDERS\"] = \"writeReminders\";\n})(PluginPermission || (PluginPermission = {}));\n//# sourceMappingURL=plugin-permission.js.map","/**\n * Enum representing the repeating frequency of the reminder.\n *\n * @enum ReminderRecurrenceFrequency\n * @platform iOS\n */\nexport var ReminderRecurrenceFrequency;\n(function (ReminderRecurrenceFrequency) {\n /**\n * The reminder repeats on a daily basis\n */\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"DAILY\"] = 0] = \"DAILY\";\n /**\n * The reminder repeats on a weekly basis\n */\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"WEEKLY\"] = 1] = \"WEEKLY\";\n /**\n * The reminder repeats on a monthly basis\n */\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"MONTHLY\"] = 2] = \"MONTHLY\";\n /**\n * The reminder repeats on a yearly basis\n */\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"YEARLY\"] = 3] = \"YEARLY\";\n})(ReminderRecurrenceFrequency || (ReminderRecurrenceFrequency = {}));\n//# sourceMappingURL=reminder-recurrence-frequency.js.map","import { registerPlugin } from '@capacitor/core';\nimport { CalendarChooserDisplayStyle } from './schemas/enums/calendar-chooser-display-style';\nimport { CalendarChooserSelectionStyle } from './schemas/enums/calendar-chooser-selection-style';\nimport { PluginPermission } from './schemas/enums/plugin-permission';\nimport { ReminderRecurrenceFrequency } from './schemas/enums/reminder-recurrence-frequency';\nconst CapacitorCalendar = registerPlugin('CapacitorCalendar', {\n web: () => import('./web').then((m) => new m.CapacitorCalendarWeb()),\n});\nexport * from './definitions';\nexport { CalendarChooserSelectionStyle, CalendarChooserDisplayStyle, PluginPermission, ReminderRecurrenceFrequency, CapacitorCalendar, };\n//# sourceMappingURL=index.js.map","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { WebPlugin } from '@capacitor/core';\nexport class CapacitorCalendarWeb extends WebPlugin {\n checkPermission(_options) {\n throw this.unimplemented(`${this.checkPermission.name} is not implemented on the web`);\n }\n checkAllPermissions() {\n throw this.unimplemented(`${this.checkAllPermissions.name} is not implemented on the web`);\n }\n requestPermission(_options) {\n throw this.unimplemented(`${this.requestPermission.name} is not implemented on the web`);\n }\n requestAllPermissions() {\n throw this.unimplemented(`${this.requestAllPermissions.name} is not implemented on the web`);\n }\n createEventWithPrompt(_options) {\n throw this.unimplemented(`${this.createEventWithPrompt.name} is not implemented on the web`);\n }\n selectCalendarsWithPrompt() {\n throw this.unimplemented(`${this.selectCalendarsWithPrompt.name} is not implemented on the web`);\n }\n listCalendars() {\n throw this.unimplemented(`${this.listCalendars.name} is not implemented on the web`);\n }\n getDefaultCalendar() {\n throw this.unimplemented(`${this.getDefaultCalendar.name} is not implemented on the web`);\n }\n createEvent(_options) {\n throw this.unimplemented(`${this.createEvent.name} is not implemented on the web`);\n }\n createReminder(_options) {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n getDefaultRemindersList() {\n throw this.unimplemented(`${this.getDefaultRemindersList.name} is not implemented on the web`);\n }\n getRemindersLists() {\n throw this.unimplemented(`${this.getRemindersLists.name} is not implemented on the web`);\n }\n openCalendar(_options) {\n throw this.unimplemented(`${this.openCalendar.name} is not implemented on the web`);\n }\n openReminders() {\n throw this.unimplemented(`${this.openReminders.name} is not implemented on the web`);\n }\n listEventsInRange(_options) {\n throw this.unimplemented(`${this.listEventsInRange.name} is not implemented on the web`);\n }\n deleteEventsById(_options) {\n throw this.unimplemented(`${this.deleteEventsById.name} is not implemented on the web`);\n }\n createCalendar(_options) {\n throw this.unimplemented(`${this.createCalendar.name} is not implemented on the web`);\n }\n deleteCalendar(_options) {\n throw this.unimplemented(`${this.deleteCalendar.name} is not implemented on the web`);\n }\n getRemindersFromLists(_options) {\n throw this.unimplemented(`${this.getRemindersFromLists.name} is not implemented on the web`);\n }\n deleteRemindersById(_options) {\n throw this.unimplemented(`${this.deleteRemindersById.name} is not implemented on the web`);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["CalendarChooserDisplayStyle","CalendarChooserSelectionStyle","PluginPermission","ReminderRecurrenceFrequency","registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;IACA;IACA;AACWA,iDAA4B;IACvC,CAAC,UAAU,2BAA2B,EAAE;IACxC;IACA;IACA;IACA,IAAI,2BAA2B,CAAC,2BAA2B,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,eAAe,CAAC;IACpG;IACA;IACA;IACA,IAAI,2BAA2B,CAAC,2BAA2B,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC,GAAG,yBAAyB,CAAC;IACxH,CAAC,EAAEA,mCAA2B,KAAKA,mCAA2B,GAAG,EAAE,CAAC,CAAC;;IChBrE;IACA;IACA;IACA;IACA;IACA;AACWC,mDAA8B;IACzC,CAAC,UAAU,6BAA6B,EAAE;IAC1C;IACA;IACA;IACA,IAAI,6BAA6B,CAAC,6BAA6B,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;IAC1F;IACA;IACA;IACA,IAAI,6BAA6B,CAAC,6BAA6B,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;IAC9F,CAAC,EAAEA,qCAA6B,KAAKA,qCAA6B,GAAG,EAAE,CAAC,CAAC;;IChBzE;IACA;IACA;IACA;IACA;IACA;AACWC,sCAAiB;IAC5B,CAAC,UAAU,gBAAgB,EAAE;IAC7B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,gBAAgB,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AI,gBAAgB,CAAC,QAAQ,EAAE;IAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAChG,KAAK;IACL,IAAI,cAAc,CAAC,QAAQ,EAAE;IAC7B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAC9F,KAAK;IACL,IAAI,cAAc,CAAC,QAAQ,EAAE;IAC7B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAC9F,KAAK;IACL,IAAI,qBAAqB,CAAC,QAAQ,EAAE;IACpC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IACrG,KAAK;IACL,IAAI,mBAAmB,CAAC,QAAQ,EAAE;IAClC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IACnG,KAAK;IACL;;;;;;;;;;;;;;;"}
@@ -5,7 +5,7 @@ import EventKitUI
5
5
  public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarChooserDelegate {
6
6
  private let bridge: (any CAPBridgeProtocol)?
7
7
  private let eventStore: EKEventStore
8
- private var currentCreateEventContinuation: CheckedContinuation<String, any Error>?
8
+ private var currentCreateEventContinuation: CheckedContinuation<[String], any Error>?
9
9
  private var currentSelectCalendarsContinuation: CheckedContinuation<[[String: String]], any Error>?
10
10
 
11
11
  init(bridge: (any CAPBridgeProtocol)?, eventStore: EKEventStore) {
@@ -13,7 +13,7 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
13
13
  self.eventStore = eventStore
14
14
  }
15
15
 
16
- public func createEventWithPrompt(with parameters: EventCreationParameters) async throws -> String {
16
+ public func createEventWithPrompt(with parameters: EventCreationParameters) async throws -> [String] {
17
17
  let newEvent = EKEvent(eventStore: eventStore)
18
18
  if let calendarId = parameters.calendarId, let calendar = eventStore.calendar(withIdentifier: calendarId) {
19
19
  newEvent.calendar = calendar
@@ -310,6 +310,33 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
310
310
  }
311
311
  }
312
312
 
313
+ public func createCalendar(title: String, color: String?) throws -> String {
314
+ let newCalendar = EKCalendar(for: .event, eventStore: eventStore)
315
+ newCalendar.title = title
316
+ if let calendarColor = color {
317
+ newCalendar.cgColor = UIColor(hex: calendarColor)?.cgColor
318
+ } else {
319
+ newCalendar.cgColor = eventStore.defaultCalendarForNewEvents?.cgColor
320
+ }
321
+ newCalendar.source = eventStore.defaultCalendarForNewEvents?.source
322
+
323
+ do {
324
+ try eventStore.saveCalendar(newCalendar, commit: true)
325
+ } catch {
326
+ throw CapacitorCalendarPluginError.unableToCreateCalendar
327
+ }
328
+
329
+ return newCalendar.calendarIdentifier
330
+ }
331
+
332
+ public func deleteCalendar(id: String) throws {
333
+ if let calendar = eventStore.calendar(withIdentifier: id) {
334
+ try eventStore.removeCalendar(calendar, commit: true)
335
+ } else {
336
+ throw CapacitorCalendarPluginError.calendarNotFound
337
+ }
338
+ }
339
+
313
340
  public func eventEditViewController(
314
341
  _ controller: EKEventEditViewController,
315
342
  didCompleteWith action: EKEventEditViewAction
@@ -317,13 +344,13 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
317
344
  controller.dismiss(animated: true) {
318
345
  if action == .saved {
319
346
  if let event = controller.event {
320
- self.currentCreateEventContinuation?.resume(returning: event.eventIdentifier)
347
+ self.currentCreateEventContinuation?.resume(returning: [event.eventIdentifier])
321
348
  } else {
322
349
  self.currentCreateEventContinuation?.resume(throwing: CapacitorCalendarPluginError.undefinedEvent)
323
350
  return
324
351
  }
325
352
  } else if action == .canceled {
326
- self.currentCreateEventContinuation?.resume(throwing: CapacitorCalendarPluginError.createEventCancelled)
353
+ self.currentCreateEventContinuation?.resume(returning: [])
327
354
  } else {
328
355
  self.currentCreateEventContinuation?.resume(throwing: CapacitorCalendarPluginError.unknownActionEventCreationPrompt)
329
356
  }
@@ -339,7 +366,7 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
339
366
 
340
367
  public func calendarChooserDidCancel(_ calendarChooser: EKCalendarChooser) {
341
368
  bridge?.viewController?.dismiss(animated: true) {
342
- self.currentSelectCalendarsContinuation?.resume(throwing: CapacitorCalendarPluginError.canceledCalendarsSelectionPrompt)
369
+ self.currentSelectCalendarsContinuation?.resume(returning: [])
343
370
  }
344
371
  }
345
372
 
@@ -20,4 +20,8 @@ CAP_PLUGIN(CapacitorCalendarPlugin, "CapacitorCalendar",
20
20
  CAP_PLUGIN_METHOD(openReminders, CAPPluginReturnNone);
21
21
  CAP_PLUGIN_METHOD(listEventsInRange, CAPPluginReturnPromise);
22
22
  CAP_PLUGIN_METHOD(deleteEventsById, CAPPluginReturnPromise);
23
+ CAP_PLUGIN_METHOD(createCalendar, CAPPluginReturnPromise);
24
+ CAP_PLUGIN_METHOD(deleteCalendar, CAPPluginReturnNone);
25
+ CAP_PLUGIN_METHOD(getRemindersFromLists, CAPPluginReturnPromise);
26
+ CAP_PLUGIN_METHOD(deleteRemindersById, CAPPluginReturnPromise);
23
27
  )
@@ -145,7 +145,7 @@ public class CapacitorCalendarPlugin: CAPPlugin {
145
145
  Task {
146
146
  do {
147
147
  let result = try await calendar.createEventWithPrompt(with: eventParameters)
148
- call.resolve(["result": [result]])
148
+ call.resolve(["result": result])
149
149
  } catch {
150
150
  call.reject("[CapacitorCalendar.\(#function)] Unable to retrieve view controller")
151
151
  return
@@ -354,4 +354,70 @@ public class CapacitorCalendarPlugin: CAPPlugin {
354
354
  }
355
355
  }
356
356
  }
357
+
358
+ @objc public func createCalendar(_ call: CAPPluginCall) {
359
+ guard let title = call.getString("title") else {
360
+ call.reject("[CapacitorCalendar.\(#function)] A title for the calendar was not provided")
361
+ return
362
+ }
363
+ let color = call.getString("color")
364
+
365
+ do {
366
+ let id = try calendar.createCalendar(title: title, color: color)
367
+ call.resolve(["result": id])
368
+ } catch {
369
+ call.reject("[CapacitorCalendar.\(#function)] Could not create calendar")
370
+ return
371
+ }
372
+ }
373
+
374
+ @objc public func deleteCalendar(_ call: CAPPluginCall) {
375
+ guard let id = call.getString("id") else {
376
+ call.reject("[CapacitorCalendar.\(#function)] An id for the calendar to delete should be provided")
377
+ return
378
+ }
379
+
380
+ do {
381
+ try calendar.deleteCalendar(id: id)
382
+ call.resolve()
383
+ } catch {
384
+ call.reject("[CapacitorCalendar.\(#function)] Could not delete calendar")
385
+ return
386
+ }
387
+ }
388
+
389
+ @objc public func getRemindersFromLists(_ call: CAPPluginCall) {
390
+ let ids = call.getArray("listIds")
391
+
392
+ Task {
393
+ do {
394
+ try call.resolve(["result": await reminders.getRemindersFromLists(listIds: ids)])
395
+ } catch {
396
+ call.reject("[CapacitorCalendar.\(#function)] Could not get the reminders from lists")
397
+ return
398
+ }
399
+ }
400
+ }
401
+
402
+ @objc public func deleteRemindersById(_ call: CAPPluginCall) {
403
+ guard let ids = call.getArray("ids") else {
404
+ call.reject("[CapacitorCalendar.\(#function)] Reminder ids were not provided")
405
+ return
406
+ }
407
+
408
+ Task {
409
+ do {
410
+ let deleteResult = try await reminders.deleteRemindersById(ids: ids)
411
+ call.resolve([
412
+ "result": [
413
+ "deleted": deleteResult.deleted,
414
+ "failed": deleteResult.failed
415
+ ]
416
+ ])
417
+ } catch {
418
+ call.reject("[CapacitorCalendar.\(#function)] Could not delete the reminders")
419
+ return
420
+ }
421
+ }
422
+ }
357
423
  }
@@ -13,10 +13,11 @@ public enum CapacitorCalendarPluginError: Error {
13
13
  case eventStoreAuthorization
14
14
  case viewControllerUnavailable
15
15
  case unknownActionEventCreationPrompt
16
- case canceledCalendarsSelectionPrompt
17
16
  case noDefaultCalendar
18
17
  case unableToOpenCalendar
19
18
  case unableToOpenReminders
20
19
  case undefinedEvent
21
- case createEventCancelled
20
+ case unableToParseColor
21
+ case unableToCreateCalendar
22
+ case calendarNotFound
22
23
  }
@@ -9,6 +9,7 @@
9
9
  import Foundation
10
10
  import EventKit
11
11
  import UIKit
12
+ import Capacitor
12
13
 
13
14
  public class CapacitorReminders: NSObject {
14
15
  private let eventStore: EKEventStore
@@ -172,6 +173,62 @@ public class CapacitorReminders: NSObject {
172
173
  }
173
174
  }
174
175
 
176
+ public func getRemindersFromLists(listIds: JSArray?) async throws -> [[String: Any]] {
177
+ return try await withCheckedThrowingContinuation { continuation in
178
+ var lists: [EKCalendar]?
179
+ if let ids = listIds {
180
+ lists = []
181
+ for id in ids {
182
+ if let list = eventStore.calendar(withIdentifier: "\(id)") {
183
+ lists?.append(list)
184
+ }
185
+ }
186
+ }
187
+
188
+ let predicate = eventStore.predicateForReminders(in: lists)
189
+
190
+ self.eventStore.fetchReminders(matching: predicate) {reminders in
191
+ if let result = reminders {
192
+ continuation.resume(returning: self.dictionaryRepresentationOfReminder(events: result))
193
+ } else {
194
+ continuation.resume(returning: [])
195
+ }
196
+
197
+ }
198
+ }
199
+ }
200
+
201
+ public func deleteRemindersById(ids: JSArray) async throws -> EventDeleteResults {
202
+ await withCheckedContinuation { continuation in
203
+
204
+ var deletedEvents: [String] = []
205
+ var failedToDeleteEvents: [String] = []
206
+
207
+ for id in ids {
208
+ guard let reminder = eventStore.calendarItem(withIdentifier: "\(id)") else {
209
+ failedToDeleteEvents.append("\(id)")
210
+ continue
211
+ }
212
+
213
+ do {
214
+ try eventStore.remove(reminder as! EKReminder, commit: false)
215
+ deletedEvents.append("\(id)")
216
+ } catch {
217
+ failedToDeleteEvents.append("\(id)")
218
+ }
219
+ }
220
+
221
+ do {
222
+ try eventStore.commit()
223
+ } catch {
224
+ failedToDeleteEvents.append(contentsOf: deletedEvents)
225
+ deletedEvents.removeAll()
226
+ }
227
+
228
+ continuation.resume(returning: EventDeleteResults(deleted: deletedEvents, failed: failedToDeleteEvents))
229
+ }
230
+ }
231
+
175
232
  private func convertEKCalendarsToDictionaries(calendars: Set<EKCalendar>) -> [[String: String]] {
176
233
  var result: [[String: String]] = []
177
234
 
@@ -233,4 +290,69 @@ public class CapacitorReminders: NSObject {
233
290
  setDueDate()
234
291
  setCompletionDate()
235
292
  }
293
+
294
+ private func dictionaryRepresentationOfReminder(events: [EKReminder]) -> [[String: Any]] {
295
+ return events.map { event in
296
+ var dict = [String: Any]()
297
+ dict["id"] = event.calendarItemIdentifier
298
+ dict["listId"] = event.calendar.calendarIdentifier
299
+ dict["isCompleted"] = event.isCompleted
300
+ dict["priority"] = event.priority
301
+
302
+ if let title = event.title, !title.isEmpty {
303
+ dict["title"] = title
304
+ }
305
+ if let url = event.url {
306
+ dict["url"] = url
307
+ }
308
+ if let notes = event.notes {
309
+ dict["notes"] = notes
310
+ }
311
+ if let location = event.location {
312
+ dict["location"] = location
313
+ }
314
+ if let startDate = event.startDateComponents, let startMillis = convertDateComponentToMillis(dateComponent: startDate) {
315
+ dict["startDate"] = startMillis
316
+ }
317
+ if let dueDate = event.dueDateComponents, let dueMillis = convertDateComponentToMillis(dateComponent: dueDate) {
318
+ dict["dueDate"] = dueMillis
319
+ }
320
+ if let completionDate = event.completionDate {
321
+ dict["completionDate"] = completionDate.timeIntervalSince1970 * 1000
322
+ }
323
+ if let recurrenceRules = event.recurrenceRules {
324
+ let recurrence = extractReminderRecurrenceRules(rules: recurrenceRules)
325
+
326
+ if !recurrence.isEmpty {
327
+ dict["recurrence"] = recurrence
328
+ }
329
+ }
330
+
331
+ return dict
332
+ }
333
+ }
334
+
335
+ private func convertDateComponentToMillis(dateComponent: DateComponents) -> Double? {
336
+ let calendar = Calendar.current
337
+ if let startDate = calendar.date(from: dateComponent) {
338
+ return startDate.timeIntervalSince1970 * 1000
339
+ } else {
340
+ return nil
341
+ }
342
+ }
343
+
344
+ private func extractReminderRecurrenceRules(rules: [EKRecurrenceRule]) -> [[String: Any]] {
345
+ return rules.map { rule in
346
+ var obj = [String: Any]()
347
+
348
+ obj["frequency"] = rule.frequency.rawValue
349
+ obj["interval"] = rule.interval
350
+
351
+ if let endDate = rule.recurrenceEnd?.endDate {
352
+ obj["end"] = endDate.timeIntervalSince1970 * 1000
353
+ }
354
+
355
+ return obj
356
+ }
357
+ }
236
358
  }
@@ -0,0 +1,28 @@
1
+ //
2
+ // UIColorExtensions.swift
3
+ // Plugin
4
+ //
5
+ // Created by Ehsan Barooni on 03.05.24.
6
+ // Copyright © 2024 Max Lynch. All rights reserved.
7
+ //
8
+
9
+ import Foundation
10
+
11
+ import UIKit
12
+
13
+ extension UIColor {
14
+ convenience init?(hex: String) {
15
+ var hexSanitized = hex.trimmingCharacters(in: .whitespacesAndNewlines)
16
+ hexSanitized = hexSanitized.replacingOccurrences(of: "#", with: "")
17
+
18
+ var rgb: UInt64 = 0
19
+
20
+ Scanner(string: hexSanitized).scanHexInt64(&rgb)
21
+
22
+ let red = CGFloat((rgb & 0xFF0000) >> 16) / 255.0
23
+ let green = CGFloat((rgb & 0x00FF00) >> 8) / 255.0
24
+ let blue = CGFloat(rgb & 0x0000FF) / 255.0
25
+
26
+ self.init(red: red, green: green, blue: blue, alpha: 1.0)
27
+ }
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebarooni/capacitor-calendar",
3
- "version": "6.1.0",
3
+ "version": "6.3.0",
4
4
  "description": "The Capacitor Calendar Plugin enables full calendar functionality on iOS and Android, with added reminder support for iOS devices.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -57,9 +57,10 @@
57
57
  "fmt:md": "npx prettier --write \"**/*.md\"",
58
58
  "fmt:kt": "npm run ktlint -- -F",
59
59
  "fmt": "npm run fmt:ts && npm run fmt:html && npm run fmt:css && npm run fmt:swift && npm run fmt:md && npm run fmt:kt",
60
- "docgen": "docgen --api CapacitorCalendarPlugin --output-readme documentation.md --output-json dist/docs.json",
60
+ "docgen:api": "docgen --api CapacitorCalendarPlugin --output-readme documentation.md --output-json dist/docs.json",
61
+ "docgen:readme": "docgen --api CapacitorCalendarPlugin --output-readme README.md",
61
62
  "clean": "rm -rf ./dist",
62
- "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
63
+ "build": "npm run clean && npm run docgen:api && npm run docgen:readme && tsc && rollup -c rollup.config.mjs",
63
64
  "prepublishOnly": "npm run build"
64
65
  },
65
66
  "devDependencies": {