@ebarooni/capacitor-calendar 0.4.0 → 0.5.1

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 +96 -25
  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/dist/docs.json CHANGED
@@ -7,12 +7,12 @@
7
7
  "methods": [
8
8
  {
9
9
  "name": "checkPermission",
10
- "signature": "(options: { alias: keyof CalendarPermissionStatus; }) => Promise<{ result: PermissionState; }>",
10
+ "signature": "(options: { alias: PluginPermission; }) => Promise<{ result: PermissionState; }>",
11
11
  "parameters": [
12
12
  {
13
13
  "name": "options",
14
14
  "docs": "An object with the name of the permission",
15
- "type": "{ alias: keyof CalendarPermissionStatus; }"
15
+ "type": "{ alias: PluginPermission; }"
16
16
  }
17
17
  ],
18
18
  "returns": "Promise<{ result: PermissionState; }>",
@@ -20,6 +20,10 @@
20
20
  {
21
21
  "name": "method"
22
22
  },
23
+ {
24
+ "name": "platform",
25
+ "text": "iOS, Android"
26
+ },
23
27
  {
24
28
  "name": "param",
25
29
  "text": "options An object with the name of the permission"
@@ -36,22 +40,26 @@
36
40
  "docs": "Checks the current authorization status of a specific permission.",
37
41
  "complexTypes": [
38
42
  "PermissionState",
39
- "CalendarPermissionStatus"
43
+ "PluginPermission"
40
44
  ],
41
45
  "slug": "checkpermission"
42
46
  },
43
47
  {
44
48
  "name": "checkAllPermissions",
45
- "signature": "() => Promise<CalendarPermissionStatus>",
49
+ "signature": "() => Promise<PluginPermissionsMap>",
46
50
  "parameters": [],
47
- "returns": "Promise<CalendarPermissionStatus>",
51
+ "returns": "Promise<PluginPermissionsMap>",
48
52
  "tags": [
49
53
  {
50
54
  "name": "method"
51
55
  },
56
+ {
57
+ "name": "platform",
58
+ "text": "iOS, Android"
59
+ },
52
60
  {
53
61
  "name": "returns",
54
- "text": ";CalendarPermissionStatus&gt;} – A promise that resolves with an object containing all the permissions and their status."
62
+ "text": ";PluginPermissionsMap&gt;} – A promise that resolves with an object containing all the permissions and their status."
55
63
  },
56
64
  {
57
65
  "name": "example",
@@ -60,18 +68,18 @@
60
68
  ],
61
69
  "docs": "Checks the current authorization status of all the required permissions for the plugin.",
62
70
  "complexTypes": [
63
- "CalendarPermissionStatus"
71
+ "PluginPermissionsMap"
64
72
  ],
65
73
  "slug": "checkallpermissions"
66
74
  },
67
75
  {
68
76
  "name": "requestPermission",
69
- "signature": "(options: { alias: keyof CalendarPermissionStatus; }) => Promise<{ result: PermissionState; }>",
77
+ "signature": "(options: { alias: PluginPermission; }) => Promise<{ result: PermissionState; }>",
70
78
  "parameters": [
71
79
  {
72
80
  "name": "options",
73
81
  "docs": "An object with the name of the permission",
74
- "type": "{ alias: keyof CalendarPermissionStatus; }"
82
+ "type": "{ alias: PluginPermission; }"
75
83
  }
76
84
  ],
77
85
  "returns": "Promise<{ result: PermissionState; }>",
@@ -79,6 +87,10 @@
79
87
  {
80
88
  "name": "method"
81
89
  },
90
+ {
91
+ "name": "platform",
92
+ "text": "iOS, Android"
93
+ },
82
94
  {
83
95
  "name": "param",
84
96
  "text": "options An object with the name of the permission"
@@ -95,22 +107,26 @@
95
107
  "docs": "Requests authorization to a specific permission, if not already granted.\nIf the permission is already granted, it will directly return the status.",
96
108
  "complexTypes": [
97
109
  "PermissionState",
98
- "CalendarPermissionStatus"
110
+ "PluginPermission"
99
111
  ],
100
112
  "slug": "requestpermission"
101
113
  },
102
114
  {
103
115
  "name": "requestAllPermissions",
104
- "signature": "() => Promise<CalendarPermissionStatus>",
116
+ "signature": "() => Promise<PluginPermissionsMap>",
105
117
  "parameters": [],
106
- "returns": "Promise<CalendarPermissionStatus>",
118
+ "returns": "Promise<PluginPermissionsMap>",
107
119
  "tags": [
108
120
  {
109
121
  "name": "method"
110
122
  },
123
+ {
124
+ "name": "platform",
125
+ "text": "iOS, Android"
126
+ },
111
127
  {
112
128
  "name": "returns",
113
- "text": ";CalendarPermissionStatus&gt;} – A promise that resolves with the new permission statuses after the request is made."
129
+ "text": ";PluginPermissionsMap&gt;} – A promise that resolves with the new permission statuses after the request is made."
114
130
  },
115
131
  {
116
132
  "name": "example",
@@ -119,7 +135,7 @@
119
135
  ],
120
136
  "docs": "Requests authorization to all the required permissions for the plugin, if they have not already been granted.",
121
137
  "complexTypes": [
122
- "CalendarPermissionStatus"
138
+ "PluginPermissionsMap"
123
139
  ],
124
140
  "slug": "requestallpermissions"
125
141
  },
@@ -132,6 +148,10 @@
132
148
  {
133
149
  "name": "method"
134
150
  },
151
+ {
152
+ "name": "platform",
153
+ "text": "iOS, Android"
154
+ },
135
155
  {
136
156
  "name": "returns",
137
157
  "text": ";{ eventCreated: boolean }&gt;} – A promise that resolves with the result of the action."
@@ -161,6 +181,10 @@
161
181
  "name": "method",
162
182
  "text": "selectCalendarsWithPrompt"
163
183
  },
184
+ {
185
+ "name": "platform",
186
+ "text": "iOS"
187
+ },
164
188
  {
165
189
  "name": "param",
166
190
  "text": "options - Options for customizing the display and selection styles of the calendar chooser."
@@ -198,6 +222,10 @@
198
222
  "name": "method",
199
223
  "text": "listCalendars"
200
224
  },
225
+ {
226
+ "name": "platform",
227
+ "text": "iOS, Android"
228
+ },
201
229
  {
202
230
  "name": "returns",
203
231
  "text": "A promise that resolves with an array of calendars available on the device.\nEach calendar object in the array contains an ID and a title."
@@ -223,6 +251,10 @@
223
251
  "name": "method",
224
252
  "text": "getDefaultCalendar"
225
253
  },
254
+ {
255
+ "name": "platform",
256
+ "text": "iOS, Android"
257
+ },
226
258
  {
227
259
  "name": "returns",
228
260
  "text": "A promise that resolves with the default calendar set on the device.\nThe returned calendar object contains an ID and a title."
@@ -254,6 +286,10 @@
254
286
  "name": "method",
255
287
  "text": "createEvent"
256
288
  },
289
+ {
290
+ "name": "platform",
291
+ "text": "iOS, Android"
292
+ },
257
293
  {
258
294
  "name": "param",
259
295
  "text": "options - Options for creating the event."
@@ -272,41 +308,118 @@
272
308
  "Date"
273
309
  ],
274
310
  "slug": "createevent"
311
+ },
312
+ {
313
+ "name": "getDefaultRemindersList",
314
+ "signature": "() => Promise<{ result: RemindersList; }>",
315
+ "parameters": [],
316
+ "returns": "Promise<{ result: RemindersList; }>",
317
+ "tags": [
318
+ {
319
+ "name": "method",
320
+ "text": "getDefaultRemindersList"
321
+ },
322
+ {
323
+ "name": "platform",
324
+ "text": "iOS"
325
+ },
326
+ {
327
+ "name": "returns",
328
+ "text": "A promise that resolves with the default reminder list set on the device.\nThe returned reminders list object contains an ID and a title."
329
+ },
330
+ {
331
+ "name": "example",
332
+ "text": "const { result } = await getDefaultRemindersList();\nconsole.log(result); // { id: '1', title: 'Default Reminders List' }"
333
+ }
334
+ ],
335
+ "docs": "Retrieves the default reminders list set on the device.",
336
+ "complexTypes": [
337
+ "RemindersList"
338
+ ],
339
+ "slug": "getdefaultreminderslist"
340
+ },
341
+ {
342
+ "name": "getRemindersLists",
343
+ "signature": "() => Promise<{ result: RemindersList[]; }>",
344
+ "parameters": [],
345
+ "returns": "Promise<{ result: RemindersList[]; }>",
346
+ "tags": [
347
+ {
348
+ "name": "async"
349
+ },
350
+ {
351
+ "name": "method",
352
+ "text": "getRemindersLists"
353
+ },
354
+ {
355
+ "name": "platform",
356
+ "text": "iOS"
357
+ },
358
+ {
359
+ "name": "returns",
360
+ "text": "A promise that resolves with an array of reminders lists available on the device.\nEach reminders list object in the array contains an ID and a title."
361
+ },
362
+ {
363
+ "name": "example",
364
+ "text": "const { result } = await getRemindersLists();\nconsole.log(result); // [{ id: '1', title: 'Groceries' }, { id: '2', title: 'Subscriptions' }]"
365
+ }
366
+ ],
367
+ "docs": "Retrieves all available reminders lists on the device.",
368
+ "complexTypes": [
369
+ "RemindersList"
370
+ ],
371
+ "slug": "getreminderslists"
372
+ },
373
+ {
374
+ "name": "createReminder",
375
+ "signature": "(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; }>",
376
+ "parameters": [
377
+ {
378
+ "name": "options",
379
+ "docs": "- Options for creating the reminder.",
380
+ "type": "{ title: string; listId?: string | undefined; priority?: number | undefined; isCompleted?: boolean | undefined; startDate?: number | undefined; dueDate?: number | undefined; completionDate?: number | undefined; notes?: string | undefined; url?: string | undefined; location?: string | undefined; recurrence?: ReminderRecurrenceRule | undefined; }"
381
+ }
382
+ ],
383
+ "returns": "Promise<{ reminderCreated: boolean; }>",
384
+ "tags": [
385
+ {
386
+ "name": "method",
387
+ "text": "createReminder"
388
+ },
389
+ {
390
+ "name": "platform",
391
+ "text": "iOS"
392
+ },
393
+ {
394
+ "name": "param",
395
+ "text": "options - Options for creating the reminder."
396
+ },
397
+ {
398
+ "name": "returns",
399
+ "text": "A Promise that resolves with an object indicating whether the reminder was created successfully.\nThe resolved object has a property 'reminderCreated' which is a boolean value representing whether the reminder was created."
400
+ },
401
+ {
402
+ "name": "example",
403
+ "text": "const now = Date.now();\nconst rules: ReminderRecurrenceRule = {\n frequency: ReminderRecurrenceFrequency.MONTHLY,\n interval: 10,\n end: Date.now()\n}\nconst reminderOptions = {\n title: 'Buy cucumber',\n listId: 'ABC12',\n priority: 5,\n isCompleted: false,\n startDateComponents: now,\n notes: 'Also buy tomatoes',\n url: 'https://capacitor-calendar.pages.dev/',\n location: 'My Local Supermarket',\n recurrence: rules\n};\nconst { reminderCreated } = await createReminder(reminderOptions);\nconsole.log(reminderCreated); // true"
404
+ }
405
+ ],
406
+ "docs": "Creates a reminder with the provided options.",
407
+ "complexTypes": [
408
+ "ReminderRecurrenceRule"
409
+ ],
410
+ "slug": "createreminder"
275
411
  }
276
412
  ],
277
413
  "properties": []
278
414
  },
279
415
  "interfaces": [
280
416
  {
281
- "name": "CalendarPermissionStatus",
282
- "slug": "calendarpermissionstatus",
283
- "docs": "Describes the permission status for reading from the calendar.",
284
- "tags": [
285
- {
286
- "name": "interface"
287
- }
288
- ],
417
+ "name": "PluginPermissionsMap",
418
+ "slug": "pluginpermissionsmap",
419
+ "docs": "",
420
+ "tags": [],
289
421
  "methods": [],
290
- "properties": [
291
- {
292
- "name": "readCalendar",
293
- "tags": [],
294
- "docs": "",
295
- "complexTypes": [
296
- "PermissionState"
297
- ],
298
- "type": "PermissionState"
299
- },
300
- {
301
- "name": "writeCalendar",
302
- "tags": [],
303
- "docs": "",
304
- "complexTypes": [
305
- "PermissionState"
306
- ],
307
- "type": "PermissionState"
308
- }
309
- ]
422
+ "properties": []
310
423
  },
311
424
  {
312
425
  "name": "Calendar",
@@ -317,6 +430,10 @@
317
430
  "text": "Calendar",
318
431
  "name": "interface"
319
432
  },
433
+ {
434
+ "text": "iOS, Android",
435
+ "name": "platform"
436
+ },
320
437
  {
321
438
  "text": "{string} id - The unique identifier of the calendar.",
322
439
  "name": "property"
@@ -1115,9 +1232,114 @@
1115
1232
  }
1116
1233
  ],
1117
1234
  "properties": []
1235
+ },
1236
+ {
1237
+ "name": "RemindersList",
1238
+ "slug": "reminderslist",
1239
+ "docs": "",
1240
+ "tags": [],
1241
+ "methods": [],
1242
+ "properties": []
1243
+ },
1244
+ {
1245
+ "name": "ReminderRecurrenceRule",
1246
+ "slug": "reminderrecurrencerule",
1247
+ "docs": "",
1248
+ "tags": [],
1249
+ "methods": [],
1250
+ "properties": [
1251
+ {
1252
+ "name": "frequency",
1253
+ "tags": [
1254
+ {
1255
+ "text": "// if frequency is set to weekly, the reminder will repeat on a weekly basis.\nconst rules: ReminderRecurrenceRule = {\n frequency: ReminderRecurrenceFrequency.WEEKLY,\n interval: 1,\n}",
1256
+ "name": "example"
1257
+ }
1258
+ ],
1259
+ "docs": "How frequent should the reminder repeat.",
1260
+ "complexTypes": [
1261
+ "ReminderRecurrenceFrequency"
1262
+ ],
1263
+ "type": "ReminderRecurrenceFrequency"
1264
+ },
1265
+ {
1266
+ "name": "interval",
1267
+ "tags": [
1268
+ {
1269
+ "text": "// if interval is set to 2 and frequency is set to daily, the reminder will repeat every 2 days.\nconst rules: ReminderRecurrenceRule = {\n frequency: ReminderRecurrenceFrequency.DAILY,\n interval: 2,\n}",
1270
+ "name": "example"
1271
+ }
1272
+ ],
1273
+ "docs": "The interval should be a number greater than 0. For values lower than 1 the method will throw an error.",
1274
+ "complexTypes": [],
1275
+ "type": "number"
1276
+ },
1277
+ {
1278
+ "name": "end",
1279
+ "tags": [
1280
+ {
1281
+ "text": "const rules: ReminderRecurrenceRule = {\n frequency: ReminderRecurrenceFrequency.MONTHLY,\n interval: 10,\n end: Date.now()\n}",
1282
+ "name": "example"
1283
+ }
1284
+ ],
1285
+ "docs": "When provided, the reminder will stop repeating at the given time.",
1286
+ "complexTypes": [],
1287
+ "type": "number | undefined"
1288
+ }
1289
+ ]
1118
1290
  }
1119
1291
  ],
1120
1292
  "enums": [
1293
+ {
1294
+ "name": "PluginPermission",
1295
+ "slug": "pluginpermission",
1296
+ "members": [
1297
+ {
1298
+ "name": "READ_CALENDAR",
1299
+ "value": "'readCalendar'",
1300
+ "tags": [
1301
+ {
1302
+ "text": "iOS, Android",
1303
+ "name": "platform"
1304
+ }
1305
+ ],
1306
+ "docs": "Represents the permission state for reading calendar."
1307
+ },
1308
+ {
1309
+ "name": "WRITE_CALENDAR",
1310
+ "value": "'writeCalendar'",
1311
+ "tags": [
1312
+ {
1313
+ "text": "iOS, Android",
1314
+ "name": "platform"
1315
+ }
1316
+ ],
1317
+ "docs": "Represents the permission state for writing calendar."
1318
+ },
1319
+ {
1320
+ "name": "READ_REMINDERS",
1321
+ "value": "'readReminders'",
1322
+ "tags": [
1323
+ {
1324
+ "text": "iOS",
1325
+ "name": "platform"
1326
+ }
1327
+ ],
1328
+ "docs": "Represents the permission state for reading reminders."
1329
+ },
1330
+ {
1331
+ "name": "WRITE_REMINDERS",
1332
+ "value": "'writeReminders'",
1333
+ "tags": [
1334
+ {
1335
+ "text": "iOS",
1336
+ "name": "platform"
1337
+ }
1338
+ ],
1339
+ "docs": "Represents the permission state for writing reminders."
1340
+ }
1341
+ ]
1342
+ },
1121
1343
  {
1122
1344
  "name": "CalendarChooserDisplayStyle",
1123
1345
  "slug": "calendarchooserdisplaystyle",
@@ -1149,6 +1371,32 @@
1149
1371
  "docs": "Allows multiple selections in the calendar chooser."
1150
1372
  }
1151
1373
  ]
1374
+ },
1375
+ {
1376
+ "name": "ReminderRecurrenceFrequency",
1377
+ "slug": "reminderrecurrencefrequency",
1378
+ "members": [
1379
+ {
1380
+ "name": "DAILY",
1381
+ "tags": [],
1382
+ "docs": ""
1383
+ },
1384
+ {
1385
+ "name": "WEEKLY",
1386
+ "tags": [],
1387
+ "docs": ""
1388
+ },
1389
+ {
1390
+ "name": "MONTHLY",
1391
+ "tags": [],
1392
+ "docs": ""
1393
+ },
1394
+ {
1395
+ "name": "YEARLY",
1396
+ "tags": [],
1397
+ "docs": ""
1398
+ }
1399
+ ]
1152
1400
  }
1153
1401
  ],
1154
1402
  "typeAliases": [