@ebarooni/capacitor-calendar 8.9.0 → 8.10.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 (28) hide show
  1. package/README.md +20 -5
  2. package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +2 -4
  3. package/android/src/main/java/dev/barooni/capacitor/calendar/PluginError.kt +37 -22
  4. package/android/src/main/java/dev/barooni/capacitor/calendar/implementation/CapacitorCalendar.kt +1 -1
  5. package/android/src/main/java/dev/barooni/capacitor/calendar/models/data/CalendarInfo.kt +1 -0
  6. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CreateEventInput.kt +4 -1
  7. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteEventInput.kt +4 -1
  8. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteEventWithPromptInput.kt +4 -1
  9. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ModifyEvent.kt +8 -2
  10. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ModifyEventWithPromptInput.kt +1 -1
  11. package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/GetDefaultCalendarResult.kt +1 -1
  12. package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/ListCalendarsResult.kt +1 -1
  13. package/android/src/main/java/dev/barooni/capacitor/calendar/utils/ImplementationHelper.kt +27 -2
  14. package/android/src/main/java/dev/barooni/capacitor/calendar/utils/PluginCallRejecter.kt +69 -0
  15. package/dist/docs.json +2 -2
  16. package/dist/esm/schemas/enums/capacitor-calendar-error-code.d.ts +31 -0
  17. package/dist/esm/schemas/enums/capacitor-calendar-error-code.js +31 -0
  18. package/dist/esm/schemas/enums/capacitor-calendar-error-code.js.map +1 -1
  19. package/dist/esm/schemas/interfaces/calendar.d.ts +3 -1
  20. package/dist/esm/schemas/interfaces/calendar.js.map +1 -1
  21. package/dist/plugin.cjs.js +31 -0
  22. package/dist/plugin.cjs.js.map +1 -1
  23. package/dist/plugin.js +31 -0
  24. package/dist/plugin.js.map +1 -1
  25. package/ios/Plugin/CapacitorCalendarPlugin.swift +1 -3
  26. package/ios/Plugin/PluginError.swift +34 -0
  27. package/ios/Plugin/Utils/PluginCallRejecter.swift +36 -0
  28. package/package.json +1 -1
package/README.md CHANGED
@@ -154,13 +154,28 @@ Add the appropriate usage description keys to `ios/App/App/Info.plist`. Starting
154
154
 
155
155
  ## Error codes
156
156
 
157
- On Android and iOS, a rejected call can expose `error.code` (stable category) and `error.message` (exact cause). Compare codes with the exported `CapacitorCalendarErrorCode` enum.
157
+ On Android and iOS, a rejected call can expose `error.code` (stable category) and `error.message` (exact cause). Compare codes with the exported `CapacitorCalendarErrorCode` enum. Not every reject has a code yet; later releases add more catalog cases.
158
158
 
159
159
  Defined codes:
160
160
 
161
- | Code | Name | When |
162
- | :------------- | :------------------- | :------------------------------------------------------------------------------ |
163
- | `EB-CLDR-0100` | `MissingDeclaration` | Required Info.plist usage description or AndroidManifest permission is not set. |
161
+ | Code | Name | When |
162
+ | :------------- | :------------------- | :-------------------------------------------------------------------------------- |
163
+ | `EB-CLDR-0001` | `InvalidArgument` | A required argument is missing or invalid. |
164
+ | `EB-CLDR-0002` | `NotFound` | The requested calendar, event, list, reminder, or calendar source does not exist. |
165
+ | `EB-CLDR-0004` | `IoError` | A calendar store read or write failed. |
166
+ | `EB-CLDR-0005` | `NotSupported` | The device cannot open the calendar UI, reminders UI, or target URL. |
167
+ | `EB-CLDR-0020` | `PermissionDenied` | Calendar access was denied. |
168
+ | `EB-CLDR-0100` | `MissingDeclaration` | Required Info.plist usage description or AndroidManifest permission is not set. |
169
+
170
+ Android rejects a non-numeric or empty calendar or event `id` as `InvalidArgument`. iOS looks up the string in the system calendar store and may reject as `NotFound` when nothing matches.
171
+
172
+ `IoError`: Android and iOS map store failures such as failed create/delete ID retrieval and delete failures. Other calendar store errors that are not permission or launch failures also use this code. On iOS, EventKit store or system rejects use this code, including some authorization-related failures; Android permission-provider denials still use `PermissionDenied` (`EB-CLDR-0020`). On iOS, this code also covers the edit-prompt `processFailed` outcome.
173
+
174
+ `NotSupported`: Android maps a missing calendar activity handler (`ActivityNotFoundException`, for example `openCalendar`) to this code. iOS maps launch and URL failures (`Failed to launch calendar app.`, reminders, `Unable to open URL.`).
175
+
176
+ On Android, calendar operations that fail with a permission error reject with `PermissionDenied` (`EB-CLDR-0020`). Permission check and request APIs still resolve `"denied"` on Android and iOS; they do not reject with `0020`.
177
+
178
+ For Android and iOS wraps of system store, launch, and permission failures, the message starts with a fixed sentence. If the OS provides a different detail, it is appended in parentheses.
164
179
 
165
180
  ## Quick Start
166
181
 
@@ -1351,7 +1366,7 @@ Options for {@link CalendarAccess#requestPermission}.
1351
1366
  | **`color`** | <code>string \| null</code> | Hex color string, or null when none is available. Format: `#RRGGBB` when opaque; `#RRGGBBAA` when alpha is below fully opaque. | 7.1.0 | Android, iOS |
1352
1367
  | **`colorName`** | <code><a href="#systemcolorname">SystemColorName</a> \| null</code> | Named color if the stored color matches one of the system colors; otherwise null. May be null in dark mode or for custom hex. Always null on Android. | 8.8.0 | Android, iOS |
1353
1368
  | **`isImmutable`** | <code>boolean \| null</code> | | 7.1.0 | iOS |
1354
- | **`allowsContentModifications`** | <code>boolean \| null</code> | | 7.1.0 | iOS |
1369
+ | **`allowsContentModifications`** | <code>boolean \| null</code> | Whether events can be added to or changed in this calendar. | 7.1.0 | Android, iOS |
1355
1370
  | **`type`** | <code><a href="#calendartype">CalendarType</a> \| null</code> | | 7.1.0 | iOS |
1356
1371
  | **`isSubscribed`** | <code>boolean \| null</code> | | 7.1.0 | iOS |
1357
1372
  | **`source`** | <code><a href="#calendarsource">CalendarSource</a> \| null</code> | | 7.1.0 | iOS |
@@ -33,6 +33,7 @@ import dev.barooni.capacitor.calendar.models.results.RequestAllPermissionsResult
33
33
  import dev.barooni.capacitor.calendar.models.results.RequestPermissionResult
34
34
  import dev.barooni.capacitor.calendar.models.templates.JSResult
35
35
  import dev.barooni.capacitor.calendar.utils.DeclarationCheck
36
+ import dev.barooni.capacitor.calendar.utils.PluginCallRejecter
36
37
 
37
38
  @CapacitorPlugin(
38
39
  name = "CapacitorCalendar",
@@ -517,10 +518,7 @@ class CapacitorCalendarPlugin : Plugin() {
517
518
  call: PluginCall,
518
519
  error: Exception?,
519
520
  ) {
520
- val message =
521
- error?.message
522
- ?: PluginError.CustomError("An unknown error has occurred.").message
523
- call.reject(message, (error as? PluginError)?.code)
521
+ PluginCallRejecter.reject(call, error)
524
522
  }
525
523
 
526
524
  private fun resolveCall(call: PluginCall) {
@@ -4,45 +4,52 @@ sealed class PluginError(
4
4
  localizedDescription: String,
5
5
  val code: String? = null,
6
6
  ) : Exception(localizedDescription) {
7
- data object AccountNameMissing : PluginError("Account name must be provided.")
7
+ data object AccountNameMissing : PluginError("Account name must be provided.", "EB-CLDR-0001")
8
8
 
9
- data object AttendeeEmailMissing : PluginError("Attendee email must be provided.")
9
+ data object AttendeeEmailMissing : PluginError("Attendee email must be provided.", "EB-CLDR-0001")
10
10
 
11
- data object CalendarIdMissing : PluginError("Calendar ID must be provided.")
11
+ data object CalendarIdMissing : PluginError("Calendar ID must be provided.", "EB-CLDR-0001")
12
12
 
13
- data object CalendarNotFound : PluginError("Calendar not found.")
13
+ data object CalendarNotFound : PluginError("Calendar not found.", "EB-CLDR-0002")
14
14
 
15
- data object ColorMissing : PluginError("Color must be provided.")
15
+ data object ColorMissing : PluginError("Color must be provided.", "EB-CLDR-0001")
16
16
 
17
17
  data class CustomError(
18
18
  val details: String,
19
19
  ) : PluginError(details)
20
20
 
21
- data object EventNotFound : PluginError("Event not found.")
21
+ data object EventNotFound : PluginError("Event not found.", "EB-CLDR-0002")
22
22
 
23
- data object FailedToDelete : PluginError("Failed to delete.")
23
+ data object FailedToDelete : PluginError("Failed to delete.", "EB-CLDR-0004")
24
24
 
25
- data object FailedToModify : PluginError("Failed to modify.")
25
+ data object FailedToModify : PluginError("Failed to modify.", "EB-CLDR-0004")
26
26
 
27
- data object FailedToRetrieveCalendarId : PluginError("Failed to retrieve calendar ID.")
27
+ data object FailedToRetrieveCalendarId : PluginError("Failed to retrieve calendar ID.", "EB-CLDR-0004")
28
28
 
29
- data object FailedToRetrieveEventId : PluginError("Failed to retrieve event ID.")
29
+ data object FailedToRetrieveEventId : PluginError("Failed to retrieve event ID.", "EB-CLDR-0004")
30
30
 
31
- data object FromDateMissing : PluginError("From date must be provided.")
31
+ data object FromDateMissing : PluginError("From date must be provided.", "EB-CLDR-0001")
32
32
 
33
33
  data object InstanceDateMissing : PluginError(
34
34
  "Instance date must be provided for this span on recurring events.",
35
+ "EB-CLDR-0001",
35
36
  )
36
37
 
37
- data object InvalidCalendarId : PluginError("Invalid calendar ID.")
38
+ data class IoError(
39
+ val details: String,
40
+ ) : PluginError(details, "EB-CLDR-0004")
41
+
42
+ data object InvalidCalendarId : PluginError("Invalid calendar ID.", "EB-CLDR-0001")
38
43
 
39
- data object InvalidColor : PluginError("Invalid color format.")
44
+ data object InvalidColor : PluginError("Invalid color format.", "EB-CLDR-0001")
40
45
 
41
- data object InvalidInvitees : PluginError("Invalid invitees. Array must contain only strings.")
46
+ data object InvalidEventId : PluginError("Invalid event ID.", "EB-CLDR-0001")
42
47
 
43
- data object InvalidScope : PluginError("Invalid scope.")
48
+ data object InvalidInvitees : PluginError("Invalid invitees. Array must contain only strings.", "EB-CLDR-0001")
44
49
 
45
- data object MessageMissing : PluginError("Message must be provided.")
50
+ data object InvalidScope : PluginError("Invalid scope.", "EB-CLDR-0001")
51
+
52
+ data object MessageMissing : PluginError("Message must be provided.", "EB-CLDR-0001")
46
53
 
47
54
  data class MissingDeclaration(
48
55
  val permission: String,
@@ -51,19 +58,27 @@ sealed class PluginError(
51
58
  "EB-CLDR-0100",
52
59
  )
53
60
 
54
- data object MissingId : PluginError("Event ID must be provided.")
61
+ data object MissingId : PluginError("Event ID must be provided.", "EB-CLDR-0001")
55
62
 
56
- data object MissingScope : PluginError("Scope must be provided.")
63
+ data object MissingScope : PluginError("Scope must be provided.", "EB-CLDR-0001")
57
64
 
58
65
  data object NoCalendarsAvailable : PluginError("No calendars available.")
59
66
 
60
- data object NoFieldsToModify : PluginError("At least one of title or color must be provided.")
67
+ data object NoFieldsToModify : PluginError("At least one of title or color must be provided.", "EB-CLDR-0001")
61
68
 
62
- data object OwnerAccountMissing : PluginError("Owner account must be provided.")
69
+ data class NotSupported(
70
+ val details: String,
71
+ ) : PluginError(details, "EB-CLDR-0005")
72
+
73
+ data object OwnerAccountMissing : PluginError("Owner account must be provided.", "EB-CLDR-0001")
74
+
75
+ data class PermissionDenied(
76
+ val details: String,
77
+ ) : PluginError(details, "EB-CLDR-0020")
63
78
 
64
- data object TitleMissing : PluginError("Title must be provided.")
79
+ data object TitleMissing : PluginError("Title must be provided.", "EB-CLDR-0001")
65
80
 
66
- data object ToDateMissing : PluginError("To date must be provided.")
81
+ data object ToDateMissing : PluginError("To date must be provided.", "EB-CLDR-0001")
67
82
 
68
83
  data object UnhandledPermissionState : PluginError("Unhandled permission state.")
69
84
 
@@ -113,7 +113,7 @@ class CapacitorCalendar(
113
113
  input.recurrence?.let { put(CalendarContract.Events.RRULE, it.toRRule()) }
114
114
  }
115
115
  val uri: Uri? = cr.insert(CalendarContract.Events.CONTENT_URI, values)
116
- val eventId: Long = uri?.lastPathSegment?.toLong() ?: throw PluginError.FailedToRetrieveEventId
116
+ val eventId: Long = uri?.lastPathSegment?.toLongOrNull() ?: throw PluginError.FailedToRetrieveEventId
117
117
  input.attendees?.let { ImplementationHelper.insertAttendeesToEvent(eventId, cr, it) }
118
118
  input.alerts?.let { ImplementationHelper.insertAlertsToEvents(eventId, cr, it) }
119
119
  return CreateEventResult(eventId)
@@ -11,4 +11,5 @@ data class CalendarInfo(
11
11
  val maxReminders: Int?,
12
12
  val location: String?,
13
13
  val isPrimary: Boolean?,
14
+ val allowsContentModifications: Boolean?,
14
15
  )
@@ -13,7 +13,10 @@ data class CreateEventInput(
13
13
  val title: String = call.getString("title") ?: throw PluginError.TitleMissing
14
14
  val isAllDay: Int? = input.isAllDay?.let { if (it) 1 else 0 }
15
15
  val alerts: List<Int>? = ImplementationHelper.jsArrayToIntArray(call.getArray("alerts"))
16
- val calendarId: Long? = call.getString("calendarId")?.toLong()
16
+ val calendarId: Long? =
17
+ call.getString("calendarId")?.let {
18
+ it.toLongOrNull() ?: throw PluginError.InvalidCalendarId
19
+ }
17
20
  val location: String? = input.location
18
21
  val startDate: Long? = input.startDate
19
22
  val endDate: Long? = input.endDate
@@ -7,7 +7,10 @@ import dev.barooni.capacitor.calendar.models.enums.EventSpan
7
7
  data class DeleteEventInput(
8
8
  private val call: PluginCall,
9
9
  ) {
10
- val id = call.getString("id")?.toLongOrNull() ?: throw PluginError.MissingId
10
+ val id =
11
+ call.getString("id")?.let { idString ->
12
+ idString.toLongOrNull() ?: throw PluginError.InvalidEventId
13
+ } ?: throw PluginError.MissingId
11
14
  val instanceDate: Long? = call.getLong("instanceDate")
12
15
  val span: EventSpan = call.getInt("span")?.let { EventSpan.fromInt(it) } ?: EventSpan.THIS_EVENT
13
16
  }
@@ -7,7 +7,10 @@ import dev.barooni.capacitor.calendar.models.enums.EventSpan
7
7
  data class DeleteEventWithPromptInput(
8
8
  private val call: PluginCall,
9
9
  ) {
10
- val id: Long = call.getString("id")?.toLongOrNull() ?: throw PluginError.MissingId
10
+ val id: Long =
11
+ call.getString("id")?.let { idString ->
12
+ idString.toLongOrNull() ?: throw PluginError.InvalidEventId
13
+ } ?: throw PluginError.MissingId
11
14
  val title: String = call.getString("title") ?: throw PluginError.TitleMissing
12
15
  val message: String = call.getString("message") ?: throw PluginError.MessageMissing
13
16
  val confirmButtonText: String = call.getString("confirmButtonText") ?: "Delete"
@@ -9,9 +9,15 @@ import dev.barooni.capacitor.calendar.utils.ImplementationHelper
9
9
  data class ModifyEvent(
10
10
  private val call: PluginCall,
11
11
  ) {
12
- val id: Long = call.getString("id")?.toLong() ?: throw PluginError.MissingId
12
+ val id: Long =
13
+ call.getString("id")?.let { idString ->
14
+ idString.toLongOrNull() ?: throw PluginError.InvalidEventId
15
+ } ?: throw PluginError.MissingId
13
16
  val title: String? = call.getString("title")
14
- val calendarId: Long? = call.getString("calendarId")?.toLong()
17
+ val calendarId: Long? =
18
+ call.getString("calendarId")?.let {
19
+ it.toLongOrNull() ?: throw PluginError.InvalidCalendarId
20
+ }
15
21
  val location: String? = call.getString("location")
16
22
  val startDate: Long? = call.getLong("startDate")?.let { ImplementationHelper.getCalendarFromTimestamp(it).timeInMillis }
17
23
  val endDate: Long? = call.getLong("endDate")?.let { ImplementationHelper.getCalendarFromTimestamp(it).timeInMillis }
@@ -18,7 +18,7 @@ data class ModifyEventWithPromptInput(
18
18
 
19
19
  init {
20
20
  val idString = call.getString("id") ?: throw PluginError.MissingId
21
- id = idString.toLong()
21
+ id = idString.toLongOrNull() ?: throw PluginError.InvalidEventId
22
22
  val uri: Uri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, id)
23
23
  intent.setData(uri)
24
24
  setEventUpdates()
@@ -19,7 +19,7 @@ data class GetDefaultCalendarResult(
19
19
  put("color", cal.color)
20
20
  put("colorName", null)
21
21
  put("isImmutable", null)
22
- put("allowsContentModifications", null)
22
+ put("allowsContentModifications", cal.allowsContentModifications)
23
23
  put("type", null)
24
24
  put("isSubscribed", null)
25
25
  put("source", null)
@@ -24,7 +24,7 @@ data class ListCalendarsResult(
24
24
  obj.put("color", calendar.color)
25
25
  obj.put("colorName", null)
26
26
  obj.put("isImmutable", null)
27
- obj.put("allowsContentModifications", null)
27
+ obj.put("allowsContentModifications", calendar.allowsContentModifications)
28
28
  obj.put("type", null)
29
29
  obj.put("isSubscribed", null)
30
30
  obj.put("source", null)
@@ -123,7 +123,7 @@ class ImplementationHelper {
123
123
 
124
124
  fun jsArrayToLongArray(array: JSArray): List<Long> {
125
125
  val list = array.toList<String>()
126
- return list.map { it.toLongOrNull() ?: throw PluginError.MissingId }
126
+ return list.map { it.toLongOrNull() ?: throw PluginError.InvalidEventId }
127
127
  }
128
128
 
129
129
  fun hexToColorInt(hex: String?): Int? {
@@ -294,6 +294,7 @@ class ImplementationHelper {
294
294
  CalendarContract.Calendars.MAX_REMINDERS,
295
295
  CalendarContract.Calendars.CALENDAR_LOCATION,
296
296
  CalendarContract.Calendars.IS_PRIMARY,
297
+ CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL,
297
298
  )
298
299
 
299
300
  val calendars = mutableListOf<CalendarInfo>()
@@ -385,14 +386,38 @@ class ImplementationHelper {
385
386
  cursor.getColumnIndexOrThrow(CalendarContract.Calendars.IS_PRIMARY).let {
386
387
  if (it < 0) null else cursor.getInt(it) == 1
387
388
  }
389
+ val accessLevel =
390
+ cursor.getColumnIndex(CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL).let {
391
+ if (it < 0 || cursor.isNull(it)) null else cursor.getInt(it)
392
+ }
388
393
  calendars.add(
389
- CalendarInfo(id, title, internalName, color, visible, accountName, ownerAccount, maxReminders, location, isPrimary),
394
+ CalendarInfo(
395
+ id,
396
+ title,
397
+ internalName,
398
+ color,
399
+ visible,
400
+ accountName,
401
+ ownerAccount,
402
+ maxReminders,
403
+ location,
404
+ isPrimary,
405
+ allowsContentModifications(accessLevel),
406
+ ),
390
407
  )
391
408
  }
392
409
  }
393
410
  return calendars
394
411
  }
395
412
 
413
+ /**
414
+ * Whether events can be added to a calendar with the given `CALENDAR_ACCESS_LEVEL`: contributor
415
+ * access or above, the same threshold the AOSP Calendar app uses. `null` when the provider did
416
+ * not report a level.
417
+ */
418
+ fun allowsContentModifications(accessLevel: Int?): Boolean? =
419
+ accessLevel?.let { it >= CalendarContract.Calendars.CAL_ACCESS_CONTRIBUTOR }
420
+
396
421
  fun requiresInstanceDateForDelete(
397
422
  cr: ContentResolver,
398
423
  eventId: Long,
@@ -0,0 +1,69 @@
1
+ package dev.barooni.capacitor.calendar.utils
2
+
3
+ import android.content.ActivityNotFoundException
4
+ import com.getcapacitor.PluginCall
5
+ import dev.barooni.capacitor.calendar.PluginError
6
+
7
+ /**
8
+ * Maps thrown exceptions to [PluginError] and rejects the Capacitor call.
9
+ */
10
+ object PluginCallRejecter {
11
+ fun reject(
12
+ call: PluginCall,
13
+ error: Exception?,
14
+ ) {
15
+ val pluginError = toPluginError(error)
16
+ val message =
17
+ pluginError?.message
18
+ ?: error?.message
19
+ ?: PluginError.CustomError("An unknown error has occurred.").message
20
+ call.reject(message, pluginError?.code)
21
+ }
22
+
23
+ fun toPluginError(error: Exception?): PluginError? =
24
+ when (error) {
25
+ is PluginError -> {
26
+ error
27
+ }
28
+
29
+ is ActivityNotFoundException -> {
30
+ PluginError.NotSupported(
31
+ wrapSystemError("Failed to launch calendar app.", error.message),
32
+ )
33
+ }
34
+
35
+ is SecurityException -> {
36
+ PluginError.PermissionDenied(
37
+ wrapSystemError("Calendar permission was denied.", error.message),
38
+ )
39
+ }
40
+
41
+ null -> {
42
+ null
43
+ }
44
+
45
+ else -> {
46
+ PluginError.IoError(
47
+ wrapSystemError(
48
+ "An I/O error occurred while accessing the calendar.",
49
+ error.message,
50
+ ),
51
+ )
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Lead with the stable plugin sentence; append a different non-blank OS message in parentheses.
57
+ */
58
+ fun wrapSystemError(
59
+ canonicalMessage: String,
60
+ systemMessage: String?,
61
+ ): String {
62
+ val detail = systemMessage?.trim().orEmpty()
63
+ return if (detail.isEmpty() || detail == canonicalMessage) {
64
+ canonicalMessage
65
+ } else {
66
+ "$canonicalMessage ($detail)"
67
+ }
68
+ }
69
+ }
package/dist/docs.json CHANGED
@@ -3896,7 +3896,7 @@
3896
3896
  "name": "allowsContentModifications",
3897
3897
  "tags": [
3898
3898
  {
3899
- "text": "iOS",
3899
+ "text": "Android, iOS",
3900
3900
  "name": "platform"
3901
3901
  },
3902
3902
  {
@@ -3904,7 +3904,7 @@
3904
3904
  "name": "since"
3905
3905
  }
3906
3906
  ],
3907
- "docs": "",
3907
+ "docs": "Whether events can be added to or changed in this calendar.",
3908
3908
  "complexTypes": [],
3909
3909
  "type": "boolean | null"
3910
3910
  },
@@ -4,6 +4,37 @@
4
4
  * @since 8.9.0
5
5
  */
6
6
  export declare enum CapacitorCalendarErrorCode {
7
+ /**
8
+ * Missing or invalid method arguments.
9
+ *
10
+ * @since 8.10.0
11
+ */
12
+ InvalidArgument = "EB-CLDR-0001",
13
+ /**
14
+ * Requested calendar, event, list, reminder, or calendar source was not found.
15
+ *
16
+ * @since 8.10.0
17
+ */
18
+ NotFound = "EB-CLDR-0002",
19
+ /**
20
+ * A calendar store read or write failed.
21
+ *
22
+ * @since 8.10.0
23
+ */
24
+ IoError = "EB-CLDR-0004",
25
+ /**
26
+ * The device cannot open the calendar UI, reminders UI, or target URL.
27
+ *
28
+ * @since 8.10.0
29
+ */
30
+ NotSupported = "EB-CLDR-0005",
31
+ /**
32
+ * Calendar access was denied.
33
+ * On Android, calendar operations that fail with a permission error reject with this code. Permission check and request APIs still resolve `"denied"` on Android and iOS.
34
+ *
35
+ * @since 8.10.0
36
+ */
37
+ PermissionDenied = "EB-CLDR-0020",
7
38
  /**
8
39
  * Missing Info.plist usage description or AndroidManifest permission declaration.
9
40
  *
@@ -5,6 +5,37 @@
5
5
  */
6
6
  export var CapacitorCalendarErrorCode;
7
7
  (function (CapacitorCalendarErrorCode) {
8
+ /**
9
+ * Missing or invalid method arguments.
10
+ *
11
+ * @since 8.10.0
12
+ */
13
+ CapacitorCalendarErrorCode["InvalidArgument"] = "EB-CLDR-0001";
14
+ /**
15
+ * Requested calendar, event, list, reminder, or calendar source was not found.
16
+ *
17
+ * @since 8.10.0
18
+ */
19
+ CapacitorCalendarErrorCode["NotFound"] = "EB-CLDR-0002";
20
+ /**
21
+ * A calendar store read or write failed.
22
+ *
23
+ * @since 8.10.0
24
+ */
25
+ CapacitorCalendarErrorCode["IoError"] = "EB-CLDR-0004";
26
+ /**
27
+ * The device cannot open the calendar UI, reminders UI, or target URL.
28
+ *
29
+ * @since 8.10.0
30
+ */
31
+ CapacitorCalendarErrorCode["NotSupported"] = "EB-CLDR-0005";
32
+ /**
33
+ * Calendar access was denied.
34
+ * On Android, calendar operations that fail with a permission error reject with this code. Permission check and request APIs still resolve `"denied"` on Android and iOS.
35
+ *
36
+ * @since 8.10.0
37
+ */
38
+ CapacitorCalendarErrorCode["PermissionDenied"] = "EB-CLDR-0020";
8
39
  /**
9
40
  * Missing Info.plist usage description or AndroidManifest permission declaration.
10
41
  *
@@ -1 +1 @@
1
- {"version":3,"file":"capacitor-calendar-error-code.js","sourceRoot":"","sources":["../../../../src/schemas/enums/capacitor-calendar-error-code.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,0BAOX;AAPD,WAAY,0BAA0B;IACpC;;;;OAIG;IACH,iEAAmC,CAAA;AACrC,CAAC,EAPW,0BAA0B,KAA1B,0BAA0B,QAOrC","sourcesContent":["/**\n * Stable reject codes for CapacitorCalendar. Compare with `error.code`.\n *\n * @since 8.9.0\n */\nexport enum CapacitorCalendarErrorCode {\n /**\n * Missing Info.plist usage description or AndroidManifest permission declaration.\n *\n * @since 8.9.0\n */\n MissingDeclaration = 'EB-CLDR-0100',\n}\n"]}
1
+ {"version":3,"file":"capacitor-calendar-error-code.js","sourceRoot":"","sources":["../../../../src/schemas/enums/capacitor-calendar-error-code.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,0BA2CX;AA3CD,WAAY,0BAA0B;IACpC;;;;OAIG;IACH,8DAAgC,CAAA;IAEhC;;;;OAIG;IACH,uDAAyB,CAAA;IAEzB;;;;OAIG;IACH,sDAAwB,CAAA;IAExB;;;;OAIG;IACH,2DAA6B,CAAA;IAE7B;;;;;OAKG;IACH,+DAAiC,CAAA;IAEjC;;;;OAIG;IACH,iEAAmC,CAAA;AACrC,CAAC,EA3CW,0BAA0B,KAA1B,0BAA0B,QA2CrC","sourcesContent":["/**\n * Stable reject codes for CapacitorCalendar. Compare with `error.code`.\n *\n * @since 8.9.0\n */\nexport enum CapacitorCalendarErrorCode {\n /**\n * Missing or invalid method arguments.\n *\n * @since 8.10.0\n */\n InvalidArgument = 'EB-CLDR-0001',\n\n /**\n * Requested calendar, event, list, reminder, or calendar source was not found.\n *\n * @since 8.10.0\n */\n NotFound = 'EB-CLDR-0002',\n\n /**\n * A calendar store read or write failed.\n *\n * @since 8.10.0\n */\n IoError = 'EB-CLDR-0004',\n\n /**\n * The device cannot open the calendar UI, reminders UI, or target URL.\n *\n * @since 8.10.0\n */\n NotSupported = 'EB-CLDR-0005',\n\n /**\n * Calendar access was denied.\n * On Android, calendar operations that fail with a permission error reject with this code. Permission check and request APIs still resolve `\"denied\"` on Android and iOS.\n *\n * @since 8.10.0\n */\n PermissionDenied = 'EB-CLDR-0020',\n\n /**\n * Missing Info.plist usage description or AndroidManifest permission declaration.\n *\n * @since 8.9.0\n */\n MissingDeclaration = 'EB-CLDR-0100',\n}\n"]}
@@ -50,7 +50,9 @@ export interface Calendar {
50
50
  */
51
51
  isImmutable: boolean | null;
52
52
  /**
53
- * @platform iOS
53
+ * Whether events can be added to or changed in this calendar.
54
+ *
55
+ * @platform Android, iOS
54
56
  * @since 7.1.0
55
57
  */
56
58
  allowsContentModifications: boolean | null;
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/calendar.ts"],"names":[],"mappings":"","sourcesContent":["import type { CalendarType } from '../enums/calendar-type';\nimport type { SystemColorName } from '../types/system-color-name';\n\nimport type { CalendarSource } from './calendar-source';\n\n/**\n * @since 7.1.0\n */\nexport interface Calendar {\n /**\n * @platform Android, iOS\n * @since 7.1.0\n */\n id: string;\n /**\n * Display title of the calendar.\n * May be `null` when the platform does not provide a title.\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n title: string | null;\n /**\n * Internal name of the calendar (`CalendarContract.Calendars.NAME`).\n *\n * @platform Android\n * @since 7.1.0\n */\n internalTitle: string | null;\n /**\n * Hex color string, or null when none is available.\n *\n * Format: `#RRGGBB` when opaque; `#RRGGBBAA` when alpha is below fully opaque.\n *\n * @platform Android, iOS\n * @example #0000FF\n * @example #0000FF80\n * @since 7.1.0\n */\n color: string | null;\n /**\n * Named color if the stored color matches one of the system colors;\n * otherwise null. May be null in dark mode or for custom hex. Always null on Android.\n *\n * @platform Android, iOS\n * @since 8.8.0\n */\n colorName?: SystemColorName | null;\n /**\n * @platform iOS\n * @since 7.1.0\n */\n isImmutable: boolean | null;\n /**\n * @platform iOS\n * @since 7.1.0\n */\n allowsContentModifications: boolean | null;\n /**\n * @platform iOS\n * @since 7.1.0\n */\n type: CalendarType | null;\n /**\n * @platform iOS\n * @since 7.1.0\n */\n isSubscribed: boolean | null;\n /**\n * @platform iOS\n * @since 7.1.0\n */\n source: CalendarSource | null;\n /**\n * Indicates if the events from this calendar should be shown.\n *\n * @platform Android\n * @since 7.1.0\n */\n visible: boolean | null;\n /**\n * The account under which the calendar is registered.\n *\n * @platform Android\n * @since 7.1.0\n */\n accountName: string | null;\n /**\n * The owner of the calendar.\n *\n * @platform Android\n * @since 7.1.0\n */\n ownerAccount: string | null;\n /**\n * Maximum number of reminders allowed per event.\n *\n * @platform Android\n * @since 7.1.0\n */\n maxReminders: number | null;\n /**\n * @platform Android\n * @since 7.1.0\n */\n location: string | null;\n}\n"]}
1
+ {"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/calendar.ts"],"names":[],"mappings":"","sourcesContent":["import type { CalendarType } from '../enums/calendar-type';\nimport type { SystemColorName } from '../types/system-color-name';\n\nimport type { CalendarSource } from './calendar-source';\n\n/**\n * @since 7.1.0\n */\nexport interface Calendar {\n /**\n * @platform Android, iOS\n * @since 7.1.0\n */\n id: string;\n /**\n * Display title of the calendar.\n * May be `null` when the platform does not provide a title.\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n title: string | null;\n /**\n * Internal name of the calendar (`CalendarContract.Calendars.NAME`).\n *\n * @platform Android\n * @since 7.1.0\n */\n internalTitle: string | null;\n /**\n * Hex color string, or null when none is available.\n *\n * Format: `#RRGGBB` when opaque; `#RRGGBBAA` when alpha is below fully opaque.\n *\n * @platform Android, iOS\n * @example #0000FF\n * @example #0000FF80\n * @since 7.1.0\n */\n color: string | null;\n /**\n * Named color if the stored color matches one of the system colors;\n * otherwise null. May be null in dark mode or for custom hex. Always null on Android.\n *\n * @platform Android, iOS\n * @since 8.8.0\n */\n colorName?: SystemColorName | null;\n /**\n * @platform iOS\n * @since 7.1.0\n */\n isImmutable: boolean | null;\n /**\n * Whether events can be added to or changed in this calendar.\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n allowsContentModifications: boolean | null;\n /**\n * @platform iOS\n * @since 7.1.0\n */\n type: CalendarType | null;\n /**\n * @platform iOS\n * @since 7.1.0\n */\n isSubscribed: boolean | null;\n /**\n * @platform iOS\n * @since 7.1.0\n */\n source: CalendarSource | null;\n /**\n * Indicates if the events from this calendar should be shown.\n *\n * @platform Android\n * @since 7.1.0\n */\n visible: boolean | null;\n /**\n * The account under which the calendar is registered.\n *\n * @platform Android\n * @since 7.1.0\n */\n accountName: string | null;\n /**\n * The owner of the calendar.\n *\n * @platform Android\n * @since 7.1.0\n */\n ownerAccount: string | null;\n /**\n * Maximum number of reminders allowed per event.\n *\n * @platform Android\n * @since 7.1.0\n */\n maxReminders: number | null;\n /**\n * @platform Android\n * @since 7.1.0\n */\n location: string | null;\n}\n"]}
@@ -308,6 +308,37 @@ exports.CalendarType = void 0;
308
308
  */
309
309
  exports.CapacitorCalendarErrorCode = void 0;
310
310
  (function (CapacitorCalendarErrorCode) {
311
+ /**
312
+ * Missing or invalid method arguments.
313
+ *
314
+ * @since 8.10.0
315
+ */
316
+ CapacitorCalendarErrorCode["InvalidArgument"] = "EB-CLDR-0001";
317
+ /**
318
+ * Requested calendar, event, list, reminder, or calendar source was not found.
319
+ *
320
+ * @since 8.10.0
321
+ */
322
+ CapacitorCalendarErrorCode["NotFound"] = "EB-CLDR-0002";
323
+ /**
324
+ * A calendar store read or write failed.
325
+ *
326
+ * @since 8.10.0
327
+ */
328
+ CapacitorCalendarErrorCode["IoError"] = "EB-CLDR-0004";
329
+ /**
330
+ * The device cannot open the calendar UI, reminders UI, or target URL.
331
+ *
332
+ * @since 8.10.0
333
+ */
334
+ CapacitorCalendarErrorCode["NotSupported"] = "EB-CLDR-0005";
335
+ /**
336
+ * Calendar access was denied.
337
+ * On Android, calendar operations that fail with a permission error reject with this code. Permission check and request APIs still resolve `"denied"` on Android and iOS.
338
+ *
339
+ * @since 8.10.0
340
+ */
341
+ CapacitorCalendarErrorCode["PermissionDenied"] = "EB-CLDR-0020";
311
342
  /**
312
343
  * Missing Info.plist usage description or AndroidManifest permission declaration.
313
344
  *