@ebarooni/capacitor-calendar 6.4.0 → 6.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.
@@ -6,6 +6,7 @@ import android.content.Context
6
6
  import android.content.Intent
7
7
  import android.net.Uri
8
8
  import android.provider.CalendarContract
9
+ import android.util.Log
9
10
  import com.getcapacitor.JSArray
10
11
  import com.getcapacitor.JSObject
11
12
  import java.util.Calendar
@@ -72,7 +73,7 @@ class CapacitorCalendar() {
72
73
  }
73
74
 
74
75
  @Throws(Exception::class)
75
- fun getDefaultCalendar(context: Context): JSObject {
76
+ fun getDefaultCalendar(context: Context): JSObject? {
76
77
  val projection =
77
78
  arrayOf(
78
79
  CalendarContract.Calendars._ID,
@@ -102,7 +103,7 @@ class CapacitorCalendar() {
102
103
  }
103
104
  return calendarObject
104
105
  } else {
105
- throw Exception("No primary calendar found")
106
+ return null
106
107
  }
107
108
  }
108
109
  throw Exception("No primary calendar found")
@@ -117,8 +118,11 @@ class CapacitorCalendar() {
117
118
  startDate: Long?,
118
119
  endDate: Long?,
119
120
  isAllDay: Boolean?,
120
- alertOffsetInMinutes: Float?,
121
- ): Uri? {
121
+ alertOffsetInMinutesSingle: Float?,
122
+ alertOffsetInMinutesMultiple: JSArray?,
123
+ url: String?,
124
+ notes: String?,
125
+ ): Uri {
122
126
  val startMillis = startDate ?: Calendar.getInstance().timeInMillis
123
127
  val endMillis = endDate ?: (startMillis + 3600 * 1000)
124
128
 
@@ -128,30 +132,50 @@ class CapacitorCalendar() {
128
132
  put(CalendarContract.Events.DTEND, endMillis)
129
133
  put(CalendarContract.Events.TITLE, title)
130
134
  location?.let { put(CalendarContract.Events.EVENT_LOCATION, it) }
131
- put(CalendarContract.Events.CALENDAR_ID, calendarId ?: getDefaultCalendar(context).getString("id"))
135
+ put(CalendarContract.Events.CALENDAR_ID, calendarId ?: getDefaultCalendar(context)?.getString("id"))
132
136
  put(CalendarContract.Events.EVENT_TIMEZONE, TimeZone.getDefault().id)
133
137
  isAllDay?.let { put(CalendarContract.Events.ALL_DAY, if (it) 1 else 0) }
138
+ put(CalendarContract.Events.DESCRIPTION, listOfNotNull(notes, url?.let { "URL: $it" }).joinToString("\n"))
134
139
  }
135
140
 
136
141
  val eventUri = context.contentResolver.insert(CalendarContract.Events.CONTENT_URI, eventValues)
137
-
138
- if (alertOffsetInMinutes == null || alertOffsetInMinutes < 0) {
139
- return eventUri
140
- }
141
-
142
142
  val eventId = eventUri?.lastPathSegment?.toLong() ?: throw IllegalArgumentException("Failed to convert event id to long")
143
- val alertValues =
144
- ContentValues().apply {
145
- put(CalendarContract.Reminders.EVENT_ID, eventId)
146
- put(CalendarContract.Reminders.MINUTES, alertOffsetInMinutes)
147
- put(CalendarContract.Reminders.METHOD, CalendarContract.Reminders.METHOD_ALERT)
148
- }
149
143
 
150
- context.contentResolver.insert(CalendarContract.Reminders.CONTENT_URI, alertValues)
144
+ when {
145
+ alertOffsetInMinutesSingle != null && alertOffsetInMinutesSingle > -1 -> {
146
+ val alertValues = createAlertValues(eventId, alertOffsetInMinutesSingle)
147
+ context.contentResolver.insert(CalendarContract.Reminders.CONTENT_URI, alertValues)
148
+ }
149
+ alertOffsetInMinutesMultiple != null -> {
150
+ alertOffsetInMinutesMultiple.toList<Any>().mapNotNull { alert ->
151
+ try {
152
+ val alertFloat = alert.toString().toFloat()
153
+ if (alertFloat > -1) alertFloat else null
154
+ } catch (e: NumberFormatException) {
155
+ Log.e("Error", "Failed to convert alert to float: $alert", e)
156
+ null
157
+ }
158
+ }.forEach { alertFloat ->
159
+ val alertValues = createAlertValues(eventId, alertFloat)
160
+ context.contentResolver.insert(CalendarContract.Reminders.CONTENT_URI, alertValues)
161
+ }
162
+ }
163
+ }
151
164
 
152
165
  return eventUri
153
166
  }
154
167
 
168
+ private fun createAlertValues(
169
+ eventId: Long,
170
+ alertOffset: Float,
171
+ ): ContentValues {
172
+ return ContentValues().apply {
173
+ put(CalendarContract.Reminders.EVENT_ID, eventId)
174
+ put(CalendarContract.Reminders.MINUTES, alertOffset)
175
+ put(CalendarContract.Reminders.METHOD, CalendarContract.Reminders.METHOD_ALERT)
176
+ }
177
+ }
178
+
155
179
  @Throws(Exception::class)
156
180
  fun openCalendar(timestamp: Long): Intent {
157
181
  return Intent(Intent.ACTION_VIEW).apply {
@@ -52,6 +52,8 @@ class CapacitorCalendarPlugin : Plugin() {
52
52
  val startDate = call.getLong("startDate")
53
53
  val endDate = call.getLong("endDate")
54
54
  val isAllDay = call.getBoolean("isAllDay", false)
55
+ val url = call.getString("url")
56
+ val notes = call.getString("notes")
55
57
 
56
58
  val intent = Intent(Intent.ACTION_INSERT).setData(CalendarContract.Events.CONTENT_URI)
57
59
 
@@ -61,6 +63,7 @@ class CapacitorCalendarPlugin : Plugin() {
61
63
  startDate?.let { intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, it) }
62
64
  endDate?.let { intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, it) }
63
65
  isAllDay?.let { intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, it) }
66
+ intent.putExtra(CalendarContract.Events.DESCRIPTION, listOfNotNull(notes, url?.let { "URL: $it" }).joinToString("\n"))
64
67
 
65
68
  return startActivityForResult(
66
69
  call,
@@ -217,7 +220,7 @@ class CapacitorCalendarPlugin : Plugin() {
217
220
  }
218
221
 
219
222
  @PermissionCallback
220
- private fun requestFullCalendarAccessCallbackCallback(call: PluginCall) {
223
+ private fun requestFullCalendarAccessCallback(call: PluginCall) {
221
224
  val permissionName = "readWriteCalendar"
222
225
  try {
223
226
  val ret = JSObject()
@@ -279,7 +282,10 @@ class CapacitorCalendarPlugin : Plugin() {
279
282
  val startDate = call.getLong("startDate")
280
283
  val endDate = call.getLong("endDate")
281
284
  val isAllDay = call.getBoolean("isAllDay", false)
282
- val alertOffsetInMinutes = call.getFloat("alertOffsetInMinutes")
285
+ val alertOffsetInMinutesSingle = call.getFloat("alertOffsetInMinutes")
286
+ val alertOffsetInMinutesMultiple = call.getArray("alertOffsetInMinutes")
287
+ val url = call.getString("url")
288
+ val notes = call.getString("notes")
283
289
 
284
290
  val eventUri =
285
291
  implementation.createEvent(
@@ -290,7 +296,10 @@ class CapacitorCalendarPlugin : Plugin() {
290
296
  startDate,
291
297
  endDate,
292
298
  isAllDay,
293
- alertOffsetInMinutes,
299
+ alertOffsetInMinutesSingle,
300
+ alertOffsetInMinutesMultiple,
301
+ url,
302
+ notes,
294
303
  )
295
304
 
296
305
  val id = eventUri?.lastPathSegment ?: throw IllegalArgumentException("Failed to insert event into calendar")
package/dist/docs.json CHANGED
@@ -161,12 +161,12 @@
161
161
  },
162
162
  {
163
163
  "name": "createEventWithPrompt",
164
- "signature": "(options: { title: string; calendarId?: string; location?: string; startDate?: number; endDate?: number; isAllDay?: boolean; alertOffsetInMinutes?: number; }) => Promise<{ result: string[]; }>",
164
+ "signature": "(options: { title: string; calendarId?: string; location?: string; startDate?: number; endDate?: number; isAllDay?: boolean; alertOffsetInMinutes?: number | number[]; url?: string; notes?: string; }) => Promise<{ result: string[]; }>",
165
165
  "parameters": [
166
166
  {
167
167
  "name": "options",
168
- "docs": "- Options for creating the event.",
169
- "type": "{ title: string; calendarId?: string | undefined; location?: string | undefined; startDate?: number | undefined; endDate?: number | undefined; isAllDay?: boolean | undefined; alertOffsetInMinutes?: number | undefined; }"
168
+ "docs": "Options for creating the event.",
169
+ "type": "{ title: string; calendarId?: string | undefined; location?: string | undefined; startDate?: number | undefined; endDate?: number | undefined; isAllDay?: boolean | undefined; alertOffsetInMinutes?: number | number[] | undefined; url?: string | undefined; notes?: string | undefined; }"
170
170
  }
171
171
  ],
172
172
  "returns": "Promise<{ result: string[]; }>",
@@ -189,7 +189,7 @@
189
189
  },
190
190
  {
191
191
  "name": "param",
192
- "text": "options - Options for creating the event."
192
+ "text": "options Options for creating the event."
193
193
  },
194
194
  {
195
195
  "name": "returns",
@@ -197,7 +197,7 @@
197
197
  },
198
198
  {
199
199
  "name": "example",
200
- "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}"
200
+ "text": "if (capacitor.getPlatform() === 'android') {\n await this.requestPermission({ alias: 'readCalendar' });\n { result } = result = await this.createEventWithPrompt({\n title: 'Title',\n alertOffsetInMinutes: [5, 30],\n url: 'https://capacitor-calendar.pages.dev',\n notes: 'A CapacitorJS plugin',\n });\n} else {\n { result } = result = await this.createEventWithPrompt({\n title: 'Title',\n alertOffsetInMinutes: [0, 1440],\n url: 'https://capacitor-calendar.pages.dev',\n notes: 'A CapacitorJS plugin'\n });\n}"
201
201
  }
202
202
  ],
203
203
  "docs": "Creates an event in the calendar by using the native calendar.\nOn iOS opens a native sheet and on Android opens an intent.",
@@ -287,21 +287,29 @@
287
287
  },
288
288
  {
289
289
  "name": "getDefaultCalendar",
290
- "signature": "() => Promise<{ result: Calendar; }>",
290
+ "signature": "() => Promise<{ result: Calendar | null; }>",
291
291
  "parameters": [],
292
- "returns": "Promise<{ result: Calendar; }>",
292
+ "returns": "Promise<{ result: Calendar | null; }>",
293
293
  "tags": [
294
294
  {
295
295
  "name": "method",
296
296
  "text": "getDefaultCalendar"
297
297
  },
298
+ {
299
+ "name": "since",
300
+ "text": "0.3.0"
301
+ },
298
302
  {
299
303
  "name": "platform",
300
304
  "text": "iOS, Android"
301
305
  },
306
+ {
307
+ "name": "permissions",
308
+ "text": "<h3>Runtime Permissions:</h3>\n<ul>\n <li><strong>iOS:</strong> readCalendar</li>\n <li><strong>Android:</strong> readCalendar</li>\n</ul>"
309
+ },
302
310
  {
303
311
  "name": "returns",
304
- "text": "A promise that resolves with the default calendar set on the device.\nThe returned calendar object contains an ID and a title."
312
+ "text": "A promise that resolves with the default calendar set on the device.\nThe returned calendar object contains an ID and a title. Returns null if there is no default calendar found."
305
313
  },
306
314
  {
307
315
  "name": "example",
@@ -316,12 +324,12 @@
316
324
  },
317
325
  {
318
326
  "name": "createEvent",
319
- "signature": "(options: { title: string; calendarId?: string; location?: string; startDate?: number; endDate?: number; isAllDay?: boolean; alertOffsetInMinutes?: number; }) => Promise<{ result: string; }>",
327
+ "signature": "(options: { title: string; calendarId?: string; location?: string; startDate?: number; endDate?: number; isAllDay?: boolean; alertOffsetInMinutes?: number | number[]; url?: string; notes?: string; }) => Promise<{ result: string; }>",
320
328
  "parameters": [
321
329
  {
322
330
  "name": "options",
323
- "docs": "- Options for creating the event.",
324
- "type": "{ title: string; calendarId?: string | undefined; location?: string | undefined; startDate?: number | undefined; endDate?: number | undefined; isAllDay?: boolean | undefined; alertOffsetInMinutes?: number | undefined; }"
331
+ "docs": "Options for creating the event.",
332
+ "type": "{ title: string; calendarId?: string | undefined; location?: string | undefined; startDate?: number | undefined; endDate?: number | undefined; isAllDay?: boolean | undefined; alertOffsetInMinutes?: number | number[] | undefined; url?: string | undefined; notes?: string | undefined; }"
325
333
  }
326
334
  ],
327
335
  "returns": "Promise<{ result: string; }>",
@@ -330,6 +338,10 @@
330
338
  "name": "method",
331
339
  "text": "createEvent"
332
340
  },
341
+ {
342
+ "name": "since",
343
+ "text": "0.4.0"
344
+ },
333
345
  {
334
346
  "name": "platform",
335
347
  "text": "iOS, Android"
@@ -340,7 +352,7 @@
340
352
  },
341
353
  {
342
354
  "name": "param",
343
- "text": "options - Options for creating the event."
355
+ "text": "options Options for creating the event."
344
356
  },
345
357
  {
346
358
  "name": "returns",
@@ -348,7 +360,7 @@
348
360
  },
349
361
  {
350
362
  "name": "example",
351
- "text": "const now = Date.now();\nconst eventOptions = {\n title: 'Team Meeting',\n location: 'Conference Room A',\n startDate: now,\n endDate: now + 2 * 60 * 60 * 1000,\n isAllDay: false,\n alertOffsetInMinutes: 5,\n};\nconst { result } = await createEvent(eventOptions);"
363
+ "text": "const now = Date.now();\nconst eventOptions = {\n title: 'Team Meeting',\n location: 'Conference Room A',\n startDate: now,\n endDate: now + 2 * 60 * 60 * 1000,\n isAllDay: false,\n alertOffsetInMinutes: 5,\n url: 'https://capacitor-calendar.pages.dev',\n notes: 'A CapacitorJS plugin'\n};\nconst { result } = await createEvent(eventOptions);"
352
364
  }
353
365
  ],
354
366
  "docs": "Creates an event with the provided options.",
@@ -76,28 +76,35 @@ export interface CapacitorCalendarPlugin {
76
76
  * <ul>
77
77
  * <li><strong>Android:</strong> readCalendar</li>
78
78
  * </ul>
79
- * @param {object} options - Options for creating the event.
80
- * @param {string} options.title - The title of the event.
81
- * @param {string} options.calendarId - The id of the destination calendar. (Optional)
82
- * @param {string} [options.location] - The location of the event. (Optional)
83
- * @param {number} [options.startDate] - The start date and time of the event. (Optional)
84
- * @param {number} [options.endDate] - The end date and time of the event. (Optional)
85
- * @param {boolean} [options.isAllDay] - Weather the event is for the entire day or not. (Optional)
86
- * @param {number} [options.alertOffsetInMinutes] - Ignored on Android. If a number >= 0 is provided,
87
- * an alert will be set for the event this many minutes *before* the event.
88
- * Negative values are ignored. (Optional)
79
+ * @param {object} options Options for creating the event.
80
+ * @param {string} options.title The title of the event.
81
+ * @param {string} options.calendarId The id of the destination calendar. (Optional)
82
+ * @param {string} [options.location] The location of the event. (Optional)
83
+ * @param {number} [options.startDate] The start date and time of the event. (Optional)
84
+ * @param {number} [options.endDate] The end date and time of the event. (Optional)
85
+ * @param {boolean} [options.isAllDay] Weather the event is for the entire day or not. (Optional)
86
+ * @param {number} [options.alertOffsetInMinutes] If a number >= 0 is provided, an alert will be set for the event this many
87
+ * minutes *before* the event. If an array of number >= 0 are provided, it will add multiple alerts.
88
+ * On iOS only the first two valid elements of the array are taken into account.
89
+ * The parameter is not supported on Android. Negative values are ignored. (Optional)
90
+ * @param {string} [options.url] The URL of the event. (Optional)
91
+ * @param {string} [options.notes] The notes of the event. (Optional)
89
92
  * @returns {Promise<{ result: string[] }>} A promise that resolves with an array of the ids of created events.
90
93
  * @example
91
94
  * if (capacitor.getPlatform() === 'android') {
92
95
  * await this.requestPermission({ alias: 'readCalendar' });
93
96
  * { result } = result = await this.createEventWithPrompt({
94
97
  * title: 'Title',
95
- * alertOffsetInMinutes: 5,
98
+ * alertOffsetInMinutes: [5, 30],
99
+ * url: 'https://capacitor-calendar.pages.dev',
100
+ * notes: 'A CapacitorJS plugin',
96
101
  * });
97
102
  * } else {
98
103
  * { result } = result = await this.createEventWithPrompt({
99
104
  * title: 'Title',
100
- * alertOffsetInMinutes: 5,
105
+ * alertOffsetInMinutes: [0, 1440],
106
+ * url: 'https://capacitor-calendar.pages.dev',
107
+ * notes: 'A CapacitorJS plugin'
101
108
  * });
102
109
  * }
103
110
  */
@@ -108,7 +115,9 @@ export interface CapacitorCalendarPlugin {
108
115
  startDate?: number;
109
116
  endDate?: number;
110
117
  isAllDay?: boolean;
111
- alertOffsetInMinutes?: number;
118
+ alertOffsetInMinutes?: number | number[];
119
+ url?: string;
120
+ notes?: string;
112
121
  }): Promise<{
113
122
  result: string[];
114
123
  }>;
@@ -159,20 +168,28 @@ export interface CapacitorCalendarPlugin {
159
168
  * Retrieves the default calendar set on the device.
160
169
  *
161
170
  * @method getDefaultCalendar
171
+ * @since 0.3.0
162
172
  * @platform iOS, Android
163
- * @returns {Promise<{ result: Calendar }>} A promise that resolves with the default calendar set on the device.
164
- * The returned calendar object contains an ID and a title.
173
+ * @permissions
174
+ * <h3>Runtime Permissions:</h3>
175
+ * <ul>
176
+ * <li><strong>iOS:</strong> readCalendar</li>
177
+ * <li><strong>Android:</strong> readCalendar</li>
178
+ * </ul>
179
+ * @returns {Promise<{ result: Calendar | null }>} A promise that resolves with the default calendar set on the device.
180
+ * The returned calendar object contains an ID and a title. Returns null if there is no default calendar found.
165
181
  * @example
166
182
  * const { result } = await getDefaultCalendar();
167
183
  * console.log(result); // { id: '1', title: 'Default Calendar' }
168
184
  */
169
185
  getDefaultCalendar(): Promise<{
170
- result: Calendar;
186
+ result: Calendar | null;
171
187
  }>;
172
188
  /**
173
189
  * Creates an event with the provided options.
174
190
  *
175
191
  * @method createEvent
192
+ * @since 0.4.0
176
193
  * @platform iOS, Android
177
194
  * @permissions
178
195
  * <h3>Runtime Permissions:</h3>
@@ -180,15 +197,19 @@ export interface CapacitorCalendarPlugin {
180
197
  * <li><strong>iOS:</strong> writeCalendar</li>
181
198
  * <li><strong>Android:</strong> readCalendar, writeCalendar</li>
182
199
  * </ul>
183
- * @param {object} options - Options for creating the event.
184
- * @param {string} options.title - The title of the event.
185
- * @param {string} options.calendarId - The id of the destination calendar. (Optional)
186
- * @param {string} [options.location] - The location of the event. (Optional)
187
- * @param {number} [options.startDate] - The start date and time of the event. (Optional)
188
- * @param {number} [options.endDate] - The end date and time of the event. (Optional)
189
- * @param {boolean} [options.isAllDay] - Weather the event is for the entire day or not. (Optional)
190
- * @param {number} [options.alertOffsetInMinutes] - If a number >= 0 is provided, an alert will be set for the event this many
191
- * minutes *before* the event. Negative values are ignored. (Optional)
200
+ * @param {object} options Options for creating the event.
201
+ * @param {string} options.title The title of the event.
202
+ * @param {string} options.calendarId The id of the destination calendar. (Optional)
203
+ * @param {string} [options.location] The location of the event. (Optional)
204
+ * @param {number} [options.startDate] The start date and time of the event. (Optional)
205
+ * @param {number} [options.endDate] The end date and time of the event. (Optional)
206
+ * @param {boolean} [options.isAllDay] Weather the event is for the entire day or not. (Optional)
207
+ * @param {number} [options.alertOffsetInMinutes] If a number >= 0 is provided, an alert will be set for the event this many
208
+ * minutes *before* the event. If an array of number >= 0 are provided, it will add multiple alerts.
209
+ * On iOS only the first two valid elements of the array are taken into account.
210
+ * Negative values are ignored. (Optional)
211
+ * @param {string} [options.url] The URL of the event. (Optional)
212
+ * @param {string} [options.notes] The notes of the event. (Optional)
192
213
  * @returns {Promise<{ result: string }>} A promise that resolves with the id of the created event.
193
214
  * @example
194
215
  * const now = Date.now();
@@ -199,6 +220,8 @@ export interface CapacitorCalendarPlugin {
199
220
  * endDate: now + 2 * 60 * 60 * 1000,
200
221
  * isAllDay: false,
201
222
  * alertOffsetInMinutes: 5,
223
+ * url: 'https://capacitor-calendar.pages.dev',
224
+ * notes: 'A CapacitorJS plugin'
202
225
  * };
203
226
  * const { result } = await createEvent(eventOptions);
204
227
  */
@@ -209,7 +232,9 @@ export interface CapacitorCalendarPlugin {
209
232
  startDate?: number;
210
233
  endDate?: number;
211
234
  isAllDay?: boolean;
212
- alertOffsetInMinutes?: number;
235
+ alertOffsetInMinutes?: number | number[];
236
+ url?: string;
237
+ notes?: string;
213
238
  }): Promise<{
214
239
  result: string;
215
240
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { CalendarChooserDisplayStyle } from './schemas/enums/calendar-chooser-display-style';\nimport { CalendarChooserSelectionStyle } from './schemas/enums/calendar-chooser-selection-style';\nimport { PluginPermission } from './schemas/enums/plugin-permission';\nimport type { PermissionState } from '@capacitor/core';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { RemindersList } from './schemas/interfaces/reminders-list';\nimport type { PluginPermissionsMap } from './schemas/interfaces/plugin-permissions-map';\nimport type { ReminderRecurrenceRule } from './schemas/interfaces/reminder-recurrence-rule';\nimport type { CalendarEvent } from './schemas/interfaces/calendar-event';\nimport type { Reminder } from './schemas/interfaces/reminder';\n\nexport interface CapacitorCalendarPlugin {\n /**\n * Checks the current authorization status of a specific permission.\n *\n * @method checkPermission\n * @since 0.1.0\n * @platform iOS, Android\n * @param options An object with the name of the permission\n * @returns {Promise&lt;{ result: PermissionState }&gt;} A promise that resolves with the current status of the requested permission.\n * @example\n * const { result } = await this.checkPermission({ alias: 'readCalendar' });\n */\n checkPermission(options: { alias: PluginPermission }): Promise<{ result: PermissionState }>;\n\n /**\n * Checks the current authorization status of all the required permissions for the plugin.\n *\n * @method checkAllPermissions\n * @since 0.1.0\n * @platform iOS, Android\n * @returns {Promise&lt;PluginPermissionsMap&gt;} A promise that resolves with an object containing all the permissions and their status.\n * @example\n * const permissionsStatus = await this.checkAllPermissions();\n */\n checkAllPermissions(): Promise<PluginPermissionsMap>;\n\n /**\n * Requests authorization to a specific permission, if not already granted.\n * If the permission is already granted, it will directly return the status.\n *\n * @method requestPermission\n * @since 0.1.0\n * @platform iOS, Android\n * @param options An object with the name of the permission\n * @returns {Promise&lt;{ result: PermissionState }&gt;} A promise that resolves with the new permission status after the request is made.\n * @example\n * const { result } = await this.requestPermission({ alias: 'readCalendar' });\n */\n requestPermission(options: { alias: PluginPermission }): Promise<{ result: PermissionState }>;\n\n /**\n * Requests authorization to all the required permissions for the plugin, if they have not already been granted.\n *\n * @method requestAllPermissions\n * @since 0.1.0\n * @platform iOS, Android\n * @returns {Promise&lt;PluginPermissionsMap&gt;} A promise that resolves with the new permission statuses after the request is made.\n * @example\n * const permissionResults = await this.requestAllPermissions();\n */\n requestAllPermissions(): Promise<PluginPermissionsMap>;\n\n /**\n * Creates an event in the calendar by using the native calendar.\n * On iOS opens a native sheet and on Android opens an intent.\n *\n * @method createEventWithPrompt\n * @since 0.1.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>Android:</strong> readCalendar</li>\n * </ul>\n * @param {object} options - Options for creating the event.\n * @param {string} options.title - The title of the event.\n * @param {string} options.calendarId - The id of the destination calendar. (Optional)\n * @param {string} [options.location] - The location of the event. (Optional)\n * @param {number} [options.startDate] - The start date and time of the event. (Optional)\n * @param {number} [options.endDate] - The end date and time of the event. (Optional)\n * @param {boolean} [options.isAllDay] - Weather the event is for the entire day or not. (Optional)\n * @param {number} [options.alertOffsetInMinutes] - Ignored on Android. If a number >= 0 is provided,\n * an alert will be set for the event this many minutes *before* the event.\n * Negative values are ignored. (Optional)\n * @returns {Promise<{ result: string[] }>} A promise that resolves with an array of the ids of created events.\n * @example\n * 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 * }\n */\n createEventWithPrompt(options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number;\n }): Promise<{ result: string[] }>;\n\n /**\n * Presents a prompt to the user to select calendars. This method is available only on iOS.\n *\n * @method selectCalendarsWithPrompt\n * @since 0.2.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar</li>\n * </ul>\n * @param {object} options - Options for customizing the display and selection styles of the calendar chooser.\n * @param {CalendarChooserDisplayStyle} options.displayStyle - To show all or only writeable calendars.\n * @param {CalendarChooserSelectionStyle} [options.selectionStyle] - To be able to select multiple calendars or only one.\n * @returns { Promise<{ result: Calendar[] }> } A promise that resolves with an array of selected calendars,\n * where each calendar object contains an ID and a title.\n * @example\n * if (capacitor.getPlatform() === 'ios') {\n * const { result } = await selectCalendarsWithPrompt();\n * console.log(result); // [{ id: '1', title: 'Work Calendar' }]\n * }\n */\n selectCalendarsWithPrompt(options: {\n displayStyle: CalendarChooserDisplayStyle;\n selectionStyle: CalendarChooserSelectionStyle;\n }): Promise<{ result: Calendar[] }>;\n\n /**\n * Retrieves a list of calendars available on the device.\n *\n * @async\n * @method listCalendars\n * @platform iOS, Android\n * @returns {Promise<{ result: Calendar[] }>} A promise that resolves with an array of calendars available on the device.\n * Each calendar object in the array contains an ID and a title.\n * @example\n * const { result } = await listCalendars();\n * console.log(result); // [{ id: '1', title: 'Work Calendar' }, { id: '2', title: 'Personal Calendar' }]\n */\n listCalendars(): Promise<{ result: Calendar[] }>;\n\n /**\n * Retrieves the default calendar set on the device.\n *\n * @method getDefaultCalendar\n * @platform iOS, Android\n * @returns {Promise<{ result: Calendar }>} A promise that resolves with the default calendar set on the device.\n * The returned calendar object contains an ID and a title.\n * @example\n * const { result } = await getDefaultCalendar();\n * console.log(result); // { id: '1', title: 'Default Calendar' }\n */\n getDefaultCalendar(): Promise<{ result: Calendar }>;\n\n /**\n * Creates an event with the provided options.\n *\n * @method createEvent\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar</li>\n * <li><strong>Android:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options - Options for creating the event.\n * @param {string} options.title - The title of the event.\n * @param {string} options.calendarId - The id of the destination calendar. (Optional)\n * @param {string} [options.location] - The location of the event. (Optional)\n * @param {number} [options.startDate] - The start date and time of the event. (Optional)\n * @param {number} [options.endDate] - The end date and time of the event. (Optional)\n * @param {boolean} [options.isAllDay] - Weather the event is for the entire day or not. (Optional)\n * @param {number} [options.alertOffsetInMinutes] - If a number >= 0 is provided, an alert will be set for the event this many\n * minutes *before* the event. Negative values are ignored. (Optional)\n * @returns {Promise<{ result: string }>} A promise that resolves with the id of the created event.\n * @example\n * const now = Date.now();\n * const eventOptions = {\n * title: 'Team Meeting',\n * location: 'Conference Room A',\n * startDate: now,\n * endDate: now + 2 * 60 * 60 * 1000,\n * isAllDay: false,\n * alertOffsetInMinutes: 5,\n * };\n * const { result } = await createEvent(eventOptions);\n */\n createEvent(options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number;\n }): Promise<{ result: string }>;\n\n /**\n * Retrieves the default reminders list set on the device.\n *\n * @method getDefaultRemindersList\n * @platform iOS\n * @returns {Promise<{ result: RemindersList }>} A promise that resolves with the default reminder list set on the device.\n * The returned reminders list object contains an ID and a title.\n * @example\n * const { result } = await getDefaultRemindersList();\n * console.log(result); // { id: '1', title: 'Default Reminders List' }\n */\n getDefaultRemindersList(): Promise<{ result: RemindersList }>;\n\n /**\n * Retrieves all available reminders lists on the device.\n *\n * @async\n * @method getRemindersLists\n * @platform iOS\n * @returns {Promise<{ result: RemindersList[] }>} A promise that resolves with an array of reminders lists available on the device.\n * Each reminders list object in the array contains an ID and a title.\n * @example\n * const { result } = await getRemindersLists();\n * console.log(result); // [{ id: '1', title: 'Groceries' }, { id: '2', title: 'Subscriptions' }]\n */\n getRemindersLists(): Promise<{ result: RemindersList[] }>;\n\n /**\n * Creates a reminder with the provided options.\n *\n * @method createReminder\n * @since 0.5.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeReminders</li>\n * </ul>\n * @param {object} options - Options for creating the reminder.\n * @param {string} options.title - The title of the reminder.\n * @param {string} options.listId - The id of the destination reminders list. (Optional)\n * @param {number} [options.priority] - The priority of the reminder. A number between one and nine where nine\n * has the least priority and 0 means no priority at all. Values outside of this range will be rounded to the\n * nearest border. (Optional)\n * @param {boolean} [options.isCompleted] - Whether the reminder is completed already or not. (Optional)\n * @param {number} [options.startDate] - The start date of the reminder. (Optional)\n * @param {number} [options.dueDate] - The due date of the reminder. (Optional)\n * @param {number} [options.completionDate] - The date at which the reminder was completed. (Optional)\n * @param {string} [options.notes] - Additional notes about the reminder. (Optional)\n * @param {string} [options.url] - A URL to save under the reminder. (Optional)\n * @param {string} [options.location] - A location to save under the reminder. (Optional)\n * @param {string} [options.recurrence] - The rules for the recurrence of the reminder. (Optional)\n * @returns {Promise<{ result: string }>} A Promise that resolves with the id of the created reminder\n * @example\n * const now = Date.now();\n * const rules: ReminderRecurrenceRule = {\n * frequency: ReminderRecurrenceFrequency.MONTHLY,\n * interval: 10,\n * end: Date.now()\n * }\n * const 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 * };\n * const { result } = await createReminder(reminderOptions);\n * console.log(result); // 'ID_1'\n */\n createReminder(options: {\n title: string;\n listId?: string;\n priority?: number;\n isCompleted?: boolean;\n startDate?: number;\n dueDate?: number;\n completionDate?: number;\n notes?: string;\n url?: string;\n location?: string;\n recurrence?: ReminderRecurrenceRule;\n }): Promise<{ result: string }>;\n\n /**\n * Opens the calendar app. Since the user leaves your app, use this method with caution.\n * It will open the calendar on today's date if no date is provided.\n *\n * @method openCalendar\n * @platform iOS, Android\n * @param {object} options - Options for opening the calendar.\n * @param {number} options.date - The date at which the calendar should be opened. (Optional)\n * @returns {Promise<void>}\n * @example\n * void CapacitorCalendar.openCalendar({ date: Date.now() });\n */\n openCalendar(options: { date?: number }): Promise<void>;\n\n /**\n * Opens the reminders app. Since the user leaves your app, use this method with caution.\n *\n * @method openReminders\n * @platform iOS\n * @returns {Promise<void>}\n * @example\n * void CapacitorCalendar.openReminders();\n */\n openReminders(): Promise<void>;\n\n /**\n * Retrieves the list of calendar events present in the given date range.\n *\n * @method listEventsInRange\n * @since 0.10.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar</li>\n * <li><strong>Android:</strong> readCalendar</li>\n * </ul>\n * @param {object} options Options for defining the date range.\n * @param {number} options.startDate The start of the date range.\n * @param {number} options.endDate The end of the date range.\n * @returns {Promise<{ result: CalendarEvent[] }>} A Promise that resolves with the list of events.\n * @example\n * const { result } = await CapacitorCalendar.listEventsInRange({\n * startDate: Date.now(),\n * endDate: Date.now() + 6 * 7 * 24 * 60 * 60 * 1000, // 6 weeks from now\n * })\n */\n listEventsInRange(options: { startDate: number; endDate: number }): Promise<{ result: CalendarEvent[] }>;\n\n /**\n * Deletes events from the calendar given their IDs.\n *\n * @method deleteEventsById\n * @since 0.11.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar</li>\n * <li><strong>Android:</strong> writeCalendar</li>\n * </ul>\n * @param {object} options Options for defining event IDs.\n * @param {number} options.ids An array of event IDs to be deleted.\n * @returns {Promise<{ deleted: string[], failed: string[] }>}\n * 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.\n * @example\n * const idsToDelete = ['ID_1', 'ID_2', 'ID_DOES_NOT_EXIST'];\n * const { result } = await CapacitorCalendar.deleteEventsById(idsToDelete)\n * console.log(result.deleted) // ['ID_1', 'ID_2']\n * console.log(result.failed) // ['ID_DOES_NOT_EXIST']\n */\n deleteEventsById(options: { ids: string[] }): Promise<{ result: { deleted: string[]; failed: string[] } }>;\n\n /**\n * Creates a calendar\n *\n * @method createCalendar\n * @since 5.2.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options Options for creating a calendar.\n * @param {string} options.title The title of the calendar to create.\n * @param {string} options.color The color of the calendar to create.\n * The color should be a HEX string. (Optional)\n * @returns {Promise<{ result: string }>} The id of the created calendar.\n * @example\n * { result } = await CapacitorCalendar.createCalendar({\n * title: 'New Calendar',\n * color: '#1d00fc',\n * });\n * console.log(result); // 'CALENDAR_ID'\n */\n createCalendar(options: { title: string; color?: string }): Promise<{ result: string }>;\n\n /**\n * Deletes a calendar by id\n *\n * @method deleteCalendar\n * @since 5.2.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options Options for deleting a calendar.\n * @param {string} options.id The id of the calendar to delete.\n * @example\n * await CapacitorCalendar.deleteCalendar({ id: 'ID_1' });\n */\n deleteCalendar(options: { id: string }): Promise<void>;\n\n /**\n * Retrieves the list of reminders present in the given date range.\n *\n * @method getRemindersFromLists\n * @since 5.3.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readReminders</li>\n * </ul>\n * @param {object} options Options for defining the date range.\n * It Will fetch all reminders from all available lists if not provided. (Optional)\n * @param {string[]} options.listIds An array of reminder list ids.\n * @returns {Promise<{ result: Reminder[] }>} A Promise that resolves with the list of reminders.\n * @example\n * const now = Date.now();\n * const { result } = await CapacitorCalendar.getRemindersFromLists({\n * listIds: ['LIST_ID_1', 'LIST_ID_2'],\n * });\n */\n getRemindersFromLists(options?: { listIds: string[] }): Promise<{ result: Reminder[] }>;\n\n /**\n * Deletes reminders given their IDs.\n *\n * @method deleteRemindersById\n * @since 5.3.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeReminders</li>\n * </ul>\n * @param {object} options Options for defining reminder IDs.\n * @param {number} options.ids An array of reminder IDs to be deleted.\n * @returns {Promise<{ deleted: string[], failed: string[] }>}\n * 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.\n * @example\n * const idsToDelete = ['ID_1', 'ID_2', 'ID_DOES_NOT_EXIST'];\n * const { result } = await CapacitorCalendar.deleteRemindersById(idsToDelete)\n * console.log(result.deleted) // ['ID_1', 'ID_2']\n * console.log(result.failed) // ['ID_DOES_NOT_EXIST']\n */\n deleteRemindersById(options: { ids: string[] }): Promise<{ result: { deleted: string[]; failed: string[] } }>;\n\n /**\n * Requests write access for the calendar. If its already granted, it will directly return the state.\n *\n * @method requestWriteOnlyCalendarAccess\n * @since 5.4.0\n * @platform iOS, Android\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of the write access permission.\n * @example\n * const { result } = await this.requestWriteOnlyCalendarAccess();\n */\n requestWriteOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read access for the calendar. If its already granted, it will directly return the state.\n *\n * @method requestReadOnlyCalendarAccess\n * @since 5.4.0\n * @platform Android\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of the read access permission.\n * @example\n * const { result } = await this.requestReadOnlyCalendarAccess();\n */\n requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read and write access for the calendar. If its already granted, it will directly return the state.\n *\n * @method requestFullCalendarAccess\n * @since 5.4.0\n * @platform iOS, Android\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of read and write access permission.\n * @example\n * const { result } = await this.requestFullCalendarAccess();\n */\n requestFullCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read and write access for the reminders. If its already granted, it will directly return the state.\n *\n * @method requestFullRemindersAccess\n * @since 5.4.0\n * @platform iOS\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of read and write access permission.\n * @example\n * const { result } = await this.requestFullRemindersAccess();\n */\n requestFullRemindersAccess(): Promise<{ result: PermissionState }>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { CalendarChooserDisplayStyle } from './schemas/enums/calendar-chooser-display-style';\nimport { CalendarChooserSelectionStyle } from './schemas/enums/calendar-chooser-selection-style';\nimport { PluginPermission } from './schemas/enums/plugin-permission';\nimport type { PermissionState } from '@capacitor/core';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { RemindersList } from './schemas/interfaces/reminders-list';\nimport type { PluginPermissionsMap } from './schemas/interfaces/plugin-permissions-map';\nimport type { ReminderRecurrenceRule } from './schemas/interfaces/reminder-recurrence-rule';\nimport type { CalendarEvent } from './schemas/interfaces/calendar-event';\nimport type { Reminder } from './schemas/interfaces/reminder';\n\nexport interface CapacitorCalendarPlugin {\n /**\n * Checks the current authorization status of a specific permission.\n *\n * @method checkPermission\n * @since 0.1.0\n * @platform iOS, Android\n * @param options An object with the name of the permission\n * @returns {Promise&lt;{ result: PermissionState }&gt;} A promise that resolves with the current status of the requested permission.\n * @example\n * const { result } = await this.checkPermission({ alias: 'readCalendar' });\n */\n checkPermission(options: { alias: PluginPermission }): Promise<{ result: PermissionState }>;\n\n /**\n * Checks the current authorization status of all the required permissions for the plugin.\n *\n * @method checkAllPermissions\n * @since 0.1.0\n * @platform iOS, Android\n * @returns {Promise&lt;PluginPermissionsMap&gt;} A promise that resolves with an object containing all the permissions and their status.\n * @example\n * const permissionsStatus = await this.checkAllPermissions();\n */\n checkAllPermissions(): Promise<PluginPermissionsMap>;\n\n /**\n * Requests authorization to a specific permission, if not already granted.\n * If the permission is already granted, it will directly return the status.\n *\n * @method requestPermission\n * @since 0.1.0\n * @platform iOS, Android\n * @param options An object with the name of the permission\n * @returns {Promise&lt;{ result: PermissionState }&gt;} A promise that resolves with the new permission status after the request is made.\n * @example\n * const { result } = await this.requestPermission({ alias: 'readCalendar' });\n */\n requestPermission(options: { alias: PluginPermission }): Promise<{ result: PermissionState }>;\n\n /**\n * Requests authorization to all the required permissions for the plugin, if they have not already been granted.\n *\n * @method requestAllPermissions\n * @since 0.1.0\n * @platform iOS, Android\n * @returns {Promise&lt;PluginPermissionsMap&gt;} A promise that resolves with the new permission statuses after the request is made.\n * @example\n * const permissionResults = await this.requestAllPermissions();\n */\n requestAllPermissions(): Promise<PluginPermissionsMap>;\n\n /**\n * Creates an event in the calendar by using the native calendar.\n * On iOS opens a native sheet and on Android opens an intent.\n *\n * @method createEventWithPrompt\n * @since 0.1.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>Android:</strong> readCalendar</li>\n * </ul>\n * @param {object} options Options for creating the event.\n * @param {string} options.title The title of the event.\n * @param {string} options.calendarId The id of the destination calendar. (Optional)\n * @param {string} [options.location] The location of the event. (Optional)\n * @param {number} [options.startDate] The start date and time of the event. (Optional)\n * @param {number} [options.endDate] The end date and time of the event. (Optional)\n * @param {boolean} [options.isAllDay] Weather the event is for the entire day or not. (Optional)\n * @param {number} [options.alertOffsetInMinutes] If a number >= 0 is provided, an alert will be set for the event this many\n * minutes *before* the event. If an array of number >= 0 are provided, it will add multiple alerts.\n * On iOS only the first two valid elements of the array are taken into account.\n * The parameter is not supported on Android. Negative values are ignored. (Optional)\n * @param {string} [options.url] The URL of the event. (Optional)\n * @param {string} [options.notes] The notes of the event. (Optional)\n * @returns {Promise<{ result: string[] }>} A promise that resolves with an array of the ids of created events.\n * @example\n * if (capacitor.getPlatform() === 'android') {\n * await this.requestPermission({ alias: 'readCalendar' });\n * { result } = result = await this.createEventWithPrompt({\n * title: 'Title',\n * alertOffsetInMinutes: [5, 30],\n * url: 'https://capacitor-calendar.pages.dev',\n * notes: 'A CapacitorJS plugin',\n * });\n * } else {\n * { result } = result = await this.createEventWithPrompt({\n * title: 'Title',\n * alertOffsetInMinutes: [0, 1440],\n * url: 'https://capacitor-calendar.pages.dev',\n * notes: 'A CapacitorJS plugin'\n * });\n * }\n */\n createEventWithPrompt(options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number | number[];\n url?: string;\n notes?: string;\n }): Promise<{ result: string[] }>;\n\n /**\n * Presents a prompt to the user to select calendars. This method is available only on iOS.\n *\n * @method selectCalendarsWithPrompt\n * @since 0.2.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar</li>\n * </ul>\n * @param {object} options - Options for customizing the display and selection styles of the calendar chooser.\n * @param {CalendarChooserDisplayStyle} options.displayStyle - To show all or only writeable calendars.\n * @param {CalendarChooserSelectionStyle} [options.selectionStyle] - To be able to select multiple calendars or only one.\n * @returns { Promise<{ result: Calendar[] }> } A promise that resolves with an array of selected calendars,\n * where each calendar object contains an ID and a title.\n * @example\n * if (capacitor.getPlatform() === 'ios') {\n * const { result } = await selectCalendarsWithPrompt();\n * console.log(result); // [{ id: '1', title: 'Work Calendar' }]\n * }\n */\n selectCalendarsWithPrompt(options: {\n displayStyle: CalendarChooserDisplayStyle;\n selectionStyle: CalendarChooserSelectionStyle;\n }): Promise<{ result: Calendar[] }>;\n\n /**\n * Retrieves a list of calendars available on the device.\n *\n * @async\n * @method listCalendars\n * @platform iOS, Android\n * @returns {Promise<{ result: Calendar[] }>} A promise that resolves with an array of calendars available on the device.\n * Each calendar object in the array contains an ID and a title.\n * @example\n * const { result } = await listCalendars();\n * console.log(result); // [{ id: '1', title: 'Work Calendar' }, { id: '2', title: 'Personal Calendar' }]\n */\n listCalendars(): Promise<{ result: Calendar[] }>;\n\n /**\n * Retrieves the default calendar set on the device.\n *\n * @method getDefaultCalendar\n * @since 0.3.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar</li>\n * <li><strong>Android:</strong> readCalendar</li>\n * </ul>\n * @returns {Promise<{ result: Calendar | null }>} A promise that resolves with the default calendar set on the device.\n * The returned calendar object contains an ID and a title. Returns null if there is no default calendar found.\n * @example\n * const { result } = await getDefaultCalendar();\n * console.log(result); // { id: '1', title: 'Default Calendar' }\n */\n getDefaultCalendar(): Promise<{ result: Calendar | null }>;\n\n /**\n * Creates an event with the provided options.\n *\n * @method createEvent\n * @since 0.4.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar</li>\n * <li><strong>Android:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options Options for creating the event.\n * @param {string} options.title The title of the event.\n * @param {string} options.calendarId The id of the destination calendar. (Optional)\n * @param {string} [options.location] The location of the event. (Optional)\n * @param {number} [options.startDate] The start date and time of the event. (Optional)\n * @param {number} [options.endDate] The end date and time of the event. (Optional)\n * @param {boolean} [options.isAllDay] Weather the event is for the entire day or not. (Optional)\n * @param {number} [options.alertOffsetInMinutes] If a number >= 0 is provided, an alert will be set for the event this many\n * minutes *before* the event. If an array of number >= 0 are provided, it will add multiple alerts.\n * On iOS only the first two valid elements of the array are taken into account.\n * Negative values are ignored. (Optional)\n * @param {string} [options.url] The URL of the event. (Optional)\n * @param {string} [options.notes] The notes of the event. (Optional)\n * @returns {Promise<{ result: string }>} A promise that resolves with the id of the created event.\n * @example\n * const now = Date.now();\n * const eventOptions = {\n * title: 'Team Meeting',\n * location: 'Conference Room A',\n * startDate: now,\n * endDate: now + 2 * 60 * 60 * 1000,\n * isAllDay: false,\n * alertOffsetInMinutes: 5,\n * url: 'https://capacitor-calendar.pages.dev',\n * notes: 'A CapacitorJS plugin'\n * };\n * const { result } = await createEvent(eventOptions);\n */\n createEvent(options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number | number[];\n url?: string;\n notes?: string;\n }): Promise<{ result: string }>;\n\n /**\n * Retrieves the default reminders list set on the device.\n *\n * @method getDefaultRemindersList\n * @platform iOS\n * @returns {Promise<{ result: RemindersList }>} A promise that resolves with the default reminder list set on the device.\n * The returned reminders list object contains an ID and a title.\n * @example\n * const { result } = await getDefaultRemindersList();\n * console.log(result); // { id: '1', title: 'Default Reminders List' }\n */\n getDefaultRemindersList(): Promise<{ result: RemindersList }>;\n\n /**\n * Retrieves all available reminders lists on the device.\n *\n * @async\n * @method getRemindersLists\n * @platform iOS\n * @returns {Promise<{ result: RemindersList[] }>} A promise that resolves with an array of reminders lists available on the device.\n * Each reminders list object in the array contains an ID and a title.\n * @example\n * const { result } = await getRemindersLists();\n * console.log(result); // [{ id: '1', title: 'Groceries' }, { id: '2', title: 'Subscriptions' }]\n */\n getRemindersLists(): Promise<{ result: RemindersList[] }>;\n\n /**\n * Creates a reminder with the provided options.\n *\n * @method createReminder\n * @since 0.5.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeReminders</li>\n * </ul>\n * @param {object} options - Options for creating the reminder.\n * @param {string} options.title - The title of the reminder.\n * @param {string} options.listId - The id of the destination reminders list. (Optional)\n * @param {number} [options.priority] - The priority of the reminder. A number between one and nine where nine\n * has the least priority and 0 means no priority at all. Values outside of this range will be rounded to the\n * nearest border. (Optional)\n * @param {boolean} [options.isCompleted] - Whether the reminder is completed already or not. (Optional)\n * @param {number} [options.startDate] - The start date of the reminder. (Optional)\n * @param {number} [options.dueDate] - The due date of the reminder. (Optional)\n * @param {number} [options.completionDate] - The date at which the reminder was completed. (Optional)\n * @param {string} [options.notes] - Additional notes about the reminder. (Optional)\n * @param {string} [options.url] - A URL to save under the reminder. (Optional)\n * @param {string} [options.location] - A location to save under the reminder. (Optional)\n * @param {string} [options.recurrence] - The rules for the recurrence of the reminder. (Optional)\n * @returns {Promise<{ result: string }>} A Promise that resolves with the id of the created reminder\n * @example\n * const now = Date.now();\n * const rules: ReminderRecurrenceRule = {\n * frequency: ReminderRecurrenceFrequency.MONTHLY,\n * interval: 10,\n * end: Date.now()\n * }\n * const 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 * };\n * const { result } = await createReminder(reminderOptions);\n * console.log(result); // 'ID_1'\n */\n createReminder(options: {\n title: string;\n listId?: string;\n priority?: number;\n isCompleted?: boolean;\n startDate?: number;\n dueDate?: number;\n completionDate?: number;\n notes?: string;\n url?: string;\n location?: string;\n recurrence?: ReminderRecurrenceRule;\n }): Promise<{ result: string }>;\n\n /**\n * Opens the calendar app. Since the user leaves your app, use this method with caution.\n * It will open the calendar on today's date if no date is provided.\n *\n * @method openCalendar\n * @platform iOS, Android\n * @param {object} options - Options for opening the calendar.\n * @param {number} options.date - The date at which the calendar should be opened. (Optional)\n * @returns {Promise<void>}\n * @example\n * void CapacitorCalendar.openCalendar({ date: Date.now() });\n */\n openCalendar(options: { date?: number }): Promise<void>;\n\n /**\n * Opens the reminders app. Since the user leaves your app, use this method with caution.\n *\n * @method openReminders\n * @platform iOS\n * @returns {Promise<void>}\n * @example\n * void CapacitorCalendar.openReminders();\n */\n openReminders(): Promise<void>;\n\n /**\n * Retrieves the list of calendar events present in the given date range.\n *\n * @method listEventsInRange\n * @since 0.10.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar</li>\n * <li><strong>Android:</strong> readCalendar</li>\n * </ul>\n * @param {object} options Options for defining the date range.\n * @param {number} options.startDate The start of the date range.\n * @param {number} options.endDate The end of the date range.\n * @returns {Promise<{ result: CalendarEvent[] }>} A Promise that resolves with the list of events.\n * @example\n * const { result } = await CapacitorCalendar.listEventsInRange({\n * startDate: Date.now(),\n * endDate: Date.now() + 6 * 7 * 24 * 60 * 60 * 1000, // 6 weeks from now\n * })\n */\n listEventsInRange(options: { startDate: number; endDate: number }): Promise<{ result: CalendarEvent[] }>;\n\n /**\n * Deletes events from the calendar given their IDs.\n *\n * @method deleteEventsById\n * @since 0.11.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar</li>\n * <li><strong>Android:</strong> writeCalendar</li>\n * </ul>\n * @param {object} options Options for defining event IDs.\n * @param {number} options.ids An array of event IDs to be deleted.\n * @returns {Promise<{ deleted: string[], failed: string[] }>}\n * 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.\n * @example\n * const idsToDelete = ['ID_1', 'ID_2', 'ID_DOES_NOT_EXIST'];\n * const { result } = await CapacitorCalendar.deleteEventsById(idsToDelete)\n * console.log(result.deleted) // ['ID_1', 'ID_2']\n * console.log(result.failed) // ['ID_DOES_NOT_EXIST']\n */\n deleteEventsById(options: { ids: string[] }): Promise<{ result: { deleted: string[]; failed: string[] } }>;\n\n /**\n * Creates a calendar\n *\n * @method createCalendar\n * @since 5.2.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options Options for creating a calendar.\n * @param {string} options.title The title of the calendar to create.\n * @param {string} options.color The color of the calendar to create.\n * The color should be a HEX string. (Optional)\n * @returns {Promise<{ result: string }>} The id of the created calendar.\n * @example\n * { result } = await CapacitorCalendar.createCalendar({\n * title: 'New Calendar',\n * color: '#1d00fc',\n * });\n * console.log(result); // 'CALENDAR_ID'\n */\n createCalendar(options: { title: string; color?: string }): Promise<{ result: string }>;\n\n /**\n * Deletes a calendar by id\n *\n * @method deleteCalendar\n * @since 5.2.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options Options for deleting a calendar.\n * @param {string} options.id The id of the calendar to delete.\n * @example\n * await CapacitorCalendar.deleteCalendar({ id: 'ID_1' });\n */\n deleteCalendar(options: { id: string }): Promise<void>;\n\n /**\n * Retrieves the list of reminders present in the given date range.\n *\n * @method getRemindersFromLists\n * @since 5.3.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readReminders</li>\n * </ul>\n * @param {object} options Options for defining the date range.\n * It Will fetch all reminders from all available lists if not provided. (Optional)\n * @param {string[]} options.listIds An array of reminder list ids.\n * @returns {Promise<{ result: Reminder[] }>} A Promise that resolves with the list of reminders.\n * @example\n * const now = Date.now();\n * const { result } = await CapacitorCalendar.getRemindersFromLists({\n * listIds: ['LIST_ID_1', 'LIST_ID_2'],\n * });\n */\n getRemindersFromLists(options?: { listIds: string[] }): Promise<{ result: Reminder[] }>;\n\n /**\n * Deletes reminders given their IDs.\n *\n * @method deleteRemindersById\n * @since 5.3.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeReminders</li>\n * </ul>\n * @param {object} options Options for defining reminder IDs.\n * @param {number} options.ids An array of reminder IDs to be deleted.\n * @returns {Promise<{ deleted: string[], failed: string[] }>}\n * 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.\n * @example\n * const idsToDelete = ['ID_1', 'ID_2', 'ID_DOES_NOT_EXIST'];\n * const { result } = await CapacitorCalendar.deleteRemindersById(idsToDelete)\n * console.log(result.deleted) // ['ID_1', 'ID_2']\n * console.log(result.failed) // ['ID_DOES_NOT_EXIST']\n */\n deleteRemindersById(options: { ids: string[] }): Promise<{ result: { deleted: string[]; failed: string[] } }>;\n\n /**\n * Requests write access for the calendar. If its already granted, it will directly return the state.\n *\n * @method requestWriteOnlyCalendarAccess\n * @since 5.4.0\n * @platform iOS, Android\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of the write access permission.\n * @example\n * const { result } = await this.requestWriteOnlyCalendarAccess();\n */\n requestWriteOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read access for the calendar. If its already granted, it will directly return the state.\n *\n * @method requestReadOnlyCalendarAccess\n * @since 5.4.0\n * @platform Android\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of the read access permission.\n * @example\n * const { result } = await this.requestReadOnlyCalendarAccess();\n */\n requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read and write access for the calendar. If its already granted, it will directly return the state.\n *\n * @method requestFullCalendarAccess\n * @since 5.4.0\n * @platform iOS, Android\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of read and write access permission.\n * @example\n * const { result } = await this.requestFullCalendarAccess();\n */\n requestFullCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read and write access for the reminders. If its already granted, it will directly return the state.\n *\n * @method requestFullRemindersAccess\n * @since 5.4.0\n * @platform iOS\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of read and write access permission.\n * @example\n * const { result } = await this.requestFullRemindersAccess();\n */\n requestFullRemindersAccess(): Promise<{ result: PermissionState }>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -27,7 +27,9 @@ export declare class CapacitorCalendarWeb extends WebPlugin implements Capacitor
27
27
  startDate?: number;
28
28
  endDate?: number;
29
29
  isAllDay?: boolean;
30
- alertOffsetInMinutes?: number;
30
+ alertOffsetInMinutes?: number | number[];
31
+ url?: string;
32
+ notes?: string;
31
33
  }): Promise<{
32
34
  result: string[];
33
35
  }>;
@@ -38,7 +40,7 @@ export declare class CapacitorCalendarWeb extends WebPlugin implements Capacitor
38
40
  result: Calendar[];
39
41
  }>;
40
42
  getDefaultCalendar(): Promise<{
41
- result: Calendar;
43
+ result: Calendar | null;
42
44
  }>;
43
45
  createEvent(_options: {
44
46
  title: string;
@@ -47,7 +49,9 @@ export declare class CapacitorCalendarWeb extends WebPlugin implements Capacitor
47
49
  startDate?: number;
48
50
  endDate?: number;
49
51
  isAllDay?: boolean;
50
- alertOffsetInMinutes?: number;
52
+ alertOffsetInMinutes?: number | number[];
53
+ url?: string;
54
+ notes?: string;
51
55
  }): Promise<{
52
56
  result: string;
53
57
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"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","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { PermissionState, WebPlugin } from '@capacitor/core';\nimport { CapacitorCalendarPlugin } from './definitions';\nimport { PluginPermission } from './schemas/enums/plugin-permission';\nimport { ReminderRecurrenceRule } from './schemas/interfaces/reminder-recurrence-rule';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { RemindersList } from './schemas/interfaces/reminders-list';\nimport type { PluginPermissionsMap } from './schemas/interfaces/plugin-permissions-map';\nimport type { CalendarEvent } from './schemas/interfaces/calendar-event';\nimport type { Reminder } from './schemas/interfaces/reminder';\n\nexport class CapacitorCalendarWeb extends WebPlugin implements CapacitorCalendarPlugin {\n public checkPermission(_options: { alias: PluginPermission }): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.checkPermission.name} is not implemented on the web`);\n }\n\n public checkAllPermissions(): Promise<PluginPermissionsMap> {\n throw this.unimplemented(`${this.checkAllPermissions.name} is not implemented on the web`);\n }\n\n public requestPermission(_options: { alias: PluginPermission }): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.requestPermission.name} is not implemented on the web`);\n }\n\n public requestAllPermissions(): Promise<PluginPermissionsMap> {\n throw this.unimplemented(`${this.requestAllPermissions.name} is not implemented on the web`);\n }\n\n public createEventWithPrompt(_options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number;\n }): Promise<{ result: string[] }> {\n throw this.unimplemented(`${this.createEventWithPrompt.name} is not implemented on the web`);\n }\n\n public selectCalendarsWithPrompt(): Promise<{ result: Calendar[] }> {\n throw this.unimplemented(`${this.selectCalendarsWithPrompt.name} is not implemented on the web`);\n }\n\n public listCalendars(): Promise<{ result: Calendar[] }> {\n throw this.unimplemented(`${this.listCalendars.name} is not implemented on the web`);\n }\n\n public getDefaultCalendar(): Promise<{ result: Calendar }> {\n throw this.unimplemented(`${this.getDefaultCalendar.name} is not implemented on the web`);\n }\n\n public createEvent(_options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number;\n }): Promise<{\n result: string;\n }> {\n throw this.unimplemented(`${this.createEvent.name} is not implemented on the web`);\n }\n\n public createReminder(_options: {\n title: string;\n listId?: string;\n priority?: number;\n isCompleted?: boolean;\n startDate?: number;\n dueDate?: number;\n completionDate?: number;\n notes?: string;\n url?: string;\n location?: string;\n recurrence?: ReminderRecurrenceRule;\n }): Promise<{ result: string }> {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n\n public getDefaultRemindersList(): Promise<{ result: RemindersList }> {\n throw this.unimplemented(`${this.getDefaultRemindersList.name} is not implemented on the web`);\n }\n\n public getRemindersLists(): Promise<{ result: RemindersList[] }> {\n throw this.unimplemented(`${this.getRemindersLists.name} is not implemented on the web`);\n }\n\n public openCalendar(_options: { date?: number }): Promise<void> {\n throw this.unimplemented(`${this.openCalendar.name} is not implemented on the web`);\n }\n\n public openReminders(): Promise<void> {\n throw this.unimplemented(`${this.openReminders.name} is not implemented on the web`);\n }\n\n public listEventsInRange(_options: { startDate: number; endDate: number }): Promise<{ result: CalendarEvent[] }> {\n throw this.unimplemented(`${this.listEventsInRange.name} is not implemented on the web`);\n }\n\n public deleteEventsById(_options: { ids: string[] }): Promise<{\n result: { deleted: string[]; failed: string[] };\n }> {\n throw this.unimplemented(`${this.deleteEventsById.name} is not implemented on the web`);\n }\n\n public createCalendar(_options: { title: string; color?: string }): Promise<{ result: string }> {\n throw this.unimplemented(`${this.createCalendar.name} is not implemented on the web`);\n }\n\n public deleteCalendar(_options: { id: string }): Promise<void> {\n throw this.unimplemented(`${this.deleteCalendar.name} is not implemented on the web`);\n }\n\n public getRemindersFromLists(_options?: { listIds: string[] }): Promise<{ result: Reminder[] }> {\n throw this.unimplemented(`${this.getRemindersFromLists.name} is not implemented on the web`);\n }\n\n public deleteRemindersById(_options: {\n ids: string[];\n }): Promise<{ result: { deleted: string[]; failed: string[] } }> {\n throw this.unimplemented(`${this.deleteRemindersById.name} is not implemented on the web`);\n }\n\n public requestWriteOnlyCalendarAccess(): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.requestWriteOnlyCalendarAccess.name} is not implemented on the web`);\n }\n\n public requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.requestReadOnlyCalendarAccess.name} is not implemented on the web`);\n }\n\n public requestFullCalendarAccess(): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.requestFullCalendarAccess.name} is not implemented on the web`);\n }\n\n public requestFullRemindersAccess(): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.requestFullRemindersAccess.name} is not implemented on the web`);\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"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","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { PermissionState, WebPlugin } from '@capacitor/core';\nimport { CapacitorCalendarPlugin } from './definitions';\nimport { PluginPermission } from './schemas/enums/plugin-permission';\nimport { ReminderRecurrenceRule } from './schemas/interfaces/reminder-recurrence-rule';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { RemindersList } from './schemas/interfaces/reminders-list';\nimport type { PluginPermissionsMap } from './schemas/interfaces/plugin-permissions-map';\nimport type { CalendarEvent } from './schemas/interfaces/calendar-event';\nimport type { Reminder } from './schemas/interfaces/reminder';\n\nexport class CapacitorCalendarWeb extends WebPlugin implements CapacitorCalendarPlugin {\n public checkPermission(_options: { alias: PluginPermission }): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.checkPermission.name} is not implemented on the web`);\n }\n\n public checkAllPermissions(): Promise<PluginPermissionsMap> {\n throw this.unimplemented(`${this.checkAllPermissions.name} is not implemented on the web`);\n }\n\n public requestPermission(_options: { alias: PluginPermission }): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.requestPermission.name} is not implemented on the web`);\n }\n\n public requestAllPermissions(): Promise<PluginPermissionsMap> {\n throw this.unimplemented(`${this.requestAllPermissions.name} is not implemented on the web`);\n }\n\n public createEventWithPrompt(_options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number | number[];\n url?: string;\n notes?: string;\n }): Promise<{ result: string[] }> {\n throw this.unimplemented(`${this.createEventWithPrompt.name} is not implemented on the web`);\n }\n\n public selectCalendarsWithPrompt(): Promise<{ result: Calendar[] }> {\n throw this.unimplemented(`${this.selectCalendarsWithPrompt.name} is not implemented on the web`);\n }\n\n public listCalendars(): Promise<{ result: Calendar[] }> {\n throw this.unimplemented(`${this.listCalendars.name} is not implemented on the web`);\n }\n\n public getDefaultCalendar(): Promise<{ result: Calendar | null }> {\n throw this.unimplemented(`${this.getDefaultCalendar.name} is not implemented on the web`);\n }\n\n public createEvent(_options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number | number[];\n url?: string;\n notes?: string;\n }): Promise<{\n result: string;\n }> {\n throw this.unimplemented(`${this.createEvent.name} is not implemented on the web`);\n }\n\n public createReminder(_options: {\n title: string;\n listId?: string;\n priority?: number;\n isCompleted?: boolean;\n startDate?: number;\n dueDate?: number;\n completionDate?: number;\n notes?: string;\n url?: string;\n location?: string;\n recurrence?: ReminderRecurrenceRule;\n }): Promise<{ result: string }> {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n\n public getDefaultRemindersList(): Promise<{ result: RemindersList }> {\n throw this.unimplemented(`${this.getDefaultRemindersList.name} is not implemented on the web`);\n }\n\n public getRemindersLists(): Promise<{ result: RemindersList[] }> {\n throw this.unimplemented(`${this.getRemindersLists.name} is not implemented on the web`);\n }\n\n public openCalendar(_options: { date?: number }): Promise<void> {\n throw this.unimplemented(`${this.openCalendar.name} is not implemented on the web`);\n }\n\n public openReminders(): Promise<void> {\n throw this.unimplemented(`${this.openReminders.name} is not implemented on the web`);\n }\n\n public listEventsInRange(_options: { startDate: number; endDate: number }): Promise<{ result: CalendarEvent[] }> {\n throw this.unimplemented(`${this.listEventsInRange.name} is not implemented on the web`);\n }\n\n public deleteEventsById(_options: { ids: string[] }): Promise<{\n result: { deleted: string[]; failed: string[] };\n }> {\n throw this.unimplemented(`${this.deleteEventsById.name} is not implemented on the web`);\n }\n\n public createCalendar(_options: { title: string; color?: string }): Promise<{ result: string }> {\n throw this.unimplemented(`${this.createCalendar.name} is not implemented on the web`);\n }\n\n public deleteCalendar(_options: { id: string }): Promise<void> {\n throw this.unimplemented(`${this.deleteCalendar.name} is not implemented on the web`);\n }\n\n public getRemindersFromLists(_options?: { listIds: string[] }): Promise<{ result: Reminder[] }> {\n throw this.unimplemented(`${this.getRemindersFromLists.name} is not implemented on the web`);\n }\n\n public deleteRemindersById(_options: {\n ids: string[];\n }): Promise<{ result: { deleted: string[]; failed: string[] } }> {\n throw this.unimplemented(`${this.deleteRemindersById.name} is not implemented on the web`);\n }\n\n public requestWriteOnlyCalendarAccess(): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.requestWriteOnlyCalendarAccess.name} is not implemented on the web`);\n }\n\n public requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.requestReadOnlyCalendarAccess.name} is not implemented on the web`);\n }\n\n public requestFullCalendarAccess(): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.requestFullCalendarAccess.name} is not implemented on the web`);\n }\n\n public requestFullRemindersAccess(): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.requestFullRemindersAccess.name} is not implemented on the web`);\n }\n}\n"]}
@@ -33,8 +33,20 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
33
33
  if let isAllDay = parameters.isAllDay {
34
34
  newEvent.isAllDay = isAllDay
35
35
  }
36
- if let alertOffsetInMinutes = parameters.alertOffsetInMinutes, alertOffsetInMinutes >= 0 {
37
- newEvent.addAlarm(EKAlarm(relativeOffset: TimeInterval(-alertOffsetInMinutes * 60)))
36
+ if let alertOffsetInMinutesSingle = parameters.alertOffsetInMinutesSingle, alertOffsetInMinutesSingle >= 0 {
37
+ newEvent.addAlarm(EKAlarm(relativeOffset: TimeInterval(-alertOffsetInMinutesSingle * 60)))
38
+ } else if let alertOffsetInMinutesMultiple = parameters.alertOffsetInMinutesMultiple {
39
+ for alert in alertOffsetInMinutesMultiple {
40
+ if alert >= 0 {
41
+ newEvent.addAlarm(EKAlarm(relativeOffset: TimeInterval(-alert * 60)))
42
+ }
43
+ }
44
+ }
45
+ if let notes = parameters.notes {
46
+ newEvent.notes = notes
47
+ }
48
+ if let urlString = parameters.url, let url = URL(string: urlString) {
49
+ newEvent.url = url
38
50
  }
39
51
 
40
52
  return try await withCheckedThrowingContinuation { continuation in
@@ -90,7 +102,7 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
90
102
  return convertEKCalendarsToDictionaries(calendars: Set(eventStore.calendars(for: .event)))
91
103
  }
92
104
 
93
- public func getDefaultCalendar() throws -> [String: String] {
105
+ public func getDefaultCalendar() throws -> [String: String]? {
94
106
  let defaultCalendar = eventStore.defaultCalendarForNewEvents
95
107
  if let defaultCalendar = defaultCalendar {
96
108
  return [
@@ -98,7 +110,7 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
98
110
  "title": defaultCalendar.title
99
111
  ]
100
112
  } else {
101
- throw CapacitorCalendarPluginError.noDefaultCalendar
113
+ return nil
102
114
  }
103
115
  }
104
116
 
@@ -127,8 +139,20 @@ public class CapacitorCalendar: NSObject, EKEventEditViewDelegate, EKCalendarCho
127
139
  if let isAllDay = parameters.isAllDay {
128
140
  newEvent.isAllDay = isAllDay
129
141
  }
130
- if let alertOffsetInMinutes = parameters.alertOffsetInMinutes, alertOffsetInMinutes >= 0 {
131
- newEvent.addAlarm(EKAlarm(relativeOffset: TimeInterval(-alertOffsetInMinutes * 60)))
142
+ if let alertOffsetInMinutesSingle = parameters.alertOffsetInMinutesSingle, alertOffsetInMinutesSingle >= 0 {
143
+ newEvent.addAlarm(EKAlarm(relativeOffset: TimeInterval(-alertOffsetInMinutesSingle * 60)))
144
+ } else if let alertOffsetInMinutesMultiple = parameters.alertOffsetInMinutesMultiple {
145
+ for alert in alertOffsetInMinutesMultiple {
146
+ if alert >= 0 {
147
+ newEvent.addAlarm(EKAlarm(relativeOffset: TimeInterval(-alert * 60)))
148
+ }
149
+ }
150
+ }
151
+ if let notes = parameters.notes {
152
+ newEvent.notes = notes
153
+ }
154
+ if let urlString = parameters.url, let url = URL(string: urlString) {
155
+ newEvent.url = url
132
156
  }
133
157
 
134
158
  do {
@@ -130,19 +130,27 @@ public class CapacitorCalendarPlugin: CAPPlugin {
130
130
  let endDate = call.getDouble("endDate")
131
131
  let isAllDay = call.getBool("isAllDay")
132
132
  let calendarId = call.getString("calendarId")
133
- let alertOffsetInMinutes = call.getDouble("alertOffsetInMinutes")
134
-
135
- let eventParameters = EventCreationParameters(
136
- title: title,
137
- calendarId: calendarId,
138
- location: location,
139
- startDate: startDate,
140
- endDate: endDate,
141
- isAllDay: isAllDay,
142
- alertOffsetInMinutes: alertOffsetInMinutes
143
- )
133
+ let notes = call.getString("notes")
134
+ let url = call.getString("url")
144
135
 
145
136
  Task {
137
+ var eventParameters = EventCreationParameters(
138
+ title: title,
139
+ calendarId: calendarId,
140
+ location: location,
141
+ startDate: startDate,
142
+ endDate: endDate,
143
+ isAllDay: isAllDay,
144
+ notes: notes,
145
+ url: url
146
+ )
147
+
148
+ if let alertOffsetInMinutesSingle = call.getDouble("alertOffsetInMinutes") as Double? {
149
+ eventParameters.alertOffsetInMinutesSingle = alertOffsetInMinutesSingle
150
+ } else if let alertOffsetInMinutesMultiple = call.getArray("alertOffsetInMinutes") as? [Double]? {
151
+ eventParameters.alertOffsetInMinutesMultiple = alertOffsetInMinutesMultiple
152
+ }
153
+
146
154
  do {
147
155
  let result = try await calendar.createEventWithPrompt(with: eventParameters)
148
156
  call.resolve(["result": result])
@@ -180,7 +188,7 @@ public class CapacitorCalendarPlugin: CAPPlugin {
180
188
 
181
189
  @objc public func getDefaultCalendar(_ call: CAPPluginCall) {
182
190
  do {
183
- try call.resolve(["result": calendar.getDefaultCalendar()])
191
+ try call.resolve(["result": calendar.getDefaultCalendar() ?? NSNull()])
184
192
  } catch {
185
193
  call.reject("[CapacitorCalendar.\(#function)] No default calendar was found")
186
194
  return
@@ -197,18 +205,26 @@ public class CapacitorCalendarPlugin: CAPPlugin {
197
205
  let endDate = call.getDouble("endDate")
198
206
  let isAllDay = call.getBool("isAllDay")
199
207
  let calendarId = call.getString("calendarId")
200
- let alertOffsetInMinutes = call.getDouble("alertOffsetInMinutes")
208
+ let notes = call.getString("notes")
209
+ let url = call.getString("url")
201
210
 
202
- let eventParameters = EventCreationParameters(
211
+ var eventParameters = EventCreationParameters(
203
212
  title: title,
204
213
  calendarId: calendarId,
205
214
  location: location,
206
215
  startDate: startDate,
207
216
  endDate: endDate,
208
217
  isAllDay: isAllDay,
209
- alertOffsetInMinutes: alertOffsetInMinutes
218
+ notes: notes,
219
+ url: url
210
220
  )
211
221
 
222
+ if let alertOffsetInMinutesSingle = call.getDouble("alertOffsetInMinutes") as Double? {
223
+ eventParameters.alertOffsetInMinutesSingle = alertOffsetInMinutesSingle
224
+ } else if let alertOffsetInMinutesMultiple = call.getArray("alertOffsetInMinutes") as? [Double]? {
225
+ eventParameters.alertOffsetInMinutesMultiple = alertOffsetInMinutesMultiple
226
+ }
227
+
212
228
  do {
213
229
  let id = try calendar.createEvent(with: eventParameters)
214
230
  call.resolve(["result": id])
@@ -220,7 +236,7 @@ public class CapacitorCalendarPlugin: CAPPlugin {
220
236
 
221
237
  @objc public func getDefaultRemindersList(_ call: CAPPluginCall) {
222
238
  do {
223
- try call.resolve(["result": reminders.getDefaultRemindersList()])
239
+ try call.resolve(["result": reminders.getDefaultRemindersList() ?? NSNull()])
224
240
  } catch {
225
241
  call.reject("[CapacitorCalendar.\(#function)] No default Reminders list was found")
226
242
  return
@@ -13,7 +13,6 @@ public enum CapacitorCalendarPluginError: Error {
13
13
  case eventStoreAuthorization
14
14
  case viewControllerUnavailable
15
15
  case unknownActionEventCreationPrompt
16
- case noDefaultCalendar
17
16
  case unableToOpenCalendar
18
17
  case unableToOpenReminders
19
18
  case undefinedEvent
@@ -24,7 +24,7 @@ public class CapacitorReminders: NSObject {
24
24
  self.eventStore = eventStore
25
25
  }
26
26
 
27
- public func getDefaultRemindersList() throws -> [String: String] {
27
+ public func getDefaultRemindersList() throws -> [String: String]? {
28
28
  let defaultRemindersList = eventStore.defaultCalendarForNewReminders()
29
29
  if let defaultRemindersList = defaultRemindersList {
30
30
  return [
@@ -32,7 +32,7 @@ public class CapacitorReminders: NSObject {
32
32
  "title": defaultRemindersList.title
33
33
  ]
34
34
  } else {
35
- throw CapacitorCalendarPluginError.noDefaultCalendar
35
+ return nil
36
36
  }
37
37
  }
38
38
 
@@ -15,5 +15,8 @@ public struct EventCreationParameters {
15
15
  public var startDate: Double?
16
16
  public var endDate: Double?
17
17
  public var isAllDay: Bool?
18
- public var alertOffsetInMinutes: Double?
18
+ public var alertOffsetInMinutesSingle: Double?
19
+ public var alertOffsetInMinutesMultiple: [Double]?
20
+ public var notes: String?
21
+ public var url: String?
19
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebarooni/capacitor-calendar",
3
- "version": "6.4.0",
3
+ "version": "6.5.0",
4
4
  "description": "The Capacitor Calendar Plugin enables full calendar functionality on iOS and Android, with added reminder support for iOS devices.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",