@ebarooni/capacitor-calendar 7.3.0 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -2
- package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +72 -25
- package/android/src/main/java/dev/barooni/capacitor/calendar/PluginError.kt +8 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/utils/DeclarationCheck.kt +59 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/schemas/enums/capacitor-calendar-error-code.d.ts +13 -0
- package/dist/esm/schemas/enums/capacitor-calendar-error-code.js +15 -0
- package/dist/esm/schemas/enums/capacitor-calendar-error-code.js.map +1 -0
- package/dist/plugin.cjs.js +15 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +15 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorCalendarPlugin.swift +68 -22
- package/ios/Plugin/PluginError.swift +13 -0
- package/ios/Plugin/Utils/DeclarationCheck.swift +63 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
<img src="https://img.shields.io/npm/dm/@ebarooni/capacitor-calendar?style=flat-square" />
|
|
10
10
|
</a>
|
|
11
11
|
<a href="https://www.npmjs.com/package/@ebarooni/capacitor-calendar">
|
|
12
|
-
<img src="https://img.shields.io/npm/v/@ebarooni/capacitor-calendar?style=flat-square" />
|
|
12
|
+
<img src="https://img.shields.io/npm/v/@ebarooni/capacitor-calendar/latest-7?style=flat-square" />
|
|
13
13
|
</a>
|
|
14
14
|
<a href="https://capacitorjs.com/">
|
|
15
|
-
<img src="https://img.shields.io/badge/Capacitor-
|
|
15
|
+
<img src="https://img.shields.io/badge/Capacitor-7.x-119EFF.svg?style=flat-square" />
|
|
16
16
|
</a>
|
|
17
17
|
<a href="mcp/README.md">
|
|
18
18
|
<img src="https://img.shields.io/badge/MCP-161b22?style=flat&logo=modelcontextprotocol&logoColor=5FB8AF" />
|
|
@@ -29,8 +29,10 @@
|
|
|
29
29
|
- [Demo](#demo)
|
|
30
30
|
- [Why this plugin?](#why-this-plugin)
|
|
31
31
|
- [MCP Server](#mcp-server)
|
|
32
|
+
- [Capacitor Compatibility](#capacitor-compatibility)
|
|
32
33
|
- [Installation](#installation)
|
|
33
34
|
- [Setup](#setup)
|
|
35
|
+
- [Error codes](#error-codes)
|
|
34
36
|
- [Quick Start](#quick-start)
|
|
35
37
|
- [Usage Examples](#usage-examples)
|
|
36
38
|
- [Documentation](#documentation)
|
|
@@ -80,10 +82,29 @@ docker run --rm -d --name capacitor-calendar-mcp -p 8080:8080 ghcr.io/ebarooni/c
|
|
|
80
82
|
|
|
81
83
|
See [`mcp/README.md`](mcp/README.md) for client configuration and full details.
|
|
82
84
|
|
|
85
|
+
## Capacitor Compatibility
|
|
86
|
+
|
|
87
|
+
Match the npm tag to your Capacitor major. The `latest` and `latest-7` packages are intended to stay in feature parity.
|
|
88
|
+
|
|
89
|
+
| Capacitor | npm tag | Version |
|
|
90
|
+
| :-------- | :--------- | :------------------------------------------------------------------------------------------------------------------------- |
|
|
91
|
+
| `8.x` | `latest` |  |
|
|
92
|
+
| `7.x` | `latest-7` |  |
|
|
93
|
+
|
|
83
94
|
## Installation
|
|
84
95
|
|
|
96
|
+
**Capacitor 8:**
|
|
97
|
+
|
|
85
98
|
```bash
|
|
86
99
|
npm install @ebarooni/capacitor-calendar
|
|
100
|
+
# or: npm install @ebarooni/capacitor-calendar@latest
|
|
101
|
+
npx cap sync
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Capacitor 7:**
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
npm install @ebarooni/capacitor-calendar@latest-7
|
|
87
108
|
npx cap sync
|
|
88
109
|
```
|
|
89
110
|
|
|
@@ -131,6 +152,16 @@ Add the appropriate usage description keys to `ios/App/App/Info.plist`. Starting
|
|
|
131
152
|
- **iOS:** [Migrating to the Latest Calendar Access Levels](https://developer.apple.com/documentation/technotes/tn3152-migrating-to-the-latest-calendar-access-levels)
|
|
132
153
|
- **Android:** [Calendar Provider User Permissions](https://developer.android.com/identity/providers/calendar-provider#manifest)
|
|
133
154
|
|
|
155
|
+
## Error codes
|
|
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.
|
|
158
|
+
|
|
159
|
+
Defined codes:
|
|
160
|
+
|
|
161
|
+
| Code | Name | When |
|
|
162
|
+
| :------------- | :------------------- | :------------------------------------------------------------------------------ |
|
|
163
|
+
| `EB-CLDR-0100` | `MissingDeclaration` | Required Info.plist usage description or AndroidManifest permission is not set. |
|
|
164
|
+
|
|
134
165
|
## Quick Start
|
|
135
166
|
|
|
136
167
|
The sample below is for Android and iOS. For Web, see [Create and download an event on the web](#create-and-download-an-event-on-the-web).
|
|
@@ -32,6 +32,7 @@ import dev.barooni.capacitor.calendar.models.results.ModifyEventWithPromptResult
|
|
|
32
32
|
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
|
+
import dev.barooni.capacitor.calendar.utils.DeclarationCheck
|
|
35
36
|
|
|
36
37
|
@CapacitorPlugin(
|
|
37
38
|
name = "CapacitorCalendar",
|
|
@@ -59,6 +60,7 @@ import dev.barooni.capacitor.calendar.models.templates.JSResult
|
|
|
59
60
|
)
|
|
60
61
|
class CapacitorCalendarPlugin : Plugin() {
|
|
61
62
|
private val implementation: CapacitorCalendar by lazy { CapacitorCalendar(this) }
|
|
63
|
+
private val declarationCheck: DeclarationCheck by lazy { DeclarationCheck(context) }
|
|
62
64
|
private var eventIdOptional = false
|
|
63
65
|
|
|
64
66
|
@PluginMethod
|
|
@@ -68,7 +70,7 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
68
70
|
val result = implementation.checkPermission(input)
|
|
69
71
|
call.resolve(result.toJSON())
|
|
70
72
|
} catch (error: Exception) {
|
|
71
|
-
call
|
|
73
|
+
rejectCall(call, error)
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
|
|
@@ -78,7 +80,7 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
78
80
|
val result = implementation.checkAllPermissions()
|
|
79
81
|
call.resolve(result.toJSON())
|
|
80
82
|
} catch (error: Exception) {
|
|
81
|
-
call
|
|
83
|
+
rejectCall(call, error)
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
|
|
@@ -96,9 +98,10 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
96
98
|
fun requestPermission(call: PluginCall) {
|
|
97
99
|
try {
|
|
98
100
|
val input = RequestPermissionInput.FromCall(call, ::requestPermissionCallback.name)
|
|
101
|
+
declarationCheck.ensureManifestPermissionsForScope(input.scope)
|
|
99
102
|
implementation.requestPermission(input, ::requestPermissionForAlias)
|
|
100
103
|
} catch (error: Exception) {
|
|
101
|
-
call
|
|
104
|
+
rejectCall(call, error)
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
|
|
@@ -108,17 +111,21 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
108
111
|
val result = RequestPermissionResult.FromCall(call, ::getPermissionState)
|
|
109
112
|
call.resolve(result.toJSON())
|
|
110
113
|
} catch (error: Exception) {
|
|
111
|
-
call
|
|
114
|
+
rejectCall(call, error)
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
117
|
|
|
115
118
|
@PluginMethod
|
|
116
119
|
fun requestAllPermissions(call: PluginCall) {
|
|
117
120
|
try {
|
|
121
|
+
declarationCheck.ensureManifestPermissions(
|
|
122
|
+
Manifest.permission.READ_CALENDAR,
|
|
123
|
+
Manifest.permission.WRITE_CALENDAR,
|
|
124
|
+
)
|
|
118
125
|
val input = RequestAllPermissionsInput(call, ::requestAllPermissionsCallback.name)
|
|
119
126
|
implementation.requestAllPermissions(input, ::requestPermissionForAlias)
|
|
120
127
|
} catch (error: Exception) {
|
|
121
|
-
call
|
|
128
|
+
rejectCall(call, error)
|
|
122
129
|
}
|
|
123
130
|
}
|
|
124
131
|
|
|
@@ -128,13 +135,14 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
128
135
|
val result = RequestAllPermissionsResult(::getPermissionState)
|
|
129
136
|
call.resolve(result.toJSON())
|
|
130
137
|
} catch (error: Exception) {
|
|
131
|
-
call
|
|
138
|
+
rejectCall(call, error)
|
|
132
139
|
}
|
|
133
140
|
}
|
|
134
141
|
|
|
135
142
|
@PluginMethod
|
|
136
143
|
fun requestWriteOnlyCalendarAccess(call: PluginCall) {
|
|
137
144
|
try {
|
|
145
|
+
declarationCheck.ensureManifestPermissions(Manifest.permission.WRITE_CALENDAR)
|
|
138
146
|
val input =
|
|
139
147
|
RequestPermissionInput.FromScope(
|
|
140
148
|
call,
|
|
@@ -143,7 +151,7 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
143
151
|
)
|
|
144
152
|
implementation.requestPermission(input, ::requestPermissionForAlias)
|
|
145
153
|
} catch (error: Exception) {
|
|
146
|
-
call
|
|
154
|
+
rejectCall(call, error)
|
|
147
155
|
}
|
|
148
156
|
}
|
|
149
157
|
|
|
@@ -153,13 +161,14 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
153
161
|
val result = RequestPermissionResult.FromScope(CalendarPermissionScope.WRITE_CALENDAR, ::getPermissionState)
|
|
154
162
|
call.resolve(result.toJSON())
|
|
155
163
|
} catch (error: Exception) {
|
|
156
|
-
call
|
|
164
|
+
rejectCall(call, error)
|
|
157
165
|
}
|
|
158
166
|
}
|
|
159
167
|
|
|
160
168
|
@PluginMethod
|
|
161
169
|
fun requestReadOnlyCalendarAccess(call: PluginCall) {
|
|
162
170
|
try {
|
|
171
|
+
declarationCheck.ensureManifestPermissions(Manifest.permission.READ_CALENDAR)
|
|
163
172
|
val input =
|
|
164
173
|
RequestPermissionInput.FromScope(
|
|
165
174
|
call,
|
|
@@ -168,7 +177,7 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
168
177
|
)
|
|
169
178
|
implementation.requestPermission(input, ::requestPermissionForAlias)
|
|
170
179
|
} catch (error: Exception) {
|
|
171
|
-
call
|
|
180
|
+
rejectCall(call, error)
|
|
172
181
|
}
|
|
173
182
|
}
|
|
174
183
|
|
|
@@ -178,17 +187,21 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
178
187
|
val result = RequestPermissionResult.FromScope(CalendarPermissionScope.READ_CALENDAR, ::getPermissionState)
|
|
179
188
|
call.resolve(result.toJSON())
|
|
180
189
|
} catch (error: Exception) {
|
|
181
|
-
call
|
|
190
|
+
rejectCall(call, error)
|
|
182
191
|
}
|
|
183
192
|
}
|
|
184
193
|
|
|
185
194
|
@PluginMethod
|
|
186
195
|
fun requestFullCalendarAccess(call: PluginCall) {
|
|
187
196
|
try {
|
|
197
|
+
declarationCheck.ensureManifestPermissions(
|
|
198
|
+
Manifest.permission.READ_CALENDAR,
|
|
199
|
+
Manifest.permission.WRITE_CALENDAR,
|
|
200
|
+
)
|
|
188
201
|
val input = RequestAllPermissionsInput(call, ::requestFullCalendarAccessCallback.name)
|
|
189
202
|
implementation.requestAllPermissions(input, ::requestPermissionForAlias)
|
|
190
203
|
} catch (error: Exception) {
|
|
191
|
-
call
|
|
204
|
+
rejectCall(call, error)
|
|
192
205
|
}
|
|
193
206
|
}
|
|
194
207
|
|
|
@@ -198,7 +211,7 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
198
211
|
val result = RequestPermissionResult.FullCalendarAccess(::getPermissionState)
|
|
199
212
|
call.resolve(result.toJSON())
|
|
200
213
|
} catch (error: Exception) {
|
|
201
|
-
call
|
|
214
|
+
rejectCall(call, error)
|
|
202
215
|
}
|
|
203
216
|
}
|
|
204
217
|
|
|
@@ -213,7 +226,7 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
213
226
|
val input = CreateEventWithPromptInput(call, "createEventWithPromptCallback")
|
|
214
227
|
implementation.createEventWithPrompt(input, ::startActivityForResult)
|
|
215
228
|
} catch (error: Exception) {
|
|
216
|
-
call
|
|
229
|
+
rejectCall(call, error)
|
|
217
230
|
}
|
|
218
231
|
}
|
|
219
232
|
|
|
@@ -234,7 +247,7 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
234
247
|
val input = ModifyEventWithPromptInput(call, "modifyEventWithPromptCallback")
|
|
235
248
|
implementation.modifyEventWithPrompt(input, ::startActivityForResult)
|
|
236
249
|
} catch (error: Exception) {
|
|
237
|
-
call
|
|
250
|
+
rejectCall(call, error)
|
|
238
251
|
}
|
|
239
252
|
}
|
|
240
253
|
|
|
@@ -252,11 +265,15 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
252
265
|
@PluginMethod
|
|
253
266
|
fun createEvent(call: PluginCall) {
|
|
254
267
|
try {
|
|
268
|
+
declarationCheck.ensureManifestPermissions(
|
|
269
|
+
Manifest.permission.READ_CALENDAR,
|
|
270
|
+
Manifest.permission.WRITE_CALENDAR,
|
|
271
|
+
)
|
|
255
272
|
val input = CreateEventInput(call)
|
|
256
273
|
val result = implementation.createEvent(input)
|
|
257
274
|
call.resolve(result.toJSON())
|
|
258
275
|
} catch (error: Exception) {
|
|
259
|
-
call
|
|
276
|
+
rejectCall(call, error)
|
|
260
277
|
}
|
|
261
278
|
}
|
|
262
279
|
|
|
@@ -268,11 +285,15 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
268
285
|
@PluginMethod(returnType = PluginMethod.RETURN_NONE)
|
|
269
286
|
fun modifyEvent(call: PluginCall) {
|
|
270
287
|
try {
|
|
288
|
+
declarationCheck.ensureManifestPermissions(
|
|
289
|
+
Manifest.permission.READ_CALENDAR,
|
|
290
|
+
Manifest.permission.WRITE_CALENDAR,
|
|
291
|
+
)
|
|
271
292
|
val input = ModifyEvent(call)
|
|
272
293
|
implementation.modifyEvent(input)
|
|
273
294
|
call.resolve()
|
|
274
295
|
} catch (error: Exception) {
|
|
275
|
-
call
|
|
296
|
+
rejectCall(call, error)
|
|
276
297
|
}
|
|
277
298
|
}
|
|
278
299
|
|
|
@@ -289,6 +310,7 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
289
310
|
@PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
|
|
290
311
|
fun listCalendars(call: PluginCall) {
|
|
291
312
|
try {
|
|
313
|
+
declarationCheck.ensureManifestPermissions(Manifest.permission.READ_CALENDAR)
|
|
292
314
|
implementation.listCalendars { result, error ->
|
|
293
315
|
if (error != null) {
|
|
294
316
|
rejectCall(call, error)
|
|
@@ -314,6 +336,7 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
314
336
|
@PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
|
|
315
337
|
fun getDefaultCalendar(call: PluginCall) {
|
|
316
338
|
try {
|
|
339
|
+
declarationCheck.ensureManifestPermissions(Manifest.permission.READ_CALENDAR)
|
|
317
340
|
val input = GetDefaultCalendarInput(call)
|
|
318
341
|
implementation.getDefaultCalendar(input) { result, error ->
|
|
319
342
|
if (error != null) {
|
|
@@ -344,29 +367,35 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
344
367
|
implementation.openCalendar(input)
|
|
345
368
|
call.resolve()
|
|
346
369
|
} catch (error: Exception) {
|
|
347
|
-
call
|
|
370
|
+
rejectCall(call, error)
|
|
348
371
|
}
|
|
349
372
|
}
|
|
350
373
|
|
|
351
374
|
@PluginMethod
|
|
352
375
|
fun createCalendar(call: PluginCall) {
|
|
353
376
|
try {
|
|
377
|
+
// Insert-only path; no CalendarContract query.
|
|
378
|
+
declarationCheck.ensureManifestPermissions(Manifest.permission.WRITE_CALENDAR)
|
|
354
379
|
val input = CreateCalendarInput(call)
|
|
355
380
|
val result = implementation.createCalendar(input)
|
|
356
381
|
call.resolve(result.toJSON())
|
|
357
382
|
} catch (error: Exception) {
|
|
358
|
-
call
|
|
383
|
+
rejectCall(call, error)
|
|
359
384
|
}
|
|
360
385
|
}
|
|
361
386
|
|
|
362
387
|
@PluginMethod
|
|
363
388
|
fun deleteCalendar(call: PluginCall) {
|
|
364
389
|
try {
|
|
390
|
+
declarationCheck.ensureManifestPermissions(
|
|
391
|
+
Manifest.permission.READ_CALENDAR,
|
|
392
|
+
Manifest.permission.WRITE_CALENDAR,
|
|
393
|
+
)
|
|
365
394
|
val input = DeleteCalendarInput(call)
|
|
366
395
|
implementation.deleteCalendar(input)
|
|
367
396
|
call.resolve()
|
|
368
397
|
} catch (error: Exception) {
|
|
369
|
-
call
|
|
398
|
+
rejectCall(call, error)
|
|
370
399
|
}
|
|
371
400
|
}
|
|
372
401
|
|
|
@@ -403,28 +432,40 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
403
432
|
@PluginMethod
|
|
404
433
|
fun deleteEventsById(call: PluginCall) {
|
|
405
434
|
try {
|
|
435
|
+
declarationCheck.ensureManifestPermissions(
|
|
436
|
+
Manifest.permission.READ_CALENDAR,
|
|
437
|
+
Manifest.permission.WRITE_CALENDAR,
|
|
438
|
+
)
|
|
406
439
|
val input = DeleteEventsByIdInput(call)
|
|
407
440
|
val result = implementation.deleteEventsById(input)
|
|
408
441
|
call.resolve(result.toJSON())
|
|
409
442
|
} catch (error: Exception) {
|
|
410
|
-
call
|
|
443
|
+
rejectCall(call, error)
|
|
411
444
|
}
|
|
412
445
|
}
|
|
413
446
|
|
|
414
447
|
@PluginMethod
|
|
415
448
|
fun deleteEvent(call: PluginCall) {
|
|
416
449
|
try {
|
|
450
|
+
declarationCheck.ensureManifestPermissions(
|
|
451
|
+
Manifest.permission.READ_CALENDAR,
|
|
452
|
+
Manifest.permission.WRITE_CALENDAR,
|
|
453
|
+
)
|
|
417
454
|
val input = DeleteEventInput(call)
|
|
418
455
|
implementation.deleteEvent(input)
|
|
419
456
|
call.resolve()
|
|
420
457
|
} catch (error: Exception) {
|
|
421
|
-
call
|
|
458
|
+
rejectCall(call, error)
|
|
422
459
|
}
|
|
423
460
|
}
|
|
424
461
|
|
|
425
462
|
@PluginMethod
|
|
426
463
|
fun deleteEventWithPrompt(call: PluginCall) {
|
|
427
464
|
try {
|
|
465
|
+
declarationCheck.ensureManifestPermissions(
|
|
466
|
+
Manifest.permission.READ_CALENDAR,
|
|
467
|
+
Manifest.permission.WRITE_CALENDAR,
|
|
468
|
+
)
|
|
428
469
|
val input = DeleteEventWithPromptInput(call)
|
|
429
470
|
implementation.deleteEventWithPrompt(
|
|
430
471
|
input,
|
|
@@ -433,29 +474,32 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
433
474
|
},
|
|
434
475
|
)
|
|
435
476
|
} catch (error: Exception) {
|
|
436
|
-
call
|
|
477
|
+
rejectCall(call, error)
|
|
437
478
|
}
|
|
438
479
|
}
|
|
439
480
|
|
|
440
481
|
@PluginMethod
|
|
441
482
|
fun listEventsInRange(call: PluginCall) {
|
|
442
483
|
try {
|
|
484
|
+
declarationCheck.ensureManifestPermissions(Manifest.permission.READ_CALENDAR)
|
|
443
485
|
val input = ListEventsInRangeInput(call)
|
|
444
486
|
val result = implementation.listEventsInRange(input)
|
|
445
487
|
call.resolve(result.toJSON())
|
|
446
488
|
} catch (error: Exception) {
|
|
447
|
-
call
|
|
489
|
+
rejectCall(call, error)
|
|
448
490
|
}
|
|
449
491
|
}
|
|
450
492
|
|
|
451
493
|
@PluginMethod
|
|
452
494
|
fun modifyCalendar(call: PluginCall) {
|
|
453
495
|
try {
|
|
496
|
+
// Update-only path; no CalendarContract query.
|
|
497
|
+
declarationCheck.ensureManifestPermissions(Manifest.permission.WRITE_CALENDAR)
|
|
454
498
|
val input = ModifyCalendarInput(call)
|
|
455
499
|
implementation.modifyCalendar(input)
|
|
456
500
|
call.resolve()
|
|
457
501
|
} catch (error: Exception) {
|
|
458
|
-
call
|
|
502
|
+
rejectCall(call, error)
|
|
459
503
|
}
|
|
460
504
|
}
|
|
461
505
|
|
|
@@ -473,7 +517,10 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
473
517
|
call: PluginCall,
|
|
474
518
|
error: Exception?,
|
|
475
519
|
) {
|
|
476
|
-
|
|
520
|
+
val message =
|
|
521
|
+
error?.message
|
|
522
|
+
?: PluginError.CustomError("An unknown error has occurred.").message
|
|
523
|
+
call.reject(message, (error as? PluginError)?.code)
|
|
477
524
|
}
|
|
478
525
|
|
|
479
526
|
private fun resolveCall(call: PluginCall) {
|
|
@@ -2,6 +2,7 @@ package dev.barooni.capacitor.calendar
|
|
|
2
2
|
|
|
3
3
|
sealed class PluginError(
|
|
4
4
|
localizedDescription: String,
|
|
5
|
+
val code: String? = null,
|
|
5
6
|
) : Exception(localizedDescription) {
|
|
6
7
|
data object AccountNameMissing : PluginError("Account name must be provided.")
|
|
7
8
|
|
|
@@ -43,6 +44,13 @@ sealed class PluginError(
|
|
|
43
44
|
|
|
44
45
|
data object MessageMissing : PluginError("Message must be provided.")
|
|
45
46
|
|
|
47
|
+
data class MissingDeclaration(
|
|
48
|
+
val permission: String,
|
|
49
|
+
) : PluginError(
|
|
50
|
+
"Missing AndroidManifest permission: $permission.",
|
|
51
|
+
"EB-CLDR-0100",
|
|
52
|
+
)
|
|
53
|
+
|
|
46
54
|
data object MissingId : PluginError("Event ID must be provided.")
|
|
47
55
|
|
|
48
56
|
data object MissingScope : PluginError("Scope must be provided.")
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
package dev.barooni.capacitor.calendar.utils
|
|
2
|
+
|
|
3
|
+
import android.Manifest
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.content.pm.PackageManager
|
|
6
|
+
import android.os.Build
|
|
7
|
+
import dev.barooni.capacitor.calendar.PluginError
|
|
8
|
+
import dev.barooni.capacitor.calendar.models.enums.CalendarPermissionScope
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Early AndroidManifest permission checks for EB-CLDR-0100 MissingDeclaration.
|
|
12
|
+
* Callers pass only the permissions the method actually uses.
|
|
13
|
+
*/
|
|
14
|
+
class DeclarationCheck(
|
|
15
|
+
private val context: Context,
|
|
16
|
+
) {
|
|
17
|
+
/**
|
|
18
|
+
* Throws [PluginError.MissingDeclaration] when a required AndroidManifest permission is not declared.
|
|
19
|
+
*/
|
|
20
|
+
fun ensureManifestPermissions(vararg permissions: String) {
|
|
21
|
+
for (permission in permissions) {
|
|
22
|
+
if (!isPermissionDeclared(permission)) {
|
|
23
|
+
throw PluginError.MissingDeclaration(permission)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
fun ensureManifestPermissionsForScope(scope: CalendarPermissionScope) {
|
|
29
|
+
when (scope) {
|
|
30
|
+
CalendarPermissionScope.READ_CALENDAR -> {
|
|
31
|
+
ensureManifestPermissions(Manifest.permission.READ_CALENDAR)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
CalendarPermissionScope.WRITE_CALENDAR -> {
|
|
35
|
+
ensureManifestPermissions(Manifest.permission.WRITE_CALENDAR)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
CalendarPermissionScope.READ_REMINDERS,
|
|
39
|
+
CalendarPermissionScope.WRITE_REMINDERS,
|
|
40
|
+
-> {
|
|
41
|
+
Unit
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private fun isPermissionDeclared(permission: String): Boolean {
|
|
47
|
+
val packageInfo =
|
|
48
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
49
|
+
context.packageManager.getPackageInfo(
|
|
50
|
+
context.packageName,
|
|
51
|
+
PackageManager.PackageInfoFlags.of(PackageManager.GET_PERMISSIONS.toLong()),
|
|
52
|
+
)
|
|
53
|
+
} else {
|
|
54
|
+
@Suppress("DEPRECATION")
|
|
55
|
+
context.packageManager.getPackageInfo(context.packageName, PackageManager.GET_PERMISSIONS)
|
|
56
|
+
}
|
|
57
|
+
return packageInfo.requestedPermissions?.contains(permission) == true
|
|
58
|
+
}
|
|
59
|
+
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { CalendarChooserDisplayStyle } from './schemas/enums/calendar-chooser-di
|
|
|
6
6
|
import { CalendarPermissionScope } from './schemas/enums/calendar-permission-scope';
|
|
7
7
|
import { CalendarSourceType } from './schemas/enums/calendar-source-type';
|
|
8
8
|
import { CalendarType } from './schemas/enums/calendar-type';
|
|
9
|
+
import { CapacitorCalendarErrorCode } from './schemas/enums/capacitor-calendar-error-code';
|
|
9
10
|
import { EventAvailability } from './schemas/enums/event-availability';
|
|
10
11
|
import { EventSpan } from './schemas/enums/event-span';
|
|
11
12
|
import { EventStatus } from './schemas/enums/event-status';
|
|
@@ -69,4 +70,4 @@ import { downloadIcsFile } from './web/download-ics-file';
|
|
|
69
70
|
declare const CapacitorCalendar: CapacitorCalendarPlugin;
|
|
70
71
|
export * from './definitions';
|
|
71
72
|
export type { Calendar, CalendarEvent, CalendarSource, CheckAllPermissionsResult, CheckPermissionOptions, CreateCalendarOptions, CreateCalendarResult, CreateEventOptions, CreateEventResult, CreateEventWithPromptOptions, CreateEventWithPromptResult, CreateReminderOptions, CreateReminderResult, CreateRemindersListOptions, CreateRemindersListResult, DeleteCalendarOptions, DeleteEventOptions, DeleteEventWithPromptOptions, DeleteEventsByIdOptions, DeleteEventsByIdResult, DeleteReminderOptions, DeleteReminderWithPromptOptions, DeleteReminderWithPromptResult, DeleteRemindersByIdOptions, DeleteRemindersByIdResult, DeleteRemindersListOptions, EventEditAction, EventGuest, FetchAllCalendarSourcesResult, GetDefaultCalendarOptions, GetDefaultRemindersListResult, GetReminderByIdOptions, GetReminderByIdResult, GetRemindersFromListsOptions, GetRemindersFromListsResult, GetRemindersListsResult, ListCalendarsResult, ListEventsInRangeOptions, ListEventsInRangeResult, ModifyCalendarOptions, ModifyEventOptions, ModifyEventWithPromptOptions, ModifyReminderOptions, OpenCalendarOptions, RecurrenceRule, Reminder, ReminderRecurrenceRule, RemindersList, RequestAllPermissionsResult, RequestPermissionOptions, SelectCalendarsWithPromptOptions, SelectCalendarsWithPromptResult, SystemColorName, UpdateRemindersListOptions, UpdateRemindersListResult, };
|
|
72
|
-
export { CalendarPermissionScope, EventAvailability, EventSpan, CalendarChooserDisplayStyle, CalendarType, CalendarSourceType, ReminderRecurrenceFrequency, RecurrenceFrequency, EventStatus, AttendeeRole, AttendeeType, AttendeeStatus, CapacitorCalendar, downloadIcsFile, };
|
|
73
|
+
export { CalendarPermissionScope, CapacitorCalendarErrorCode, EventAvailability, EventSpan, CalendarChooserDisplayStyle, CalendarType, CalendarSourceType, ReminderRecurrenceFrequency, RecurrenceFrequency, EventStatus, AttendeeRole, AttendeeType, AttendeeStatus, CapacitorCalendar, downloadIcsFile, };
|
package/dist/esm/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { CalendarChooserDisplayStyle } from './schemas/enums/calendar-chooser-di
|
|
|
6
6
|
import { CalendarPermissionScope } from './schemas/enums/calendar-permission-scope';
|
|
7
7
|
import { CalendarSourceType } from './schemas/enums/calendar-source-type';
|
|
8
8
|
import { CalendarType } from './schemas/enums/calendar-type';
|
|
9
|
+
import { CapacitorCalendarErrorCode } from './schemas/enums/capacitor-calendar-error-code';
|
|
9
10
|
import { EventAvailability } from './schemas/enums/event-availability';
|
|
10
11
|
import { EventSpan } from './schemas/enums/event-span';
|
|
11
12
|
import { EventStatus } from './schemas/enums/event-status';
|
|
@@ -15,5 +16,5 @@ const CapacitorCalendar = registerPlugin('CapacitorCalendar', {
|
|
|
15
16
|
web: () => import('./web').then((m) => new m.CapacitorCalendarWeb()),
|
|
16
17
|
});
|
|
17
18
|
export * from './definitions';
|
|
18
|
-
export { CalendarPermissionScope, EventAvailability, EventSpan, CalendarChooserDisplayStyle, CalendarType, CalendarSourceType, ReminderRecurrenceFrequency, EventStatus, AttendeeRole, AttendeeType, AttendeeStatus, CapacitorCalendar, downloadIcsFile, };
|
|
19
|
+
export { CalendarPermissionScope, CapacitorCalendarErrorCode, EventAvailability, EventSpan, CalendarChooserDisplayStyle, CalendarType, CalendarSourceType, ReminderRecurrenceFrequency, EventStatus, AttendeeRole, AttendeeType, AttendeeStatus, CapacitorCalendar, downloadIcsFile, };
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAwD5F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,iBAAiB,GAAG,cAAc,CAA0B,mBAAmB,EAAE;IACrF,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;CACrE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AA0D9B,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,2BAA2B,EAC3B,YAAY,EACZ,kBAAkB,EAClB,2BAA2B,EAE3B,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,eAAe,GAChB,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { CapacitorCalendarPlugin } from './definitions';\nimport { AttendeeRole } from './schemas/enums/attendee-role';\nimport { AttendeeStatus } from './schemas/enums/attendee-status';\nimport { AttendeeType } from './schemas/enums/attendee-type';\nimport { CalendarChooserDisplayStyle } from './schemas/enums/calendar-chooser-display-style';\nimport { CalendarPermissionScope } from './schemas/enums/calendar-permission-scope';\nimport { CalendarSourceType } from './schemas/enums/calendar-source-type';\nimport { CalendarType } from './schemas/enums/calendar-type';\nimport { EventAvailability } from './schemas/enums/event-availability';\nimport { EventSpan } from './schemas/enums/event-span';\nimport { EventStatus } from './schemas/enums/event-status';\nimport { ReminderRecurrenceFrequency } from './schemas/enums/reminder-recurrence-frequency';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { CalendarEvent } from './schemas/interfaces/calendar-event';\nimport type { CalendarSource } from './schemas/interfaces/calendar-source';\nimport type { CheckPermissionOptions } from './schemas/interfaces/check-permission-options';\nimport type { CreateCalendarOptions } from './schemas/interfaces/create-calendar-options';\nimport type { CreateCalendarResult } from './schemas/interfaces/create-calendar-result';\nimport type { CreateEventOptions } from './schemas/interfaces/create-event-options';\nimport type { CreateEventResult } from './schemas/interfaces/create-event-result';\nimport type { CreateEventWithPromptOptions } from './schemas/interfaces/create-event-with-prompt-options';\nimport type { CreateEventWithPromptResult } from './schemas/interfaces/create-event-with-prompt-result';\nimport type { CreateReminderOptions } from './schemas/interfaces/create-reminder-options';\nimport type { CreateReminderResult } from './schemas/interfaces/create-reminder-result';\nimport type { CreateRemindersListOptions } from './schemas/interfaces/create-reminders-list-options';\nimport type { CreateRemindersListResult } from './schemas/interfaces/create-reminders-list-result';\nimport type { DeleteCalendarOptions } from './schemas/interfaces/delete-calendar-options';\nimport type { DeleteEventOptions } from './schemas/interfaces/delete-event-options';\nimport type { DeleteEventWithPromptOptions } from './schemas/interfaces/delete-event-with-prompt-options';\nimport type { DeleteEventsByIdOptions } from './schemas/interfaces/delete-events-by-id-options';\nimport type { DeleteReminderOptions } from './schemas/interfaces/delete-reminder-options';\nimport type { DeleteReminderWithPromptOptions } from './schemas/interfaces/delete-reminder-with-prompt-options';\nimport type { DeleteReminderWithPromptResult } from './schemas/interfaces/delete-reminder-with-prompt-result';\nimport type { DeleteRemindersByIdOptions } from './schemas/interfaces/delete-reminders-by-id-options';\nimport type { DeleteRemindersByIdResult } from './schemas/interfaces/delete-reminders-by-id-result';\nimport type { DeleteRemindersListOptions } from './schemas/interfaces/delete-reminders-list-options';\nimport type { EventGuest } from './schemas/interfaces/event-guest';\nimport type { FetchAllCalendarSourcesResult } from './schemas/interfaces/fetch-all-calendar-sources-result';\nimport type { GetDefaultCalendarOptions } from './schemas/interfaces/get-default-calendar-options';\nimport type { GetDefaultRemindersListResult } from './schemas/interfaces/get-default-reminders-list-result';\nimport type { GetReminderByIdOptions } from './schemas/interfaces/get-reminder-by-id-options';\nimport type { GetReminderByIdResult } from './schemas/interfaces/get-reminder-by-id-result';\nimport type { GetRemindersFromListsOptions } from './schemas/interfaces/get-reminders-from-lists-options';\nimport type { GetRemindersFromListsResult } from './schemas/interfaces/get-reminders-from-lists-result';\nimport type { GetRemindersListsResult } from './schemas/interfaces/get-reminders-lists-result';\nimport type { ListCalendarsResult } from './schemas/interfaces/list-calendars-result';\nimport type { ListEventsInRangeOptions } from './schemas/interfaces/list-events-in-range-options';\nimport type { ListEventsInRangeResult } from './schemas/interfaces/list-events-in-range-result';\nimport type { ModifyCalendarOptions } from './schemas/interfaces/modify-calendar-options';\nimport type { ModifyEventOptions } from './schemas/interfaces/modify-event-options';\nimport type { ModifyEventWithPromptOptions } from './schemas/interfaces/modify-event-with-prompt-options';\nimport type { ModifyReminderOptions } from './schemas/interfaces/modify-reminder-options';\nimport type { OpenCalendarOptions } from './schemas/interfaces/open-calendar-options';\nimport type { RecurrenceRule } from './schemas/interfaces/recurrence-rule';\nimport type { Reminder } from './schemas/interfaces/reminder';\nimport type { ReminderRecurrenceRule } from './schemas/interfaces/reminder-recurrence-rule';\nimport type { RemindersList } from './schemas/interfaces/reminders-list';\nimport type { RequestPermissionOptions } from './schemas/interfaces/request-permission-options';\nimport type { SelectCalendarsWithPromptOptions } from './schemas/interfaces/select-calendars-with-prompt-options';\nimport type { SelectCalendarsWithPromptResult } from './schemas/interfaces/select-calendars-with-prompt-result';\nimport type { UpdateRemindersListOptions } from './schemas/interfaces/update-reminders-list-options';\nimport type { UpdateRemindersListResult } from './schemas/interfaces/update-reminders-list-result';\nimport type { EventEditAction } from './schemas/types/event-edit-action';\nimport type { RecurrenceFrequency } from './schemas/types/recurrence-frequency';\nimport type { SystemColorName } from './schemas/types/system-color-name';\nimport type { CheckAllPermissionsResult, RequestAllPermissionsResult } from './sub-definitions/calendar-access';\nimport type { DeleteEventsByIdResult } from './sub-definitions/event-operations';\nimport { downloadIcsFile } from './web/download-ics-file';\n\nconst CapacitorCalendar = registerPlugin<CapacitorCalendarPlugin>('CapacitorCalendar', {\n web: () => import('./web').then((m) => new m.CapacitorCalendarWeb()),\n});\n\nexport * from './definitions';\nexport type {\n Calendar,\n CalendarEvent,\n CalendarSource,\n CheckAllPermissionsResult,\n CheckPermissionOptions,\n CreateCalendarOptions,\n CreateCalendarResult,\n CreateEventOptions,\n CreateEventResult,\n CreateEventWithPromptOptions,\n CreateEventWithPromptResult,\n CreateReminderOptions,\n CreateReminderResult,\n CreateRemindersListOptions,\n CreateRemindersListResult,\n DeleteCalendarOptions,\n DeleteEventOptions,\n DeleteEventWithPromptOptions,\n DeleteEventsByIdOptions,\n DeleteEventsByIdResult,\n DeleteReminderOptions,\n DeleteReminderWithPromptOptions,\n DeleteReminderWithPromptResult,\n DeleteRemindersByIdOptions,\n DeleteRemindersByIdResult,\n DeleteRemindersListOptions,\n EventEditAction,\n EventGuest,\n FetchAllCalendarSourcesResult,\n GetDefaultCalendarOptions,\n GetDefaultRemindersListResult,\n GetReminderByIdOptions,\n GetReminderByIdResult,\n GetRemindersFromListsOptions,\n GetRemindersFromListsResult,\n GetRemindersListsResult,\n ListCalendarsResult,\n ListEventsInRangeOptions,\n ListEventsInRangeResult,\n ModifyCalendarOptions,\n ModifyEventOptions,\n ModifyEventWithPromptOptions,\n ModifyReminderOptions,\n OpenCalendarOptions,\n RecurrenceRule,\n Reminder,\n ReminderRecurrenceRule,\n RemindersList,\n RequestAllPermissionsResult,\n RequestPermissionOptions,\n SelectCalendarsWithPromptOptions,\n SelectCalendarsWithPromptResult,\n SystemColorName,\n UpdateRemindersListOptions,\n UpdateRemindersListResult,\n};\nexport {\n CalendarPermissionScope,\n EventAvailability,\n EventSpan,\n CalendarChooserDisplayStyle,\n CalendarType,\n CalendarSourceType,\n ReminderRecurrenceFrequency,\n RecurrenceFrequency,\n EventStatus,\n AttendeeRole,\n AttendeeType,\n AttendeeStatus,\n CapacitorCalendar,\n downloadIcsFile,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAwD5F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,iBAAiB,GAAG,cAAc,CAA0B,mBAAmB,EAAE;IACrF,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;CACrE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AA0D9B,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,iBAAiB,EACjB,SAAS,EACT,2BAA2B,EAC3B,YAAY,EACZ,kBAAkB,EAClB,2BAA2B,EAE3B,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,eAAe,GAChB,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { CapacitorCalendarPlugin } from './definitions';\nimport { AttendeeRole } from './schemas/enums/attendee-role';\nimport { AttendeeStatus } from './schemas/enums/attendee-status';\nimport { AttendeeType } from './schemas/enums/attendee-type';\nimport { CalendarChooserDisplayStyle } from './schemas/enums/calendar-chooser-display-style';\nimport { CalendarPermissionScope } from './schemas/enums/calendar-permission-scope';\nimport { CalendarSourceType } from './schemas/enums/calendar-source-type';\nimport { CalendarType } from './schemas/enums/calendar-type';\nimport { CapacitorCalendarErrorCode } from './schemas/enums/capacitor-calendar-error-code';\nimport { EventAvailability } from './schemas/enums/event-availability';\nimport { EventSpan } from './schemas/enums/event-span';\nimport { EventStatus } from './schemas/enums/event-status';\nimport { ReminderRecurrenceFrequency } from './schemas/enums/reminder-recurrence-frequency';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { CalendarEvent } from './schemas/interfaces/calendar-event';\nimport type { CalendarSource } from './schemas/interfaces/calendar-source';\nimport type { CheckPermissionOptions } from './schemas/interfaces/check-permission-options';\nimport type { CreateCalendarOptions } from './schemas/interfaces/create-calendar-options';\nimport type { CreateCalendarResult } from './schemas/interfaces/create-calendar-result';\nimport type { CreateEventOptions } from './schemas/interfaces/create-event-options';\nimport type { CreateEventResult } from './schemas/interfaces/create-event-result';\nimport type { CreateEventWithPromptOptions } from './schemas/interfaces/create-event-with-prompt-options';\nimport type { CreateEventWithPromptResult } from './schemas/interfaces/create-event-with-prompt-result';\nimport type { CreateReminderOptions } from './schemas/interfaces/create-reminder-options';\nimport type { CreateReminderResult } from './schemas/interfaces/create-reminder-result';\nimport type { CreateRemindersListOptions } from './schemas/interfaces/create-reminders-list-options';\nimport type { CreateRemindersListResult } from './schemas/interfaces/create-reminders-list-result';\nimport type { DeleteCalendarOptions } from './schemas/interfaces/delete-calendar-options';\nimport type { DeleteEventOptions } from './schemas/interfaces/delete-event-options';\nimport type { DeleteEventWithPromptOptions } from './schemas/interfaces/delete-event-with-prompt-options';\nimport type { DeleteEventsByIdOptions } from './schemas/interfaces/delete-events-by-id-options';\nimport type { DeleteReminderOptions } from './schemas/interfaces/delete-reminder-options';\nimport type { DeleteReminderWithPromptOptions } from './schemas/interfaces/delete-reminder-with-prompt-options';\nimport type { DeleteReminderWithPromptResult } from './schemas/interfaces/delete-reminder-with-prompt-result';\nimport type { DeleteRemindersByIdOptions } from './schemas/interfaces/delete-reminders-by-id-options';\nimport type { DeleteRemindersByIdResult } from './schemas/interfaces/delete-reminders-by-id-result';\nimport type { DeleteRemindersListOptions } from './schemas/interfaces/delete-reminders-list-options';\nimport type { EventGuest } from './schemas/interfaces/event-guest';\nimport type { FetchAllCalendarSourcesResult } from './schemas/interfaces/fetch-all-calendar-sources-result';\nimport type { GetDefaultCalendarOptions } from './schemas/interfaces/get-default-calendar-options';\nimport type { GetDefaultRemindersListResult } from './schemas/interfaces/get-default-reminders-list-result';\nimport type { GetReminderByIdOptions } from './schemas/interfaces/get-reminder-by-id-options';\nimport type { GetReminderByIdResult } from './schemas/interfaces/get-reminder-by-id-result';\nimport type { GetRemindersFromListsOptions } from './schemas/interfaces/get-reminders-from-lists-options';\nimport type { GetRemindersFromListsResult } from './schemas/interfaces/get-reminders-from-lists-result';\nimport type { GetRemindersListsResult } from './schemas/interfaces/get-reminders-lists-result';\nimport type { ListCalendarsResult } from './schemas/interfaces/list-calendars-result';\nimport type { ListEventsInRangeOptions } from './schemas/interfaces/list-events-in-range-options';\nimport type { ListEventsInRangeResult } from './schemas/interfaces/list-events-in-range-result';\nimport type { ModifyCalendarOptions } from './schemas/interfaces/modify-calendar-options';\nimport type { ModifyEventOptions } from './schemas/interfaces/modify-event-options';\nimport type { ModifyEventWithPromptOptions } from './schemas/interfaces/modify-event-with-prompt-options';\nimport type { ModifyReminderOptions } from './schemas/interfaces/modify-reminder-options';\nimport type { OpenCalendarOptions } from './schemas/interfaces/open-calendar-options';\nimport type { RecurrenceRule } from './schemas/interfaces/recurrence-rule';\nimport type { Reminder } from './schemas/interfaces/reminder';\nimport type { ReminderRecurrenceRule } from './schemas/interfaces/reminder-recurrence-rule';\nimport type { RemindersList } from './schemas/interfaces/reminders-list';\nimport type { RequestPermissionOptions } from './schemas/interfaces/request-permission-options';\nimport type { SelectCalendarsWithPromptOptions } from './schemas/interfaces/select-calendars-with-prompt-options';\nimport type { SelectCalendarsWithPromptResult } from './schemas/interfaces/select-calendars-with-prompt-result';\nimport type { UpdateRemindersListOptions } from './schemas/interfaces/update-reminders-list-options';\nimport type { UpdateRemindersListResult } from './schemas/interfaces/update-reminders-list-result';\nimport type { EventEditAction } from './schemas/types/event-edit-action';\nimport type { RecurrenceFrequency } from './schemas/types/recurrence-frequency';\nimport type { SystemColorName } from './schemas/types/system-color-name';\nimport type { CheckAllPermissionsResult, RequestAllPermissionsResult } from './sub-definitions/calendar-access';\nimport type { DeleteEventsByIdResult } from './sub-definitions/event-operations';\nimport { downloadIcsFile } from './web/download-ics-file';\n\nconst CapacitorCalendar = registerPlugin<CapacitorCalendarPlugin>('CapacitorCalendar', {\n web: () => import('./web').then((m) => new m.CapacitorCalendarWeb()),\n});\n\nexport * from './definitions';\nexport type {\n Calendar,\n CalendarEvent,\n CalendarSource,\n CheckAllPermissionsResult,\n CheckPermissionOptions,\n CreateCalendarOptions,\n CreateCalendarResult,\n CreateEventOptions,\n CreateEventResult,\n CreateEventWithPromptOptions,\n CreateEventWithPromptResult,\n CreateReminderOptions,\n CreateReminderResult,\n CreateRemindersListOptions,\n CreateRemindersListResult,\n DeleteCalendarOptions,\n DeleteEventOptions,\n DeleteEventWithPromptOptions,\n DeleteEventsByIdOptions,\n DeleteEventsByIdResult,\n DeleteReminderOptions,\n DeleteReminderWithPromptOptions,\n DeleteReminderWithPromptResult,\n DeleteRemindersByIdOptions,\n DeleteRemindersByIdResult,\n DeleteRemindersListOptions,\n EventEditAction,\n EventGuest,\n FetchAllCalendarSourcesResult,\n GetDefaultCalendarOptions,\n GetDefaultRemindersListResult,\n GetReminderByIdOptions,\n GetReminderByIdResult,\n GetRemindersFromListsOptions,\n GetRemindersFromListsResult,\n GetRemindersListsResult,\n ListCalendarsResult,\n ListEventsInRangeOptions,\n ListEventsInRangeResult,\n ModifyCalendarOptions,\n ModifyEventOptions,\n ModifyEventWithPromptOptions,\n ModifyReminderOptions,\n OpenCalendarOptions,\n RecurrenceRule,\n Reminder,\n ReminderRecurrenceRule,\n RemindersList,\n RequestAllPermissionsResult,\n RequestPermissionOptions,\n SelectCalendarsWithPromptOptions,\n SelectCalendarsWithPromptResult,\n SystemColorName,\n UpdateRemindersListOptions,\n UpdateRemindersListResult,\n};\nexport {\n CalendarPermissionScope,\n CapacitorCalendarErrorCode,\n EventAvailability,\n EventSpan,\n CalendarChooserDisplayStyle,\n CalendarType,\n CalendarSourceType,\n ReminderRecurrenceFrequency,\n RecurrenceFrequency,\n EventStatus,\n AttendeeRole,\n AttendeeType,\n AttendeeStatus,\n CapacitorCalendar,\n downloadIcsFile,\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable reject codes for CapacitorCalendar. Compare with `error.code`.
|
|
3
|
+
*
|
|
4
|
+
* @since 7.4.0
|
|
5
|
+
*/
|
|
6
|
+
export declare enum CapacitorCalendarErrorCode {
|
|
7
|
+
/**
|
|
8
|
+
* Missing Info.plist usage description or AndroidManifest permission declaration.
|
|
9
|
+
*
|
|
10
|
+
* @since 7.4.0
|
|
11
|
+
*/
|
|
12
|
+
MissingDeclaration = "EB-CLDR-0100"
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable reject codes for CapacitorCalendar. Compare with `error.code`.
|
|
3
|
+
*
|
|
4
|
+
* @since 7.4.0
|
|
5
|
+
*/
|
|
6
|
+
export var CapacitorCalendarErrorCode;
|
|
7
|
+
(function (CapacitorCalendarErrorCode) {
|
|
8
|
+
/**
|
|
9
|
+
* Missing Info.plist usage description or AndroidManifest permission declaration.
|
|
10
|
+
*
|
|
11
|
+
* @since 7.4.0
|
|
12
|
+
*/
|
|
13
|
+
CapacitorCalendarErrorCode["MissingDeclaration"] = "EB-CLDR-0100";
|
|
14
|
+
})(CapacitorCalendarErrorCode || (CapacitorCalendarErrorCode = {}));
|
|
15
|
+
//# sourceMappingURL=capacitor-calendar-error-code.js.map
|
|
@@ -0,0 +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 7.4.0\n */\nexport enum CapacitorCalendarErrorCode {\n /**\n * Missing Info.plist usage description or AndroidManifest permission declaration.\n *\n * @since 7.4.0\n */\n MissingDeclaration = 'EB-CLDR-0100',\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -301,6 +301,21 @@ exports.CalendarType = void 0;
|
|
|
301
301
|
CalendarType[CalendarType["BIRTHDAY"] = 4] = "BIRTHDAY";
|
|
302
302
|
})(exports.CalendarType || (exports.CalendarType = {}));
|
|
303
303
|
|
|
304
|
+
/**
|
|
305
|
+
* Stable reject codes for CapacitorCalendar. Compare with `error.code`.
|
|
306
|
+
*
|
|
307
|
+
* @since 7.4.0
|
|
308
|
+
*/
|
|
309
|
+
exports.CapacitorCalendarErrorCode = void 0;
|
|
310
|
+
(function (CapacitorCalendarErrorCode) {
|
|
311
|
+
/**
|
|
312
|
+
* Missing Info.plist usage description or AndroidManifest permission declaration.
|
|
313
|
+
*
|
|
314
|
+
* @since 7.4.0
|
|
315
|
+
*/
|
|
316
|
+
CapacitorCalendarErrorCode["MissingDeclaration"] = "EB-CLDR-0100";
|
|
317
|
+
})(exports.CapacitorCalendarErrorCode || (exports.CapacitorCalendarErrorCode = {}));
|
|
318
|
+
|
|
304
319
|
/**
|
|
305
320
|
* @since 7.1.0
|
|
306
321
|
*/
|