@ebarooni/capacitor-calendar 8.3.0 → 8.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.
- package/README.md +225 -97
- package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +42 -7
- package/android/src/main/java/dev/barooni/capacitor/calendar/PluginError.kt +31 -21
- package/android/src/main/java/dev/barooni/capacitor/calendar/implementation/CapacitorCalendar.kt +59 -15
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CheckPermissionInput.kt +0 -4
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CreateCalendarInput.kt +3 -1
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteCalendarInput.kt +4 -1
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/GetDefaultCalendarInput.kt +9 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ModifyCalendarInput.kt +10 -1
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/RequestPermissionInput.kt +3 -5
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/CheckAllPermissionsResult.kt +3 -2
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/RequestAllPermissionsResult.kt +1 -1
- package/android/src/main/java/dev/barooni/capacitor/calendar/models/templates/PluginCompletion.kt +8 -0
- package/android/src/main/java/dev/barooni/capacitor/calendar/utils/ImplementationHelper.kt +68 -31
- package/dist/docs.json +562 -70
- package/dist/esm/index.d.ts +12 -2
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/schemas/enums/calendar-permission-scope.d.ts +8 -0
- package/dist/esm/schemas/enums/calendar-permission-scope.js +8 -0
- package/dist/esm/schemas/enums/calendar-permission-scope.js.map +1 -1
- package/dist/esm/schemas/interfaces/calendar-source.d.ts +3 -0
- package/dist/esm/schemas/interfaces/calendar-source.js.map +1 -1
- package/dist/esm/schemas/interfaces/calendar.d.ts +12 -2
- package/dist/esm/schemas/interfaces/calendar.js.map +1 -1
- package/dist/esm/schemas/interfaces/check-permission-options.d.ts +19 -0
- package/dist/esm/schemas/interfaces/check-permission-options.js +2 -0
- package/dist/esm/schemas/interfaces/check-permission-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/create-calendar-options.d.ts +16 -5
- package/dist/esm/schemas/interfaces/create-calendar-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-calendar-result.d.ts +12 -0
- package/dist/esm/schemas/interfaces/create-calendar-result.js +2 -0
- package/dist/esm/schemas/interfaces/create-calendar-result.js.map +1 -0
- package/dist/esm/schemas/interfaces/create-event-options.d.ts +22 -13
- package/dist/esm/schemas/interfaces/create-event-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-event-result.d.ts +23 -0
- package/dist/esm/schemas/interfaces/create-event-result.js +2 -0
- package/dist/esm/schemas/interfaces/create-event-result.js.map +1 -0
- package/dist/esm/schemas/interfaces/create-event-with-prompt-result.d.ts +14 -0
- package/dist/esm/schemas/interfaces/create-event-with-prompt-result.js +2 -0
- package/dist/esm/schemas/interfaces/create-event-with-prompt-result.js.map +1 -0
- package/dist/esm/schemas/interfaces/delete-calendar-options.d.ts +1 -0
- package/dist/esm/schemas/interfaces/delete-calendar-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/fetch-all-calendar-sources-result.d.ts +13 -0
- package/dist/esm/schemas/interfaces/fetch-all-calendar-sources-result.js +2 -0
- package/dist/esm/schemas/interfaces/fetch-all-calendar-sources-result.js.map +1 -0
- package/dist/esm/schemas/interfaces/get-default-calendar-options.d.ts +13 -0
- package/dist/esm/schemas/interfaces/get-default-calendar-options.js +2 -0
- package/dist/esm/schemas/interfaces/get-default-calendar-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/list-calendars-result.d.ts +13 -0
- package/dist/esm/schemas/interfaces/list-calendars-result.js +2 -0
- package/dist/esm/schemas/interfaces/list-calendars-result.js.map +1 -0
- package/dist/esm/schemas/interfaces/list-events-in-range-options.d.ts +7 -2
- package/dist/esm/schemas/interfaces/list-events-in-range-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/modify-calendar-options.d.ts +8 -1
- package/dist/esm/schemas/interfaces/modify-calendar-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/open-calendar-options.d.ts +5 -1
- package/dist/esm/schemas/interfaces/open-calendar-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/request-permission-options.d.ts +16 -0
- package/dist/esm/schemas/interfaces/request-permission-options.js +2 -0
- package/dist/esm/schemas/interfaces/request-permission-options.js.map +1 -0
- package/dist/esm/schemas/interfaces/select-calendars-with-prompt-result.d.ts +14 -0
- package/dist/esm/schemas/interfaces/select-calendars-with-prompt-result.js +2 -0
- package/dist/esm/schemas/interfaces/select-calendars-with-prompt-result.js.map +1 -0
- package/dist/esm/sub-definitions/calendar-access.d.ts +22 -10
- package/dist/esm/sub-definitions/calendar-access.js.map +1 -1
- package/dist/esm/sub-definitions/calendar-operations.d.ts +61 -14
- package/dist/esm/sub-definitions/calendar-operations.js.map +1 -1
- package/dist/esm/sub-definitions/event-operations.d.ts +35 -9
- package/dist/esm/sub-definitions/event-operations.js.map +1 -1
- package/dist/esm/sub-definitions/reminders-access.d.ts +4 -0
- package/dist/esm/sub-definitions/reminders-access.js.map +1 -1
- package/dist/esm/web/download-ics-file.d.ts +18 -0
- package/dist/esm/web/download-ics-file.js +33 -0
- package/dist/esm/web/download-ics-file.js.map +1 -0
- package/dist/esm/web/ics.d.ts +21 -0
- package/dist/esm/web/ics.js +252 -0
- package/dist/esm/web/ics.js.map +1 -0
- package/dist/esm/web.d.ts +19 -27
- package/dist/esm/web.js +14 -3
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +306 -3
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +306 -3
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorCalendarPlugin.swift +19 -16
- package/ios/Plugin/Implementation/CapacitorCalendar.swift +64 -34
- package/ios/Plugin/Models/Inputs/CreateCalendarInput.swift +4 -5
- package/ios/Plugin/Models/Inputs/DeleteCalendarInput.swift +1 -1
- package/ios/Plugin/Models/Inputs/GetDefaultCalendarInput.swift +13 -0
- package/ios/Plugin/Models/Inputs/ModifyCalendarInput.swift +4 -1
- package/ios/Plugin/PluginError.swift +68 -56
- package/ios/Plugin/Utils/ImplementationHelper.swift +15 -12
- package/package.json +1 -1
|
@@ -3,14 +3,19 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface ListEventsInRangeOptions {
|
|
5
5
|
/**
|
|
6
|
-
* The
|
|
6
|
+
* The start of the range, in milliseconds since the epoch.
|
|
7
|
+
* Events still in progress at this time are included.
|
|
7
8
|
*
|
|
9
|
+
* @example 1719792000000
|
|
8
10
|
* @since 7.1.0
|
|
9
11
|
*/
|
|
10
12
|
from: number;
|
|
11
13
|
/**
|
|
12
|
-
* The
|
|
14
|
+
* The end of the range, in milliseconds since the epoch.
|
|
15
|
+
* Events that begin at or after this time are typically excluded; prefer the
|
|
16
|
+
* next day's start when querying a single calendar day.
|
|
13
17
|
*
|
|
18
|
+
* @example 1719878400000
|
|
14
19
|
* @since 7.1.0
|
|
15
20
|
*/
|
|
16
21
|
to: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-events-in-range-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/list-events-in-range-options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @since 7.1.0\n */\nexport interface ListEventsInRangeOptions {\n /**\n * The
|
|
1
|
+
{"version":3,"file":"list-events-in-range-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/list-events-in-range-options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @since 7.1.0\n */\nexport interface ListEventsInRangeOptions {\n /**\n * The start of the range, in milliseconds since the epoch.\n * Events still in progress at this time are included.\n *\n * @example 1719792000000\n * @since 7.1.0\n */\n from: number;\n /**\n * The end of the range, in milliseconds since the epoch.\n * Events that begin at or after this time are typically excluded; prefer the\n * next day's start when querying a single calendar day.\n *\n * @example 1719878400000\n * @since 7.1.0\n */\n to: number;\n}\n"]}
|
|
@@ -8,13 +8,20 @@ export interface ModifyCalendarOptions {
|
|
|
8
8
|
*/
|
|
9
9
|
id: string;
|
|
10
10
|
/**
|
|
11
|
+
* Display title of the calendar.
|
|
12
|
+
*
|
|
13
|
+
* On Android this updates both `CALENDAR_DISPLAY_NAME` (`title`) and
|
|
14
|
+
* `Calendars.NAME` (`internalTitle`).
|
|
15
|
+
*
|
|
11
16
|
* @platform Android, iOS
|
|
12
17
|
* @since 7.2.0
|
|
13
18
|
*/
|
|
14
19
|
title?: string;
|
|
15
20
|
/**
|
|
21
|
+
* The color of the calendar as `#RRGGBB` or `#RRGGBBAA`.
|
|
22
|
+
*
|
|
16
23
|
* @platform Android, iOS
|
|
17
|
-
* @example #
|
|
24
|
+
* @example #007AFF
|
|
18
25
|
* @since 7.2.0
|
|
19
26
|
*/
|
|
20
27
|
color?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modify-calendar-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/modify-calendar-options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @since 7.2.0\n */\nexport interface ModifyCalendarOptions {\n /**\n * @platform Android, iOS\n * @since 7.2.0\n */\n id: string;\n /**\n * @platform Android, iOS\n * @since 7.2.0\n */\n title?: string;\n /**\n * @platform Android, iOS\n * @example #
|
|
1
|
+
{"version":3,"file":"modify-calendar-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/modify-calendar-options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @since 7.2.0\n */\nexport interface ModifyCalendarOptions {\n /**\n * @platform Android, iOS\n * @since 7.2.0\n */\n id: string;\n /**\n * Display title of the calendar.\n *\n * On Android this updates both `CALENDAR_DISPLAY_NAME` (`title`) and\n * `Calendars.NAME` (`internalTitle`).\n *\n * @platform Android, iOS\n * @since 7.2.0\n */\n title?: string;\n /**\n * The color of the calendar as `#RRGGBB` or `#RRGGBBAA`.\n *\n * @platform Android, iOS\n * @example #007AFF\n * @since 7.2.0\n */\n color?: string;\n}\n"]}
|
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface OpenCalendarOptions {
|
|
5
5
|
/**
|
|
6
|
+
* The date to open the calendar at, in milliseconds since the epoch.
|
|
7
|
+
*
|
|
8
|
+
* @example Date.now()
|
|
6
9
|
* @default Date.now()
|
|
10
|
+
* @platform Android, iOS
|
|
7
11
|
* @since 7.1.0
|
|
8
12
|
*/
|
|
9
|
-
date
|
|
13
|
+
date?: number;
|
|
10
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-calendar-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/open-calendar-options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @since 7.1.0\n */\nexport interface OpenCalendarOptions {\n /**\n * @default Date.now()\n * @since 7.1.0\n */\n date
|
|
1
|
+
{"version":3,"file":"open-calendar-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/open-calendar-options.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * @since 7.1.0\n */\nexport interface OpenCalendarOptions {\n /**\n * The date to open the calendar at, in milliseconds since the epoch.\n *\n * @example Date.now()\n * @default Date.now()\n * @platform Android, iOS\n * @since 7.1.0\n */\n date?: number;\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CalendarPermissionScope } from '../enums/calendar-permission-scope';
|
|
2
|
+
/**
|
|
3
|
+
* Options for {@link CalendarAccess#requestPermission}.
|
|
4
|
+
*
|
|
5
|
+
* @since 8.3.1
|
|
6
|
+
*/
|
|
7
|
+
export interface RequestPermissionOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The permission scope to request.
|
|
10
|
+
*
|
|
11
|
+
* @example CalendarPermissionScope.READ_CALENDAR
|
|
12
|
+
* @platform Android, iOS
|
|
13
|
+
* @since 8.3.1
|
|
14
|
+
*/
|
|
15
|
+
scope: CalendarPermissionScope;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-permission-options.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/request-permission-options.ts"],"names":[],"mappings":"","sourcesContent":["import type { CalendarPermissionScope } from '../enums/calendar-permission-scope';\n\n/**\n * Options for {@link CalendarAccess#requestPermission}.\n *\n * @since 8.3.1\n */\nexport interface RequestPermissionOptions {\n /**\n * The permission scope to request.\n *\n * @example CalendarPermissionScope.READ_CALENDAR\n * @platform Android, iOS\n * @since 8.3.1\n */\n scope: CalendarPermissionScope;\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Calendar } from './calendar';
|
|
2
|
+
/**
|
|
3
|
+
* @since 8.4.0
|
|
4
|
+
*/
|
|
5
|
+
export interface SelectCalendarsWithPromptResult {
|
|
6
|
+
/**
|
|
7
|
+
* Calendars the user confirmed in the chooser.
|
|
8
|
+
* Empty when the user cancels.
|
|
9
|
+
*
|
|
10
|
+
* @platform iOS
|
|
11
|
+
* @since 8.4.0
|
|
12
|
+
*/
|
|
13
|
+
result: Calendar[];
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-calendars-with-prompt-result.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/select-calendars-with-prompt-result.ts"],"names":[],"mappings":"","sourcesContent":["import type { Calendar } from './calendar';\n\n/**\n * @since 8.4.0\n */\nexport interface SelectCalendarsWithPromptResult {\n /**\n * Calendars the user confirmed in the chooser.\n * Empty when the user cancels.\n *\n * @platform iOS\n * @since 8.4.0\n */\n result: Calendar[];\n}\n"]}
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
import type { PermissionState } from '@capacitor/core';
|
|
2
2
|
import type { CalendarPermissionScope } from '../schemas/enums/calendar-permission-scope';
|
|
3
|
+
import type { CheckPermissionOptions } from '../schemas/interfaces/check-permission-options';
|
|
4
|
+
import type { RequestPermissionOptions } from '../schemas/interfaces/request-permission-options';
|
|
3
5
|
/**
|
|
4
6
|
* @since 7.1.0
|
|
5
7
|
*/
|
|
6
8
|
export interface CalendarAccess {
|
|
7
9
|
/**
|
|
8
10
|
* Retrieves the current permission state for a given scope.
|
|
11
|
+
* On Android, `readReminders` and `writeReminders` resolve to `"prompt"`.
|
|
9
12
|
*
|
|
10
13
|
* @example
|
|
11
14
|
* CapacitorCalendar.checkPermission({ scope: CalendarPermissionScope.READ_CALENDAR });
|
|
12
15
|
*
|
|
16
|
+
* @throws {Error} `Scope must be provided.` — when `scope` is missing.
|
|
17
|
+
* @throws {Error} `Invalid scope.` — when `scope` is invalid.
|
|
18
|
+
* @throws {Error} `Unhandled permission state.` — when the native status cannot be mapped.
|
|
19
|
+
*
|
|
13
20
|
* @platform Android, iOS
|
|
14
21
|
* @since 0.1.0
|
|
15
|
-
*
|
|
16
22
|
*/
|
|
17
|
-
checkPermission(options: {
|
|
18
|
-
scope: CalendarPermissionScope;
|
|
19
|
-
}): Promise<{
|
|
23
|
+
checkPermission(options: CheckPermissionOptions): Promise<{
|
|
20
24
|
result: PermissionState;
|
|
21
25
|
}>;
|
|
22
26
|
/**
|
|
23
27
|
* Retrieves the current state of all permissions.
|
|
28
|
+
* On Android, reminder keys always resolve to `"prompt"`.
|
|
29
|
+
*
|
|
30
|
+
* @throws {Error} `Unhandled permission state.` — when a native status cannot be mapped.
|
|
24
31
|
*
|
|
25
32
|
* @platform Android, iOS
|
|
26
33
|
* @since 0.1.0
|
|
@@ -30,23 +37,28 @@ export interface CalendarAccess {
|
|
|
30
37
|
}>;
|
|
31
38
|
/**
|
|
32
39
|
* Requests permission for a given scope.
|
|
40
|
+
* On Android, `readReminders` and `writeReminders` reject with `Invalid scope.`
|
|
33
41
|
*
|
|
34
42
|
* @example
|
|
35
|
-
*
|
|
43
|
+
* CapacitorCalendar.requestPermission({ scope: CalendarPermissionScope.READ_CALENDAR });
|
|
44
|
+
*
|
|
45
|
+
* @throws {Error} `Scope must be provided.` — when `scope` is missing.
|
|
46
|
+
* @throws {Error} `Invalid scope.` — when `scope` is invalid, or a reminders scope on Android.
|
|
36
47
|
*
|
|
37
|
-
* @deprecated Use {@link requestWriteOnlyCalendarAccess},
|
|
38
|
-
* {@link
|
|
48
|
+
* @deprecated Use {@link requestWriteOnlyCalendarAccess},
|
|
49
|
+
* {@link requestReadOnlyCalendarAccess} (Android),
|
|
50
|
+
* {@link requestFullCalendarAccess} (also for read on iOS),
|
|
51
|
+
* or {@link requestFullRemindersAccess} instead.
|
|
39
52
|
*
|
|
40
53
|
* @platform Android, iOS
|
|
41
54
|
* @since 0.1.0
|
|
42
55
|
*/
|
|
43
|
-
requestPermission(options: {
|
|
44
|
-
scope: CalendarPermissionScope;
|
|
45
|
-
}): Promise<{
|
|
56
|
+
requestPermission(options: RequestPermissionOptions): Promise<{
|
|
46
57
|
result: PermissionState;
|
|
47
58
|
}>;
|
|
48
59
|
/**
|
|
49
60
|
* Requests permission for all calendar and reminder permissions.
|
|
61
|
+
* On Android, only calendar permissions are requested; reminder keys stay `"prompt"`.
|
|
50
62
|
*
|
|
51
63
|
* @deprecated Use {@link requestFullCalendarAccess} or {@link requestFullRemindersAccess} instead.
|
|
52
64
|
* @platform Android, iOS
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-access.js","sourceRoot":"","sources":["../../../src/sub-definitions/calendar-access.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\nimport type { CalendarPermissionScope } from '../schemas/enums/calendar-permission-scope';\n\n/**\n * @since 7.1.0\n */\nexport interface CalendarAccess {\n /**\n * Retrieves the current permission state for a given scope.\n *\n * @example\n * CapacitorCalendar.checkPermission({ scope: CalendarPermissionScope.READ_CALENDAR });\n *\n * @platform Android, iOS\n * @since 0.1.0\n
|
|
1
|
+
{"version":3,"file":"calendar-access.js","sourceRoot":"","sources":["../../../src/sub-definitions/calendar-access.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\nimport type { CalendarPermissionScope } from '../schemas/enums/calendar-permission-scope';\nimport type { CheckPermissionOptions } from '../schemas/interfaces/check-permission-options';\nimport type { RequestPermissionOptions } from '../schemas/interfaces/request-permission-options';\n\n/**\n * @since 7.1.0\n */\nexport interface CalendarAccess {\n /**\n * Retrieves the current permission state for a given scope.\n * On Android, `readReminders` and `writeReminders` resolve to `\"prompt\"`.\n *\n * @example\n * CapacitorCalendar.checkPermission({ scope: CalendarPermissionScope.READ_CALENDAR });\n *\n * @throws {Error} `Scope must be provided.` — when `scope` is missing.\n * @throws {Error} `Invalid scope.` — when `scope` is invalid.\n * @throws {Error} `Unhandled permission state.` — when the native status cannot be mapped.\n *\n * @platform Android, iOS\n * @since 0.1.0\n */\n checkPermission(options: CheckPermissionOptions): Promise<{ result: PermissionState }>;\n\n /**\n * Retrieves the current state of all permissions.\n * On Android, reminder keys always resolve to `\"prompt\"`.\n *\n * @throws {Error} `Unhandled permission state.` — when a native status cannot be mapped.\n *\n * @platform Android, iOS\n * @since 0.1.0\n */\n checkAllPermissions(): Promise<{ result: CheckAllPermissionsResult }>;\n\n /**\n * Requests permission for a given scope.\n * On Android, `readReminders` and `writeReminders` reject with `Invalid scope.`\n *\n * @example\n * CapacitorCalendar.requestPermission({ scope: CalendarPermissionScope.READ_CALENDAR });\n *\n * @throws {Error} `Scope must be provided.` — when `scope` is missing.\n * @throws {Error} `Invalid scope.` — when `scope` is invalid, or a reminders scope on Android.\n *\n * @deprecated Use {@link requestWriteOnlyCalendarAccess},\n * {@link requestReadOnlyCalendarAccess} (Android),\n * {@link requestFullCalendarAccess} (also for read on iOS),\n * or {@link requestFullRemindersAccess} instead.\n *\n * @platform Android, iOS\n * @since 0.1.0\n */\n requestPermission(options: RequestPermissionOptions): Promise<{ result: PermissionState }>;\n\n /**\n * Requests permission for all calendar and reminder permissions.\n * On Android, only calendar permissions are requested; reminder keys stay `\"prompt\"`.\n *\n * @deprecated Use {@link requestFullCalendarAccess} or {@link requestFullRemindersAccess} instead.\n * @platform Android, iOS\n * @since 0.1.0\n */\n requestAllPermissions(): Promise<{ result: RequestAllPermissionsResult }>;\n\n /**\n * Requests write access to the calendar.\n *\n * @permissions\n * | Platform | Required |\n * |-----------|---------------------|\n * | iOS 17+ | `NSCalendarsWriteOnlyAccessUsageDescription` |\n * | iOS 13-16 | `NSCalendarsUsageDescription` |\n * | Android | `android.permission.WRITE_CALENDAR` |\n *\n * @platform Android, iOS\n * @since 5.4.0\n */\n requestWriteOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read access to the calendar.\n *\n * @permissions\n * | Platform | Required |\n * |-----------|---------------------|\n * | Android | `android.permission.READ_CALENDAR` |\n *\n * @platform Android\n * @since 5.4.0\n */\n requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read and write access to the calendar.\n *\n * @permissions\n * | Platform | Required |\n * |-----------|---------------------|\n * | iOS 17+ | `NSCalendarsFullAccessUsageDescription` |\n * | iOS 13-16 | `NSCalendarsUsageDescription` |\n * | Android | `android.permission.READ_CALENDAR` & `android.permission.WRITE_CALENDAR` |\n *\n * @platform Android, iOS\n * @since 5.4.0\n */\n requestFullCalendarAccess(): Promise<{ result: PermissionState }>;\n}\n\n/**\n * @platform Android, iOS\n * @since 7.1.0\n */\nexport type CheckAllPermissionsResult = Record<CalendarPermissionScope, PermissionState>;\n\n/**\n * @platform Android, iOS\n * @since 7.1.0\n */\nexport type RequestAllPermissionsResult = CheckAllPermissionsResult;\n"]}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { Calendar } from '../schemas/interfaces/calendar';
|
|
2
|
-
import type { CalendarSource } from '../schemas/interfaces/calendar-source';
|
|
3
2
|
import type { CreateCalendarOptions } from '../schemas/interfaces/create-calendar-options';
|
|
3
|
+
import type { CreateCalendarResult } from '../schemas/interfaces/create-calendar-result';
|
|
4
4
|
import type { DeleteCalendarOptions } from '../schemas/interfaces/delete-calendar-options';
|
|
5
|
+
import type { FetchAllCalendarSourcesResult } from '../schemas/interfaces/fetch-all-calendar-sources-result';
|
|
6
|
+
import type { GetDefaultCalendarOptions } from '../schemas/interfaces/get-default-calendar-options';
|
|
7
|
+
import type { ListCalendarsResult } from '../schemas/interfaces/list-calendars-result';
|
|
5
8
|
import type { ModifyCalendarOptions } from '../schemas/interfaces/modify-calendar-options';
|
|
6
9
|
import type { OpenCalendarOptions } from '../schemas/interfaces/open-calendar-options';
|
|
7
10
|
import type { SelectCalendarsWithPromptOptions } from '../schemas/interfaces/select-calendars-with-prompt-options';
|
|
11
|
+
import type { SelectCalendarsWithPromptResult } from '../schemas/interfaces/select-calendars-with-prompt-result';
|
|
8
12
|
export interface CalendarOperations {
|
|
9
13
|
/**
|
|
10
14
|
* Saves pending calendar changes.
|
|
@@ -16,37 +20,54 @@ export interface CalendarOperations {
|
|
|
16
20
|
/**
|
|
17
21
|
* Opens a system interface to choose one or multiple calendars.
|
|
18
22
|
*
|
|
23
|
+
* Calendar access is expected. Call `requestFullCalendarAccess()` first.
|
|
24
|
+
* Without authorization the chooser can look empty.
|
|
25
|
+
*
|
|
26
|
+
* On confirm, `result` contains the calendars the user selected.
|
|
27
|
+
* On cancel, `result` is an empty array.
|
|
28
|
+
*
|
|
29
|
+
* If a chooser is already presented, a new call is rejected; the in-flight
|
|
30
|
+
* call continues until the user confirms or cancels.
|
|
31
|
+
*
|
|
19
32
|
* @platform iOS
|
|
20
33
|
* @since 0.2.0
|
|
21
34
|
*/
|
|
22
|
-
selectCalendarsWithPrompt(options?: SelectCalendarsWithPromptOptions): Promise<
|
|
23
|
-
result: Calendar[];
|
|
24
|
-
}>;
|
|
35
|
+
selectCalendarsWithPrompt(options?: SelectCalendarsWithPromptOptions): Promise<SelectCalendarsWithPromptResult>;
|
|
25
36
|
/**
|
|
26
37
|
* Retrieves a list of calendar sources.
|
|
27
38
|
*
|
|
39
|
+
* Requires calendar access. Without authorization, `result` is typically
|
|
40
|
+
* an empty array. This method does not reject solely for missing permission.
|
|
41
|
+
*
|
|
28
42
|
* @platform iOS
|
|
29
43
|
* @since 6.6.0
|
|
30
44
|
*/
|
|
31
|
-
fetchAllCalendarSources(): Promise<
|
|
32
|
-
result: CalendarSource[];
|
|
33
|
-
}>;
|
|
45
|
+
fetchAllCalendarSources(): Promise<FetchAllCalendarSourcesResult>;
|
|
34
46
|
/**
|
|
35
47
|
* Retrieves a list of all available calendars.
|
|
36
48
|
*
|
|
49
|
+
* Requires calendar read access. On Android, missing permission typically
|
|
50
|
+
* rejects. On iOS, missing authorization typically returns an empty `result`.
|
|
51
|
+
*
|
|
37
52
|
* @platform Android, iOS
|
|
38
53
|
* @since 7.1.0
|
|
39
54
|
*/
|
|
40
|
-
listCalendars(): Promise<
|
|
41
|
-
result: Calendar[];
|
|
42
|
-
}>;
|
|
55
|
+
listCalendars(): Promise<ListCalendarsResult>;
|
|
43
56
|
/**
|
|
44
57
|
* Retrieves the default calendar.
|
|
45
58
|
*
|
|
59
|
+
* Requires calendar read access. On Android, missing permission typically
|
|
60
|
+
* rejects. On iOS, missing authorization typically yields `result: null`.
|
|
61
|
+
*
|
|
62
|
+
* The system default is the primary calendar on Android and
|
|
63
|
+
* `defaultCalendarForNewEvents` on iOS. When neither exists and
|
|
64
|
+
* `useFallbackCalendar` is true, the first available calendar is returned.
|
|
65
|
+
* Otherwise the method returns `null` when there is no system default.
|
|
66
|
+
*
|
|
46
67
|
* @platform Android, iOS
|
|
47
68
|
* @since 0.3.0
|
|
48
69
|
*/
|
|
49
|
-
getDefaultCalendar(): Promise<{
|
|
70
|
+
getDefaultCalendar(options?: GetDefaultCalendarOptions): Promise<{
|
|
50
71
|
result: Calendar | null;
|
|
51
72
|
}>;
|
|
52
73
|
/**
|
|
@@ -62,15 +83,34 @@ export interface CalendarOperations {
|
|
|
62
83
|
/**
|
|
63
84
|
* Creates a calendar.
|
|
64
85
|
*
|
|
86
|
+
* `title` is required. `color` is optional and defaults to `#007AFF`.
|
|
87
|
+
* On Android, `accountName` and `ownerAccount` are required at runtime.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* CapacitorCalendar.createCalendar({
|
|
91
|
+
* title: 'Work',
|
|
92
|
+
* accountName: 'plugin@example.com',
|
|
93
|
+
* ownerAccount: 'plugin@example.com',
|
|
94
|
+
* });
|
|
95
|
+
*
|
|
96
|
+
* @throws {Error} `Title must be provided.` — when `title` is missing.
|
|
97
|
+
* @throws {Error} `Invalid color format.` — when `color` is present but invalid.
|
|
98
|
+
* @throws {Error} `Account name must be provided.` — when `accountName` is missing on Android.
|
|
99
|
+
* @throws {Error} `Owner account must be provided.` — when `ownerAccount` is missing on Android.
|
|
100
|
+
* @throws {Error} `Calendar source not found.` — when `sourceId` is set and no EventKit source matches (iOS).
|
|
101
|
+
* @throws {Error} `Failed to retrieve calendar ID.` — when the calendar is created but no id is returned.
|
|
102
|
+
*
|
|
65
103
|
* @platform Android, iOS
|
|
66
104
|
* @since 5.2.0
|
|
67
105
|
*/
|
|
68
|
-
createCalendar(options: CreateCalendarOptions): Promise<
|
|
69
|
-
id: string;
|
|
70
|
-
}>;
|
|
106
|
+
createCalendar(options: CreateCalendarOptions): Promise<CreateCalendarResult>;
|
|
71
107
|
/**
|
|
72
108
|
* Deletes a calendar by id.
|
|
73
109
|
*
|
|
110
|
+
* @throws {Error} `Calendar ID must be provided.` — when `id` is missing.
|
|
111
|
+
* @throws {Error} `Invalid calendar ID.` — when `id` is not a numeric Android calendar id.
|
|
112
|
+
* @throws {Error} `Calendar not found.` — when no calendar exists for `id`.
|
|
113
|
+
*
|
|
74
114
|
* @platform Android, iOS
|
|
75
115
|
* @since 5.2.0
|
|
76
116
|
*/
|
|
@@ -78,6 +118,13 @@ export interface CalendarOperations {
|
|
|
78
118
|
/**
|
|
79
119
|
* Modifies a calendar with options.
|
|
80
120
|
*
|
|
121
|
+
* @throws {Error} `Calendar ID must be provided.` — when `id` is missing.
|
|
122
|
+
* @throws {Error} `Invalid calendar ID.` — when `id` is not a numeric Android calendar id.
|
|
123
|
+
* @throws {Error} `At least one of title or color must be provided.` — when both are omitted.
|
|
124
|
+
* @throws {Error} `Invalid color format.` — when `color` is present but invalid.
|
|
125
|
+
* @throws {Error} `Calendar not found.` — when no calendar exists for `id`.
|
|
126
|
+
* @throws {Error} `Calendar is not modifiable.` — when the calendar cannot be modified (iOS).
|
|
127
|
+
*
|
|
81
128
|
* @platform Android, iOS
|
|
82
129
|
* @since 7.2.0
|
|
83
130
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-operations.js","sourceRoot":"","sources":["../../../src/sub-definitions/calendar-operations.ts"],"names":[],"mappings":"","sourcesContent":["import type { Calendar } from '../schemas/interfaces/calendar';\nimport type {
|
|
1
|
+
{"version":3,"file":"calendar-operations.js","sourceRoot":"","sources":["../../../src/sub-definitions/calendar-operations.ts"],"names":[],"mappings":"","sourcesContent":["import type { Calendar } from '../schemas/interfaces/calendar';\nimport type { CreateCalendarOptions } from '../schemas/interfaces/create-calendar-options';\nimport type { CreateCalendarResult } from '../schemas/interfaces/create-calendar-result';\nimport type { DeleteCalendarOptions } from '../schemas/interfaces/delete-calendar-options';\nimport type { FetchAllCalendarSourcesResult } from '../schemas/interfaces/fetch-all-calendar-sources-result';\nimport type { GetDefaultCalendarOptions } from '../schemas/interfaces/get-default-calendar-options';\nimport type { ListCalendarsResult } from '../schemas/interfaces/list-calendars-result';\nimport type { ModifyCalendarOptions } from '../schemas/interfaces/modify-calendar-options';\nimport type { OpenCalendarOptions } from '../schemas/interfaces/open-calendar-options';\nimport type { SelectCalendarsWithPromptOptions } from '../schemas/interfaces/select-calendars-with-prompt-options';\nimport type { SelectCalendarsWithPromptResult } from '../schemas/interfaces/select-calendars-with-prompt-result';\n\nexport interface CalendarOperations {\n /**\n * Saves pending calendar changes.\n *\n * @platform iOS\n * @since 7.1.0\n */\n commit(): Promise<void>;\n /**\n * Opens a system interface to choose one or multiple calendars.\n *\n * Calendar access is expected. Call `requestFullCalendarAccess()` first.\n * Without authorization the chooser can look empty.\n *\n * On confirm, `result` contains the calendars the user selected.\n * On cancel, `result` is an empty array.\n *\n * If a chooser is already presented, a new call is rejected; the in-flight\n * call continues until the user confirms or cancels.\n *\n * @platform iOS\n * @since 0.2.0\n */\n selectCalendarsWithPrompt(options?: SelectCalendarsWithPromptOptions): Promise<SelectCalendarsWithPromptResult>;\n /**\n * Retrieves a list of calendar sources.\n *\n * Requires calendar access. Without authorization, `result` is typically\n * an empty array. This method does not reject solely for missing permission.\n *\n * @platform iOS\n * @since 6.6.0\n */\n fetchAllCalendarSources(): Promise<FetchAllCalendarSourcesResult>;\n /**\n * Retrieves a list of all available calendars.\n *\n * Requires calendar read access. On Android, missing permission typically\n * rejects. On iOS, missing authorization typically returns an empty `result`.\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n listCalendars(): Promise<ListCalendarsResult>;\n /**\n * Retrieves the default calendar.\n *\n * Requires calendar read access. On Android, missing permission typically\n * rejects. On iOS, missing authorization typically yields `result: null`.\n *\n * The system default is the primary calendar on Android and\n * `defaultCalendarForNewEvents` on iOS. When neither exists and\n * `useFallbackCalendar` is true, the first available calendar is returned.\n * Otherwise the method returns `null` when there is no system default.\n *\n * @platform Android, iOS\n * @since 0.3.0\n */\n getDefaultCalendar(options?: GetDefaultCalendarOptions): Promise<{ result: Calendar | null }>;\n /**\n * Opens the calendar app.\n *\n * @example\n * CapacitorCalendar.openCalendar({ date: Date.now() });\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n openCalendar(options?: OpenCalendarOptions): Promise<void>;\n /**\n * Creates a calendar.\n *\n * `title` is required. `color` is optional and defaults to `#007AFF`.\n * On Android, `accountName` and `ownerAccount` are required at runtime.\n *\n * @example\n * CapacitorCalendar.createCalendar({\n * title: 'Work',\n * accountName: 'plugin@example.com',\n * ownerAccount: 'plugin@example.com',\n * });\n *\n * @throws {Error} `Title must be provided.` — when `title` is missing.\n * @throws {Error} `Invalid color format.` — when `color` is present but invalid.\n * @throws {Error} `Account name must be provided.` — when `accountName` is missing on Android.\n * @throws {Error} `Owner account must be provided.` — when `ownerAccount` is missing on Android.\n * @throws {Error} `Calendar source not found.` — when `sourceId` is set and no EventKit source matches (iOS).\n * @throws {Error} `Failed to retrieve calendar ID.` — when the calendar is created but no id is returned.\n *\n * @platform Android, iOS\n * @since 5.2.0\n */\n createCalendar(options: CreateCalendarOptions): Promise<CreateCalendarResult>;\n /**\n * Deletes a calendar by id.\n *\n * @throws {Error} `Calendar ID must be provided.` — when `id` is missing.\n * @throws {Error} `Invalid calendar ID.` — when `id` is not a numeric Android calendar id.\n * @throws {Error} `Calendar not found.` — when no calendar exists for `id`.\n *\n * @platform Android, iOS\n * @since 5.2.0\n */\n deleteCalendar(options: DeleteCalendarOptions): Promise<void>;\n /**\n * Modifies a calendar with options.\n *\n * @throws {Error} `Calendar ID must be provided.` — when `id` is missing.\n * @throws {Error} `Invalid calendar ID.` — when `id` is not a numeric Android calendar id.\n * @throws {Error} `At least one of title or color must be provided.` — when both are omitted.\n * @throws {Error} `Invalid color format.` — when `color` is present but invalid.\n * @throws {Error} `Calendar not found.` — when no calendar exists for `id`.\n * @throws {Error} `Calendar is not modifiable.` — when the calendar cannot be modified (iOS).\n *\n * @platform Android, iOS\n * @since 7.2.0\n */\n modifyCalendar(options: ModifyCalendarOptions): Promise<void>;\n}\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { CalendarEvent } from '../schemas/interfaces/calendar-event';
|
|
2
2
|
import type { CreateEventOptions } from '../schemas/interfaces/create-event-options';
|
|
3
|
+
import type { CreateEventResult } from '../schemas/interfaces/create-event-result';
|
|
3
4
|
import type { CreateEventWithPromptOptions } from '../schemas/interfaces/create-event-with-prompt-options';
|
|
5
|
+
import type { CreateEventWithPromptResult } from '../schemas/interfaces/create-event-with-prompt-result';
|
|
4
6
|
import type { DeleteEventOptions } from '../schemas/interfaces/delete-event-options';
|
|
5
7
|
import type { DeleteEventWithPromptOptions } from '../schemas/interfaces/delete-event-with-prompt-options';
|
|
6
8
|
import type { DeleteEventsByIdOptions } from '../schemas/interfaces/delete-events-by-id-options';
|
|
@@ -11,7 +13,7 @@ import type { EventEditAction } from '../schemas/types/event-edit-action';
|
|
|
11
13
|
export interface EventOperations {
|
|
12
14
|
/**
|
|
13
15
|
* Opens the system calendar interface to create a new event.
|
|
14
|
-
* On Android always returns `null`.
|
|
16
|
+
* On Android always returns `null` for `id`.
|
|
15
17
|
* Fetch the events to find the ID of the newly created event.
|
|
16
18
|
*
|
|
17
19
|
* @example
|
|
@@ -24,9 +26,7 @@ export interface EventOperations {
|
|
|
24
26
|
* @platform Android, iOS
|
|
25
27
|
* @since 0.1.0
|
|
26
28
|
*/
|
|
27
|
-
createEventWithPrompt(options?: CreateEventWithPromptOptions): Promise<
|
|
28
|
-
id: string | null;
|
|
29
|
-
}>;
|
|
29
|
+
createEventWithPrompt(options?: CreateEventWithPromptOptions): Promise<CreateEventWithPromptResult>;
|
|
30
30
|
/**
|
|
31
31
|
* Opens a system calendar interface to modify an event.
|
|
32
32
|
* On Android always returns `null`.
|
|
@@ -46,13 +46,25 @@ export interface EventOperations {
|
|
|
46
46
|
}>;
|
|
47
47
|
/**
|
|
48
48
|
* Creates an event in the calendar.
|
|
49
|
+
* On Android and iOS, inserts into the system calendar and returns its `id`.
|
|
50
|
+
* On Web, there is no system calendar store: builds an `.ics` `File` as `ics`.
|
|
51
|
+
* The app must download or open that file (for example with `downloadIcsFile(...)`);
|
|
52
|
+
* this method does not trigger a download.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* const { id, ics } = await CapacitorCalendar.createEvent({
|
|
56
|
+
* title: 'Team standup',
|
|
57
|
+
* startDate: Date.now(),
|
|
58
|
+
* icsFileName: 'team-standup.ics',
|
|
59
|
+
* });
|
|
60
|
+
* if (ics) {
|
|
61
|
+
* await downloadIcsFile(ics);
|
|
62
|
+
* }
|
|
49
63
|
*
|
|
50
|
-
* @platform iOS,
|
|
64
|
+
* @platform Android, iOS, Web
|
|
51
65
|
* @since 0.4.0
|
|
52
66
|
*/
|
|
53
|
-
createEvent(options: CreateEventOptions): Promise<
|
|
54
|
-
id: string;
|
|
55
|
-
}>;
|
|
67
|
+
createEvent(options: CreateEventOptions): Promise<CreateEventResult>;
|
|
56
68
|
/**
|
|
57
69
|
* Modifies an event.
|
|
58
70
|
*
|
|
@@ -87,7 +99,21 @@ export interface EventOperations {
|
|
|
87
99
|
deleted: boolean;
|
|
88
100
|
}>;
|
|
89
101
|
/**
|
|
90
|
-
* Retrieves
|
|
102
|
+
* Retrieves events that overlap a date range.
|
|
103
|
+
*
|
|
104
|
+
* An event is included when its time interval intersects `[from, to]`, including
|
|
105
|
+
* multi-day events that span the range without starting or ending inside it.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* const startOfDay = new Date();
|
|
109
|
+
* startOfDay.setHours(0, 0, 0, 0);
|
|
110
|
+
* const startOfNextDay = new Date(startOfDay);
|
|
111
|
+
* startOfNextDay.setDate(startOfNextDay.getDate() + 1);
|
|
112
|
+
*
|
|
113
|
+
* const { result } = await CapacitorCalendar.listEventsInRange({
|
|
114
|
+
* from: startOfDay.getTime(),
|
|
115
|
+
* to: startOfNextDay.getTime(),
|
|
116
|
+
* });
|
|
91
117
|
*
|
|
92
118
|
* @platform Android, iOS
|
|
93
119
|
* @since 0.10.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-operations.js","sourceRoot":"","sources":["../../../src/sub-definitions/event-operations.ts"],"names":[],"mappings":"","sourcesContent":["import type { CalendarEvent } from '../schemas/interfaces/calendar-event';\nimport type { CreateEventOptions } from '../schemas/interfaces/create-event-options';\nimport type { CreateEventWithPromptOptions } from '../schemas/interfaces/create-event-with-prompt-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 { ListEventsInRangeOptions } from '../schemas/interfaces/list-events-in-range-options';\nimport type { ModifyEventOptions } from '../schemas/interfaces/modify-event-options';\nimport type { ModifyEventWithPromptOptions } from '../schemas/interfaces/modify-event-with-prompt-options';\nimport type { EventEditAction } from '../schemas/types/event-edit-action';\n\nexport interface EventOperations {\n /**\n * Opens the system calendar interface to create a new event.\n * On Android always returns `null`.\n * Fetch the events to find the ID of the newly created event.\n *\n * @example\n * const options = {\n * title: 'Test event',\n * startDate: Date.now(),\n * }\n * await CapacitorCalendar.createEventWithPrompt(options)\n *\n * @platform Android, iOS\n * @since 0.1.0\n */\n createEventWithPrompt(options?: CreateEventWithPromptOptions): Promise<
|
|
1
|
+
{"version":3,"file":"event-operations.js","sourceRoot":"","sources":["../../../src/sub-definitions/event-operations.ts"],"names":[],"mappings":"","sourcesContent":["import type { CalendarEvent } from '../schemas/interfaces/calendar-event';\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 { 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 { ListEventsInRangeOptions } from '../schemas/interfaces/list-events-in-range-options';\nimport type { ModifyEventOptions } from '../schemas/interfaces/modify-event-options';\nimport type { ModifyEventWithPromptOptions } from '../schemas/interfaces/modify-event-with-prompt-options';\nimport type { EventEditAction } from '../schemas/types/event-edit-action';\n\nexport interface EventOperations {\n /**\n * Opens the system calendar interface to create a new event.\n * On Android always returns `null` for `id`.\n * Fetch the events to find the ID of the newly created event.\n *\n * @example\n * const options = {\n * title: 'Test event',\n * startDate: Date.now(),\n * }\n * await CapacitorCalendar.createEventWithPrompt(options)\n *\n * @platform Android, iOS\n * @since 0.1.0\n */\n createEventWithPrompt(options?: CreateEventWithPromptOptions): Promise<CreateEventWithPromptResult>;\n /**\n * Opens a system calendar interface to modify an event.\n * On Android always returns `null`.\n *\n * @example\n * const options = {\n * id: 'EVENT_ID',\n * title: 'New title',\n * }\n * await CapacitorCalendar.modifyEventWithPrompt(options);\n *\n * @platform Android, iOS\n * @since 6.6.0\n */\n modifyEventWithPrompt(options: ModifyEventWithPromptOptions): Promise<{ result: EventEditAction | null }>;\n /**\n * Creates an event in the calendar.\n * On Android and iOS, inserts into the system calendar and returns its `id`.\n * On Web, there is no system calendar store: builds an `.ics` `File` as `ics`.\n * The app must download or open that file (for example with `downloadIcsFile(...)`);\n * this method does not trigger a download.\n *\n * @example\n * const { id, ics } = await CapacitorCalendar.createEvent({\n * title: 'Team standup',\n * startDate: Date.now(),\n * icsFileName: 'team-standup.ics',\n * });\n * if (ics) {\n * await downloadIcsFile(ics);\n * }\n *\n * @platform Android, iOS, Web\n * @since 0.4.0\n */\n createEvent(options: CreateEventOptions): Promise<CreateEventResult>;\n /**\n * Modifies an event.\n *\n * @platform Android, iOS\n * @since 6.6.0\n */\n modifyEvent(options: ModifyEventOptions): Promise<void>;\n /**\n * Deletes multiple events.\n *\n * @deprecated Use `deleteEvent(...)`.\n * @platform Android, iOS\n * @since 0.11.0\n */\n deleteEventsById(options: DeleteEventsByIdOptions): Promise<{ result: DeleteEventsByIdResult }>;\n /**\n * Deletes an event.\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n deleteEvent(options: DeleteEventOptions): Promise<void>;\n /**\n * Opens a dialog to delete an event.\n *\n * @platform Android, iOS\n * @since 7.1.0\n */\n deleteEventWithPrompt(options: DeleteEventWithPromptOptions): Promise<{ deleted: boolean }>;\n /**\n * Retrieves events that overlap a date range.\n *\n * An event is included when its time interval intersects `[from, to]`, including\n * multi-day events that span the range without starting or ending inside it.\n *\n * @example\n * const startOfDay = new Date();\n * startOfDay.setHours(0, 0, 0, 0);\n * const startOfNextDay = new Date(startOfDay);\n * startOfNextDay.setDate(startOfNextDay.getDate() + 1);\n *\n * const { result } = await CapacitorCalendar.listEventsInRange({\n * from: startOfDay.getTime(),\n * to: startOfNextDay.getTime(),\n * });\n *\n * @platform Android, iOS\n * @since 0.10.0\n */\n listEventsInRange(options: ListEventsInRangeOptions): Promise<{ result: CalendarEvent[] }>;\n}\n\n/**\n * @since 7.1.0\n */\nexport interface DeleteEventsByIdResult {\n /**\n * @since 7.1.0\n */\n deleted: string[];\n /**\n * @since 7.1.0\n */\n failed: string[];\n}\n"]}
|
|
@@ -5,6 +5,8 @@ import type { PermissionState } from '@capacitor/core';
|
|
|
5
5
|
export interface RemindersAccess {
|
|
6
6
|
/**
|
|
7
7
|
* Requests read and write access to the reminders.
|
|
8
|
+
* Resolves with `"granted"` or `"denied"` (never `"prompt"`).
|
|
9
|
+
* A grant covers both `readReminders` and `writeReminders`.
|
|
8
10
|
*
|
|
9
11
|
* @permissions
|
|
10
12
|
* | Platform | Required |
|
|
@@ -12,6 +14,8 @@ export interface RemindersAccess {
|
|
|
12
14
|
* | iOS 17+ | `NSRemindersFullAccessUsageDescription` |
|
|
13
15
|
* | iOS 10-16 | `NSRemindersUsageDescription` |
|
|
14
16
|
*
|
|
17
|
+
* @throws {Error} when EventKit fails or required Info.plist keys are missing.
|
|
18
|
+
*
|
|
15
19
|
* @platform iOS
|
|
16
20
|
* @see {@link CalendarPermissionScope}
|
|
17
21
|
* @since 5.4.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reminders-access.js","sourceRoot":"","sources":["../../../src/sub-definitions/reminders-access.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\n/**\n * @since 7.1.0\n */\nexport interface RemindersAccess {\n /**\n * Requests read and write access to the reminders.\n *\n * @permissions\n * | Platform | Required |\n * |-----------|---------------------|\n * | iOS 17+ | `NSRemindersFullAccessUsageDescription` |\n * | iOS 10-16 | `NSRemindersUsageDescription` |\n *\n * @platform iOS\n * @see {@link CalendarPermissionScope}\n * @since 5.4.0\n */\n requestFullRemindersAccess(): Promise<{ result: PermissionState }>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reminders-access.js","sourceRoot":"","sources":["../../../src/sub-definitions/reminders-access.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\n/**\n * @since 7.1.0\n */\nexport interface RemindersAccess {\n /**\n * Requests read and write access to the reminders.\n * Resolves with `\"granted\"` or `\"denied\"` (never `\"prompt\"`).\n * A grant covers both `readReminders` and `writeReminders`.\n *\n * @permissions\n * | Platform | Required |\n * |-----------|---------------------|\n * | iOS 17+ | `NSRemindersFullAccessUsageDescription` |\n * | iOS 10-16 | `NSRemindersUsageDescription` |\n *\n * @throws {Error} when EventKit fails or required Info.plist keys are missing.\n *\n * @platform iOS\n * @see {@link CalendarPermissionScope}\n * @since 5.4.0\n */\n requestFullRemindersAccess(): Promise<{ result: PermissionState }>;\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Triggers a browser download for an `.ics` `File`.
|
|
3
|
+
* Resolves after the object URL is revoked.
|
|
4
|
+
*
|
|
5
|
+
* @throws If `document` or `URL` is not available.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const { ics } = await CapacitorCalendar.createEvent({
|
|
9
|
+
* title: 'Team standup',
|
|
10
|
+
* icsFileName: 'team-standup.ics',
|
|
11
|
+
* });
|
|
12
|
+
* if (ics) {
|
|
13
|
+
* await downloadIcsFile(ics);
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* @since 8.5.0
|
|
17
|
+
*/
|
|
18
|
+
export declare function downloadIcsFile(file: File): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Triggers a browser download for an `.ics` `File`.
|
|
3
|
+
* Resolves after the object URL is revoked.
|
|
4
|
+
*
|
|
5
|
+
* @throws If `document` or `URL` is not available.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const { ics } = await CapacitorCalendar.createEvent({
|
|
9
|
+
* title: 'Team standup',
|
|
10
|
+
* icsFileName: 'team-standup.ics',
|
|
11
|
+
* });
|
|
12
|
+
* if (ics) {
|
|
13
|
+
* await downloadIcsFile(ics);
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* @since 8.5.0
|
|
17
|
+
*/
|
|
18
|
+
export async function downloadIcsFile(file) {
|
|
19
|
+
if (typeof document === 'undefined' || typeof URL === 'undefined') {
|
|
20
|
+
throw new Error('downloadIcsFile requires a browser document environment.');
|
|
21
|
+
}
|
|
22
|
+
const url = URL.createObjectURL(file);
|
|
23
|
+
const link = document.createElement('a');
|
|
24
|
+
link.href = url;
|
|
25
|
+
link.download = file.name.length > 0 ? file.name : 'event.ics';
|
|
26
|
+
document.body.appendChild(link);
|
|
27
|
+
link.click();
|
|
28
|
+
link.remove();
|
|
29
|
+
// Delay revoke so the browser can start the download
|
|
30
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
31
|
+
URL.revokeObjectURL(url);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=download-ics-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-ics-file.js","sourceRoot":"","sources":["../../../src/web/download-ics-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAU;IAC9C,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,GAAG,KAAK,WAAW,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IAED,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;IAC/D,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK,EAAE,CAAC;IACb,IAAI,CAAC,MAAM,EAAE,CAAC;IACd,qDAAqD;IACrD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1D,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["/**\n * Triggers a browser download for an `.ics` `File`.\n * Resolves after the object URL is revoked.\n *\n * @throws If `document` or `URL` is not available.\n *\n * @example\n * const { ics } = await CapacitorCalendar.createEvent({\n * title: 'Team standup',\n * icsFileName: 'team-standup.ics',\n * });\n * if (ics) {\n * await downloadIcsFile(ics);\n * }\n *\n * @since 8.5.0\n */\nexport async function downloadIcsFile(file: File): Promise<void> {\n if (typeof document === 'undefined' || typeof URL === 'undefined') {\n throw new Error('downloadIcsFile requires a browser document environment.');\n }\n\n const url = URL.createObjectURL(file);\n const link = document.createElement('a');\n link.href = url;\n link.download = file.name.length > 0 ? file.name : 'event.ics';\n document.body.appendChild(link);\n link.click();\n link.remove();\n // Delay revoke so the browser can start the download\n await new Promise((resolve) => setTimeout(resolve, 1000));\n URL.revokeObjectURL(url);\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CreateEventOptions } from '../schemas/interfaces/create-event-options';
|
|
2
|
+
/**
|
|
3
|
+
* Builds an RFC 5545 `VCALENDAR` document with one `VEVENT` from CreateEventOptions.
|
|
4
|
+
* When `startDate` is omitted, uses the current time. When `endDate` is omitted, uses
|
|
5
|
+
* one hour after the start (or the next day for all-day events).
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildEventIcs(options: CreateEventOptions): string;
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the `.ics` download filename.
|
|
10
|
+
* Uses `icsFileName` when set; otherwise derives a name from `title` (fallback `event.ics`).
|
|
11
|
+
* Appends `.ics` when the chosen name has no such extension.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveIcsFileName(options: Pick<CreateEventOptions, 'icsFileName' | 'title'>): string;
|
|
14
|
+
/**
|
|
15
|
+
* Escapes TEXT values per RFC 5545 §3.3.11.
|
|
16
|
+
*/
|
|
17
|
+
export declare function escapeText(value: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Folds a content line so each physical line is at most 75 octets (RFC 5545 §3.1).
|
|
20
|
+
*/
|
|
21
|
+
export declare function foldLine(line: string): string;
|