@ebarooni/capacitor-calendar 7.2.0 → 8.0.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.
- package/EbarooniCapacitorCalendar.podspec +2 -2
- package/Package.swift +4 -4
- package/README.md +176 -162
- package/android/build.gradle +20 -18
- package/android/src/main/java/dev/barooni/capacitor/calendar/implementation/CapacitorCalendar.kt +90 -61
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/data/EventRecurrenceRule.kt +135 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CreateEventInput.kt +1 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CreateEventWithPromptInput.kt +5 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ModifyEvent.kt +2 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ModifyEventWithPromptInput.kt +3 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/utils/ImplementationHelper.kt +48 -4
- package/dist/docs.json +584 -324
- package/dist/esm/definitions.d.ts +5 -5
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +46 -46
- package/dist/esm/index.js +16 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/schemas/enums/attendee-role.js.map +1 -1
- package/dist/esm/schemas/enums/attendee-status.js.map +1 -1
- package/dist/esm/schemas/enums/attendee-type.js.map +1 -1
- package/dist/esm/schemas/enums/calendar-permission-scope.js.map +1 -1
- package/dist/esm/schemas/enums/event-status.js.map +1 -1
- package/dist/esm/schemas/interfaces/calendar-event.d.ts +7 -5
- package/dist/esm/schemas/interfaces/calendar-event.js.map +1 -1
- package/dist/esm/schemas/interfaces/calendar-source.d.ts +1 -1
- package/dist/esm/schemas/interfaces/calendar-source.js.map +1 -1
- package/dist/esm/schemas/interfaces/calendar.d.ts +2 -2
- package/dist/esm/schemas/interfaces/calendar.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-event-options.d.ts +63 -46
- package/dist/esm/schemas/interfaces/create-event-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-event-with-prompt-options.d.ts +42 -31
- package/dist/esm/schemas/interfaces/create-event-with-prompt-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-reminder-options.d.ts +10 -1
- package/dist/esm/schemas/interfaces/create-reminder-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/delete-event-options.d.ts +1 -1
- package/dist/esm/schemas/interfaces/delete-event-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/delete-event-with-prompt-options.d.ts +1 -1
- package/dist/esm/schemas/interfaces/delete-event-with-prompt-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/delete-events-by-id-options.d.ts +1 -1
- package/dist/esm/schemas/interfaces/delete-events-by-id-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/event-recurrence-rule.d.ts +96 -0
- package/dist/esm/schemas/interfaces/event-recurrence-rule.js +2 -0
- package/dist/esm/schemas/interfaces/event-recurrence-rule.js.map +1 -0
- package/dist/esm/schemas/interfaces/modify-event-options.d.ts +61 -44
- package/dist/esm/schemas/interfaces/modify-event-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/modify-event-with-prompt-options.d.ts +1 -1
- package/dist/esm/schemas/interfaces/modify-event-with-prompt-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/modify-reminder-options.d.ts +12 -1
- package/dist/esm/schemas/interfaces/modify-reminder-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/recurrence-rule.d.ts +1 -1
- package/dist/esm/schemas/interfaces/recurrence-rule.js.map +1 -1
- package/dist/esm/schemas/interfaces/reminder-recurrence-rule.d.ts +1 -1
- package/dist/esm/schemas/interfaces/reminder-recurrence-rule.js.map +1 -1
- package/dist/esm/schemas/interfaces/reminder.d.ts +1 -1
- package/dist/esm/schemas/interfaces/reminder.js.map +1 -1
- package/dist/esm/schemas/interfaces/reminders-list.d.ts +2 -2
- package/dist/esm/schemas/interfaces/reminders-list.js.map +1 -1
- package/dist/esm/schemas/interfaces/select-calendars-with-prompt-options.d.ts +1 -1
- package/dist/esm/schemas/interfaces/select-calendars-with-prompt-options.js.map +1 -1
- package/dist/esm/schemas/types/event-edit-action.d.ts +1 -1
- package/dist/esm/schemas/types/event-edit-action.js.map +1 -1
- package/dist/esm/schemas/types/recurrence-frequency.d.ts +4 -0
- package/dist/esm/schemas/types/recurrence-frequency.js +2 -0
- package/dist/esm/schemas/types/recurrence-frequency.js.map +1 -0
- package/dist/esm/sub-definitions/calendar-access.d.ts +4 -4
- package/dist/esm/sub-definitions/calendar-access.js.map +1 -1
- package/dist/esm/sub-definitions/calendar-operations.d.ts +7 -7
- package/dist/esm/sub-definitions/calendar-operations.js.map +1 -1
- package/dist/esm/sub-definitions/event-operations.d.ts +10 -10
- package/dist/esm/sub-definitions/event-operations.js.map +1 -1
- package/dist/esm/sub-definitions/reminders-access.d.ts +1 -1
- package/dist/esm/sub-definitions/reminders-access.js.map +1 -1
- package/dist/esm/sub-definitions/reminders-operations.d.ts +10 -10
- package/dist/esm/sub-definitions/reminders-operations.js.map +1 -1
- package/dist/esm/web.d.ts +33 -32
- package/dist/esm/web.js +1 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +1 -24
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1 -24
- package/dist/plugin.js.map +1 -1
- package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/CapacitorCalendarPlugin.swift +90 -71
- package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Implementation/CapacitorCalendar.swift +45 -63
- package/ios/Plugin/Info.plist +24 -0
- package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/CreateEventInput.swift +25 -21
- package/ios/Plugin/Models/Inputs/CreateEventWithPromptInput.swift +171 -0
- package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/CreateReminderInput.swift +2 -2
- package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ModifyEventInput.swift +63 -41
- package/ios/Plugin/Models/Structs/RecurrenceInput.swift +31 -0
- package/package.json +37 -45
- package/dist/esm/schemas/enums/recurrence-frequency.d.ts +0 -21
- package/dist/esm/schemas/enums/recurrence-frequency.js +0 -23
- package/dist/esm/schemas/enums/recurrence-frequency.js.map +0 -1
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/CreateEventWithPromptInput.swift +0 -89
- package/ios/Tests/CapacitorCalendarPluginTests/CapacitorCalendarPluginTests.swift +0 -15
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Enums/CAPPermissionState.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Enums/CalendarPermissionScope.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Enums/EventEditAction.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/CheckPermissionInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/CreateCalendarInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteCalendarInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteEventInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteEventWithPromptInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteEventsByIdInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteReminderInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteReminderWithPromptInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteRemindersByIdInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/GetReminderByIdInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/GetRemindersFromListsInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ListEventsInRangeInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ModifyCalendarInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ModifyEventWithPromptInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ModifyReminderInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/OpenCalendarInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/RequestPermissionInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/SelectCalendarsWithPromptInput.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CheckAllPermissionsResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CheckPermissionResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CreateCalendarResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CreateEventResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CreateEventWithPromptResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CreateReminderResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/DeleteEventWithPromptResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/DeleteEventsByIdResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/DeleteRemindersByIdResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/FetchAllCalendarSourcesResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/GetDefaultCalendarResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/GetReminderByIdResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/GetRemindersFromListsResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/ListCalendarsResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/ListEventsInRangeResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/ModifyEventWithPromptResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/RequestAllPermissionsResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/RequestPermissionResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/SelectCalendarsWithPromptResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Templates/JSResult.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/PluginConfig.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/PluginError.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Utils/ImplementationHelper.swift +0 -0
- /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Utils/UIColorFromHexExtension.swift +0 -0
package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Implementation/CapacitorCalendar.swift
RENAMED
|
@@ -3,12 +3,12 @@ import Combine
|
|
|
3
3
|
import EventKitUI
|
|
4
4
|
import Capacitor
|
|
5
5
|
|
|
6
|
-
class CapacitorCalendar: NSObject
|
|
7
|
-
private
|
|
6
|
+
class CapacitorCalendar: NSObject {
|
|
7
|
+
private var createEventWithPromptContinuation: CheckedContinuation<CreateEventWithPromptResult, Error>?
|
|
8
8
|
private let eventStore = EKEventStore()
|
|
9
|
-
private
|
|
10
|
-
private let
|
|
11
|
-
private
|
|
9
|
+
private var modifyEventWithPromptContinuation: CheckedContinuation<ModifyEventWithPromptResult, Error>?
|
|
10
|
+
private let plugin: CapacitorCalendarPlugin
|
|
11
|
+
private var selectCalendarsWithPromptContinuation: CheckedContinuation<SelectCalendarsWithPromptResult, Error>?
|
|
12
12
|
|
|
13
13
|
init(plugin: CapacitorCalendarPlugin) {
|
|
14
14
|
self.plugin = plugin
|
|
@@ -107,6 +107,8 @@ class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarChooserDel
|
|
|
107
107
|
event.endDate = input.getEndDate()
|
|
108
108
|
event.url = input.getUrl()
|
|
109
109
|
event.notes = input.getDescription()
|
|
110
|
+
event.recurrenceRules = input.getRecurrenceRule()
|
|
111
|
+
|
|
110
112
|
if let availability = input.getAvailability() {
|
|
111
113
|
event.availability = availability
|
|
112
114
|
}
|
|
@@ -121,7 +123,7 @@ class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarChooserDel
|
|
|
121
123
|
eventEditViewController.eventStore = eventStore
|
|
122
124
|
eventEditViewController.editViewDelegate = self
|
|
123
125
|
viewController.present(eventEditViewController, animated: true) {
|
|
124
|
-
self.
|
|
126
|
+
self.createEventWithPromptContinuation = continuation
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
}
|
|
@@ -169,7 +171,7 @@ class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarChooserDel
|
|
|
169
171
|
eventEditViewController.eventStore = eventStore
|
|
170
172
|
eventEditViewController.editViewDelegate = self
|
|
171
173
|
viewController.present(eventEditViewController, animated: true) {
|
|
172
|
-
self.
|
|
174
|
+
self.modifyEventWithPromptContinuation = continuation
|
|
173
175
|
}
|
|
174
176
|
}
|
|
175
177
|
}
|
|
@@ -186,6 +188,8 @@ class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarChooserDel
|
|
|
186
188
|
event.endDate = input.getEndDate()
|
|
187
189
|
event.url = input.getUrl()
|
|
188
190
|
event.notes = input.getDescription()
|
|
191
|
+
event.recurrenceRules = input.getRecurrenceRule()
|
|
192
|
+
|
|
189
193
|
if let availability = input.getAvailability() {
|
|
190
194
|
event.availability = availability
|
|
191
195
|
}
|
|
@@ -229,6 +233,8 @@ class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarChooserDel
|
|
|
229
233
|
if let alerts = input.getAlerts() {
|
|
230
234
|
event.alarms = alerts
|
|
231
235
|
}
|
|
236
|
+
event.recurrenceRules = input.getRecurrenceRule()
|
|
237
|
+
|
|
232
238
|
try eventStore.save(event, span: input.getSpan())
|
|
233
239
|
}
|
|
234
240
|
|
|
@@ -248,7 +254,7 @@ class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarChooserDel
|
|
|
248
254
|
calendarChooser.delegate = self
|
|
249
255
|
|
|
250
256
|
viewController.present(UINavigationController(rootViewController: calendarChooser), animated: true) {
|
|
251
|
-
self.
|
|
257
|
+
self.selectCalendarsWithPromptContinuation = continuation
|
|
252
258
|
}
|
|
253
259
|
}
|
|
254
260
|
}
|
|
@@ -503,7 +509,7 @@ class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarChooserDel
|
|
|
503
509
|
guard let viewController = plugin.bridge?.viewController else {
|
|
504
510
|
throw PluginError.viewControllerMissing
|
|
505
511
|
}
|
|
506
|
-
guard let
|
|
512
|
+
guard let _ = eventStore.calendarItem(withIdentifier: input.getId()) as? EKReminder else {
|
|
507
513
|
throw PluginError.reminderNotFound
|
|
508
514
|
}
|
|
509
515
|
|
|
@@ -527,70 +533,46 @@ class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarChooserDel
|
|
|
527
533
|
viewController.present(alert, animated: true)
|
|
528
534
|
}
|
|
529
535
|
}
|
|
536
|
+
}
|
|
530
537
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
}
|
|
537
|
-
switch action {
|
|
538
|
-
case .saved:
|
|
539
|
-
promise.resume(returning: CreateEventWithPromptResult(id: controller.event?.eventIdentifier))
|
|
540
|
-
case .canceled, .cancelled, .deleted:
|
|
541
|
-
promise.resume(returning: CreateEventWithPromptResult(id: nil))
|
|
542
|
-
@unknown default:
|
|
543
|
-
promise.resume(throwing: PluginError.processFailed)
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
controller.dismiss(animated: true) {
|
|
547
|
-
createEventWithPromptCancellable?.cancel()
|
|
548
|
-
}
|
|
538
|
+
extension CapacitorCalendar: EKCalendarChooserDelegate {
|
|
539
|
+
func calendarChooserDidFinish(_ calendarChooser: EKCalendarChooser) {
|
|
540
|
+
selectCalendarsWithPromptContinuation?.resume(returning: SelectCalendarsWithPromptResult(calendarChooser.selectedCalendars))
|
|
541
|
+
self.plugin.bridge?.viewController?.dismiss(animated: true) {
|
|
542
|
+
self.selectCalendarsWithPromptContinuation = nil
|
|
549
543
|
}
|
|
544
|
+
}
|
|
550
545
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
do {
|
|
558
|
-
promise.resume(returning: try ModifyEventWithPromptResult(action: action))
|
|
559
|
-
} catch let error {
|
|
560
|
-
promise.resume(throwing: error)
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
controller.dismiss(animated: true) {
|
|
564
|
-
modifyEventWithPromptCancellable?.cancel()
|
|
565
|
-
}
|
|
546
|
+
func calendarChooserDidCancel(_ calendarChooser: EKCalendarChooser) {
|
|
547
|
+
selectCalendarsWithPromptContinuation?.resume(returning: SelectCalendarsWithPromptResult(calendarChooser.selectedCalendars))
|
|
548
|
+
self.plugin.bridge?.viewController?.dismiss(animated: true) {
|
|
549
|
+
self.selectCalendarsWithPromptContinuation = nil
|
|
566
550
|
}
|
|
567
551
|
}
|
|
552
|
+
}
|
|
568
553
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
guard let promise = promise else {
|
|
573
|
-
return
|
|
574
|
-
}
|
|
554
|
+
extension CapacitorCalendar: EKEventEditViewDelegate {
|
|
555
|
+
func eventEditViewController(_ controller: EKEventEditViewController, didCompleteWith action: EKEventEditViewAction) {
|
|
556
|
+
let identifier = controller.event?.eventIdentifier
|
|
575
557
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
558
|
+
switch action {
|
|
559
|
+
case .saved:
|
|
560
|
+
createEventWithPromptContinuation?.resume(returning: CreateEventWithPromptResult(id: identifier))
|
|
561
|
+
case .canceled, .cancelled, .deleted:
|
|
562
|
+
createEventWithPromptContinuation?.resume(returning: CreateEventWithPromptResult(id: identifier))
|
|
563
|
+
@unknown default:
|
|
564
|
+
createEventWithPromptContinuation?.resume(throwing: PluginError.processFailed)
|
|
580
565
|
}
|
|
581
|
-
}
|
|
582
566
|
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
}
|
|
567
|
+
do {
|
|
568
|
+
modifyEventWithPromptContinuation?.resume(returning: try ModifyEventWithPromptResult(action: action))
|
|
569
|
+
} catch let error {
|
|
570
|
+
modifyEventWithPromptContinuation?.resume(throwing: error)
|
|
571
|
+
}
|
|
589
572
|
|
|
590
|
-
|
|
591
|
-
self.
|
|
592
|
-
|
|
593
|
-
}
|
|
573
|
+
controller.dismiss(animated: true) {
|
|
574
|
+
self.createEventWithPromptContinuation = nil
|
|
575
|
+
self.modifyEventWithPromptContinuation = nil
|
|
594
576
|
}
|
|
595
577
|
}
|
|
596
578
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
|
+
<key>CFBundleExecutable</key>
|
|
8
|
+
<string>$(EXECUTABLE_NAME)</string>
|
|
9
|
+
<key>CFBundleIdentifier</key>
|
|
10
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
12
|
+
<string>6.0</string>
|
|
13
|
+
<key>CFBundleName</key>
|
|
14
|
+
<string>$(PRODUCT_NAME)</string>
|
|
15
|
+
<key>CFBundlePackageType</key>
|
|
16
|
+
<string>FMWK</string>
|
|
17
|
+
<key>CFBundleShortVersionString</key>
|
|
18
|
+
<string>1.0</string>
|
|
19
|
+
<key>CFBundleVersion</key>
|
|
20
|
+
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
21
|
+
<key>NSPrincipalClass</key>
|
|
22
|
+
<string></string>
|
|
23
|
+
</dict>
|
|
24
|
+
</plist>
|
|
@@ -7,55 +7,59 @@ struct CreateEventInput {
|
|
|
7
7
|
private let commit: Bool
|
|
8
8
|
|
|
9
9
|
init(call: CAPPluginCall) throws {
|
|
10
|
+
self.commit = call.getBool("commit", true)
|
|
10
11
|
self.input = CreateEventWithPromptInput(call: call)
|
|
11
12
|
guard let title = call.getString("title") else {
|
|
12
13
|
throw PluginError.titleMissing
|
|
13
14
|
}
|
|
14
15
|
self.title = title
|
|
15
|
-
self.commit = call.getBool("commit", true)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
func getTitle() -> String {
|
|
19
|
-
return title
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
func getIsAllDay() -> Bool {
|
|
23
|
-
return input.getIsAllDay()
|
|
24
16
|
}
|
|
25
17
|
|
|
26
18
|
func getAlerts() -> [EKAlarm] {
|
|
27
19
|
return input.getAlerts()
|
|
28
20
|
}
|
|
29
21
|
|
|
22
|
+
func getAvailability() -> EKEventAvailability? {
|
|
23
|
+
return input.getAvailability()
|
|
24
|
+
}
|
|
25
|
+
|
|
30
26
|
func getCalendar(from eventStore: EKEventStore) -> EKCalendar? {
|
|
31
27
|
return input.getCalendar(from: eventStore)
|
|
32
28
|
}
|
|
33
29
|
|
|
34
|
-
func
|
|
35
|
-
return
|
|
30
|
+
func getCommit() -> Bool {
|
|
31
|
+
return commit
|
|
36
32
|
}
|
|
37
33
|
|
|
38
|
-
func
|
|
39
|
-
return input.
|
|
34
|
+
func getDescription() -> String? {
|
|
35
|
+
return input.getDescription()
|
|
40
36
|
}
|
|
41
37
|
|
|
42
38
|
func getEndDate() -> Date? {
|
|
43
39
|
return input.getEndDate()
|
|
44
40
|
}
|
|
45
41
|
|
|
46
|
-
func
|
|
47
|
-
return input.
|
|
42
|
+
func getIsAllDay() -> Bool {
|
|
43
|
+
return input.getIsAllDay()
|
|
48
44
|
}
|
|
49
45
|
|
|
50
|
-
func
|
|
51
|
-
return input.
|
|
46
|
+
func getLocation() -> String? {
|
|
47
|
+
return input.getLocation()
|
|
52
48
|
}
|
|
53
49
|
|
|
54
|
-
func
|
|
55
|
-
return input.
|
|
50
|
+
func getRecurrenceRule() -> [EKRecurrenceRule] {
|
|
51
|
+
return input.getRecurrenceRule()
|
|
56
52
|
}
|
|
57
53
|
|
|
58
|
-
func
|
|
59
|
-
return
|
|
54
|
+
func getStartDate() -> Date? {
|
|
55
|
+
return input.getStartDate()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
func getTitle() -> String {
|
|
59
|
+
return title
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
func getUrl() -> URL? {
|
|
63
|
+
return input.getUrl()
|
|
60
64
|
}
|
|
61
65
|
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import Capacitor
|
|
2
|
+
import EventKit
|
|
3
|
+
|
|
4
|
+
struct CreateEventWithPromptInput {
|
|
5
|
+
private var alerts: [Double]
|
|
6
|
+
private var availability: EKEventAvailability?
|
|
7
|
+
private var calendarId: String?
|
|
8
|
+
private var description: String?
|
|
9
|
+
private var endDate: Double?
|
|
10
|
+
private let isAllDay: Bool
|
|
11
|
+
private var location: String?
|
|
12
|
+
private let recurrence: RecurrenceInput?
|
|
13
|
+
private var startDate: Double?
|
|
14
|
+
private let title: String
|
|
15
|
+
private var url: String?
|
|
16
|
+
|
|
17
|
+
init(call: CAPPluginCall) {
|
|
18
|
+
if let alerts = call.getArray("alerts", []) as? [Double] {
|
|
19
|
+
self.alerts = alerts
|
|
20
|
+
} else {
|
|
21
|
+
self.alerts = []
|
|
22
|
+
}
|
|
23
|
+
if let availability = call.getInt("availability") {
|
|
24
|
+
self.availability = EKEventAvailability(rawValue: availability)
|
|
25
|
+
}
|
|
26
|
+
if let calendarId = call.getString("calendarId") {
|
|
27
|
+
self.calendarId = calendarId
|
|
28
|
+
}
|
|
29
|
+
if let description = call.getString("description") {
|
|
30
|
+
self.description = description
|
|
31
|
+
}
|
|
32
|
+
if let endDate = call.getDouble("endDate") as Double? {
|
|
33
|
+
self.endDate = endDate
|
|
34
|
+
}
|
|
35
|
+
self.isAllDay = call.getBool("isAllDay", false)
|
|
36
|
+
if let location = call.getString("location") {
|
|
37
|
+
self.location = location
|
|
38
|
+
}
|
|
39
|
+
self.recurrence = CreateEventWithPromptInput.getRecurrence(from: call)
|
|
40
|
+
if let startDate = call.getDouble("startDate") as Double? {
|
|
41
|
+
self.startDate = startDate
|
|
42
|
+
}
|
|
43
|
+
self.title = call.getString("title", "")
|
|
44
|
+
if let url = call.getString("url") {
|
|
45
|
+
self.url = url
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
func getAlerts() -> [EKAlarm] {
|
|
50
|
+
return alerts.map { EKAlarm(relativeOffset: $0 * 60) }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
func getAvailability() -> EKEventAvailability? {
|
|
54
|
+
return availability
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
func getCalendar(from eventStore: EKEventStore) -> EKCalendar? {
|
|
58
|
+
return ImplementationHelper.getCalendarFromId(eventStore: eventStore, calendarId: calendarId, fallback: true)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
func getDescription() -> String? {
|
|
62
|
+
return description
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
func getEndDate() -> Date? {
|
|
66
|
+
guard let endDate = endDate else { return nil }
|
|
67
|
+
return ImplementationHelper.dateFromTimestamp(endDate)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
func getIsAllDay() -> Bool {
|
|
71
|
+
return isAllDay
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
func getLocation() -> String? {
|
|
75
|
+
return location
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
func getRecurrenceRule() -> [EKRecurrenceRule] {
|
|
79
|
+
guard let recurrence = recurrence else {
|
|
80
|
+
return []
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let rule = EKRecurrenceRule(
|
|
84
|
+
recurrenceWith: recurrence.frequency.toEKFrequency(),
|
|
85
|
+
interval: recurrence.interval,
|
|
86
|
+
daysOfTheWeek: recurrence.byWeekDay,
|
|
87
|
+
daysOfTheMonth: recurrence.byMonthDay,
|
|
88
|
+
monthsOfTheYear: recurrence.byMonth,
|
|
89
|
+
weeksOfTheYear: recurrence.weeksOfTheYear,
|
|
90
|
+
daysOfTheYear: recurrence.daysOfTheYear,
|
|
91
|
+
setPositions: nil,
|
|
92
|
+
end: recurrence.end
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
return [rule]
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
func getStartDate() -> Date? {
|
|
99
|
+
guard let startDate = startDate else { return nil }
|
|
100
|
+
return ImplementationHelper.dateFromTimestamp(startDate)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
func getTitle() -> String {
|
|
104
|
+
return title
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
func getUrl() -> URL? {
|
|
108
|
+
guard let url = url else { return nil }
|
|
109
|
+
return URL(string: url)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static func getRecurrence(from call: CAPPluginCall) -> RecurrenceInput? {
|
|
113
|
+
if let recurrenceObject = call.getObject("recurrence") {
|
|
114
|
+
if let frequencyString = recurrenceObject["frequency"] as? String, let frequency = RecurrenceInput.Frequency(rawValue: frequencyString) {
|
|
115
|
+
let interval = recurrenceObject["interval"] as? Int ?? 1
|
|
116
|
+
let count = recurrenceObject["count"] as? Int
|
|
117
|
+
|
|
118
|
+
var endDate: Date?
|
|
119
|
+
if let endMs = recurrenceObject["end"] as? Double {
|
|
120
|
+
endDate = ImplementationHelper.dateFromTimestamp(endMs)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
var end: EKRecurrenceEnd?
|
|
124
|
+
if let count = count {
|
|
125
|
+
end = EKRecurrenceEnd(occurrenceCount: count)
|
|
126
|
+
} else if let endDate = endDate {
|
|
127
|
+
end = EKRecurrenceEnd(end: endDate)
|
|
128
|
+
} else {
|
|
129
|
+
end = nil
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
var byWeekDay: [EKRecurrenceDayOfWeek]?
|
|
133
|
+
if let days = recurrenceObject["byWeekDay"] as? [Int] {
|
|
134
|
+
byWeekDay = days.compactMap { day in
|
|
135
|
+
switch day {
|
|
136
|
+
case 1: return EKRecurrenceDayOfWeek(.monday)
|
|
137
|
+
case 2: return EKRecurrenceDayOfWeek(.tuesday)
|
|
138
|
+
case 3: return EKRecurrenceDayOfWeek(.wednesday)
|
|
139
|
+
case 4: return EKRecurrenceDayOfWeek(.thursday)
|
|
140
|
+
case 5: return EKRecurrenceDayOfWeek(.friday)
|
|
141
|
+
case 6: return EKRecurrenceDayOfWeek(.saturday)
|
|
142
|
+
case 7: return EKRecurrenceDayOfWeek(.sunday)
|
|
143
|
+
default: return nil
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
let byMonthDay = (recurrenceObject["byMonthDay"] as? [Int])?.map { NSNumber(value: $0) }
|
|
149
|
+
let byMonth = (recurrenceObject["byMonth"] as? [Int])?.map { NSNumber(value: $0) }
|
|
150
|
+
let weeksOfTheYear = (recurrenceObject["weeksOfTheYear"] as? [Int])?.map { NSNumber(value: $0) }
|
|
151
|
+
let daysOfTheYear = (recurrenceObject["daysOfTheYear"] as? [Int])?.map { NSNumber(value: $0) }
|
|
152
|
+
|
|
153
|
+
return RecurrenceInput(
|
|
154
|
+
frequency: frequency,
|
|
155
|
+
interval: max(1, interval),
|
|
156
|
+
count: count,
|
|
157
|
+
end: end,
|
|
158
|
+
byWeekDay: byWeekDay,
|
|
159
|
+
byMonthDay: byMonthDay,
|
|
160
|
+
byMonth: byMonth,
|
|
161
|
+
weeksOfTheYear: weeksOfTheYear,
|
|
162
|
+
daysOfTheYear: daysOfTheYear
|
|
163
|
+
)
|
|
164
|
+
} else {
|
|
165
|
+
return nil
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
return nil
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/CreateReminderInput.swift
RENAMED
|
@@ -32,10 +32,10 @@ struct CreateReminderInput {
|
|
|
32
32
|
self.url = call.getString("url")
|
|
33
33
|
self.location = call.getString("location")
|
|
34
34
|
if let recurrence = call.getObject("recurrence") {
|
|
35
|
-
guard let frequency = recurrence["frequency"] as?
|
|
35
|
+
guard let frequency = recurrence["frequency"] as? String else {
|
|
36
36
|
throw PluginError.missingFrequency
|
|
37
37
|
}
|
|
38
|
-
self.frequency =
|
|
38
|
+
self.frequency = RecurrenceInput.Frequency(rawValue: frequency)?.toEKFrequency()
|
|
39
39
|
guard let interval = recurrence["interval"] as? Int else {
|
|
40
40
|
throw PluginError.missingInterval
|
|
41
41
|
}
|
|
@@ -2,59 +2,73 @@ import Capacitor
|
|
|
2
2
|
import EventKit
|
|
3
3
|
|
|
4
4
|
struct ModifyEventInput {
|
|
5
|
-
private
|
|
6
|
-
private var
|
|
5
|
+
private var alerts: [Double]?
|
|
6
|
+
private var availability: EKEventAvailability?
|
|
7
7
|
private var calendarId: String?
|
|
8
|
-
private var
|
|
9
|
-
private var startDate: Double?
|
|
8
|
+
private var description: String?
|
|
10
9
|
private var endDate: Double?
|
|
10
|
+
private let id: String
|
|
11
11
|
private var isAllDay: Bool?
|
|
12
|
-
private var
|
|
13
|
-
private
|
|
14
|
-
private var description: String?
|
|
15
|
-
private var availability: EKEventAvailability?
|
|
12
|
+
private var location: String?
|
|
13
|
+
private let recurrence: RecurrenceInput?
|
|
16
14
|
private var span: EKSpan
|
|
15
|
+
private var startDate: Double?
|
|
16
|
+
private var title: String?
|
|
17
|
+
private var url: String?
|
|
17
18
|
|
|
18
19
|
init(call: CAPPluginCall) throws {
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
if let alerts = call.getArray("alerts") as? [Double] {
|
|
21
|
+
self.alerts = alerts
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
self.title = title
|
|
23
|
+
if let availability = call.getInt("availability") {
|
|
24
|
+
self.availability = EKEventAvailability(rawValue: availability)
|
|
25
25
|
}
|
|
26
26
|
if let calendarId = call.getString("calendarId") {
|
|
27
27
|
self.calendarId = calendarId
|
|
28
28
|
}
|
|
29
|
-
if let
|
|
30
|
-
self.
|
|
31
|
-
}
|
|
32
|
-
if let startDate = call.getDouble("startDate") as Double? {
|
|
33
|
-
self.startDate = startDate
|
|
29
|
+
if let description = call.getString("description") {
|
|
30
|
+
self.description = description
|
|
34
31
|
}
|
|
35
32
|
if let endDate = call.getDouble("endDate") as Double? {
|
|
36
33
|
self.endDate = endDate
|
|
37
34
|
}
|
|
35
|
+
guard let id = call.getString("id") else {
|
|
36
|
+
throw PluginError.idMissing
|
|
37
|
+
}
|
|
38
|
+
self.id = id
|
|
38
39
|
if let isAllDay = call.getBool("isAllDay") as Bool? {
|
|
39
40
|
self.isAllDay = isAllDay
|
|
40
41
|
}
|
|
41
|
-
if let
|
|
42
|
-
self.
|
|
43
|
-
}
|
|
44
|
-
if let url = call.getString("url") {
|
|
45
|
-
self.url = url
|
|
46
|
-
}
|
|
47
|
-
if let description = call.getString("description") {
|
|
48
|
-
self.description = description
|
|
49
|
-
}
|
|
50
|
-
if let availability = call.getInt("availability") {
|
|
51
|
-
self.availability = EKEventAvailability(rawValue: availability)
|
|
42
|
+
if let location = call.getString("location") {
|
|
43
|
+
self.location = location
|
|
52
44
|
}
|
|
45
|
+
self.recurrence = CreateEventWithPromptInput.getRecurrence(from: call)
|
|
53
46
|
if let spanInt = call.getInt("span"), let span = EKSpan(rawValue: spanInt) {
|
|
54
47
|
self.span = span
|
|
55
48
|
} else {
|
|
56
49
|
self.span = .thisEvent
|
|
57
50
|
}
|
|
51
|
+
if let startDate = call.getDouble("startDate") as Double? {
|
|
52
|
+
self.startDate = startDate
|
|
53
|
+
}
|
|
54
|
+
if let title = call.getString("title") {
|
|
55
|
+
self.title = title
|
|
56
|
+
}
|
|
57
|
+
if let url = call.getString("url") {
|
|
58
|
+
self.url = url
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
func getAlerts() -> [EKAlarm]? {
|
|
63
|
+
if let alerts = self.alerts {
|
|
64
|
+
return alerts.map { EKAlarm(relativeOffset: $0 * 60) }
|
|
65
|
+
} else {
|
|
66
|
+
return nil
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
func getIsAllDay() -> Bool? {
|
|
71
|
+
return isAllDay
|
|
58
72
|
}
|
|
59
73
|
|
|
60
74
|
func getEvent(from eventStore: EKEventStore) throws -> EKEvent {
|
|
@@ -76,6 +90,26 @@ struct ModifyEventInput {
|
|
|
76
90
|
return location
|
|
77
91
|
}
|
|
78
92
|
|
|
93
|
+
func getRecurrenceRule() -> [EKRecurrenceRule] {
|
|
94
|
+
guard let recurrence = recurrence else {
|
|
95
|
+
return []
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let rule = EKRecurrenceRule(
|
|
99
|
+
recurrenceWith: recurrence.frequency.toEKFrequency(),
|
|
100
|
+
interval: recurrence.interval,
|
|
101
|
+
daysOfTheWeek: recurrence.byWeekDay,
|
|
102
|
+
daysOfTheMonth: recurrence.byMonthDay,
|
|
103
|
+
monthsOfTheYear: recurrence.byMonth,
|
|
104
|
+
weeksOfTheYear: recurrence.weeksOfTheYear,
|
|
105
|
+
daysOfTheYear: recurrence.daysOfTheYear,
|
|
106
|
+
setPositions: nil,
|
|
107
|
+
end: recurrence.end
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return [rule]
|
|
111
|
+
}
|
|
112
|
+
|
|
79
113
|
func getStartDate() -> Date? {
|
|
80
114
|
guard let startDate = startDate else { return nil }
|
|
81
115
|
return ImplementationHelper.dateFromTimestamp(startDate)
|
|
@@ -86,18 +120,6 @@ struct ModifyEventInput {
|
|
|
86
120
|
return ImplementationHelper.dateFromTimestamp(endDate)
|
|
87
121
|
}
|
|
88
122
|
|
|
89
|
-
func getIsAllDay() -> Bool? {
|
|
90
|
-
return isAllDay
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
func getAlerts() -> [EKAlarm]? {
|
|
94
|
-
if let alerts = self.alerts {
|
|
95
|
-
return alerts.map { EKAlarm(relativeOffset: $0 * 60) }
|
|
96
|
-
} else {
|
|
97
|
-
return nil
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
123
|
func getUrl() -> URL? {
|
|
102
124
|
guard let url = url else { return nil }
|
|
103
125
|
return URL(string: url)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import EventKit
|
|
2
|
+
|
|
3
|
+
struct RecurrenceInput {
|
|
4
|
+
enum Frequency: String {
|
|
5
|
+
case daily
|
|
6
|
+
case weekly
|
|
7
|
+
case monthly
|
|
8
|
+
case yearly
|
|
9
|
+
|
|
10
|
+
func toEKFrequency() -> EKRecurrenceFrequency {
|
|
11
|
+
switch self {
|
|
12
|
+
case .daily: return .daily
|
|
13
|
+
case .weekly: return .weekly
|
|
14
|
+
case .monthly: return .monthly
|
|
15
|
+
case .yearly: return .yearly
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let frequency: Frequency
|
|
21
|
+
let interval: Int
|
|
22
|
+
let count: Int?
|
|
23
|
+
let end: EKRecurrenceEnd?
|
|
24
|
+
|
|
25
|
+
let byWeekDay: [EKRecurrenceDayOfWeek]?
|
|
26
|
+
let byMonthDay: [NSNumber]?
|
|
27
|
+
let byMonth: [NSNumber]?
|
|
28
|
+
|
|
29
|
+
let weeksOfTheYear: [NSNumber]?
|
|
30
|
+
let daysOfTheYear: [NSNumber]?
|
|
31
|
+
}
|