@ebarooni/capacitor-calendar 0.4.0 → 0.5.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 (45) hide show
  1. package/README.md +95 -24
  2. package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +18 -0
  3. package/dist/docs.json +290 -42
  4. package/dist/esm/definitions.d.ts +108 -55
  5. package/dist/esm/definitions.js +1 -31
  6. package/dist/esm/definitions.js.map +1 -1
  7. package/dist/esm/index.d.ts +10 -1
  8. package/dist/esm/index.js +5 -1
  9. package/dist/esm/index.js.map +1 -1
  10. package/dist/esm/schemas/enums/calendar-chooser-display-style.d.ts +15 -0
  11. package/dist/esm/schemas/enums/calendar-chooser-display-style.js +17 -0
  12. package/dist/esm/schemas/enums/calendar-chooser-display-style.js.map +1 -0
  13. package/dist/esm/schemas/enums/calendar-chooser-selection-style.d.ts +15 -0
  14. package/dist/esm/schemas/enums/calendar-chooser-selection-style.js +17 -0
  15. package/dist/esm/schemas/enums/calendar-chooser-selection-style.js.map +1 -0
  16. package/dist/esm/schemas/enums/plugin-permission.d.ts +22 -0
  17. package/dist/esm/schemas/enums/plugin-permission.js +24 -0
  18. package/dist/esm/schemas/enums/plugin-permission.js.map +1 -0
  19. package/dist/esm/schemas/enums/reminder-recurrence-frequency.d.ts +6 -0
  20. package/dist/esm/schemas/enums/reminder-recurrence-frequency.js +8 -0
  21. package/dist/esm/schemas/enums/reminder-recurrence-frequency.js.map +1 -0
  22. package/dist/esm/schemas/interfaces/calendar.d.ts +12 -0
  23. package/dist/esm/schemas/interfaces/calendar.js +2 -0
  24. package/dist/esm/schemas/interfaces/calendar.js.map +1 -0
  25. package/dist/esm/schemas/interfaces/plugin-permissions-map.d.ts +4 -0
  26. package/dist/esm/schemas/interfaces/plugin-permissions-map.js +2 -0
  27. package/dist/esm/schemas/interfaces/plugin-permissions-map.js.map +1 -0
  28. package/dist/esm/schemas/interfaces/reminder-recurrence-rule.d.ts +36 -0
  29. package/dist/esm/schemas/interfaces/reminder-recurrence-rule.js +2 -0
  30. package/dist/esm/schemas/interfaces/reminder-recurrence-rule.js.map +1 -0
  31. package/dist/esm/schemas/interfaces/reminders-list.d.ts +3 -0
  32. package/dist/esm/schemas/interfaces/reminders-list.js +2 -0
  33. package/dist/esm/schemas/interfaces/reminders-list.js.map +1 -0
  34. package/dist/esm/web.d.ts +31 -5
  35. package/dist/esm/web.js +9 -0
  36. package/dist/esm/web.js.map +1 -1
  37. package/dist/plugin.cjs.js +55 -14
  38. package/dist/plugin.cjs.js.map +1 -1
  39. package/dist/plugin.js +55 -14
  40. package/dist/plugin.js.map +1 -1
  41. package/ios/Plugin/CapacitorCalendarPlugin.m +3 -0
  42. package/ios/Plugin/CapacitorCalendarPlugin.swift +104 -23
  43. package/ios/Plugin/CapacitorReminders.swift +177 -0
  44. package/package.json +4 -4
  45. package/ios/Plugin/Calendar.swift +0 -14
package/README.md CHANGED
@@ -1,9 +1,7 @@
1
1
  <h1 align="center">CapacitorCalendar</h1>
2
2
  <p align="center">
3
3
  <em>
4
- This CapacitorJS plugin simplifies the process of managing calendar events within your hybrid mobile applications.
5
- With CRUD functionalities (Create, Read, Update, Delete), you can seamlessly interact with the device's native
6
- calendar directly from your app.
4
+ The Capacitor Calendar Plugin enables full calendar functionality on iOS and Android, with added reminder support for iOS devices.
7
5
  </em>
8
6
  </p>
9
7
  <p align="center">
@@ -41,7 +39,9 @@ npx cap sync
41
39
  |:--------------------------------------:|:------------------------------------------:|
42
40
  | ![](./example/src/assets/ios-demo.gif) | ![](./example/src/assets/android-demo.gif) |
43
41
 
44
- On iOS, `readCalendar` permission is not needed when you are creating an event using the native prompt.
42
+ On iOS, `readCalendar` permission is not needed when you a
43
+
44
+ re creating an event using the native prompt.
45
45
  The video is just for showing the functionality, otherwise the `createEventWithPrompt` method works without the `readCalendar` authorization.
46
46
 
47
47
  ## MVP
@@ -49,7 +49,7 @@ The video is just for showing the functionality, otherwise the `createEventWithP
49
49
  - ✅ Choose calendars with prompt (only supported on iOS)
50
50
  - ✅ Get list of available calendars
51
51
  - ✅ Get default calendar
52
- - ⌛ Create calendar events without native prompts
52
+ - ✅ Create calendar events without native prompts
53
53
  - ⌛️ Create reminders (only supported on iOS)
54
54
  - ⌛️ Find calendar events
55
55
  - ⌛️ Delete calendar events
@@ -75,6 +75,9 @@ permissions can be found below:
75
75
  * [`listCalendars()`](#listcalendars)
76
76
  * [`getDefaultCalendar()`](#getdefaultcalendar)
77
77
  * [`createEvent(...)`](#createevent)
78
+ * [`getDefaultRemindersList()`](#getdefaultreminderslist)
79
+ * [`getRemindersLists()`](#getreminderslists)
80
+ * [`createReminder(...)`](#createreminder)
78
81
  * [Interfaces](#interfaces)
79
82
  * [Type Aliases](#type-aliases)
80
83
  * [Enums](#enums)
@@ -87,14 +90,14 @@ permissions can be found below:
87
90
  ### checkPermission(...)
88
91
 
89
92
  ```typescript
90
- checkPermission(options: { alias: keyof CalendarPermissionStatus; }) => Promise<{ result: PermissionState; }>
93
+ checkPermission(options: { alias: PluginPermission; }) => Promise<{ result: PermissionState; }>
91
94
  ```
92
95
 
93
96
  Checks the current authorization status of a specific permission.
94
97
 
95
- | Param | Type | Description |
96
- | ------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------- |
97
- | **`options`** | <code>{ alias: keyof <a href="#calendarpermissionstatus">CalendarPermissionStatus</a>; }</code> | An object with the name of the permission |
98
+ | Param | Type | Description |
99
+ | ------------- | ------------------------------------------------------------------------- | ----------------------------------------- |
100
+ | **`options`** | <code>{ alias: <a href="#pluginpermission">PluginPermission</a>; }</code> | An object with the name of the permission |
98
101
 
99
102
  **Returns:** <code>Promise&lt;{ result: <a href="#permissionstate">PermissionState</a>; }&gt;</code>
100
103
 
@@ -104,12 +107,12 @@ Checks the current authorization status of a specific permission.
104
107
  ### checkAllPermissions()
105
108
 
106
109
  ```typescript
107
- checkAllPermissions() => Promise<CalendarPermissionStatus>
110
+ checkAllPermissions() => Promise<PluginPermissionsMap>
108
111
  ```
109
112
 
110
113
  Checks the current authorization status of all the required permissions for the plugin.
111
114
 
112
- **Returns:** <code>Promise&lt;<a href="#calendarpermissionstatus">CalendarPermissionStatus</a>&gt;</code>
115
+ **Returns:** <code>Promise&lt;<a href="#pluginpermissionsmap">PluginPermissionsMap</a>&gt;</code>
113
116
 
114
117
  --------------------
115
118
 
@@ -117,15 +120,15 @@ Checks the current authorization status of all the required permissions for the
117
120
  ### requestPermission(...)
118
121
 
119
122
  ```typescript
120
- requestPermission(options: { alias: keyof CalendarPermissionStatus; }) => Promise<{ result: PermissionState; }>
123
+ requestPermission(options: { alias: PluginPermission; }) => Promise<{ result: PermissionState; }>
121
124
  ```
122
125
 
123
126
  Requests authorization to a specific permission, if not already granted.
124
127
  If the permission is already granted, it will directly return the status.
125
128
 
126
- | Param | Type | Description |
127
- | ------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------- |
128
- | **`options`** | <code>{ alias: keyof <a href="#calendarpermissionstatus">CalendarPermissionStatus</a>; }</code> | An object with the name of the permission |
129
+ | Param | Type | Description |
130
+ | ------------- | ------------------------------------------------------------------------- | ----------------------------------------- |
131
+ | **`options`** | <code>{ alias: <a href="#pluginpermission">PluginPermission</a>; }</code> | An object with the name of the permission |
129
132
 
130
133
  **Returns:** <code>Promise&lt;{ result: <a href="#permissionstate">PermissionState</a>; }&gt;</code>
131
134
 
@@ -135,12 +138,12 @@ If the permission is already granted, it will directly return the status.
135
138
  ### requestAllPermissions()
136
139
 
137
140
  ```typescript
138
- requestAllPermissions() => Promise<CalendarPermissionStatus>
141
+ requestAllPermissions() => Promise<PluginPermissionsMap>
139
142
  ```
140
143
 
141
144
  Requests authorization to all the required permissions for the plugin, if they have not already been granted.
142
145
 
143
- **Returns:** <code>Promise&lt;<a href="#calendarpermissionstatus">CalendarPermissionStatus</a>&gt;</code>
146
+ **Returns:** <code>Promise&lt;<a href="#pluginpermissionsmap">PluginPermissionsMap</a>&gt;</code>
144
147
 
145
148
  --------------------
146
149
 
@@ -221,17 +224,53 @@ Creates an event with the provided options.
221
224
  --------------------
222
225
 
223
226
 
224
- ### Interfaces
227
+ ### getDefaultRemindersList()
228
+
229
+ ```typescript
230
+ getDefaultRemindersList() => Promise<{ result: RemindersList; }>
231
+ ```
232
+
233
+ Retrieves the default reminders list set on the device.
234
+
235
+ **Returns:** <code>Promise&lt;{ result: <a href="#reminderslist">RemindersList</a>; }&gt;</code>
236
+
237
+ --------------------
238
+
239
+
240
+ ### getRemindersLists()
241
+
242
+ ```typescript
243
+ getRemindersLists() => Promise<{ result: RemindersList[]; }>
244
+ ```
245
+
246
+ Retrieves all available reminders lists on the device.
247
+
248
+ **Returns:** <code>Promise&lt;{ result: RemindersList[]; }&gt;</code>
249
+
250
+ --------------------
251
+
252
+
253
+ ### createReminder(...)
225
254
 
255
+ ```typescript
256
+ createReminder(options: { title: string; listId?: string; priority?: number; isCompleted?: boolean; startDate?: number; dueDate?: number; completionDate?: number; notes?: string; url?: string; location?: string; recurrence?: ReminderRecurrenceRule; }) => Promise<{ reminderCreated: boolean; }>
257
+ ```
258
+
259
+ Creates a reminder with the provided options.
260
+
261
+ | Param | Type | Description |
262
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
263
+ | **`options`** | <code>{ title: string; listId?: string; priority?: number; isCompleted?: boolean; startDate?: number; dueDate?: number; completionDate?: number; notes?: string; url?: string; location?: string; recurrence?: <a href="#reminderrecurrencerule">ReminderRecurrenceRule</a>; }</code> | - Options for creating the reminder. |
264
+
265
+ **Returns:** <code>Promise&lt;{ reminderCreated: boolean; }&gt;</code>
266
+
267
+ --------------------
226
268
 
227
- #### CalendarPermissionStatus
228
269
 
229
- Describes the permission status for reading from the calendar.
270
+ ### Interfaces
230
271
 
231
- | Prop | Type |
232
- | ------------------- | ----------------------------------------------------------- |
233
- | **`readCalendar`** | <code><a href="#permissionstate">PermissionState</a></code> |
234
- | **`writeCalendar`** | <code><a href="#permissionstate">PermissionState</a></code> |
272
+
273
+ #### PluginPermissionsMap
235
274
 
236
275
 
237
276
  #### Calendar
@@ -295,6 +334,18 @@ Enables basic storage and retrieval of dates and times.
295
334
  | **toJSON** | (key?: any) =&gt; string | Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. |
296
335
 
297
336
 
337
+ #### RemindersList
338
+
339
+
340
+ #### ReminderRecurrenceRule
341
+
342
+ | Prop | Type | Description |
343
+ | --------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
344
+ | **`frequency`** | <code><a href="#reminderrecurrencefrequency">ReminderRecurrenceFrequency</a></code> | How frequent should the reminder repeat. |
345
+ | **`interval`** | <code>number</code> | The interval should be a number greater than 0. For values lower than 1 the method will throw an error. |
346
+ | **`end`** | <code>number</code> | When provided, the reminder will stop repeating at the given time. |
347
+
348
+
298
349
  ### Type Aliases
299
350
 
300
351
 
@@ -306,6 +357,16 @@ Enables basic storage and retrieval of dates and times.
306
357
  ### Enums
307
358
 
308
359
 
360
+ #### PluginPermission
361
+
362
+ | Members | Value | Description |
363
+ | --------------------- | ----------------------------- | ------------------------------------------------------ |
364
+ | **`READ_CALENDAR`** | <code>'readCalendar'</code> | Represents the permission state for reading calendar. |
365
+ | **`WRITE_CALENDAR`** | <code>'writeCalendar'</code> | Represents the permission state for writing calendar. |
366
+ | **`READ_REMINDERS`** | <code>'readReminders'</code> | Represents the permission state for reading reminders. |
367
+ | **`WRITE_REMINDERS`** | <code>'writeReminders'</code> | Represents the permission state for writing reminders. |
368
+
369
+
309
370
  #### CalendarChooserDisplayStyle
310
371
 
311
372
  | Members | Description |
@@ -321,4 +382,14 @@ Enables basic storage and retrieval of dates and times.
321
382
  | **`SINGLE`** | Allows only a single selection in the calendar chooser. |
322
383
  | **`MULTIPLE`** | Allows multiple selections in the calendar chooser. |
323
384
 
385
+
386
+ #### ReminderRecurrenceFrequency
387
+
388
+ | Members |
389
+ | ------------- |
390
+ | **`DAILY`** |
391
+ | **`WEEKLY`** |
392
+ | **`MONTHLY`** |
393
+ | **`YEARLY`** |
394
+
324
395
  </docgen-api>
@@ -183,4 +183,22 @@ class CapacitorCalendarPlugin: Plugin() {
183
183
  return
184
184
  }
185
185
  }
186
+
187
+ @PluginMethod
188
+ fun getDefaultRemindersList(call: PluginCall) {
189
+ call.unimplemented("[CapacitorCalendar.${::getDefaultRemindersList.name}] Not implemented on Android")
190
+ return
191
+ }
192
+
193
+ @PluginMethod
194
+ fun getRemindersLists(call: PluginCall) {
195
+ call.unimplemented("[CapacitorCalendar.${::getRemindersLists.name}] Not implemented on Android")
196
+ return
197
+ }
198
+
199
+ @PluginMethod
200
+ fun createReminder(call: PluginCall) {
201
+ call.unimplemented("[CapacitorCalendar.${::createReminder.name}] Not implemented on Android")
202
+ return
203
+ }
186
204
  }