@ebarooni/capacitor-calendar 6.7.2 → 7.1.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 +28 -0
- package/README.md +1197 -119
- package/android/build.gradle +8 -7
- package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +267 -317
- package/android/src/main/java/dev/barooni/capacitor/calendar/PluginError.kt +47 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/implementation/CapacitorCalendar.kt +348 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/data/CalendarEvent.kt +25 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/data/CalendarInfo.kt +14 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/data/EventGuest.kt +9 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/enums/CalendarPermissionScope.kt +15 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CheckPermissionInput.kt +20 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CreateCalendarInput.kt +18 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CreateEventInput.kt +27 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CreateEventWithPromptInput.kt +36 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteCalendarInput.kt +10 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteEventInput.kt +10 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteEventWithPromptInput.kt +14 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteEventsByIdInput.kt +11 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ListEventsInRangeInput.kt +14 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ModifyEvent.kt +25 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ModifyEventWithPromptInput.kt +37 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/OpenCalendarInput.kt +10 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/RequestAllPermissionsInput.kt +9 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/RequestPermissionInput.kt +40 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/CheckAllPermissionsResult.kt +17 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/CheckPermissionResult.kt +15 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/CreateCalendarResult.kt +21 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/CreateEventResult.kt +21 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/CreateEventWithPromptResult.kt +12 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/DeleteEventWithPromptResult.kt +14 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/DeleteEventsByIdResult.kt +27 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/GetDefaultCalendarResult.kt +34 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/ListCalendarsResult.kt +39 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/ListEventsInRangeResult.kt +58 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/ModifyEventWithPromptResult.kt +12 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/RequestAllPermissionsResult.kt +30 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/RequestPermissionResult.kt +42 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/templates/JSResult.kt +7 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/utils/ImplementationHelper.kt +387 -0
- package/dist/docs.json +3808 -1126
- package/dist/esm/definitions.d.ts +6 -759
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +40 -12
- package/dist/esm/index.js +11 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/schemas/enums/attendee-role.d.ts +50 -0
- package/dist/esm/schemas/enums/attendee-role.js +52 -0
- package/dist/esm/schemas/enums/attendee-role.js.map +1 -0
- package/dist/esm/schemas/enums/attendee-status.d.ts +55 -0
- package/dist/esm/schemas/enums/attendee-status.js +57 -0
- package/dist/esm/schemas/enums/attendee-status.js.map +1 -0
- package/dist/esm/schemas/enums/attendee-type.d.ts +45 -0
- package/dist/esm/schemas/enums/attendee-type.js +47 -0
- package/dist/esm/schemas/enums/attendee-type.js.map +1 -0
- package/dist/esm/schemas/enums/calendar-chooser-display-style.d.ts +3 -6
- package/dist/esm/schemas/enums/calendar-chooser-display-style.js +3 -6
- package/dist/esm/schemas/enums/calendar-chooser-display-style.js.map +1 -1
- package/dist/esm/schemas/enums/calendar-permission-scope.d.ts +60 -0
- package/dist/esm/schemas/enums/calendar-permission-scope.js +62 -0
- package/dist/esm/schemas/enums/calendar-permission-scope.js.map +1 -0
- package/dist/esm/schemas/enums/calendar-source-type.d.ts +7 -16
- package/dist/esm/schemas/enums/calendar-source-type.js +7 -16
- package/dist/esm/schemas/enums/calendar-source-type.js.map +1 -1
- package/dist/esm/schemas/enums/calendar-type.d.ts +6 -9
- package/dist/esm/schemas/enums/calendar-type.js +6 -9
- package/dist/esm/schemas/enums/calendar-type.js.map +1 -1
- package/dist/esm/schemas/enums/event-availability.d.ts +30 -0
- package/dist/esm/schemas/enums/event-availability.js +32 -0
- package/dist/esm/schemas/enums/event-availability.js.map +1 -0
- package/dist/esm/schemas/enums/event-span.d.ts +3 -6
- package/dist/esm/schemas/enums/event-span.js +3 -6
- package/dist/esm/schemas/enums/event-span.js.map +1 -1
- package/dist/esm/schemas/enums/event-status.d.ts +26 -0
- package/dist/esm/schemas/enums/event-status.js +28 -0
- package/dist/esm/schemas/enums/event-status.js.map +1 -0
- package/dist/esm/schemas/enums/recurrence-frequency.d.ts +21 -0
- package/dist/esm/schemas/enums/recurrence-frequency.js +23 -0
- package/dist/esm/schemas/enums/recurrence-frequency.js.map +1 -0
- package/dist/esm/schemas/enums/reminder-recurrence-frequency.d.ts +5 -8
- package/dist/esm/schemas/enums/reminder-recurrence-frequency.js +5 -8
- package/dist/esm/schemas/enums/reminder-recurrence-frequency.js.map +1 -1
- package/dist/esm/schemas/interfaces/calendar-event.d.ts +116 -48
- package/dist/esm/schemas/interfaces/calendar-event.js.map +1 -1
- package/dist/esm/schemas/interfaces/calendar-source.d.ts +10 -7
- package/dist/esm/schemas/interfaces/calendar-source.js.map +1 -1
- package/dist/esm/schemas/interfaces/calendar.d.ts +59 -25
- package/dist/esm/schemas/interfaces/calendar.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-calendar-options.d.ts +38 -0
- package/dist/esm/schemas/interfaces/create-calendar-options.js +2 -0
- package/dist/esm/schemas/interfaces/create-calendar-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/create-event-options.d.ts +96 -0
- package/dist/esm/schemas/interfaces/create-event-options.js +2 -0
- package/dist/esm/schemas/interfaces/create-event-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/create-event-with-prompt-options.d.ts +70 -0
- package/dist/esm/schemas/interfaces/create-event-with-prompt-options.js +2 -0
- package/dist/esm/schemas/interfaces/create-event-with-prompt-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/create-reminder-options.d.ts +54 -0
- package/dist/esm/schemas/interfaces/create-reminder-options.js +2 -0
- package/dist/esm/schemas/interfaces/create-reminder-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/delete-calendar-options.d.ts +9 -0
- package/dist/esm/schemas/interfaces/delete-calendar-options.js +2 -0
- package/dist/esm/schemas/interfaces/delete-calendar-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/delete-event-options.d.ts +18 -0
- package/dist/esm/schemas/interfaces/delete-event-options.js +2 -0
- package/dist/esm/schemas/interfaces/delete-event-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/delete-event-with-prompt-options.d.ts +48 -0
- package/dist/esm/schemas/interfaces/delete-event-with-prompt-options.js +2 -0
- package/dist/esm/schemas/interfaces/delete-event-with-prompt-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/delete-events-by-id-options.d.ts +18 -0
- package/dist/esm/schemas/interfaces/delete-events-by-id-options.js +2 -0
- package/dist/esm/schemas/interfaces/delete-events-by-id-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/delete-reminder-options.d.ts +9 -0
- package/dist/esm/schemas/interfaces/delete-reminder-options.js +2 -0
- package/dist/esm/schemas/interfaces/delete-reminder-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/delete-reminders-by-id-options.d.ts +9 -0
- package/dist/esm/schemas/interfaces/delete-reminders-by-id-options.js +2 -0
- package/dist/esm/schemas/interfaces/delete-reminders-by-id-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/event-guest.d.ts +13 -0
- package/dist/esm/schemas/interfaces/event-guest.js +2 -0
- package/dist/esm/schemas/interfaces/event-guest.js.map +1 -0
- package/dist/esm/schemas/interfaces/get-reminder-by-id-options.d.ts +6 -0
- package/dist/esm/schemas/interfaces/get-reminder-by-id-options.js +2 -0
- package/dist/esm/schemas/interfaces/get-reminder-by-id-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/get-reminders-from-lists-options.d.ts +9 -0
- package/dist/esm/schemas/interfaces/get-reminders-from-lists-options.js +2 -0
- package/dist/esm/schemas/interfaces/get-reminders-from-lists-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/list-events-in-range-options.d.ts +17 -0
- package/dist/esm/schemas/interfaces/list-events-in-range-options.js +2 -0
- package/dist/esm/schemas/interfaces/list-events-in-range-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/modify-event-options.d.ts +103 -0
- package/dist/esm/schemas/interfaces/modify-event-options.js +2 -0
- package/dist/esm/schemas/interfaces/modify-event-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/modify-event-with-prompt-options.d.ts +13 -0
- package/dist/esm/schemas/interfaces/modify-event-with-prompt-options.js +2 -0
- package/dist/esm/schemas/interfaces/modify-event-with-prompt-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/modify-reminder-options.d.ts +58 -0
- package/dist/esm/schemas/interfaces/modify-reminder-options.js +2 -0
- package/dist/esm/schemas/interfaces/modify-reminder-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/open-calendar-options.d.ts +10 -0
- package/dist/esm/schemas/interfaces/open-calendar-options.js +2 -0
- package/dist/esm/schemas/interfaces/open-calendar-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/recurrence-rule.d.ts +22 -0
- package/dist/esm/schemas/interfaces/recurrence-rule.js +2 -0
- package/dist/esm/schemas/interfaces/recurrence-rule.js.map +1 -0
- package/dist/esm/schemas/interfaces/reminder-recurrence-rule.d.ts +7 -25
- package/dist/esm/schemas/interfaces/reminder-recurrence-rule.js.map +1 -1
- package/dist/esm/schemas/interfaces/reminder.d.ts +29 -38
- package/dist/esm/schemas/interfaces/reminder.js.map +1 -1
- package/dist/esm/schemas/interfaces/reminders-list.d.ts +5 -3
- package/dist/esm/schemas/interfaces/reminders-list.js.map +1 -1
- package/dist/esm/schemas/interfaces/select-calendars-with-prompt-options.d.ts +18 -0
- package/dist/esm/schemas/interfaces/select-calendars-with-prompt-options.js +2 -0
- package/dist/esm/schemas/interfaces/select-calendars-with-prompt-options.js.map +1 -0
- package/dist/esm/schemas/types/event-edit-action.d.ts +4 -0
- package/dist/esm/schemas/types/event-edit-action.js +2 -0
- package/dist/esm/schemas/types/event-edit-action.js.map +1 -0
- package/dist/esm/sub-definitions/calendar-access.d.ts +114 -0
- package/dist/esm/sub-definitions/calendar-access.js +2 -0
- package/dist/esm/sub-definitions/calendar-access.js.map +1 -0
- package/dist/esm/sub-definitions/calendar-operations.d.ts +77 -0
- package/dist/esm/sub-definitions/calendar-operations.js +2 -0
- package/dist/esm/sub-definitions/calendar-operations.js.map +1 -0
- package/dist/esm/sub-definitions/event-operations.d.ts +111 -0
- package/dist/esm/sub-definitions/event-operations.js +2 -0
- package/dist/esm/sub-definitions/event-operations.js.map +1 -0
- package/dist/esm/sub-definitions/reminders-access.d.ts +22 -0
- package/dist/esm/sub-definitions/reminders-access.js +2 -0
- package/dist/esm/sub-definitions/reminders-access.js.map +1 -0
- package/dist/esm/sub-definitions/reminders-operations.d.ts +110 -0
- package/dist/esm/sub-definitions/reminders-operations.js +2 -0
- package/dist/esm/sub-definitions/reminders-operations.js.map +1 -0
- package/dist/esm/web.d.ts +86 -151
- package/dist/esm/web.js +67 -49
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +392 -172
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +392 -172
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorCalendarPlugin/CapacitorCalendarPlugin.swift +348 -0
- package/ios/Sources/CapacitorCalendarPlugin/Implementation/CapacitorCalendar.swift +554 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Enums/CAPPermissionState.swift +6 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Enums/CalendarPermissionScope.swift +6 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Enums/EventEditAction.swift +20 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/CheckPermissionInput.swift +19 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/CreateCalendarInput.swift +32 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/CreateEventInput.swift +61 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/CreateEventWithPromptInput.swift +89 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/CreateReminderInput.swift +116 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/DeleteCalendarInput.swift +16 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/DeleteEventInput.swift +27 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/DeleteEventWithPromptInput.swift +57 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/DeleteEventsByIdInput.swift +27 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/DeleteReminderInput.swift +16 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/DeleteRemindersByIdInput.swift +16 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/GetReminderByIdInput.swift +16 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/GetRemindersFromListsInput.swift +24 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/ListEventsInRangeInput.swift +25 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/ModifyEventInput.swift +117 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/ModifyEventWithPromptInput.swift +83 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/ModifyReminderInput.swift +118 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/OpenCalendarInput.swift +17 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/RequestPermissionInput.swift +19 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/SelectCalendarsWithPromptInput.swift +32 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/CheckAllPermissionsResult.swift +15 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/CheckPermissionResult.swift +16 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/CreateCalendarResult.swift +18 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/CreateEventResult.swift +18 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/CreateEventWithPromptResult.swift +15 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/CreateReminderResult.swift +16 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/DeleteEventWithPromptResult.swift +15 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/DeleteEventsByIdResult.swift +23 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/DeleteRemindersByIdResult.swift +23 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/FetchAllCalendarSourcesResult.swift +16 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/GetDefaultCalendarResult.swift +16 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/GetReminderByIdResult.swift +20 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/GetRemindersFromListsResult.swift +16 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/ListCalendarsResult.swift +16 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/ListEventsInRangeResult.swift +16 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/ModifyEventWithPromptResult.swift +16 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/RequestAllPermissionsResult.swift +20 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/RequestPermissionResult.swift +15 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Results/SelectCalendarsWithPromptResult.swift +16 -0
- package/ios/Sources/CapacitorCalendarPlugin/Models/Templates/JSResult.swift +5 -0
- package/ios/Sources/CapacitorCalendarPlugin/PluginConfig.swift +42 -0
- package/ios/Sources/CapacitorCalendarPlugin/PluginError.swift +87 -0
- package/ios/Sources/CapacitorCalendarPlugin/Utils/ImplementationHelper.swift +361 -0
- package/ios/Sources/CapacitorCalendarPlugin/Utils/UIColorFromHexExtension.swift +32 -0
- package/ios/Tests/CapacitorCalendarPluginTests/CapacitorCalendarPluginTests.swift +15 -0
- package/package.json +68 -72
- package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendar.kt +0 -358
- package/assets/images/text-logo.png +0 -0
- package/dist/esm/schemas/enums/calendar-chooser-selection-style.d.ts +0 -16
- package/dist/esm/schemas/enums/calendar-chooser-selection-style.js +0 -18
- package/dist/esm/schemas/enums/calendar-chooser-selection-style.js.map +0 -1
- package/dist/esm/schemas/enums/plugin-permission.d.ts +0 -58
- package/dist/esm/schemas/enums/plugin-permission.js +0 -60
- package/dist/esm/schemas/enums/plugin-permission.js.map +0 -1
- package/dist/esm/schemas/interfaces/plugin-permissions-map.d.ts +0 -4
- package/dist/esm/schemas/interfaces/plugin-permissions-map.js +0 -2
- package/dist/esm/schemas/interfaces/plugin-permissions-map.js.map +0 -1
- package/ios/Plugin/CapacitorCalendar.swift +0 -635
- package/ios/Plugin/CapacitorCalendarPlugin.h +0 -10
- package/ios/Plugin/CapacitorCalendarPlugin.m +0 -36
- package/ios/Plugin/CapacitorCalendarPlugin.swift +0 -648
- package/ios/Plugin/CapacitorCalendarPluginError.swift +0 -22
- package/ios/Plugin/CapacitorReminders.swift +0 -456
- package/ios/Plugin/EventCreationParameters.swift +0 -22
- package/ios/Plugin/EventDeleteResults.swift +0 -14
- package/ios/Plugin/Info.plist +0 -24
- package/ios/Plugin/PermissionState.swift +0 -16
- package/ios/Plugin/RecurrenceParameters.swift +0 -15
- package/ios/Plugin/ReminderCreationParameters.swift +0 -23
- package/ios/Plugin/UIColorExtensions.swift +0 -28
- /package/{LICENSE.txt → LICENSE} +0 -0
package/package.json
CHANGED
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ebarooni/capacitor-calendar",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "dist/plugin.cjs.js",
|
|
6
|
-
"module": "dist/esm/index.js",
|
|
7
|
-
"types": "dist/esm/index.d.ts",
|
|
8
|
-
"unpkg": "dist/plugin.js",
|
|
9
|
-
"files": [
|
|
10
|
-
"android/src/main/",
|
|
11
|
-
"android/build.gradle",
|
|
12
|
-
"dist/",
|
|
13
|
-
"ios/Plugin/",
|
|
14
|
-
"EbarooniCapacitorCalendar.podspec",
|
|
15
|
-
"LICENSE.txt",
|
|
16
|
-
"assets/images/text-logo.png"
|
|
17
|
-
],
|
|
3
|
+
"version": "7.1.0",
|
|
4
|
+
"description": "A capacitor plugin for managing calendar events on iOS and Android, with reminders support on iOS.",
|
|
18
5
|
"author": "Ehsan Barooni",
|
|
19
6
|
"license": "MIT",
|
|
7
|
+
"homepage": "https://ebarooni.github.io/capacitor-calendar",
|
|
20
8
|
"repository": {
|
|
21
9
|
"type": "git",
|
|
22
|
-
"url": "
|
|
10
|
+
"url": "https://github.com/ebarooni/capacitor-calendar.git"
|
|
23
11
|
},
|
|
24
12
|
"bugs": {
|
|
25
|
-
"url": "https://github.com/ebarooni/capacitor-calendar
|
|
13
|
+
"url": "https://github.com/ebarooni/capacitor-calendar/issues"
|
|
26
14
|
},
|
|
27
15
|
"keywords": [
|
|
28
16
|
"capacitor",
|
|
@@ -31,76 +19,88 @@
|
|
|
31
19
|
"calendar",
|
|
32
20
|
"reminders",
|
|
33
21
|
"eventkit",
|
|
34
|
-
"eventkitui",
|
|
35
|
-
"angular",
|
|
36
22
|
"ionic"
|
|
37
23
|
],
|
|
38
|
-
"homepage": "https://capacitor-calendar.pages.dev",
|
|
39
24
|
"engines": {
|
|
40
|
-
"node": ">=
|
|
25
|
+
"node": ">=20.12.2"
|
|
41
26
|
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"main": "dist/plugin.cjs.js",
|
|
31
|
+
"module": "dist/esm/index.js",
|
|
32
|
+
"types": "dist/esm/index.d.ts",
|
|
33
|
+
"unpkg": "dist/plugin.js",
|
|
34
|
+
"files": [
|
|
35
|
+
"dist/",
|
|
36
|
+
"android/src/main/",
|
|
37
|
+
"android/build.gradle",
|
|
38
|
+
"ios/Sources",
|
|
39
|
+
"ios/Tests",
|
|
40
|
+
"Package.swift",
|
|
41
|
+
"EbarooniCapacitorCalendar.podspec",
|
|
42
|
+
"LICENSE"
|
|
43
|
+
],
|
|
42
44
|
"scripts": {
|
|
45
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
46
|
+
"build:app": "cd example-app && npm run build",
|
|
47
|
+
"bootstrap:app": "npm run build && npm run install:app && npm run build:app && npm run sync:app",
|
|
48
|
+
"clean": "rimraf ./dist",
|
|
49
|
+
"prettier": "npx prettier",
|
|
50
|
+
"prettier:check": "npm run prettier -- . --check",
|
|
51
|
+
"prettier:fix": "npm run prettier -- . --write",
|
|
52
|
+
"eslint": "npx eslint",
|
|
53
|
+
"eslint:fix": "npm run eslint -- --fix",
|
|
54
|
+
"fmt": "npm run fmt:web && npm run fmt:android && npm run fmt:ios",
|
|
55
|
+
"fmt:android": "ktlint -F",
|
|
56
|
+
"fmt:ios": "npx swiftlint --fix --format",
|
|
57
|
+
"fmt:web": "npm run eslint:fix && npm run prettier:fix",
|
|
58
|
+
"install:app": "cd example-app && npm i",
|
|
59
|
+
"lint": "npm run lint:web && npm run lint:android && npm run lint:ios",
|
|
60
|
+
"lint:android": "npx ktlint",
|
|
61
|
+
"lint:ios": "npx swiftlint lint",
|
|
62
|
+
"lint:web": "npm run eslint && npm run prettier:check",
|
|
63
|
+
"spm:install": "swift package resolve",
|
|
64
|
+
"sync:app": "cd example-app && npx cap sync",
|
|
65
|
+
"typedoc": "npx typedoc",
|
|
66
|
+
"docgen": "docgen --api CapacitorCalendarPlugin --output-readme README.md --output-json dist/docs.json",
|
|
43
67
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
44
|
-
"verify:ios": "
|
|
68
|
+
"verify:ios": "xcodebuild build -scheme EbarooniCapacitorCalendar -destination generic/platform=iOS",
|
|
45
69
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
46
70
|
"verify:web": "npm run build",
|
|
47
|
-
"prettier:check": "npx prettier . --check",
|
|
48
|
-
"prettier:fix": "npx prettier . --write",
|
|
49
|
-
"swiftlint": "node-swiftlint",
|
|
50
|
-
"ktlint": "ktlint 'android/src/main/java/**'",
|
|
51
|
-
"lint:ts-html": "npx eslint",
|
|
52
|
-
"lint:css": "npx stylelint \"**/*.(css|scss)\"",
|
|
53
|
-
"lint:swift": "npm run swiftlint -- lint",
|
|
54
|
-
"lint:kt": "npm run ktlint",
|
|
55
|
-
"lint": "npm run lint:ts-html && npm run lint:css && npm run lint:swift && npm run lint:kt",
|
|
56
|
-
"fmt:ts-html": "npx eslint --fix",
|
|
57
|
-
"fmt:css": "npx stylelint \"**/*.(css|scss)\" --fix",
|
|
58
|
-
"fmt:swift": "npm run swiftlint -- --fix --format",
|
|
59
|
-
"fmt:md": "npx prettier --write \"**/*.md\"",
|
|
60
|
-
"fmt:kt": "npm run ktlint -- -F",
|
|
61
|
-
"fmt": "npm run fmt:ts-html && npm run fmt:css && npm run fmt:swift && npm run fmt:md && npm run fmt:kt",
|
|
62
|
-
"docgen:api-reference": "docgen --api CapacitorCalendarPlugin --output-readme docs/api-reference.md --output-json dist/docs.json",
|
|
63
|
-
"docgen:readme": "docgen --api CapacitorCalendarPlugin --output-readme README.md",
|
|
64
|
-
"typedoc:index": "npx typedoc",
|
|
65
|
-
"clean": "rm -rf ./dist",
|
|
66
|
-
"build": "npm run clean && npm run docgen:api-reference && npm run docgen:readme && tsc && rollup -c rollup.config.mjs",
|
|
67
71
|
"prepublishOnly": "npm run build",
|
|
68
|
-
"serve": "cd example && npx ng serve",
|
|
69
72
|
"version:patch": "npm version patch --git-tag-version false",
|
|
70
73
|
"version:minor": "npm version minor --git-tag-version false",
|
|
71
74
|
"version:major": "npm version major --git-tag-version false"
|
|
72
75
|
},
|
|
73
76
|
"devDependencies": {
|
|
74
|
-
"@
|
|
75
|
-
"@capacitor/
|
|
76
|
-
"@capacitor/
|
|
77
|
-
"@capacitor
|
|
78
|
-
"@
|
|
79
|
-
"@
|
|
80
|
-
"@ebarooni/
|
|
81
|
-
"@
|
|
82
|
-
"@
|
|
83
|
-
"@
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"eslint": "^
|
|
88
|
-
"eslint-config-prettier": "^9.1.0",
|
|
89
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
90
|
-
"postcss": "^8.4.38",
|
|
77
|
+
"@capacitor/android": "^7.0.0",
|
|
78
|
+
"@capacitor/core": "^7.0.0",
|
|
79
|
+
"@capacitor/ios": "^7.0.0",
|
|
80
|
+
"@ebarooni/capacitor-docgen": "^0.0.2",
|
|
81
|
+
"@ebarooni/eslint-config": "^1.3.0",
|
|
82
|
+
"@ebarooni/prettier-config": "^1.4.0",
|
|
83
|
+
"@ebarooni/swiftlint-config": "^1.2.1",
|
|
84
|
+
"@eslint/js": "^9.19.0",
|
|
85
|
+
"@eslint/json": "^0.10.0",
|
|
86
|
+
"@eslint/markdown": "^6.2.2",
|
|
87
|
+
"angular-eslint": "^19.0.2",
|
|
88
|
+
"eslint": "^9.19.0",
|
|
89
|
+
"eslint-config-prettier": "^10.0.1",
|
|
90
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
91
91
|
"prettier": "^3.3.2",
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"stylelint-prettier": "^5.0.0",
|
|
96
|
-
"swiftlint": "^1.0.2",
|
|
92
|
+
"rimraf": "^6.0.1",
|
|
93
|
+
"rollup": "^4.30.1",
|
|
94
|
+
"swiftlint": "^2.0.0",
|
|
97
95
|
"typedoc": "^0.26.5",
|
|
98
|
-
"typescript": "~
|
|
99
|
-
"typescript-eslint": "^8.0
|
|
96
|
+
"typescript": "~4.8.4",
|
|
97
|
+
"typescript-eslint": "^8.22.0"
|
|
100
98
|
},
|
|
101
99
|
"peerDependencies": {
|
|
102
|
-
"@capacitor/core": "
|
|
100
|
+
"@capacitor/core": ">=7.0.0"
|
|
103
101
|
},
|
|
102
|
+
"prettier": "@ebarooni/prettier-config",
|
|
103
|
+
"swiftlint": "@ebarooni/swiftlint-config",
|
|
104
104
|
"capacitor": {
|
|
105
105
|
"ios": {
|
|
106
106
|
"src": "ios"
|
|
@@ -108,9 +108,5 @@
|
|
|
108
108
|
"android": {
|
|
109
109
|
"src": "android"
|
|
110
110
|
}
|
|
111
|
-
},
|
|
112
|
-
"prettier": "@ebarooni/prettier-config",
|
|
113
|
-
"publishConfig": {
|
|
114
|
-
"access": "public"
|
|
115
111
|
}
|
|
116
112
|
}
|
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
package dev.barooni.capacitor.calendar
|
|
2
|
-
|
|
3
|
-
import android.content.ContentUris
|
|
4
|
-
import android.content.ContentValues
|
|
5
|
-
import android.content.Context
|
|
6
|
-
import android.content.Intent
|
|
7
|
-
import android.net.Uri
|
|
8
|
-
import android.provider.CalendarContract
|
|
9
|
-
import android.util.Log
|
|
10
|
-
import com.getcapacitor.JSArray
|
|
11
|
-
import com.getcapacitor.JSObject
|
|
12
|
-
import java.util.Calendar
|
|
13
|
-
import java.util.TimeZone
|
|
14
|
-
|
|
15
|
-
class CapacitorCalendar {
|
|
16
|
-
var eventIdsArray: List<Long> = emptyList()
|
|
17
|
-
|
|
18
|
-
@Throws(Exception::class)
|
|
19
|
-
fun fetchCalendarEventIDs(context: Context): List<Long> {
|
|
20
|
-
val projection = arrayOf(CalendarContract.Events._ID)
|
|
21
|
-
val uri = CalendarContract.Events.CONTENT_URI
|
|
22
|
-
val cursor = context.contentResolver.query(uri, projection, null, null, null)
|
|
23
|
-
val eventIds = mutableListOf<Long>()
|
|
24
|
-
|
|
25
|
-
cursor?.use {
|
|
26
|
-
while (it.moveToNext()) {
|
|
27
|
-
val eventId = it.getLong(0)
|
|
28
|
-
eventIds.add(eventId)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return eventIds
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@Throws(Exception::class)
|
|
35
|
-
fun getNewEventIds(newIds: List<Long>): List<Long> = newIds.filterNot { it in eventIdsArray }
|
|
36
|
-
|
|
37
|
-
@Throws(Exception::class)
|
|
38
|
-
fun listCalendars(context: Context): JSArray {
|
|
39
|
-
val projection =
|
|
40
|
-
arrayOf(
|
|
41
|
-
CalendarContract.Calendars._ID,
|
|
42
|
-
CalendarContract.Calendars.CALENDAR_DISPLAY_NAME,
|
|
43
|
-
CalendarContract.Calendars.CALENDAR_COLOR,
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
val calendars = JSArray()
|
|
47
|
-
|
|
48
|
-
context.contentResolver
|
|
49
|
-
.query(
|
|
50
|
-
CalendarContract.Calendars.CONTENT_URI,
|
|
51
|
-
projection,
|
|
52
|
-
null,
|
|
53
|
-
null,
|
|
54
|
-
null,
|
|
55
|
-
)?.use { cursor ->
|
|
56
|
-
val idColumnIndex = cursor.getColumnIndex(CalendarContract.Calendars._ID)
|
|
57
|
-
val nameColumnIndex = cursor.getColumnIndex(CalendarContract.Calendars.CALENDAR_DISPLAY_NAME)
|
|
58
|
-
val calendarColorColumnIndex = cursor.getColumnIndex(CalendarContract.Calendars.CALENDAR_COLOR)
|
|
59
|
-
|
|
60
|
-
while (cursor.moveToNext()) {
|
|
61
|
-
val id = cursor.getLong(idColumnIndex)
|
|
62
|
-
val title = cursor.getString(nameColumnIndex)
|
|
63
|
-
val calendarColor = cursor.getInt(calendarColorColumnIndex)
|
|
64
|
-
val calendar =
|
|
65
|
-
JSObject().apply {
|
|
66
|
-
put("id", "$id")
|
|
67
|
-
put("title", title)
|
|
68
|
-
put("color", String.format("#%06X", 0xFFFFFF and calendarColor))
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
calendars.put(calendar)
|
|
72
|
-
}
|
|
73
|
-
} ?: throw Exception("Cursor is null")
|
|
74
|
-
|
|
75
|
-
return calendars
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@Throws(Exception::class)
|
|
79
|
-
fun getDefaultCalendar(context: Context): JSObject? {
|
|
80
|
-
val projection =
|
|
81
|
-
arrayOf(
|
|
82
|
-
CalendarContract.Calendars._ID,
|
|
83
|
-
CalendarContract.Calendars.CALENDAR_DISPLAY_NAME,
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
val selection = "${CalendarContract.Calendars.IS_PRIMARY} = ?"
|
|
87
|
-
val selectionArgs = arrayOf("1")
|
|
88
|
-
|
|
89
|
-
context.contentResolver
|
|
90
|
-
.query(
|
|
91
|
-
CalendarContract.Calendars.CONTENT_URI,
|
|
92
|
-
projection,
|
|
93
|
-
selection,
|
|
94
|
-
selectionArgs,
|
|
95
|
-
null,
|
|
96
|
-
)?.use { cursor ->
|
|
97
|
-
if (cursor.moveToFirst()) {
|
|
98
|
-
val idColumnIndex = cursor.getColumnIndex(CalendarContract.Calendars._ID)
|
|
99
|
-
val nameColumnIndex = cursor.getColumnIndex(CalendarContract.Calendars.CALENDAR_DISPLAY_NAME)
|
|
100
|
-
val id = cursor.getLong(idColumnIndex)
|
|
101
|
-
val title = cursor.getString(nameColumnIndex)
|
|
102
|
-
|
|
103
|
-
val calendarObject =
|
|
104
|
-
JSObject().apply {
|
|
105
|
-
put("id", id.toString())
|
|
106
|
-
put("title", title)
|
|
107
|
-
}
|
|
108
|
-
return calendarObject
|
|
109
|
-
} else {
|
|
110
|
-
return null
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
throw Exception("No primary calendar found")
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
@Throws(Exception::class)
|
|
117
|
-
fun createEvent(
|
|
118
|
-
context: Context,
|
|
119
|
-
title: String,
|
|
120
|
-
calendarId: String?,
|
|
121
|
-
location: String?,
|
|
122
|
-
startDate: Long?,
|
|
123
|
-
endDate: Long?,
|
|
124
|
-
isAllDay: Boolean?,
|
|
125
|
-
alertOffsetInMinutesSingle: Float?,
|
|
126
|
-
alertOffsetInMinutesMultiple: JSArray?,
|
|
127
|
-
url: String?,
|
|
128
|
-
notes: String?,
|
|
129
|
-
): Uri {
|
|
130
|
-
val startMillis = startDate ?: Calendar.getInstance().timeInMillis
|
|
131
|
-
val endMillis = endDate ?: (startMillis + 3600 * 1000)
|
|
132
|
-
|
|
133
|
-
val eventValues =
|
|
134
|
-
ContentValues().apply {
|
|
135
|
-
put(CalendarContract.Events.DTSTART, startMillis)
|
|
136
|
-
put(CalendarContract.Events.DTEND, endMillis)
|
|
137
|
-
put(CalendarContract.Events.TITLE, title)
|
|
138
|
-
location?.let { put(CalendarContract.Events.EVENT_LOCATION, it) }
|
|
139
|
-
put(CalendarContract.Events.CALENDAR_ID, calendarId ?: getDefaultCalendar(context)?.getString("id"))
|
|
140
|
-
put(CalendarContract.Events.EVENT_TIMEZONE, TimeZone.getDefault().id)
|
|
141
|
-
isAllDay?.let { put(CalendarContract.Events.ALL_DAY, if (it) 1 else 0) }
|
|
142
|
-
put(CalendarContract.Events.DESCRIPTION, listOfNotNull(notes, url?.let { "URL: $it" }).joinToString("\n"))
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
val eventUri = context.contentResolver.insert(CalendarContract.Events.CONTENT_URI, eventValues)
|
|
146
|
-
val eventId = eventUri?.lastPathSegment?.toLong() ?: throw IllegalArgumentException("Failed to convert event id to long")
|
|
147
|
-
|
|
148
|
-
when {
|
|
149
|
-
alertOffsetInMinutesSingle != null && alertOffsetInMinutesSingle > -1 -> {
|
|
150
|
-
val alertValues = createAlertValues(eventId, alertOffsetInMinutesSingle)
|
|
151
|
-
context.contentResolver.insert(CalendarContract.Reminders.CONTENT_URI, alertValues)
|
|
152
|
-
}
|
|
153
|
-
alertOffsetInMinutesMultiple != null -> {
|
|
154
|
-
alertOffsetInMinutesMultiple
|
|
155
|
-
.toList<Any>()
|
|
156
|
-
.mapNotNull { alert ->
|
|
157
|
-
try {
|
|
158
|
-
val alertFloat = alert.toString().toFloat()
|
|
159
|
-
if (alertFloat > -1) alertFloat else null
|
|
160
|
-
} catch (e: NumberFormatException) {
|
|
161
|
-
Log.e("Error", "Failed to convert alert to float: $alert", e)
|
|
162
|
-
null
|
|
163
|
-
}
|
|
164
|
-
}.forEach { alertFloat ->
|
|
165
|
-
val alertValues = createAlertValues(eventId, alertFloat)
|
|
166
|
-
context.contentResolver.insert(CalendarContract.Reminders.CONTENT_URI, alertValues)
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return eventUri
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
@Throws(Exception::class)
|
|
175
|
-
fun modifyEvent(
|
|
176
|
-
context: Context,
|
|
177
|
-
id: Long,
|
|
178
|
-
update: JSObject,
|
|
179
|
-
): Boolean {
|
|
180
|
-
val title = update.getString("title")
|
|
181
|
-
val calendarId = update.getString("calendarId")
|
|
182
|
-
val location = update.getString("location")
|
|
183
|
-
val startDate = update.getLong("startDate")
|
|
184
|
-
val endDate = update.getLong("endDate")
|
|
185
|
-
val isAllDay = update.getBoolean("isAllDay")
|
|
186
|
-
val url = update.getString("url")
|
|
187
|
-
val notes = update.getString("notes")
|
|
188
|
-
|
|
189
|
-
val eventUri: Uri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, id)
|
|
190
|
-
|
|
191
|
-
val values =
|
|
192
|
-
ContentValues().apply {
|
|
193
|
-
if (title != null) put(CalendarContract.Events.TITLE, title)
|
|
194
|
-
if (calendarId != null) put(CalendarContract.Events.CALENDAR_ID, calendarId)
|
|
195
|
-
if (location != null) put(CalendarContract.Events.EVENT_LOCATION, location)
|
|
196
|
-
if (startDate != null) put(CalendarContract.Events.DTSTART, startDate)
|
|
197
|
-
if (endDate != null) put(CalendarContract.Events.DTEND, endDate)
|
|
198
|
-
if (isAllDay != null) put(CalendarContract.Events.ALL_DAY, if (isAllDay) 1 else 0)
|
|
199
|
-
if (notes !=
|
|
200
|
-
null
|
|
201
|
-
) {
|
|
202
|
-
put(CalendarContract.Events.DESCRIPTION, listOfNotNull(notes, url?.let { "URL: $it" }).joinToString("\n"))
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
val rows: Int = context.contentResolver.update(eventUri, values, null, null)
|
|
207
|
-
return rows > 0
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
private fun createAlertValues(
|
|
211
|
-
eventId: Long,
|
|
212
|
-
alertOffset: Float,
|
|
213
|
-
): ContentValues =
|
|
214
|
-
ContentValues().apply {
|
|
215
|
-
put(CalendarContract.Reminders.EVENT_ID, eventId)
|
|
216
|
-
put(CalendarContract.Reminders.MINUTES, alertOffset)
|
|
217
|
-
put(CalendarContract.Reminders.METHOD, CalendarContract.Reminders.METHOD_ALERT)
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
@Throws(Exception::class)
|
|
221
|
-
fun openCalendar(timestamp: Long): Intent =
|
|
222
|
-
Intent(Intent.ACTION_VIEW).apply {
|
|
223
|
-
data = Uri.parse("content://com.android.calendar/time/$timestamp")
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
@Throws(Exception::class)
|
|
227
|
-
fun listEventsInRange(
|
|
228
|
-
context: Context,
|
|
229
|
-
startDate: Long,
|
|
230
|
-
endDate: Long,
|
|
231
|
-
): JSArray {
|
|
232
|
-
val projection =
|
|
233
|
-
arrayOf(
|
|
234
|
-
CalendarContract.Events._ID,
|
|
235
|
-
CalendarContract.Events.TITLE,
|
|
236
|
-
CalendarContract.Events.EVENT_LOCATION,
|
|
237
|
-
CalendarContract.Events.CALENDAR_COLOR,
|
|
238
|
-
CalendarContract.Events.ORGANIZER,
|
|
239
|
-
CalendarContract.Events.DESCRIPTION,
|
|
240
|
-
CalendarContract.Events.DTSTART,
|
|
241
|
-
CalendarContract.Events.DTEND,
|
|
242
|
-
CalendarContract.Events.EVENT_TIMEZONE,
|
|
243
|
-
CalendarContract.Events.EVENT_END_TIMEZONE,
|
|
244
|
-
CalendarContract.Events.DURATION,
|
|
245
|
-
CalendarContract.Events.ALL_DAY,
|
|
246
|
-
CalendarContract.Events.CALENDAR_ID,
|
|
247
|
-
)
|
|
248
|
-
val selection = "(${CalendarContract.Events.DTSTART} >= ?) AND (${CalendarContract.Events.DTEND} <= ?)"
|
|
249
|
-
val selectionArgs = arrayOf(startDate.toString(), endDate.toString())
|
|
250
|
-
|
|
251
|
-
val events = JSArray()
|
|
252
|
-
|
|
253
|
-
context.contentResolver
|
|
254
|
-
.query(
|
|
255
|
-
CalendarContract.Events.CONTENT_URI,
|
|
256
|
-
projection,
|
|
257
|
-
selection,
|
|
258
|
-
selectionArgs,
|
|
259
|
-
null,
|
|
260
|
-
)?.use { cursor ->
|
|
261
|
-
val idColumnIndex = cursor.getColumnIndex(CalendarContract.Events._ID)
|
|
262
|
-
val nameColumnIndex = cursor.getColumnIndex(CalendarContract.Events.TITLE)
|
|
263
|
-
val locationColumnIndex = cursor.getColumnIndex(CalendarContract.Events.EVENT_LOCATION)
|
|
264
|
-
val calendarColorColumnIndex = cursor.getColumnIndex(CalendarContract.Events.CALENDAR_COLOR)
|
|
265
|
-
val organizerColumnIndex = cursor.getColumnIndex(CalendarContract.Events.ORGANIZER)
|
|
266
|
-
val descriptionColumnIndex = cursor.getColumnIndex(CalendarContract.Events.DESCRIPTION)
|
|
267
|
-
val dtStartColumnIndex = cursor.getColumnIndex(CalendarContract.Events.DTSTART)
|
|
268
|
-
val dtEndColumnIndex = cursor.getColumnIndex(CalendarContract.Events.DTEND)
|
|
269
|
-
val eventTimezoneColumnIndex = cursor.getColumnIndex(CalendarContract.Events.EVENT_TIMEZONE)
|
|
270
|
-
val eventEndTimezoneColumnIndex = cursor.getColumnIndex(CalendarContract.Events.EVENT_END_TIMEZONE)
|
|
271
|
-
val durationColumnIndex = cursor.getColumnIndex(CalendarContract.Events.DURATION)
|
|
272
|
-
val isAllDayColumnIndex = cursor.getColumnIndex(CalendarContract.Events.ALL_DAY)
|
|
273
|
-
val calendarIdColumnIndex = cursor.getColumnIndex(CalendarContract.Events.CALENDAR_ID)
|
|
274
|
-
|
|
275
|
-
while (cursor.moveToNext()) {
|
|
276
|
-
val id = cursor.getLong(idColumnIndex)
|
|
277
|
-
val title = cursor.getString(nameColumnIndex)
|
|
278
|
-
val location = cursor.getString(locationColumnIndex)
|
|
279
|
-
val calendarColor = cursor.getInt(calendarColorColumnIndex)
|
|
280
|
-
val organizer = cursor.getString(organizerColumnIndex)
|
|
281
|
-
val desc = cursor.getString(descriptionColumnIndex)
|
|
282
|
-
val dtStart = cursor.getLong(dtStartColumnIndex)
|
|
283
|
-
val dtEnd = cursor.getLong(dtEndColumnIndex)
|
|
284
|
-
val eventTimezone = cursor.getString(eventTimezoneColumnIndex)
|
|
285
|
-
val eventEndTimezone = cursor.getString(eventEndTimezoneColumnIndex)
|
|
286
|
-
val duration = cursor.getString(durationColumnIndex)
|
|
287
|
-
val allDay = cursor.getInt(isAllDayColumnIndex) == 1
|
|
288
|
-
val calendarId = cursor.getLong(calendarIdColumnIndex)
|
|
289
|
-
|
|
290
|
-
val event =
|
|
291
|
-
JSObject().apply {
|
|
292
|
-
put("id", id.toString())
|
|
293
|
-
title?.takeIf { it.isNotEmpty() }?.let { put("title", it) }
|
|
294
|
-
location?.takeIf { it.isNotEmpty() }?.let { put("location", it) }
|
|
295
|
-
calendarColor.takeIf { it != 0 }?.let { put("eventColor", String.format("#%06X", 0xFFFFFF and it)) }
|
|
296
|
-
organizer?.takeIf { it.isNotEmpty() }?.let { put("organizer", it) }
|
|
297
|
-
desc?.takeIf { it.isNotEmpty() }?.let { put("description", it) }
|
|
298
|
-
dtStart.takeIf { it != 0.toLong() }?.let { put("startDate", it) }
|
|
299
|
-
dtEnd.takeIf { it != 0.toLong() }?.let { put("endDate", it) }
|
|
300
|
-
eventTimezone?.takeIf { it.isNotEmpty() }?.let { timezone ->
|
|
301
|
-
val abbreviation = getTimeZoneAbbreviation(timezone)
|
|
302
|
-
val obj = JSObject()
|
|
303
|
-
obj.put("region", timezone)
|
|
304
|
-
obj.put("abbreviation", abbreviation)
|
|
305
|
-
put("eventTimezone", obj)
|
|
306
|
-
}
|
|
307
|
-
eventEndTimezone?.takeIf { it.isNotEmpty() }?.let {
|
|
308
|
-
val abbreviation = getTimeZoneAbbreviation(it)
|
|
309
|
-
val obj = JSObject()
|
|
310
|
-
obj.put("region", it)
|
|
311
|
-
obj.put("abbreviation", abbreviation)
|
|
312
|
-
put("eventEndTimezone", obj)
|
|
313
|
-
}
|
|
314
|
-
duration?.takeIf { it.isNotEmpty() }?.let { put("duration", it) }
|
|
315
|
-
put("isAllDay", allDay)
|
|
316
|
-
calendarId.takeIf { it != 0.toLong() }?.let { put("calendarId", it.toString()) }
|
|
317
|
-
}
|
|
318
|
-
events.put(event)
|
|
319
|
-
}
|
|
320
|
-
} ?: throw Exception("Cursor is null")
|
|
321
|
-
return events
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
@Throws(Exception::class)
|
|
325
|
-
fun deleteEventsById(
|
|
326
|
-
context: Context,
|
|
327
|
-
ids: JSArray,
|
|
328
|
-
): JSObject {
|
|
329
|
-
val deletedEvents = JSArray()
|
|
330
|
-
val failedToDeleteEvents = JSArray()
|
|
331
|
-
val contentResolver = context.contentResolver
|
|
332
|
-
|
|
333
|
-
ids.toList<String>().forEach { id ->
|
|
334
|
-
try {
|
|
335
|
-
val uri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, id.toLong())
|
|
336
|
-
val rowsDeleted = contentResolver.delete(uri, null, null)
|
|
337
|
-
if (rowsDeleted > 0) {
|
|
338
|
-
deletedEvents.put(id)
|
|
339
|
-
} else {
|
|
340
|
-
failedToDeleteEvents.put(id)
|
|
341
|
-
}
|
|
342
|
-
} catch (error: Exception) {
|
|
343
|
-
failedToDeleteEvents.put(id)
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
val ret = JSObject()
|
|
348
|
-
ret.put("deleted", deletedEvents)
|
|
349
|
-
ret.put("failed", failedToDeleteEvents)
|
|
350
|
-
return ret
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
fun getTimeZoneAbbreviation(timeZoneId: String): String {
|
|
354
|
-
val timeZone = TimeZone.getTimeZone(timeZoneId)
|
|
355
|
-
val now = Calendar.getInstance(timeZone)
|
|
356
|
-
return timeZone.getDisplayName(timeZone.inDaylightTime(now.time), TimeZone.SHORT)
|
|
357
|
-
}
|
|
358
|
-
}
|
|
Binary file
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enum representing the selection style for the calendar chooser.
|
|
3
|
-
*
|
|
4
|
-
* @enum CalendarChooserSelectionStyle
|
|
5
|
-
* @platform iOS
|
|
6
|
-
*/
|
|
7
|
-
export declare enum CalendarChooserSelectionStyle {
|
|
8
|
-
/**
|
|
9
|
-
* Allows only a single selection in the calendar chooser.
|
|
10
|
-
*/
|
|
11
|
-
SINGLE = 0,
|
|
12
|
-
/**
|
|
13
|
-
* Allows multiple selections in the calendar chooser.
|
|
14
|
-
*/
|
|
15
|
-
MULTIPLE = 1
|
|
16
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enum representing the selection style for the calendar chooser.
|
|
3
|
-
*
|
|
4
|
-
* @enum CalendarChooserSelectionStyle
|
|
5
|
-
* @platform iOS
|
|
6
|
-
*/
|
|
7
|
-
export var CalendarChooserSelectionStyle;
|
|
8
|
-
(function (CalendarChooserSelectionStyle) {
|
|
9
|
-
/**
|
|
10
|
-
* Allows only a single selection in the calendar chooser.
|
|
11
|
-
*/
|
|
12
|
-
CalendarChooserSelectionStyle[CalendarChooserSelectionStyle["SINGLE"] = 0] = "SINGLE";
|
|
13
|
-
/**
|
|
14
|
-
* Allows multiple selections in the calendar chooser.
|
|
15
|
-
*/
|
|
16
|
-
CalendarChooserSelectionStyle[CalendarChooserSelectionStyle["MULTIPLE"] = 1] = "MULTIPLE";
|
|
17
|
-
})(CalendarChooserSelectionStyle || (CalendarChooserSelectionStyle = {}));
|
|
18
|
-
//# sourceMappingURL=calendar-chooser-selection-style.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-chooser-selection-style.js","sourceRoot":"","sources":["../../../../src/schemas/enums/calendar-chooser-selection-style.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,6BAUX;AAVD,WAAY,6BAA6B;IACvC;;OAEG;IACH,qFAAM,CAAA;IAEN;;OAEG;IACH,yFAAQ,CAAA;AACV,CAAC,EAVW,6BAA6B,KAA7B,6BAA6B,QAUxC","sourcesContent":["/**\n * Enum representing the selection style for the calendar chooser.\n *\n * @enum CalendarChooserSelectionStyle\n * @platform iOS\n */\nexport enum CalendarChooserSelectionStyle {\n /**\n * Allows only a single selection in the calendar chooser.\n */\n SINGLE,\n\n /**\n * Allows multiple selections in the calendar chooser.\n */\n MULTIPLE,\n}\n"]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enum representing the available runtime permissions for the plugin.
|
|
3
|
-
*
|
|
4
|
-
* @enum PluginPermission
|
|
5
|
-
* @platform iOS, Android
|
|
6
|
-
*/
|
|
7
|
-
export declare enum PluginPermission {
|
|
8
|
-
/**
|
|
9
|
-
* Represents the permission state for reading calendar.
|
|
10
|
-
*
|
|
11
|
-
* @platform iOS, Android
|
|
12
|
-
* @permissions
|
|
13
|
-
* <h3>Manifest Permissions:</h3>
|
|
14
|
-
* <ul>
|
|
15
|
-
* <li><strong>iOS 17 ≤:</strong> NSCalendarsFullAccessUsageDescription</li>
|
|
16
|
-
* <li><strong>13 ≤ iOS ≤ 16:</strong> NSCalendarsUsageDescription</li>
|
|
17
|
-
* <li><strong>Android:</strong> android.permission.READ_CALENDAR</li>
|
|
18
|
-
* </ul>
|
|
19
|
-
*/
|
|
20
|
-
READ_CALENDAR = "readCalendar",
|
|
21
|
-
/**
|
|
22
|
-
* Represents the permission state for writing calendar.
|
|
23
|
-
*
|
|
24
|
-
* @platform iOS, Android
|
|
25
|
-
* @permissions
|
|
26
|
-
* <h3>Manifest Permissions:</h3>
|
|
27
|
-
* <ul>
|
|
28
|
-
* <li><strong>iOS 17 ≤:</strong> NSCalendarsWriteOnlyAccessUsageDescription</li>
|
|
29
|
-
* <li><strong>13 ≤ iOS ≤ 16:</strong> NSCalendarsUsageDescription</li>
|
|
30
|
-
* <li><strong>Android:</strong> android.permission.WRITE_CALENDAR</li>
|
|
31
|
-
* </ul>
|
|
32
|
-
*/
|
|
33
|
-
WRITE_CALENDAR = "writeCalendar",
|
|
34
|
-
/**
|
|
35
|
-
* Represents the permission state for reading reminders.
|
|
36
|
-
*
|
|
37
|
-
* @platform iOS
|
|
38
|
-
* @permissions
|
|
39
|
-
* <h3>Manifest Permissions:</h3>
|
|
40
|
-
* <ul>
|
|
41
|
-
* <li><strong>iOS 17 ≤:</strong> NSRemindersFullAccessUsageDescription</li>
|
|
42
|
-
* <li><strong>10 ≤ iOS ≤ 16:</strong> NSRemindersUsageDescription</li>
|
|
43
|
-
* </ul>
|
|
44
|
-
*/
|
|
45
|
-
READ_REMINDERS = "readReminders",
|
|
46
|
-
/**
|
|
47
|
-
* Represents the permission state for writing reminders.
|
|
48
|
-
*
|
|
49
|
-
* @platform iOS
|
|
50
|
-
* @permissions
|
|
51
|
-
* <h3>Manifest Permissions:</h3>
|
|
52
|
-
* <ul>
|
|
53
|
-
* <li><strong>iOS 17 ≤:</strong> NSRemindersFullAccessUsageDescription</li>
|
|
54
|
-
* <li><strong>13 ≤ iOS ≤ 16:</strong> NSRemindersUsageDescription</li>
|
|
55
|
-
* </ul>
|
|
56
|
-
*/
|
|
57
|
-
WRITE_REMINDERS = "writeReminders"
|
|
58
|
-
}
|