@ebarooni/capacitor-calendar 0.5.0 → 0.6.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.
Files changed (30) hide show
  1. package/README.md +9 -9
  2. package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendar.kt +50 -44
  3. package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +46 -38
  4. package/dist/esm/definitions.d.ts +6 -6
  5. package/dist/esm/definitions.js.map +1 -1
  6. package/dist/esm/index.js +1 -1
  7. package/dist/esm/index.js.map +1 -1
  8. package/dist/esm/schemas/enums/calendar-chooser-display-style.js.map +1 -1
  9. package/dist/esm/schemas/enums/calendar-chooser-selection-style.js.map +1 -1
  10. package/dist/esm/schemas/enums/plugin-permission.js.map +1 -1
  11. package/dist/esm/schemas/enums/reminder-recurrence-frequency.js.map +1 -1
  12. package/dist/esm/schemas/interfaces/calendar.js.map +1 -1
  13. package/dist/esm/schemas/interfaces/plugin-permissions-map.js.map +1 -1
  14. package/dist/esm/schemas/interfaces/reminder-recurrence-rule.d.ts +1 -1
  15. package/dist/esm/schemas/interfaces/reminder-recurrence-rule.js.map +1 -1
  16. package/dist/esm/schemas/interfaces/reminders-list.js.map +1 -1
  17. package/dist/esm/web.d.ts +3 -3
  18. package/dist/esm/web.js +1 -0
  19. package/dist/esm/web.js.map +1 -1
  20. package/dist/plugin.cjs.js +2 -1
  21. package/dist/plugin.cjs.js.map +1 -1
  22. package/dist/plugin.js +2 -1
  23. package/dist/plugin.js.map +1 -1
  24. package/ios/Plugin/CapacitorCalendar.swift +50 -45
  25. package/ios/Plugin/CapacitorCalendarPlugin.swift +79 -64
  26. package/ios/Plugin/CapacitorReminders.swift +90 -57
  27. package/ios/Plugin/EventCreationParameters.swift +18 -0
  28. package/ios/Plugin/RecurrenceParameters.swift +15 -0
  29. package/ios/Plugin/ReminderCreationParameters.swift +23 -0
  30. package/package.json +30 -20
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.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 * @enum\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 * @enum\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","export var PluginPermission;\n(function (PluginPermission) {\n /**\n * Represents the permission state for reading calendar.\n * @platform iOS, Android\n */\n PluginPermission[\"READ_CALENDAR\"] = \"readCalendar\";\n /**\n * Represents the permission state for writing calendar.\n * @platform iOS, Android\n */\n PluginPermission[\"WRITE_CALENDAR\"] = \"writeCalendar\";\n /**\n * Represents the permission state for reading reminders.\n * @platform iOS\n */\n PluginPermission[\"READ_REMINDERS\"] = \"readReminders\";\n /**\n * Represents the permission state for writing reminders.\n * @platform iOS\n */\n PluginPermission[\"WRITE_REMINDERS\"] = \"writeReminders\";\n})(PluginPermission || (PluginPermission = {}));\n//# sourceMappingURL=plugin-permission.js.map","export var ReminderRecurrenceFrequency;\n(function (ReminderRecurrenceFrequency) {\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"DAILY\"] = 0] = \"DAILY\";\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"WEEKLY\"] = 1] = \"WEEKLY\";\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"MONTHLY\"] = 2] = \"MONTHLY\";\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","import { 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() {\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}\n//# sourceMappingURL=web.js.map"],"names":["CalendarChooserDisplayStyle","CalendarChooserSelectionStyle","PluginPermission","ReminderRecurrenceFrequency","registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACWA,6CAA4B;AACvC,CAAC,UAAU,2BAA2B,EAAE;AACxC;AACA;AACA;AACA,IAAI,2BAA2B,CAAC,2BAA2B,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,eAAe,CAAC;AACpG;AACA;AACA;AACA,IAAI,2BAA2B,CAAC,2BAA2B,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC,GAAG,yBAAyB,CAAC;AACxH,CAAC,EAAEA,mCAA2B,KAAKA,mCAA2B,GAAG,EAAE,CAAC,CAAC;;ACfrE;AACA;AACA;AACA;AACA;AACWC,+CAA8B;AACzC,CAAC,UAAU,6BAA6B,EAAE;AAC1C;AACA;AACA;AACA,IAAI,6BAA6B,CAAC,6BAA6B,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;AAC1F;AACA;AACA;AACA,IAAI,6BAA6B,CAAC,6BAA6B,CAAC,UAAU,CAAC,GAA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AC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;AAClG,KAAK;AACL,IAAI,WAAW,CAAC,QAAQ,EAAE;AAC1B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;AAC3F,KAAK;AACL,IAAI,cAAc,CAAC,QAAQ,EAAE;AAC7B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;AAC9F,KAAK;AACL,IAAI,uBAAuB,GAAG;AAC9B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;AAC9F,KAAK;AACL,IAAI,iBAAiB,GAAG;AACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;AAC9F,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.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 * @enum\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 * @enum\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","export var PluginPermission;\n(function (PluginPermission) {\n /**\n * Represents the permission state for reading calendar.\n * @platform iOS, Android\n */\n PluginPermission[\"READ_CALENDAR\"] = \"readCalendar\";\n /**\n * Represents the permission state for writing calendar.\n * @platform iOS, Android\n */\n PluginPermission[\"WRITE_CALENDAR\"] = \"writeCalendar\";\n /**\n * Represents the permission state for reading reminders.\n * @platform iOS\n */\n PluginPermission[\"READ_REMINDERS\"] = \"readReminders\";\n /**\n * Represents the permission state for writing reminders.\n * @platform iOS\n */\n PluginPermission[\"WRITE_REMINDERS\"] = \"writeReminders\";\n})(PluginPermission || (PluginPermission = {}));\n//# sourceMappingURL=plugin-permission.js.map","export var ReminderRecurrenceFrequency;\n(function (ReminderRecurrenceFrequency) {\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"DAILY\"] = 0] = \"DAILY\";\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"WEEKLY\"] = 1] = \"WEEKLY\";\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"MONTHLY\"] = 2] = \"MONTHLY\";\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() {\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}\n//# sourceMappingURL=web.js.map"],"names":["CalendarChooserDisplayStyle","CalendarChooserSelectionStyle","PluginPermission","ReminderRecurrenceFrequency","registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACWA,6CAA4B;AACvC,CAAC,UAAU,2BAA2B,EAAE;AACxC;AACA;AACA;AACA,IAAI,2BAA2B,CAAC,2BAA2B,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,eAAe,CAAC;AACpG;AACA;AACA;AACA,IAAI,2BAA2B,CAAC,2BAA2B,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC,GAAG,yBAAyB,CAAC;AACxH,CAAC,EAAEA,mCAA2B,KAAKA,mCAA2B,GAAG,EAAE,CAAC,CAAC;;ACfrE;AACA;AACA;AACA;AACA;AACWC,+CAA8B;AACzC,CAAC,UAAU,6BAA6B,EAAE;AAC1C;AACA;AACA;AACA,IAAI,6BAA6B,CAAC,6BAA6B,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;AAC1F;AACA;AACA;AACA,IAAI,6BAA6B,CAAC,6BAA6B,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;AAC9F,CAAC,EAAEA,qCAA6B,KAAKA,qCAA6B,GAAG,EAAE,CAAC,CAAC;;ACf9DC,kCAAiB;AAC5B,CAAC,UAAU,gBAAgB,EAAE;AAC7B;AACA;AACA;AACA;AACA,IAAI,gBAAgB,CAAC,eAAe,CAAC,GAAG,cAAc,CAAC;AACvD;AACA;AACA;AACA;AACA,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,eAAe,CAAC;AACzD;AACA;AACA;AACA;AACA,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,eAAe,CAAC;AACzD;AACA;AACA;AACA;AACA,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,gBAAgB,CAAC;AAC3D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CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;AAC9F,KAAK;AACL,IAAI,iBAAiB,GAAG;AACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;AAC9F,KAAK;AACL;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -68,9 +68,10 @@ var capacitorCapacitorCalendar = (function (exports, core) {
68
68
  })(exports.ReminderRecurrenceFrequency || (exports.ReminderRecurrenceFrequency = {}));
69
69
 
70
70
  const CapacitorCalendar = core.registerPlugin('CapacitorCalendar', {
71
- web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CapacitorCalendarWeb()),
71
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorCalendarWeb()),
72
72
  });
73
73
 
74
+ /* eslint-disable @typescript-eslint/no-unused-vars */
74
75
  class CapacitorCalendarWeb extends core.WebPlugin {
75
76
  checkPermission(_options) {
76
77
  throw this.unimplemented(`${this.checkPermission.name} is not implemented on the web`);
@@ -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 * @enum\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 * @enum\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","export var PluginPermission;\n(function (PluginPermission) {\n /**\n * Represents the permission state for reading calendar.\n * @platform iOS, Android\n */\n PluginPermission[\"READ_CALENDAR\"] = \"readCalendar\";\n /**\n * Represents the permission state for writing calendar.\n * @platform iOS, Android\n */\n PluginPermission[\"WRITE_CALENDAR\"] = \"writeCalendar\";\n /**\n * Represents the permission state for reading reminders.\n * @platform iOS\n */\n PluginPermission[\"READ_REMINDERS\"] = \"readReminders\";\n /**\n * Represents the permission state for writing reminders.\n * @platform iOS\n */\n PluginPermission[\"WRITE_REMINDERS\"] = \"writeReminders\";\n})(PluginPermission || (PluginPermission = {}));\n//# sourceMappingURL=plugin-permission.js.map","export var ReminderRecurrenceFrequency;\n(function (ReminderRecurrenceFrequency) {\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"DAILY\"] = 0] = \"DAILY\";\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"WEEKLY\"] = 1] = \"WEEKLY\";\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"MONTHLY\"] = 2] = \"MONTHLY\";\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","import { 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() {\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}\n//# sourceMappingURL=web.js.map"],"names":["CalendarChooserDisplayStyle","CalendarChooserSelectionStyle","PluginPermission","ReminderRecurrenceFrequency","registerPlugin","WebPlugin"],"mappings":";;;IAAA;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;;ICfrE;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;;ACf9DC,sCAAiB;IAC5B,CAAC,UAAU,gBAAgB,EAAE;IAC7B;IACA;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,eAAe,CAAC,GAAG,cAAc,CAAC;IACvD;IACA;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,eAAe,CAAC;IACzD;IACA;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,eAAe,CAAC;IACzD;IACA;IACA;IACA;IACA,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,gBAAgB,CAAC;IAC3D,CAAC,EAAEA,wBAAgB,KAAKA,wBAAgB,GAA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B,CAAC,CAAC,CAAC;IAC9F,KAAK;IACL,IAAI,iBAAiB,GAAG;IACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAC9F,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 * @enum\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 * @enum\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","export var PluginPermission;\n(function (PluginPermission) {\n /**\n * Represents the permission state for reading calendar.\n * @platform iOS, Android\n */\n PluginPermission[\"READ_CALENDAR\"] = \"readCalendar\";\n /**\n * Represents the permission state for writing calendar.\n * @platform iOS, Android\n */\n PluginPermission[\"WRITE_CALENDAR\"] = \"writeCalendar\";\n /**\n * Represents the permission state for reading reminders.\n * @platform iOS\n */\n PluginPermission[\"READ_REMINDERS\"] = \"readReminders\";\n /**\n * Represents the permission state for writing reminders.\n * @platform iOS\n */\n PluginPermission[\"WRITE_REMINDERS\"] = \"writeReminders\";\n})(PluginPermission || (PluginPermission = {}));\n//# sourceMappingURL=plugin-permission.js.map","export var ReminderRecurrenceFrequency;\n(function (ReminderRecurrenceFrequency) {\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"DAILY\"] = 0] = \"DAILY\";\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"WEEKLY\"] = 1] = \"WEEKLY\";\n ReminderRecurrenceFrequency[ReminderRecurrenceFrequency[\"MONTHLY\"] = 2] = \"MONTHLY\";\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() {\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}\n//# sourceMappingURL=web.js.map"],"names":["CalendarChooserDisplayStyle","CalendarChooserSelectionStyle","PluginPermission","ReminderRecurrenceFrequency","registerPlugin","WebPlugin"],"mappings":";;;IAAA;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;;ICfrE;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IACL,IAAI,aAAa,GAAG;IACpB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAC7F,KAAK;IACL,IAAI,kBAAkB,GAAG;IACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAClG,KAAK;IACL,IAAI,WAAW,CAAC,QAAQ,EAAE;IAC1B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAC3F,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,uBAAuB,GAAG;IAC9B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAC9F,KAAK;IACL,IAAI,iBAAiB,GAAG;IACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAC9F,KAAK;IACL;;;;;;;;;;;;;;;"}
@@ -2,25 +2,24 @@ import Foundation
2
2
  import Capacitor
3
3
  import EventKitUI
4
4
 
5
-
6
5
  public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarChooserDelegate {
7
6
  private let bridge: (any CAPBridgeProtocol)?
8
7
  private let eventStore: EKEventStore
9
8
  private var currentCreateEventContinuation: CheckedContinuation<Bool, any Error>?
10
- private var currentSelectCalendarsContinuation: CheckedContinuation<[[String : String]], any Error>?
11
-
9
+ private var currentSelectCalendarsContinuation: CheckedContinuation<[[String: String]], any Error>?
10
+
12
11
  init(bridge: (any CAPBridgeProtocol)?, eventStore: EKEventStore) {
13
12
  self.bridge = bridge
14
13
  self.eventStore = eventStore
15
14
  }
16
-
15
+
17
16
  public func createEventWithPrompt() async throws -> Bool {
18
17
  return try await withCheckedThrowingContinuation { continuation in
19
18
  guard let viewController = bridge?.viewController else {
20
19
  continuation.resume(throwing: CapacitorCalendarPluginError.viewControllerUnavailable)
21
20
  return
22
21
  }
23
-
22
+
24
23
  Task { @MainActor in
25
24
  let eventEditViewController = EKEventEditViewController()
26
25
  eventEditViewController.eventStore = eventStore
@@ -30,82 +29,88 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
30
29
  }
31
30
  }
32
31
  }
33
-
32
+
34
33
  public func selectCalendarsWithPrompt(selectionStyle: Int, displayStyle: Int) async throws -> [[String: String]] {
35
34
  return try await withCheckedThrowingContinuation { continuation in
36
35
  guard let viewController = bridge?.viewController else {
37
36
  continuation.resume(throwing: CapacitorCalendarPluginError.viewControllerUnavailable)
38
37
  return
39
38
  }
40
-
39
+
41
40
  Task { @MainActor in
42
- let calendarChooser = EKCalendarChooser(
43
- selectionStyle: EKCalendarChooserSelectionStyle(rawValue: selectionStyle)!,
44
- displayStyle: EKCalendarChooserDisplayStyle(rawValue: displayStyle)!,
45
- eventStore: eventStore
46
- )
47
- calendarChooser.showsDoneButton = true
48
- calendarChooser.showsCancelButton = true
49
- viewController.present(
50
- UINavigationController(rootViewController: calendarChooser),
51
- animated: true,
52
- completion: nil
53
- )
54
- calendarChooser.delegate = self
55
- currentSelectCalendarsContinuation = continuation
41
+ if let selectionStyle = EKCalendarChooserSelectionStyle(rawValue: selectionStyle),
42
+ let displayStyle = EKCalendarChooserDisplayStyle(rawValue: displayStyle) {
43
+ let calendarChooser = EKCalendarChooser(
44
+ selectionStyle: selectionStyle,
45
+ displayStyle: displayStyle,
46
+ eventStore: eventStore
47
+ )
48
+ calendarChooser.showsDoneButton = true
49
+ calendarChooser.showsCancelButton = true
50
+ viewController.present(
51
+ UINavigationController(rootViewController: calendarChooser),
52
+ animated: true,
53
+ completion: nil
54
+ )
55
+ calendarChooser.delegate = self
56
+ currentSelectCalendarsContinuation = continuation
57
+ } else {
58
+ continuation.resume(throwing: CapacitorCalendarPluginError.viewControllerUnavailable)
59
+ return
60
+ }
56
61
  }
57
62
  }
58
63
  }
59
-
64
+
60
65
  public func listCalendars() -> [[String: String]] {
61
66
  return convertEKCalendarsToDictionaries(calendars: Set(eventStore.calendars(for: .event)))
62
67
  }
63
-
68
+
64
69
  public func getDefaultCalendar() throws -> [String: String] {
65
70
  let defaultCalendar = eventStore.defaultCalendarForNewEvents
66
- if (defaultCalendar != nil) {
71
+ if let defaultCalendar = defaultCalendar {
67
72
  return [
68
- "id": defaultCalendar!.calendarIdentifier,
69
- "title": defaultCalendar!.title
73
+ "id": defaultCalendar.calendarIdentifier,
74
+ "title": defaultCalendar.title
70
75
  ]
71
76
  } else {
72
77
  throw CapacitorCalendarPluginError.noDefaultCalendar
73
78
  }
74
79
  }
75
-
76
- public func createEvent(title: String, calendarId: String?, location: String?, startDate: Date?, endDate: Date?, isAllDay: Bool?) throws -> Void {
80
+
81
+ public func createEvent(with parameters: EventCreationParameters) throws {
77
82
  let fallbackStartDate = Date()
78
83
  let newEvent = EKEvent(eventStore: eventStore)
79
- if let calendarId = calendarId, let calendar = eventStore.calendar(withIdentifier: calendarId) {
84
+ if let calendarId = parameters.calendarId, let calendar = eventStore.calendar(withIdentifier: calendarId) {
80
85
  newEvent.calendar = calendar
81
86
  } else {
82
87
  newEvent.calendar = eventStore.defaultCalendarForNewEvents
83
88
  }
84
- newEvent.title = title
85
- if let location = location {
89
+ newEvent.title = parameters.title
90
+ if let location = parameters.location {
86
91
  newEvent.location = location
87
92
  }
88
- if let startDate = startDate {
93
+ if let startDate = parameters.startDate {
89
94
  newEvent.startDate = startDate
90
95
  } else {
91
96
  newEvent.startDate = fallbackStartDate
92
97
  }
93
- if let endDate = endDate {
98
+ if let endDate = parameters.endDate {
94
99
  newEvent.endDate = endDate
95
100
  } else {
96
101
  newEvent.endDate = fallbackStartDate.addingTimeInterval(3600)
97
102
  }
98
- if let isAllDay = isAllDay {
103
+ if let isAllDay = parameters.isAllDay {
99
104
  newEvent.isAllDay = isAllDay
100
105
  }
101
-
106
+
102
107
  do {
103
108
  try eventStore.save(newEvent, span: .thisEvent)
104
109
  } catch {
105
110
  throw CapacitorCalendarPluginError.unknownActionEventCreationPrompt
106
111
  }
107
112
  }
108
-
113
+
109
114
  public func checkAllPermissions() async throws -> [String: String] {
110
115
  return try await withCheckedThrowingContinuation { continuation in
111
116
  var permissionsState: [String: String]
@@ -137,7 +142,7 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
137
142
  continuation.resume(returning: permissionsState)
138
143
  }
139
144
  }
140
-
145
+
141
146
  public func requestWriteAccessToEvents() async throws -> [String: String] {
142
147
  return try await withCheckedThrowingContinuation { continuation in
143
148
  if #available(iOS 17.0, *) {
@@ -146,7 +151,7 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
146
151
  continuation.resume(throwing: CapacitorCalendarPluginError.eventStoreAuthorization)
147
152
  return
148
153
  }
149
-
154
+
150
155
  var permissionState: String
151
156
  if granted {
152
157
  permissionState = PermissionState.granted.rawValue
@@ -161,7 +166,7 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
161
166
  continuation.resume(throwing: CapacitorCalendarPluginError.eventStoreAuthorization)
162
167
  return
163
168
  }
164
-
169
+
165
170
  var permissionState: String
166
171
  if granted {
167
172
  permissionState = PermissionState.granted.rawValue
@@ -173,7 +178,7 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
173
178
  }
174
179
  }
175
180
  }
176
-
181
+
177
182
  public func requestFullAccessToEvents() async throws -> String {
178
183
  return try await withCheckedThrowingContinuation { continuation in
179
184
  if #available(iOS 17.0, *) {
@@ -182,7 +187,7 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
182
187
  continuation.resume(throwing: CapacitorCalendarPluginError.eventStoreAuthorization)
183
188
  return
184
189
  }
185
-
190
+
186
191
  var permissionState: String
187
192
  if granted {
188
193
  permissionState = PermissionState.granted.rawValue
@@ -197,7 +202,7 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
197
202
  continuation.resume(throwing: CapacitorCalendarPluginError.eventStoreAuthorization)
198
203
  return
199
204
  }
200
-
205
+
201
206
  var permissionState: String
202
207
  if granted {
203
208
  permissionState = PermissionState.granted.rawValue
@@ -209,7 +214,7 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
209
214
  }
210
215
  }
211
216
  }
212
-
217
+
213
218
  public func eventEditViewController(
214
219
  _ controller: EKEventEditViewController,
215
220
  didCompleteWith action: EKEventEditViewAction
@@ -224,7 +229,7 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
224
229
  }
225
230
  }
226
231
  }
227
-
232
+
228
233
  public func calendarChooserDidFinish(_ calendarChooser: EKCalendarChooser) {
229
234
  let selectedCalendars = convertEKCalendarsToDictionaries(calendars: calendarChooser.selectedCalendars)
230
235
  bridge?.viewController?.dismiss(animated: true) {
@@ -237,7 +242,7 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
237
242
  self.currentSelectCalendarsContinuation?.resume(throwing: CapacitorCalendarPluginError.canceledCalendarsSelectionPrompt)
238
243
  }
239
244
  }
240
-
245
+
241
246
  private func convertEKCalendarsToDictionaries(calendars: Set<EKCalendar>) -> [[String: String]] {
242
247
  var result: [[String: String]] = []
243
248
 
@@ -11,39 +11,45 @@ public class CapacitorCalendarPlugin: CAPPlugin {
11
11
  private let eventStore = EKEventStore()
12
12
  private lazy var calendar = CapacitorCalendar(bridge: self.bridge, eventStore: self.eventStore)
13
13
  private lazy var reminders = CapacitorReminders(eventStore: self.eventStore)
14
-
14
+
15
15
  @objc public func checkPermission(_ call: CAPPluginCall) {
16
16
  guard let alias = call.getString("alias") else {
17
17
  call.reject("[CapacitorCalendar.\(#function)] Permission name is not defined")
18
18
  return
19
19
  }
20
-
20
+
21
21
  Task {
22
22
  do {
23
- switch alias {
24
- case "readCalendar":
25
- let permissionsState = try await calendar.checkAllPermissions()
26
- call.resolve(["result": permissionsState["readCalendar"]!])
27
- case "writeCalendar":
28
- let permissionsState = try await calendar.checkAllPermissions()
29
- call.resolve(["result": permissionsState["writeCalendar"]!])
30
- case "readReminders":
31
- let permissionsState = try await reminders.checkAllPermissions()
32
- call.resolve(["result": permissionsState["readReminders"]!])
33
- case "writeReminders":
34
- let permissionsState = try await reminders.checkAllPermissions()
35
- call.resolve(["result": permissionsState["writeReminders"]!])
36
- default:
37
- call.reject("[CapacitorCalendar.\(#function)] Could not determine the status of the requested permission")
38
- return
39
- }
23
+ try await handlePermissionCheck(for: alias, with: call)
40
24
  } catch {
41
25
  call.reject("[CapacitorCalendar.\(#function)] Could not determine the status of the requested permission")
42
- return
43
26
  }
44
27
  }
45
28
  }
46
-
29
+
30
+ private func handlePermissionCheck(for alias: String, with call: CAPPluginCall) async throws {
31
+ let permissionsState: [String: String]
32
+
33
+ switch alias {
34
+ case "readCalendar":
35
+ permissionsState = try await calendar.checkAllPermissions()
36
+ case "writeCalendar":
37
+ permissionsState = try await calendar.checkAllPermissions()
38
+ case "readReminders":
39
+ permissionsState = try await reminders.checkAllPermissions()
40
+ case "writeReminders":
41
+ permissionsState = try await reminders.checkAllPermissions()
42
+ default:
43
+ throw CapacitorCalendarPluginError.unknownPermissionStatus
44
+ }
45
+
46
+ guard let permissionResult = permissionsState[alias] else {
47
+ throw CapacitorCalendarPluginError.unknownPermissionStatus
48
+ }
49
+
50
+ call.resolve(["result": permissionResult])
51
+ }
52
+
47
53
  @objc public func checkAllPermissions(_ call: CAPPluginCall) {
48
54
  Task {
49
55
  do {
@@ -56,13 +62,13 @@ public class CapacitorCalendarPlugin: CAPPlugin {
56
62
  }
57
63
  }
58
64
  }
59
-
65
+
60
66
  @objc public func requestPermission(_ call: CAPPluginCall) {
61
67
  guard let alias = call.getString("alias") else {
62
68
  call.reject("[CapacitorCalendar.\(#function)] Permission name is not defined")
63
69
  return
64
70
  }
65
-
71
+
66
72
  Task {
67
73
  do {
68
74
  switch alias {
@@ -88,7 +94,7 @@ public class CapacitorCalendarPlugin: CAPPlugin {
88
94
  }
89
95
  }
90
96
  }
91
-
97
+
92
98
  @objc public func requestAllPermissions(_ call: CAPPluginCall) {
93
99
  Task {
94
100
  do {
@@ -107,7 +113,7 @@ public class CapacitorCalendarPlugin: CAPPlugin {
107
113
  if remindersResult == PermissionState.granted.rawValue {
108
114
  result["readReminders"] = PermissionState.granted.rawValue
109
115
  result["writeReminders"] = PermissionState.granted.rawValue
110
-
116
+
111
117
  }
112
118
  call.resolve(result)
113
119
  } catch {
@@ -116,7 +122,7 @@ public class CapacitorCalendarPlugin: CAPPlugin {
116
122
  }
117
123
  }
118
124
  }
119
-
125
+
120
126
  @objc public func createEventWithPrompt(_ call: CAPPluginCall) {
121
127
  Task {
122
128
  do {
@@ -128,7 +134,7 @@ public class CapacitorCalendarPlugin: CAPPlugin {
128
134
  }
129
135
  }
130
136
  }
131
-
137
+
132
138
  @objc public func selectCalendarsWithPrompt(_ call: CAPPluginCall) {
133
139
  guard let selectionStyle = call.getInt("selectionStyle") else {
134
140
  call.reject("[CapacitorCalendar.\(#function)] Selection style was not provided")
@@ -138,7 +144,7 @@ public class CapacitorCalendarPlugin: CAPPlugin {
138
144
  call.reject("[CapacitorCalendar.\(#function)] Display style was not provided")
139
145
  return
140
146
  }
141
-
147
+
142
148
  Task {
143
149
  do {
144
150
  let result = try await calendar.selectCalendarsWithPrompt(selectionStyle: selectionStyle, displayStyle: displayStyle)
@@ -149,11 +155,11 @@ public class CapacitorCalendarPlugin: CAPPlugin {
149
155
  }
150
156
  }
151
157
  }
152
-
158
+
153
159
  @objc public func listCalendars(_ call: CAPPluginCall) {
154
160
  call.resolve(["result": calendar.listCalendars()])
155
161
  }
156
-
162
+
157
163
  @objc public func getDefaultCalendar(_ call: CAPPluginCall) {
158
164
  do {
159
165
  try call.resolve(["result": calendar.getDefaultCalendar()])
@@ -162,7 +168,7 @@ public class CapacitorCalendarPlugin: CAPPlugin {
162
168
  return
163
169
  }
164
170
  }
165
-
171
+
166
172
  @objc public func createEvent(_ call: CAPPluginCall) {
167
173
  guard let title = call.getString("title") else {
168
174
  call.reject("[CapacitorCalendar.\(#function)] A title for the event was not provided")
@@ -173,23 +179,25 @@ public class CapacitorCalendarPlugin: CAPPlugin {
173
179
  let endDate = call.getDate("endDate")
174
180
  let isAllDay = call.getBool("isAllDay")
175
181
  let calendarId = call.getString("calendarId")
176
-
182
+
183
+ let eventParameters = EventCreationParameters(
184
+ title: title,
185
+ calendarId: calendarId,
186
+ location: location,
187
+ startDate: startDate,
188
+ endDate: endDate,
189
+ isAllDay: isAllDay
190
+ )
191
+
177
192
  do {
178
- try calendar.createEvent(
179
- title: title,
180
- calendarId: calendarId,
181
- location: location,
182
- startDate: startDate,
183
- endDate: endDate,
184
- isAllDay: isAllDay
185
- )
193
+ try calendar.createEvent(with: eventParameters)
186
194
  call.resolve(["eventCreated": true])
187
195
  } catch {
188
196
  call.reject("[CapacitorCalendar.\(#function)] Unable to create event")
189
197
  return
190
198
  }
191
199
  }
192
-
200
+
193
201
  @objc public func getDefaultRemindersList(_ call: CAPPluginCall) {
194
202
  do {
195
203
  try call.resolve(["result": reminders.getDefaultRemindersList()])
@@ -198,11 +206,11 @@ public class CapacitorCalendarPlugin: CAPPlugin {
198
206
  return
199
207
  }
200
208
  }
201
-
209
+
202
210
  @objc public func getRemindersLists(_ call: CAPPluginCall) {
203
211
  call.resolve(["result": reminders.getRemindersLists()])
204
212
  }
205
-
213
+
206
214
  @objc public func createReminder (_ call: CAPPluginCall) {
207
215
  guard let title = call.getString("title") else {
208
216
  call.reject("[CapacitorCalendar.\(#function)] A title for the reminder was not provided")
@@ -217,33 +225,40 @@ public class CapacitorCalendarPlugin: CAPPlugin {
217
225
  let notes = call.getString("notes")
218
226
  let url = call.getString("url")
219
227
  let location = call.getString("location")
220
- var frequency: Int? = nil
221
- var interval: Int? = nil
222
- var end: Double? = nil
223
- if let recurrence = call.getObject("recurrence") {
224
- if let repFrequency = recurrence["frequency"] as? Int? {
225
- frequency = repFrequency
226
- } else {
227
- call.reject("[CapacitorCalendar.\(#function)] Frequency must me provided when using recurrence")
228
+
229
+ var recurrence: RecurrenceParameters?
230
+ if let recurrenceData = call.getObject("recurrence") {
231
+ guard let frequency = recurrenceData["frequency"] as? Int else {
232
+ call.reject("[CapacitorCalendar.\(#function)] Frequency must be provided when using recurrence")
228
233
  return
229
234
  }
230
- if let repInterval = recurrence["interval"] as? Int {
231
- if (repInterval < 1) {
232
- call.reject("[CapacitorCalendar.\(#function)] Interval must be greater than 0")
233
- return
234
- }
235
- interval = repInterval
236
- } else {
237
- call.reject("[CapacitorCalendar.\(#function)] Interval must me provided when using recurrence")
235
+
236
+ guard let interval = recurrenceData["interval"] as? Int, interval > 0 else {
237
+ call.reject("[CapacitorCalendar.\(#function)] Interval must be greater than 0 when using recurrence")
238
238
  return
239
239
  }
240
- if let repEnd = recurrence["end"] as? Double {
241
- end = repEnd
242
- }
240
+
241
+ let end = recurrenceData["end"] as? Double
242
+
243
+ recurrence = RecurrenceParameters(frequency: frequency, interval: interval, end: end)
243
244
  }
244
-
245
+
246
+ let reminderParams = ReminderCreationParameters(
247
+ title: title,
248
+ listId: listId,
249
+ priority: priority,
250
+ isCompleted: isCompleted,
251
+ startDate: startDate,
252
+ dueDate: dueDate,
253
+ completionDate: completionDate,
254
+ notes: notes,
255
+ url: url,
256
+ location: location,
257
+ recurrence: recurrence
258
+ )
259
+
245
260
  do {
246
- try reminders.createReminder(title: title, listId: listId, priority: priority, isCompleted: isCompleted, startDate: startDate, dueDate: dueDate, completionDate: completionDate, notes: notes, url: url, location: location, frequency: frequency, interval: interval, end: end)
261
+ try reminders.createReminder(with: reminderParams)
247
262
  call.resolve(["reminderCreated": true])
248
263
  } catch {
249
264
  call.reject("[CapacitorCalendar.\(#function)] Unable to create reminder")