@ebarooni/capacitor-calendar 8.0.2 → 8.2.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 (39) hide show
  1. package/README.md +272 -14
  2. package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +15 -0
  3. package/dist/docs.json +397 -0
  4. package/dist/esm/index.d.ts +6 -1
  5. package/dist/esm/index.js.map +1 -1
  6. package/dist/esm/schemas/interfaces/create-reminders-list-options.d.ts +41 -0
  7. package/dist/esm/schemas/interfaces/create-reminders-list-options.js +2 -0
  8. package/dist/esm/schemas/interfaces/create-reminders-list-options.js.map +1 -0
  9. package/dist/esm/schemas/interfaces/create-reminders-list-result.d.ts +12 -0
  10. package/dist/esm/schemas/interfaces/create-reminders-list-result.js +2 -0
  11. package/dist/esm/schemas/interfaces/create-reminders-list-result.js.map +1 -0
  12. package/dist/esm/schemas/interfaces/delete-reminders-list-options.d.ts +23 -0
  13. package/dist/esm/schemas/interfaces/delete-reminders-list-options.js +2 -0
  14. package/dist/esm/schemas/interfaces/delete-reminders-list-options.js.map +1 -0
  15. package/dist/esm/schemas/interfaces/update-reminders-list-options.d.ts +40 -0
  16. package/dist/esm/schemas/interfaces/update-reminders-list-options.js +2 -0
  17. package/dist/esm/schemas/interfaces/update-reminders-list-options.js.map +1 -0
  18. package/dist/esm/schemas/interfaces/update-reminders-list-result.d.ts +12 -0
  19. package/dist/esm/schemas/interfaces/update-reminders-list-result.js +2 -0
  20. package/dist/esm/schemas/interfaces/update-reminders-list-result.js.map +1 -0
  21. package/dist/esm/sub-definitions/reminders-operations.d.ts +26 -0
  22. package/dist/esm/sub-definitions/reminders-operations.js.map +1 -1
  23. package/dist/esm/web.d.ts +8 -0
  24. package/dist/esm/web.js +9 -0
  25. package/dist/esm/web.js.map +1 -1
  26. package/dist/plugin.cjs.js +9 -0
  27. package/dist/plugin.cjs.js.map +1 -1
  28. package/dist/plugin.js +9 -0
  29. package/dist/plugin.js.map +1 -1
  30. package/ios/Plugin/CapacitorCalendarPlugin.swift +45 -0
  31. package/ios/Plugin/Implementation/CapacitorCalendar.swift +63 -0
  32. package/ios/Plugin/Models/Inputs/CreateRemindersListInput.swift +57 -0
  33. package/ios/Plugin/Models/Inputs/DeleteRemindersListInput.swift +22 -0
  34. package/ios/Plugin/Models/Inputs/UpdateRemindersListInput.swift +55 -0
  35. package/ios/Plugin/Models/Results/CreateRemindersListResult.swift +15 -0
  36. package/ios/Plugin/Models/Results/UpdateRemindersListResult.swift +15 -0
  37. package/ios/Plugin/PluginConfig.swift +30 -27
  38. package/ios/Plugin/PluginError.swift +3 -0
  39. package/package.json +3 -2
package/README.md CHANGED
@@ -1,28 +1,55 @@
1
- <p align="center">
2
- <img src="assets/images/text-logo.png" alt="capacitor-calendar-logo" height="136"/>
3
- <br>
4
- <em>A capacitor plugin for managing calendar events on iOS and Android, with reminders support on iOS.</em>
5
- </p>
1
+ # @ebarooni/capacitor-calendar
6
2
 
7
- <p align="center">
3
+ <p>
8
4
  <img src="https://img.shields.io/maintenance/yes/2026?style=flat-square" />
9
5
  <a href="https://www.npmjs.com/package/@ebarooni/capacitor-calendar">
10
6
  <img src="https://img.shields.io/npm/l/@ebarooni/capacitor-calendar?style=flat-square" />
11
7
  </a>
12
- <br>
13
8
  <a href="https://www.npmjs.com/package/@ebarooni/capacitor-calendar">
14
9
  <img src="https://img.shields.io/npm/dw/@ebarooni/capacitor-calendar?style=flat-square" />
15
10
  </a>
16
11
  <a href="https://www.npmjs.com/package/@ebarooni/capacitor-calendar">
17
12
  <img src="https://img.shields.io/npm/v/@ebarooni/capacitor-calendar?style=flat-square" />
18
13
  </a>
14
+ <a href="https://capacitorjs.com/">
15
+ <img src="https://img.shields.io/badge/Capacitor-8.x-119EFF.svg?style=flat-square" />
16
+ </a>
19
17
  </p>
20
18
 
19
+ ![capacitor-calendar-logo](assets/images/text-logo.png)
20
+
21
+ Full-featured Capacitor plugin for native calendar and reminders access. Manage permissions, create, modify, and delete events and reminders programmatically or via the native UI, query events within a given time period, and list all available calendars.
22
+
23
+ ## Core Features
24
+
25
+ - ✅ **Events** – Create, update, delete, and list events in a date range
26
+ - ✅ **Native Prompts** – Built-in system dialogs for creating, editing, and deleting events
27
+ - ✅ **Permissions** – Granular control (full access, write-only, read-only)
28
+ - ✅ **Calendars** – List calendars, get default, create, modify, and delete custom calendars
29
+ - ✅ **Open Calendar App** – Launch the native Calendar app directly
30
+ - 📅 **Reminders** – Full create, read, update, delete support _(iOS only)_
31
+ - 🔍 **Advanced iOS Features** – Calendar sources, calendar selection prompts, default reminders list
32
+
33
+ ## Supported Platforms
34
+
35
+ - **iOS** — Full support (including Reminders and advanced features)
36
+ - **Android** — Strong support for all core calendar features
37
+ - **Web** — Not supported (Capacitor stub only - calls will fail)
38
+
39
+ ## Why this plugin?
40
+
41
+ - **Original and established.** Available since Capacitor 5, this plugin has been around longer than the alternatives and has matured over time.
42
+ - **Actively maintained by the original author.** Updates, bug fixes, and new features are driven by someone who is deeply familiar with the codebase and committed to keeping it healthy.
43
+ - **Fast support.** Questions, bug reports, and integration help are handled promptly.
44
+ - **Reduced vendor risk.** Relying on a single plugin provider for all your needs is a liability. Choosing specialized, independent maintainers keeps your stack resilient.
45
+
21
46
  ## Table of Contents
22
47
 
23
48
  - [Installation](#installation)
24
49
  - [Demo](#demo)
25
50
  - [Setup](#setup)
51
+ - [Quick Start](#quick-start)
52
+ - [Usage Examples](#usage-examples)
26
53
  - [Documentation](#documentation)
27
54
  - [Changelog](#changelog)
28
55
  - [API](#api)
@@ -44,25 +71,150 @@ npx cap sync
44
71
 
45
72
  ## Setup
46
73
 
47
- This plugin requires additional platform-specific configuration. Follow the official guides:
74
+ This plugin works with native calendar APIs, so you'll need to configure permissions on each platform before requesting access at runtime.
75
+
76
+ ### Android
77
+
78
+ Add these permissions to `android/app/src/main/AndroidManifest.xml`:
79
+
80
+ ```xml
81
+ <uses-permission android:name="android.permission.READ_CALENDAR" />
82
+ <uses-permission android:name="android.permission.WRITE_CALENDAR" />
83
+ ```
84
+
85
+ Don't forget to request the matching runtime permissions before reading from or writing to the calendar.
86
+
87
+ ### iOS
88
+
89
+ Add the appropriate usage description keys to `ios/App/App/Info.plist`. Starting with iOS 17, Apple requires separate keys for write-only and full calendar access.
90
+
91
+ ```xml
92
+ <key>NSCalendarsUsageDescription</key>
93
+ <string>This app needs access to your calendar.</string>
94
+
95
+ <key>NSCalendarsWriteOnlyAccessUsageDescription</key>
96
+ <string>This app needs permission to create calendar events.</string>
97
+
98
+ <key>NSCalendarsFullAccessUsageDescription</key>
99
+ <string>This app needs permission to read and manage your calendar events.</string>
100
+
101
+ <key>NSRemindersUsageDescription</key>
102
+ <string>This app needs access to your reminders.</string>
103
+
104
+ <key>NSRemindersFullAccessUsageDescription</key>
105
+ <string>This app needs permission to read and manage your reminders.</string>
106
+ ```
107
+
108
+ > [!IMPORTANT]
109
+ > Only include the keys your app actually needs. If you're only creating events, you can safely omit the full access and reminders entries.
110
+
111
+ ### Official References
48
112
 
49
113
  - **iOS:** [Migrating to the Latest Calendar Access Levels](https://developer.apple.com/documentation/technotes/tn3152-migrating-to-the-latest-calendar-access-levels)
50
114
  - **Android:** [Calendar Provider User Permissions](https://developer.android.com/identity/providers/calendar-provider#manifest)
51
115
 
116
+ ## Quick Start
117
+
118
+ Here's a simple example to get you up and running quickly:
119
+
120
+ ```typescript
121
+ import { CapacitorCalendar } from '@ebarooni/capacitor-calendar';
122
+
123
+ const { result } = await CapacitorCalendar.requestFullCalendarAccess();
124
+
125
+ if (result !== 'granted') {
126
+ throw new Error('Calendar permission denied');
127
+ }
128
+
129
+ // Create an event starting in 1 hour, lasting 1 hour
130
+ const startDate = Date.now() + 60 * 60 * 1000;
131
+ const endDate = startDate + 60 * 60 * 1000;
132
+
133
+ const { id } = await CapacitorCalendar.createEvent({
134
+ title: 'Product review',
135
+ location: 'Office',
136
+ startDate,
137
+ endDate,
138
+ description: 'Created with @ebarooni/capacitor-calendar',
139
+ });
140
+
141
+ console.log('Event created with ID:', id);
142
+ ```
143
+
144
+ > [!NOTE]
145
+ > Dates are expected as Unix timestamps in milliseconds.
146
+
147
+ ## Usage Examples
148
+
149
+ ### Open the native event editor
150
+
151
+ Use the system calendar UI to let users create or edit events:
152
+
153
+ ```typescript
154
+ await CapacitorCalendar.createEventWithPrompt({
155
+ title: 'Planning session',
156
+ location: 'Office',
157
+ startDate: Date.now() + 24 * 60 * 60 * 1000,
158
+ endDate: Date.now() + 25 * 60 * 60 * 1000,
159
+ });
160
+ ```
161
+
162
+ > [!NOTE]
163
+ > On Android, this method always returns null. If you need the event ID, call `listEventsInRange(...)` afterward.
164
+
165
+ ### List upcoming events
166
+
167
+ ```typescript
168
+ const now = Date.now();
169
+ const oneWeekLater = now + 7 * 24 * 60 * 60 * 1000;
170
+
171
+ const { result: events } = await CapacitorCalendar.listEventsInRange({
172
+ from: now,
173
+ to: oneWeekLater,
174
+ });
175
+
176
+ console.log('Upcoming events:', events);
177
+ ```
178
+
179
+ ### Working with Calendars
180
+
181
+ ```typescript
182
+ // Get all calendars and default calendar
183
+ const { result: calendars } = await CapacitorCalendar.listCalendars();
184
+ const { result: defaultCalendar } = await CapacitorCalendar.getDefaultCalendar();
185
+
186
+ // Use default or fall back to first calendar
187
+ const targetCalendarId = defaultCalendar?.id ?? calendars[0]?.id;
188
+ ```
189
+
190
+ > [!NOTE]
191
+ > On iOS you can also use `selectCalendarsWithPrompt()` to let the user pick calendars via the native interface.
192
+
193
+ ### Create a Reminder (iOS only)
194
+
195
+ ```typescript
196
+ const { result } = await CapacitorCalendar.requestFullRemindersAccess();
197
+
198
+ if (result === 'granted') {
199
+ await CapacitorCalendar.createReminder({
200
+ title: 'Send launch notes',
201
+ dueDate: Date.now() + 2 * 24 * 60 * 60 * 1000,
202
+ notes: 'Created with @ebarooni/capacitor-calendar',
203
+ });
204
+ }
205
+ ```
206
+
52
207
  ## Documentation
53
208
 
54
- For comprehensive usage examples, detailed explanations, and API references, check out:
209
+ The full documentation is generated from TypeScript definitions and is available online:
55
210
 
56
- - **[Online documentation](https://ebarooni.github.io/capacitor-calendar/)**
57
- - **[Type definitions & examples](src/definitions.ts)**
211
+ - **[Complete Documentation](https://ebarooni.github.io/capacitor-calendar/)** — Guides, examples, and full API reference (recommended)
212
+ - **[Source Definitions](src/definitions.ts)** — The TypeScript source used to generate the docs
58
213
 
59
214
  ## Changelog
60
215
 
61
216
  See [CHANGELOG.md](CHANGELOG.md) for the latest updates and release history.
62
217
 
63
- > [!NOTE]
64
- > Version 7.1.0 introduces breaking changes.
65
-
66
218
  ## API
67
219
 
68
220
  <docgen-index>
@@ -92,6 +244,8 @@ See [CHANGELOG.md](CHANGELOG.md) for the latest updates and release history.
92
244
  * [`createCalendar(...)`](#createcalendar)
93
245
  * [`deleteCalendar(...)`](#deletecalendar)
94
246
  * [`modifyCalendar(...)`](#modifycalendar)
247
+ * [`createRemindersList(...)`](#createreminderslist)
248
+ * [`deleteRemindersList(...)`](#deletereminderslist)
95
249
  * [`fetchAllRemindersSources()`](#fetchallreminderssources)
96
250
  * [`openReminders()`](#openreminders)
97
251
  * [`getDefaultRemindersList()`](#getdefaultreminderslist)
@@ -103,6 +257,7 @@ See [CHANGELOG.md](CHANGELOG.md) for the latest updates and release history.
103
257
  * [`getReminderById(...)`](#getreminderbyid)
104
258
  * [`getRemindersFromLists(...)`](#getremindersfromlists)
105
259
  * [`deleteReminderWithPrompt(...)`](#deletereminderwithprompt)
260
+ * [`updateRemindersList(...)`](#updatereminderslist)
106
261
  * [Interfaces](#interfaces)
107
262
  * [Type Aliases](#type-aliases)
108
263
  * [Enums](#enums)
@@ -588,6 +743,46 @@ Modifies a calendar with options.
588
743
  --------------------
589
744
 
590
745
 
746
+ ### createRemindersList(...)
747
+
748
+ ```typescript
749
+ createRemindersList(options: CreateRemindersListOptions) => Promise<CreateRemindersListResult>
750
+ ```
751
+
752
+ Creates a new reminders list.
753
+
754
+ | Param | Type |
755
+ | ------------- | --------------------------------------------------------------------------------- |
756
+ | **`options`** | <code><a href="#createreminderslistoptions">CreateRemindersListOptions</a></code> |
757
+
758
+ **Returns:** <code>Promise&lt;<a href="#createreminderslistresult">CreateRemindersListResult</a>&gt;</code>
759
+
760
+ **Since:** 8.1.0
761
+
762
+ **Platform:** iOS
763
+
764
+ --------------------
765
+
766
+
767
+ ### deleteRemindersList(...)
768
+
769
+ ```typescript
770
+ deleteRemindersList(options: DeleteRemindersListOptions) => Promise<void>
771
+ ```
772
+
773
+ Deletes a reminders list.
774
+
775
+ | Param | Type |
776
+ | ------------- | --------------------------------------------------------------------------------- |
777
+ | **`options`** | <code><a href="#deletereminderslistoptions">DeleteRemindersListOptions</a></code> |
778
+
779
+ **Since:** 8.2.0
780
+
781
+ **Platform:** iOS
782
+
783
+ --------------------
784
+
785
+
591
786
  ### fetchAllRemindersSources()
592
787
 
593
788
  ```typescript
@@ -797,6 +992,27 @@ Opens a dialog to delete a reminder.
797
992
  --------------------
798
993
 
799
994
 
995
+ ### updateRemindersList(...)
996
+
997
+ ```typescript
998
+ updateRemindersList(options: UpdateRemindersListOptions) => Promise<UpdateRemindersListResult>
999
+ ```
1000
+
1001
+ Update a reminders list with options.
1002
+
1003
+ | Param | Type |
1004
+ | ------------- | --------------------------------------------------------------------------------- |
1005
+ | **`options`** | <code><a href="#updatereminderslistoptions">UpdateRemindersListOptions</a></code> |
1006
+
1007
+ **Returns:** <code>Promise&lt;<a href="#updatereminderslistresult">UpdateRemindersListResult</a>&gt;</code>
1008
+
1009
+ **Since:** 8.2.0
1010
+
1011
+ **Platform:** iOS
1012
+
1013
+ --------------------
1014
+
1015
+
800
1016
  ### Interfaces
801
1017
 
802
1018
 
@@ -1047,6 +1263,31 @@ Opens a dialog to delete a reminder.
1047
1263
  | **`color`** | <code>string</code> | 7.2.0 | Android, iOS |
1048
1264
 
1049
1265
 
1266
+ #### CreateRemindersListResult
1267
+
1268
+ | Prop | Type | Description | Since | Platform |
1269
+ | -------- | ------------------- | ----------------------------------------------- | ----- | -------- |
1270
+ | **`id`** | <code>string</code> | Identifier of the newly created reminders list. | 8.1.0 | iOS |
1271
+
1272
+
1273
+ #### CreateRemindersListOptions
1274
+
1275
+ | Prop | Type | Description | Default | Since | Platform |
1276
+ | -------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ----- | -------- |
1277
+ | **`color`** | <code>'blue' \| 'brown' \| 'gray' \| 'green' \| 'indigo' \| 'orange' \| 'pink' \| 'purple' \| 'red' \| 'teal' \| 'yellow'</code> | The color of the list. | <code>'blue'</code> | 8.1.0 | iOS |
1278
+ | **`commit`** | <code>boolean</code> | Whether to save the list to the event store immediately. Pass `false` to batch multiple changes and commit them together using `CapacitorCalendar.commit()`, which is more efficient than committing each save individually. | <code>true</code> | 8.1.0 | iOS |
1279
+ | **`sourceId`** | <code>string</code> | The EKSource identifier (account) where the list should be created. If left undefined, iCloud will be used if available, otherwise falls back to local. | | 8.1.0 | iOS |
1280
+ | **`title`** | <code>string</code> | The title of the list. | | 8.1.0 | iOS |
1281
+
1282
+
1283
+ #### DeleteRemindersListOptions
1284
+
1285
+ | Prop | Type | Description | Default | Since | Platform |
1286
+ | ------------ | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ----- | -------- |
1287
+ | **`commit`** | <code>boolean</code> | Whether to save the deletion to the event store immediately. Pass `false` to batch multiple changes and commit them together using `CapacitorCalendar.commit()`, which is more efficient than committing each save individually. | <code>true</code> | 8.2.0 | iOS |
1288
+ | **`id`** | <code>string</code> | Identifier of the reminders list to delete. | | 8.2.0 | iOS |
1289
+
1290
+
1050
1291
  #### CreateReminderOptions
1051
1292
 
1052
1293
  | Prop | Type | Description | Since |
@@ -1159,6 +1400,23 @@ Opens a dialog to delete a reminder.
1159
1400
  | **`cancelButtonText`** | <code>string</code> | Text to show on the cancel button. | <code>'Cancel'</code> | 7.2.0 |
1160
1401
 
1161
1402
 
1403
+ #### UpdateRemindersListResult
1404
+
1405
+ | Prop | Type | Description | Since | Platform |
1406
+ | -------- | ------------------- | ----------------------------------------- | ----- | -------- |
1407
+ | **`id`** | <code>string</code> | Identifier of the updated reminders list. | 8.2.0 | iOS |
1408
+
1409
+
1410
+ #### UpdateRemindersListOptions
1411
+
1412
+ | Prop | Type | Description | Default | Since | Platform |
1413
+ | ------------ | -------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ----- | -------- |
1414
+ | **`color`** | <code>'blue' \| 'brown' \| 'gray' \| 'green' \| 'indigo' \| 'orange' \| 'pink' \| 'purple' \| 'red' \| 'teal' \| 'yellow'</code> | The new color of the list. If omitted, the color is left unchanged. | | 8.1.0 | iOS |
1415
+ | **`commit`** | <code>boolean</code> | Whether to save the update to the event store immediately. Pass `false` to batch multiple changes and commit them together using `eventStore.commit()`, which is more efficient than committing each save individually. | <code>true</code> | 8.2.0 | iOS |
1416
+ | **`id`** | <code>string</code> | The identifier of the list to update. | | 8.2.0 | iOS |
1417
+ | **`title`** | <code>string</code> | The new title of the list. If omitted, the title is left unchanged. | | 8.2.0 | iOS |
1418
+
1419
+
1162
1420
  ### Type Aliases
1163
1421
 
1164
1422
 
@@ -80,6 +80,16 @@ class CapacitorCalendarPlugin : Plugin() {
80
80
  }
81
81
  }
82
82
 
83
+ @PluginMethod
84
+ fun createRemindersList(call: PluginCall) {
85
+ call.unimplemented(PluginError.Unimplemented(::createRemindersList.name).message)
86
+ }
87
+
88
+ @PluginMethod
89
+ fun deleteRemindersList(call: PluginCall) {
90
+ call.unimplemented(PluginError.Unimplemented(::deleteRemindersList.name).message)
91
+ }
92
+
83
93
  @PluginMethod
84
94
  fun requestPermission(call: PluginCall) {
85
95
  try {
@@ -440,4 +450,9 @@ class CapacitorCalendarPlugin : Plugin() {
440
450
  fun deleteReminderWithPrompt(call: PluginCall) {
441
451
  call.unimplemented(PluginError.Unimplemented(::deleteReminderWithPrompt.name).message)
442
452
  }
453
+
454
+ @PluginMethod
455
+ fun updateRemindersList(call: PluginCall) {
456
+ call.unimplemented(PluginError.Unimplemented(::updateRemindersList.name).message)
457
+ }
443
458
  }