@ebarooni/capacitor-calendar 6.1.0 → 6.3.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/README.md CHANGED
@@ -36,8 +36,17 @@
36
36
 
37
37
  ## Install
38
38
 
39
+ ### Capacitor 6
40
+
41
+ ```bash
42
+ npm install @ebarooni/capacitor-calendar@latest
43
+ npx cap sync
44
+ ```
45
+
46
+ ### Capacitor 5
47
+
39
48
  ```bash
40
- npm install @ebarooni/capacitor-calendar
49
+ npm install @ebarooni/capacitor-calendar@^5
41
50
  npx cap sync
42
51
  ```
43
52
 
@@ -62,28 +71,39 @@ permissions can be found below:
62
71
 
63
72
  ## 📋 API
64
73
 
65
- - `checkPermission(...)`
66
- - `checkAllPermissions()`
67
- - `requestPermission(...)`
68
- - `requestAllPermissions()`
69
- - `createEventWithPrompt()`
70
- - `selectCalendarsWithPrompt(...)`
71
- - `listCalendars()`
72
- - `getDefaultCalendar()`
73
- - `createEvent(...)`
74
- - `getDefaultRemindersList()`
75
- - `getRemindersLists()`
76
- - `createReminder(...)`
77
- - `openCalendar(...)`
78
- - `openReminders()`
79
- - `listEventsInRange(...)`
80
- - `deleteEventsById(...)`
74
+ <docgen-index>
75
+
76
+ * [`checkPermission(...)`](#checkpermission)
77
+ * [`checkAllPermissions()`](#checkallpermissions)
78
+ * [`requestPermission(...)`](#requestpermission)
79
+ * [`requestAllPermissions()`](#requestallpermissions)
80
+ * [`createEventWithPrompt(...)`](#createeventwithprompt)
81
+ * [`selectCalendarsWithPrompt(...)`](#selectcalendarswithprompt)
82
+ * [`listCalendars()`](#listcalendars)
83
+ * [`getDefaultCalendar()`](#getdefaultcalendar)
84
+ * [`createEvent(...)`](#createevent)
85
+ * [`getDefaultRemindersList()`](#getdefaultreminderslist)
86
+ * [`getRemindersLists()`](#getreminderslists)
87
+ * [`createReminder(...)`](#createreminder)
88
+ * [`openCalendar(...)`](#opencalendar)
89
+ * [`openReminders()`](#openreminders)
90
+ * [`listEventsInRange(...)`](#listeventsinrange)
91
+ * [`deleteEventsById(...)`](#deleteeventsbyid)
92
+ * [`createCalendar(...)`](#createcalendar)
93
+ * [`deleteCalendar(...)`](#deletecalendar)
94
+ * [`getRemindersFromLists(...)`](#getremindersfromlists)
95
+ * [`deleteRemindersById(...)`](#deleteremindersbyid)
96
+ * [Interfaces](#interfaces)
97
+ * [Type Aliases](#type-aliases)
98
+ * [Enums](#enums)
99
+
100
+ </docgen-index>
81
101
 
82
102
  ## 📚 Documentation
83
103
 
84
104
  For detailed explanations, usage examples, and additional information:
85
105
 
86
- - **documentation.md**: Autogenerated doc are available in the [documentation](documentation.md) file.
106
+ - **documentation.md**: Autogenerated docs are available in the [documentation](documentation.md) file.
87
107
  - **definitions.ts**: Complete documentation with usage examples is available in the [src/definitions.ts](src/definitions.ts) file.
88
108
 
89
109
  ## 💙 Contributions
@@ -60,7 +60,7 @@ class CapacitorCalendar() {
60
60
  val title = cursor.getString(nameColumnIndex)
61
61
  val calendar =
62
62
  JSObject().apply {
63
- put("id", id)
63
+ put("id", "$id")
64
64
  put("title", title)
65
65
  }
66
66
 
@@ -51,9 +51,9 @@ class CapacitorCalendarPlugin : Plugin() {
51
51
  intent.putExtra(CalendarContract.Events.TITLE, title)
52
52
  calendarId?.let { intent.putExtra(CalendarContract.Events.CALENDAR_ID, it) }
53
53
  location?.let { intent.putExtra(CalendarContract.Events.EVENT_LOCATION, it) }
54
- startDate?.let { intent.putExtra(CalendarContract.Events.DTSTART, it) }
55
- endDate?.let { intent.putExtra(CalendarContract.Events.DTEND, it) }
56
- isAllDay?.let { intent.putExtra(CalendarContract.Events.ALL_DAY, if (it) 1 else 0) }
54
+ startDate?.let { intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, it) }
55
+ endDate?.let { intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, it) }
56
+ isAllDay?.let { intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, it) }
57
57
 
58
58
  return startActivityForResult(
59
59
  call,
@@ -279,4 +279,16 @@ class CapacitorCalendarPlugin : Plugin() {
279
279
  return
280
280
  }
281
281
  }
282
+
283
+ @PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
284
+ fun createCalendar(call: PluginCall) {
285
+ call.unimplemented("[CapacitorCalendar.${::createCalendar.name}] Not implemented on Android")
286
+ return
287
+ }
288
+
289
+ @PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
290
+ fun deleteCalendar(call: PluginCall) {
291
+ call.unimplemented("[CapacitorCalendar.${::deleteCalendar.name}] Not implemented on Android")
292
+ return
293
+ }
282
294
  }
package/dist/docs.json CHANGED
@@ -152,7 +152,8 @@
152
152
  "returns": "Promise<{ result: string[]; }>",
153
153
  "tags": [
154
154
  {
155
- "name": "method"
155
+ "name": "method",
156
+ "text": "createEventWithPrompt"
156
157
  },
157
158
  {
158
159
  "name": "since",
@@ -174,10 +175,6 @@
174
175
  "name": "returns",
175
176
  "text": "A promise that resolves with an array of the ids of created events."
176
177
  },
177
- {
178
- "name": "throws",
179
- "text": "Error If prompt gets cancelled."
180
- },
181
178
  {
182
179
  "name": "example",
183
180
  "text": "if (capacitor.getPlatform() === 'android') {\n await this.requestPermission({ alias: 'readCalendar' });\n { result } = result = await this.createEventWithPrompt({\n title: 'Title',\n alertOffsetInMinutes: 5,\n });\n} else {\n { result } = result = await this.createEventWithPrompt({\n title: 'Title',\n alertOffsetInMinutes: 5,\n });\n}"
@@ -203,16 +200,21 @@
203
200
  "name": "method",
204
201
  "text": "selectCalendarsWithPrompt"
205
202
  },
203
+ {
204
+ "name": "since",
205
+ "text": "0.2.0"
206
+ },
206
207
  {
207
208
  "name": "platform",
208
209
  "text": "iOS"
209
210
  },
210
211
  {
211
- "name": "param",
212
- "text": "options - Options for customizing the display and selection styles of the calendar chooser."
212
+ "name": "permissions",
213
+ "text": "<h3>Runtime Permissions:</h3>\n<ul>\n <li><strong>iOS:</strong> writeCalendar</li>\n</ul>"
213
214
  },
214
215
  {
215
- "name": "async"
216
+ "name": "param",
217
+ "text": "options - Options for customizing the display and selection styles of the calendar chooser."
216
218
  },
217
219
  {
218
220
  "name": "returns",
@@ -594,6 +596,184 @@
594
596
  "docs": "Deletes events from the calendar given their IDs.",
595
597
  "complexTypes": [],
596
598
  "slug": "deleteeventsbyid"
599
+ },
600
+ {
601
+ "name": "createCalendar",
602
+ "signature": "(options: { title: string; color?: string; }) => Promise<{ result: string; }>",
603
+ "parameters": [
604
+ {
605
+ "name": "options",
606
+ "docs": "Options for creating a calendar.",
607
+ "type": "{ title: string; color?: string | undefined; }"
608
+ }
609
+ ],
610
+ "returns": "Promise<{ result: string; }>",
611
+ "tags": [
612
+ {
613
+ "name": "method",
614
+ "text": "createCalendar"
615
+ },
616
+ {
617
+ "name": "since",
618
+ "text": "5.2.0"
619
+ },
620
+ {
621
+ "name": "platform",
622
+ "text": "iOS"
623
+ },
624
+ {
625
+ "name": "permissions",
626
+ "text": "<h3>Runtime Permissions:</h3>\n<ul>\n <li><strong>iOS:</strong> readCalendar, writeCalendar</li>\n</ul>"
627
+ },
628
+ {
629
+ "name": "param",
630
+ "text": "options Options for creating a calendar."
631
+ },
632
+ {
633
+ "name": "returns",
634
+ "text": "The id of the created calendar."
635
+ },
636
+ {
637
+ "name": "example",
638
+ "text": "{ result } = await CapacitorCalendar.createCalendar({\n title: 'New Calendar',\n color: '#1d00fc',\n });\n console.log(result); // 'CALENDAR_ID'"
639
+ }
640
+ ],
641
+ "docs": "Creates a calendar",
642
+ "complexTypes": [],
643
+ "slug": "createcalendar"
644
+ },
645
+ {
646
+ "name": "deleteCalendar",
647
+ "signature": "(options: { id: string; }) => Promise<void>",
648
+ "parameters": [
649
+ {
650
+ "name": "options",
651
+ "docs": "Options for deleting a calendar.",
652
+ "type": "{ id: string; }"
653
+ }
654
+ ],
655
+ "returns": "Promise<void>",
656
+ "tags": [
657
+ {
658
+ "name": "method",
659
+ "text": "deleteCalendar"
660
+ },
661
+ {
662
+ "name": "since",
663
+ "text": "5.2.0"
664
+ },
665
+ {
666
+ "name": "platform",
667
+ "text": "iOS"
668
+ },
669
+ {
670
+ "name": "permissions",
671
+ "text": "<h3>Runtime Permissions:</h3>\n<ul>\n <li><strong>iOS:</strong> readCalendar, writeCalendar</li>\n</ul>"
672
+ },
673
+ {
674
+ "name": "param",
675
+ "text": "options Options for deleting a calendar."
676
+ },
677
+ {
678
+ "name": "example",
679
+ "text": "await CapacitorCalendar.deleteCalendar({ id: 'ID_1' });"
680
+ }
681
+ ],
682
+ "docs": "Deletes a calendar by id",
683
+ "complexTypes": [],
684
+ "slug": "deletecalendar"
685
+ },
686
+ {
687
+ "name": "getRemindersFromLists",
688
+ "signature": "(options?: { listIds: string[]; } | undefined) => Promise<{ result: Reminder[]; }>",
689
+ "parameters": [
690
+ {
691
+ "name": "options",
692
+ "docs": "Options for defining the date range.\nIt Will fetch all reminders from all available lists if not provided. (Optional)",
693
+ "type": "{ listIds: string[]; } | undefined"
694
+ }
695
+ ],
696
+ "returns": "Promise<{ result: Reminder[]; }>",
697
+ "tags": [
698
+ {
699
+ "name": "method",
700
+ "text": "getRemindersFromLists"
701
+ },
702
+ {
703
+ "name": "since",
704
+ "text": "5.3.0"
705
+ },
706
+ {
707
+ "name": "platform",
708
+ "text": "iOS"
709
+ },
710
+ {
711
+ "name": "permissions",
712
+ "text": "<h3>Runtime Permissions:</h3>\n<ul>\n <li><strong>iOS:</strong> readReminders</li>\n</ul>"
713
+ },
714
+ {
715
+ "name": "param",
716
+ "text": "options Options for defining the date range.\nIt Will fetch all reminders from all available lists if not provided. (Optional)"
717
+ },
718
+ {
719
+ "name": "returns",
720
+ "text": "A Promise that resolves with the list of reminders."
721
+ },
722
+ {
723
+ "name": "example",
724
+ "text": "const now = Date.now();\nconst { result } = await CapacitorCalendar.getRemindersFromLists({\n listIds: ['LIST_ID_1', 'LIST_ID_2'],\n});"
725
+ }
726
+ ],
727
+ "docs": "Retrieves the list of reminders present in the given date range.",
728
+ "complexTypes": [
729
+ "Reminder"
730
+ ],
731
+ "slug": "getremindersfromlists"
732
+ },
733
+ {
734
+ "name": "deleteRemindersById",
735
+ "signature": "(options: { ids: string[]; }) => Promise<{ result: { deleted: string[]; failed: string[]; }; }>",
736
+ "parameters": [
737
+ {
738
+ "name": "options",
739
+ "docs": "Options for defining reminder IDs.",
740
+ "type": "{ ids: string[]; }"
741
+ }
742
+ ],
743
+ "returns": "Promise<{ result: { deleted: string[]; failed: string[]; }; }>",
744
+ "tags": [
745
+ {
746
+ "name": "method",
747
+ "text": "deleteRemindersById"
748
+ },
749
+ {
750
+ "name": "since",
751
+ "text": "5.3.0"
752
+ },
753
+ {
754
+ "name": "platform",
755
+ "text": "iOS"
756
+ },
757
+ {
758
+ "name": "permissions",
759
+ "text": "<h3>Runtime Permissions:</h3>\n<ul>\n <li><strong>iOS:</strong> writeReminders</li>\n</ul>"
760
+ },
761
+ {
762
+ "name": "param",
763
+ "text": "options Options for defining reminder IDs."
764
+ },
765
+ {
766
+ "name": "returns",
767
+ "text": "A promise that resolves to an object with two properties:\n - deleted: string[] - An array of IDs that were successfully deleted.\n - failed: string[] - An array of IDs that could not be deleted."
768
+ },
769
+ {
770
+ "name": "example",
771
+ "text": "const idsToDelete = ['ID_1', 'ID_2', 'ID_DOES_NOT_EXIST'];\nconst { result } = await CapacitorCalendar.deleteRemindersById(idsToDelete)\nconsole.log(result.deleted) // ['ID_1', 'ID_2']\nconsole.log(result.failed) // ['ID_DOES_NOT_EXIST']"
772
+ }
773
+ ],
774
+ "docs": "Deletes reminders given their IDs.",
775
+ "complexTypes": [],
776
+ "slug": "deleteremindersbyid"
597
777
  }
598
778
  ],
599
779
  "properties": []
@@ -923,6 +1103,210 @@
923
1103
  "type": "string"
924
1104
  }
925
1105
  ]
1106
+ },
1107
+ {
1108
+ "name": "Reminder",
1109
+ "slug": "reminder",
1110
+ "docs": "Represents a reminder in a reminders list.",
1111
+ "tags": [
1112
+ {
1113
+ "text": "Reminder",
1114
+ "name": "interface"
1115
+ },
1116
+ {
1117
+ "text": "{string} id The unique identifier of the reminder.",
1118
+ "name": "property"
1119
+ },
1120
+ {
1121
+ "text": "{string} title The title or name of the reminder. (Optional)",
1122
+ "name": "property"
1123
+ },
1124
+ {
1125
+ "text": "{string} listId The list that the reminder belongs to. (Optional)",
1126
+ "name": "property"
1127
+ },
1128
+ {
1129
+ "text": "{boolean} isCompleted Whether the reminder is completed already or not.",
1130
+ "name": "property"
1131
+ },
1132
+ {
1133
+ "text": "{number} priority The priority of the reminder. (Optional)",
1134
+ "name": "property"
1135
+ },
1136
+ {
1137
+ "text": "{string} notes The notes of the reminder. (Optional)",
1138
+ "name": "property"
1139
+ },
1140
+ {
1141
+ "text": "{string} url The url of the reminder. (Optional)",
1142
+ "name": "property"
1143
+ },
1144
+ {
1145
+ "text": "{number} startDate The start date of the reminder. (Optional)",
1146
+ "name": "property"
1147
+ },
1148
+ {
1149
+ "text": "{number} dueDate The due date of the reminder. (Optional)",
1150
+ "name": "property"
1151
+ },
1152
+ {
1153
+ "text": "{number} completionDate The completion date of the reminder. (Optional)",
1154
+ "name": "property"
1155
+ },
1156
+ {
1157
+ "text": "{ReminderRecurrenceRule[]} recurrence The recurrence rules of the reminder. (Optional)",
1158
+ "name": "property"
1159
+ }
1160
+ ],
1161
+ "methods": [],
1162
+ "properties": [
1163
+ {
1164
+ "name": "id",
1165
+ "tags": [
1166
+ {
1167
+ "text": "iOS",
1168
+ "name": "platform"
1169
+ }
1170
+ ],
1171
+ "docs": "",
1172
+ "complexTypes": [],
1173
+ "type": "string"
1174
+ },
1175
+ {
1176
+ "name": "title",
1177
+ "tags": [
1178
+ {
1179
+ "text": "iOS",
1180
+ "name": "platform"
1181
+ }
1182
+ ],
1183
+ "docs": "",
1184
+ "complexTypes": [],
1185
+ "type": "string | undefined"
1186
+ },
1187
+ {
1188
+ "name": "listId",
1189
+ "tags": [
1190
+ {
1191
+ "text": "iOS",
1192
+ "name": "platform"
1193
+ }
1194
+ ],
1195
+ "docs": "",
1196
+ "complexTypes": [],
1197
+ "type": "string | undefined"
1198
+ },
1199
+ {
1200
+ "name": "isCompleted",
1201
+ "tags": [
1202
+ {
1203
+ "text": "iOS",
1204
+ "name": "platform"
1205
+ }
1206
+ ],
1207
+ "docs": "",
1208
+ "complexTypes": [],
1209
+ "type": "boolean | undefined"
1210
+ },
1211
+ {
1212
+ "name": "priority",
1213
+ "tags": [
1214
+ {
1215
+ "text": "iOS",
1216
+ "name": "platform"
1217
+ }
1218
+ ],
1219
+ "docs": "",
1220
+ "complexTypes": [],
1221
+ "type": "number | undefined"
1222
+ },
1223
+ {
1224
+ "name": "notes",
1225
+ "tags": [
1226
+ {
1227
+ "text": "iOS",
1228
+ "name": "platform"
1229
+ }
1230
+ ],
1231
+ "docs": "",
1232
+ "complexTypes": [],
1233
+ "type": "string | undefined"
1234
+ },
1235
+ {
1236
+ "name": "location",
1237
+ "tags": [
1238
+ {
1239
+ "text": "iOS",
1240
+ "name": "platform"
1241
+ }
1242
+ ],
1243
+ "docs": "",
1244
+ "complexTypes": [],
1245
+ "type": "string | undefined"
1246
+ },
1247
+ {
1248
+ "name": "url",
1249
+ "tags": [
1250
+ {
1251
+ "text": "iOS",
1252
+ "name": "platform"
1253
+ }
1254
+ ],
1255
+ "docs": "",
1256
+ "complexTypes": [],
1257
+ "type": "string | undefined"
1258
+ },
1259
+ {
1260
+ "name": "startDate",
1261
+ "tags": [
1262
+ {
1263
+ "text": "iOS",
1264
+ "name": "platform"
1265
+ }
1266
+ ],
1267
+ "docs": "",
1268
+ "complexTypes": [],
1269
+ "type": "number | undefined"
1270
+ },
1271
+ {
1272
+ "name": "dueDate",
1273
+ "tags": [
1274
+ {
1275
+ "text": "iOS",
1276
+ "name": "platform"
1277
+ }
1278
+ ],
1279
+ "docs": "",
1280
+ "complexTypes": [],
1281
+ "type": "number | undefined"
1282
+ },
1283
+ {
1284
+ "name": "completionDate",
1285
+ "tags": [
1286
+ {
1287
+ "text": "iOS",
1288
+ "name": "platform"
1289
+ }
1290
+ ],
1291
+ "docs": "",
1292
+ "complexTypes": [],
1293
+ "type": "number | undefined"
1294
+ },
1295
+ {
1296
+ "name": "recurrence",
1297
+ "tags": [
1298
+ {
1299
+ "text": "iOS",
1300
+ "name": "platform"
1301
+ }
1302
+ ],
1303
+ "docs": "",
1304
+ "complexTypes": [
1305
+ "ReminderRecurrenceRule"
1306
+ ],
1307
+ "type": "ReminderRecurrenceRule[] | undefined"
1308
+ }
1309
+ ]
926
1310
  }
927
1311
  ],
928
1312
  "enums": [