@ebarooni/capacitor-calendar 0.10.0 → 0.10.1
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 +2 -2
- package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +1 -4
- package/dist/docs.json +3 -3
- package/dist/esm/definitions.d.ts +2 -2
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +1 -1
- package/dist/esm/web.js.map +1 -1
- package/ios/Plugin/CapacitorCalendarPlugin.swift +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -225,7 +225,7 @@ Retrieves the default calendar set on the device.
|
|
|
225
225
|
### createEvent(...)
|
|
226
226
|
|
|
227
227
|
```typescript
|
|
228
|
-
createEvent(options: { title: string; calendarId?: string; location?: string; startDate?: number; endDate?: number; isAllDay?: boolean; }) => Promise<{ result: string
|
|
228
|
+
createEvent(options: { title: string; calendarId?: string; location?: string; startDate?: number; endDate?: number; isAllDay?: boolean; }) => Promise<{ result: string; }>
|
|
229
229
|
```
|
|
230
230
|
|
|
231
231
|
Creates an event with the provided options.
|
|
@@ -234,7 +234,7 @@ Creates an event with the provided options.
|
|
|
234
234
|
| ------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
|
|
235
235
|
| **`options`** | <code>{ title: string; calendarId?: string; location?: string; startDate?: number; endDate?: number; isAllDay?: boolean; }</code> | - Options for creating the event. |
|
|
236
236
|
|
|
237
|
-
**Returns:** <code>Promise<{ result: string
|
|
237
|
+
**Returns:** <code>Promise<{ result: string; }></code>
|
|
238
238
|
|
|
239
239
|
--------------------
|
|
240
240
|
|
|
@@ -181,10 +181,7 @@ class CapacitorCalendarPlugin : Plugin() {
|
|
|
181
181
|
val eventUri = implementation.createEvent(context, title, calendarId, location, startDate, endDate, isAllDay)
|
|
182
182
|
val id = eventUri?.lastPathSegment ?: throw IllegalArgumentException("Failed to insert event into calendar")
|
|
183
183
|
val ret = JSObject()
|
|
184
|
-
|
|
185
|
-
array.put(id)
|
|
186
|
-
|
|
187
|
-
ret.put("result", array)
|
|
184
|
+
ret.put("result", id)
|
|
188
185
|
call.resolve(ret)
|
|
189
186
|
} catch (error: Exception) {
|
|
190
187
|
call.reject("", "[CapacitorCalendar.${::createEvent.name}] Unable to create event")
|
package/dist/docs.json
CHANGED
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
},
|
|
281
281
|
{
|
|
282
282
|
"name": "createEvent",
|
|
283
|
-
"signature": "(options: { title: string; calendarId?: string; location?: string; startDate?: number; endDate?: number; isAllDay?: boolean; }) => Promise<{ result: string
|
|
283
|
+
"signature": "(options: { title: string; calendarId?: string; location?: string; startDate?: number; endDate?: number; isAllDay?: boolean; }) => Promise<{ result: string; }>",
|
|
284
284
|
"parameters": [
|
|
285
285
|
{
|
|
286
286
|
"name": "options",
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
"type": "{ title: string; calendarId?: string | undefined; location?: string | undefined; startDate?: number | undefined; endDate?: number | undefined; isAllDay?: boolean | undefined; }"
|
|
289
289
|
}
|
|
290
290
|
],
|
|
291
|
-
"returns": "Promise<{ result: string
|
|
291
|
+
"returns": "Promise<{ result: string; }>",
|
|
292
292
|
"tags": [
|
|
293
293
|
{
|
|
294
294
|
"name": "method",
|
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
},
|
|
309
309
|
{
|
|
310
310
|
"name": "returns",
|
|
311
|
-
"text": "A promise that resolves with
|
|
311
|
+
"text": "A promise that resolves with the id of the created event."
|
|
312
312
|
},
|
|
313
313
|
{
|
|
314
314
|
"name": "example",
|
|
@@ -152,7 +152,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
152
152
|
* @param {number} [options.startDate] - The start date and time of the event. (Optional)
|
|
153
153
|
* @param {number} [options.endDate] - The end date and time of the event. (Optional)
|
|
154
154
|
* @param {boolean} [options.isAllDay] - Weather the event is for the entire day or not. (Optional)
|
|
155
|
-
* @returns {Promise<{ result: string
|
|
155
|
+
* @returns {Promise<{ result: string }>} A promise that resolves with the id of the created event.
|
|
156
156
|
* @example
|
|
157
157
|
* const now = Date.now();
|
|
158
158
|
* const eventOptions = {
|
|
@@ -172,7 +172,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
172
172
|
endDate?: number;
|
|
173
173
|
isAllDay?: boolean;
|
|
174
174
|
}): Promise<{
|
|
175
|
-
result: string
|
|
175
|
+
result: string;
|
|
176
176
|
}>;
|
|
177
177
|
/**
|
|
178
178
|
* Retrieves the default reminders list set on the device.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { CalendarChooserDisplayStyle } from './schemas/enums/calendar-chooser-display-style';\nimport { CalendarChooserSelectionStyle } from './schemas/enums/calendar-chooser-selection-style';\nimport { PluginPermission } from './schemas/enums/plugin-permission';\nimport type { PermissionState } from '@capacitor/core';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { RemindersList } from './schemas/interfaces/reminders-list';\nimport type { PluginPermissionsMap } from './schemas/interfaces/plugin-permissions-map';\nimport type { ReminderRecurrenceRule } from './schemas/interfaces/reminder-recurrence-rule';\nimport type { CalendarEvent } from './schemas/interfaces/calendar-event';\n\nexport interface CapacitorCalendarPlugin {\n /**\n * Checks the current authorization status of a specific permission.\n *\n * @method\n * @platform iOS, Android\n * @param options An object with the name of the permission\n * @returns {Promise<{ result: PermissionState }>} – A promise that resolves with the current status of the requested permission.\n * @example\n * const status = await this.checkPermission({ alias: 'readCalendar' });\n */\n checkPermission(options: { alias: PluginPermission }): Promise<{ result: PermissionState }>;\n\n /**\n * Checks the current authorization status of all the required permissions for the plugin.\n *\n * @method\n * @platform iOS, Android\n * @returns {Promise<PluginPermissionsMap>} – A promise that resolves with an object containing all the permissions and their status.\n * @example\n * const permissionsStatus = await this.checkAllPermissions();\n */\n checkAllPermissions(): Promise<PluginPermissionsMap>;\n\n /**\n * Requests authorization to a specific permission, if not already granted.\n * If the permission is already granted, it will directly return the status.\n *\n * @method\n * @platform iOS, Android\n * @param options An object with the name of the permission\n * @returns {Promise<{ result: PermissionState }>} – A promise that resolves with the new permission status after the request is made.\n * @example\n * const result = await this.requestPermission({ alias: 'readCalendar' });\n */\n requestPermission(options: { alias: PluginPermission }): Promise<{ result: PermissionState }>;\n\n /**\n * Requests authorization to all the required permissions for the plugin, if they have not already been granted.\n *\n * @method\n * @platform iOS, Android\n * @returns {Promise<PluginPermissionsMap>} – A promise that resolves with the new permission statuses after the request is made.\n * @example\n * const permissionResults = await this.requestAllPermissions();\n */\n requestAllPermissions(): Promise<PluginPermissionsMap>;\n\n /**\n * Creates an event in the calendar by using the native calendar.\n * On iOS opens a native sheet and on Android opens an intent.\n *\n * @method\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>Android:</strong> readCalendar</li>\n * </ul>\n * @returns {Promise<{ result: string[] }>} A promise that resolves with an array of the ids of created events.\n * @throws Error If prompt gets cancelled.\n * @example\n * if (capacitor.getPlatform() === 'android') {\n * await this.requestPermission({ alias: 'readCalendar' });\n * { result } = result = await this.createEventWithPrompt();\n * } else {\n * { result } = await this.createEventWithPrompt();\n * }\n */\n createEventWithPrompt(): Promise<{ result: string[] }>;\n\n /**\n * Presents a prompt to the user to select calendars. This method is available only on iOS.\n *\n * @method selectCalendarsWithPrompt\n * @platform iOS\n * @param {object} options - Options for customizing the display and selection styles of the calendar chooser.\n * @async\n * @returns { Promise<{ result: Calendar[] }> } A promise that resolves with an array of selected calendars,\n * where each calendar object contains an ID and a title.\n * @example\n * if (capacitor.getPlatform() === 'ios') {\n * const { result } = await selectCalendarsWithPrompt();\n * console.log(result); // [{ id: '1', title: 'Work Calendar' }]\n * }\n */\n selectCalendarsWithPrompt(options: {\n displayStyle: CalendarChooserDisplayStyle;\n selectionStyle: CalendarChooserSelectionStyle;\n }): Promise<{ result: Calendar[] }>;\n\n /**\n * Retrieves a list of calendars available on the device.\n *\n * @async\n * @method listCalendars\n * @platform iOS, Android\n * @returns {Promise<{ result: Calendar[] }>} A promise that resolves with an array of calendars available on the device.\n * Each calendar object in the array contains an ID and a title.\n * @example\n * const { result } = await listCalendars();\n * console.log(result); // [{ id: '1', title: 'Work Calendar' }, { id: '2', title: 'Personal Calendar' }]\n */\n listCalendars(): Promise<{ result: Calendar[] }>;\n\n /**\n * Retrieves the default calendar set on the device.\n *\n * @method getDefaultCalendar\n * @platform iOS, Android\n * @returns {Promise<{ result: Calendar }>} A promise that resolves with the default calendar set on the device.\n * The returned calendar object contains an ID and a title.\n * @example\n * const { result } = await getDefaultCalendar();\n * console.log(result); // { id: '1', title: 'Default Calendar' }\n */\n getDefaultCalendar(): Promise<{ result: Calendar }>;\n\n /**\n * Creates an event with the provided options.\n *\n * @method createEvent\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS 17 ≤:</strong> writeCalendar</li>\n * <li><strong>iOS 10 ≤ x ≤ iOS 16:</strong> writeCalendar</li>\n * <li><strong>Android:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options - Options for creating the event.\n * @param {string} options.title - The title of the event.\n * @param {string} options.calendarId - The id of the destination calendar. (Optional)\n * @param {string} [options.location] - The location of the event. (Optional)\n * @param {number} [options.startDate] - The start date and time of the event. (Optional)\n * @param {number} [options.endDate] - The end date and time of the event. (Optional)\n * @param {boolean} [options.isAllDay] - Weather the event is for the entire day or not. (Optional)\n * @returns {Promise<{ result: string[] }>} A promise that resolves with an array of the ids of created events.\n * @example\n * const now = Date.now();\n * const eventOptions = {\n * title: 'Team Meeting',\n * location: 'Conference Room A',\n * startDate: now,\n * endDate: now + 2 * 60 * 60 * 1000,\n * isAllDay: false\n * };\n * const { result } = await createEvent(eventOptions);\n */\n createEvent(options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n }): Promise<{ result: string[] }>;\n\n /**\n * Retrieves the default reminders list set on the device.\n *\n * @method getDefaultRemindersList\n * @platform iOS\n * @returns {Promise<{ result: RemindersList }>} A promise that resolves with the default reminder list set on the device.\n * The returned reminders list object contains an ID and a title.\n * @example\n * const { result } = await getDefaultRemindersList();\n * console.log(result); // { id: '1', title: 'Default Reminders List' }\n */\n getDefaultRemindersList(): Promise<{ result: RemindersList }>;\n\n /**\n * Retrieves all available reminders lists on the device.\n *\n * @async\n * @method getRemindersLists\n * @platform iOS\n * @returns {Promise<{ result: RemindersList[] }>} A promise that resolves with an array of reminders lists available on the device.\n * Each reminders list object in the array contains an ID and a title.\n * @example\n * const { result } = await getRemindersLists();\n * console.log(result); // [{ id: '1', title: 'Groceries' }, { id: '2', title: 'Subscriptions' }]\n */\n getRemindersLists(): Promise<{ result: RemindersList[] }>;\n\n /**\n * Creates a reminder with the provided options.\n *\n * @method createReminder\n * @platform iOS\n * @param {object} options - Options for creating the reminder.\n * @param {string} options.title - The title of the reminder.\n * @param {string} options.listId - The id of the destination reminders list. (Optional)\n * @param {number} [options.priority] - The priority of the reminder. A number between one and nine where nine\n * has the least priority and 0 means no priority at all. Values outside of this range will be rounded to the\n * nearest border. (Optional)\n * @param {boolean} [options.isCompleted] - Whether the reminder is completed already or not. (Optional)\n * @param {number} [options.startDate] - The start date of the reminder. (Optional)\n * @param {number} [options.dueDate] - The due date of the reminder. (Optional)\n * @param {number} [options.completionDate] - The date at which the reminder was completed. (Optional)\n * @param {string} [options.notes] - Additional notes about the reminder. (Optional)\n * @param {string} [options.url] - A URL to save under the reminder. (Optional)\n * @param {string} [options.location] - A location to save under the reminder. (Optional)\n * @param {string} [options.recurrence] - The rules for the recurrence of the reminder. (Optional)\n * @returns {Promise<{ reminderCreated: boolean }>} A Promise that resolves with an object indicating whether the reminder was created successfully.\n * The resolved object has a property 'reminderCreated' which is a boolean value representing whether the reminder was created.\n * @example\n * const now = Date.now();\n * const rules: ReminderRecurrenceRule = {\n * frequency: ReminderRecurrenceFrequency.MONTHLY,\n * interval: 10,\n * end: Date.now()\n * }\n * const reminderOptions = {\n * title: 'Buy cucumber',\n * listId: 'ABC12',\n * priority: 5,\n * isCompleted: false,\n * startDateComponents: now,\n * notes: 'Also buy tomatoes',\n * url: 'https://capacitor-calendar.pages.dev/',\n * location: 'My Local Supermarket',\n * recurrence: rules\n * };\n * const { reminderCreated } = await createReminder(reminderOptions);\n * console.log(reminderCreated); // true\n */\n createReminder(options: {\n title: string;\n listId?: string;\n priority?: number;\n isCompleted?: boolean;\n startDate?: number;\n dueDate?: number;\n completionDate?: number;\n notes?: string;\n url?: string;\n location?: string;\n recurrence?: ReminderRecurrenceRule;\n }): Promise<{ reminderCreated: boolean }>;\n\n /**\n * Opens the calendar app. Since the user leaves your app, use this method with caution.\n * It will open the calendar on today's date if no date is provided.\n *\n * @method openCalendar\n * @platform iOS, Android\n * @param {object} options - Options for opening the calendar.\n * @param {number} options.date - The date at which the calendar should be opened. (Optional)\n * @returns {Promise<void>}\n * @example\n * void CapacitorCalendar.openCalendar({ date: Date.now() });\n */\n openCalendar(options: { date?: number }): Promise<void>;\n\n /**\n * Opens the reminders app. Since the user leaves your app, use this method with caution.\n *\n * @method openReminders\n * @platform iOS\n * @returns {Promise<void>}\n * @example\n * void CapacitorCalendar.openReminders();\n */\n openReminders(): Promise<void>;\n\n /**\n * Retrieves the list of calendar events present in the given date range.\n *\n * @method listEventsInRange\n * @platform iOS, Android\n * @param {object} options Options for defining the date range.\n * @param {number} options.startDate The start of the date range.\n * @param {number} options.endDate The end of the date range.\n * @returns {Promise<{ result: CalendarEvent[] }>} A Promise that resolves with the list of events.\n * @example\n * const { result } = await CapacitorCalendar.listEventsInRange({\n * startDate: Date.now(),\n * endDate: Date.now() + 6 * 7 * 24 * 60 * 60 * 1000, // 6 weeks from now\n * })\n */\n listEventsInRange(options: { startDate: number; endDate: number }): Promise<{ result: CalendarEvent[] }>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { CalendarChooserDisplayStyle } from './schemas/enums/calendar-chooser-display-style';\nimport { CalendarChooserSelectionStyle } from './schemas/enums/calendar-chooser-selection-style';\nimport { PluginPermission } from './schemas/enums/plugin-permission';\nimport type { PermissionState } from '@capacitor/core';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { RemindersList } from './schemas/interfaces/reminders-list';\nimport type { PluginPermissionsMap } from './schemas/interfaces/plugin-permissions-map';\nimport type { ReminderRecurrenceRule } from './schemas/interfaces/reminder-recurrence-rule';\nimport type { CalendarEvent } from './schemas/interfaces/calendar-event';\n\nexport interface CapacitorCalendarPlugin {\n /**\n * Checks the current authorization status of a specific permission.\n *\n * @method\n * @platform iOS, Android\n * @param options An object with the name of the permission\n * @returns {Promise<{ result: PermissionState }>} – A promise that resolves with the current status of the requested permission.\n * @example\n * const status = await this.checkPermission({ alias: 'readCalendar' });\n */\n checkPermission(options: { alias: PluginPermission }): Promise<{ result: PermissionState }>;\n\n /**\n * Checks the current authorization status of all the required permissions for the plugin.\n *\n * @method\n * @platform iOS, Android\n * @returns {Promise<PluginPermissionsMap>} – A promise that resolves with an object containing all the permissions and their status.\n * @example\n * const permissionsStatus = await this.checkAllPermissions();\n */\n checkAllPermissions(): Promise<PluginPermissionsMap>;\n\n /**\n * Requests authorization to a specific permission, if not already granted.\n * If the permission is already granted, it will directly return the status.\n *\n * @method\n * @platform iOS, Android\n * @param options An object with the name of the permission\n * @returns {Promise<{ result: PermissionState }>} – A promise that resolves with the new permission status after the request is made.\n * @example\n * const result = await this.requestPermission({ alias: 'readCalendar' });\n */\n requestPermission(options: { alias: PluginPermission }): Promise<{ result: PermissionState }>;\n\n /**\n * Requests authorization to all the required permissions for the plugin, if they have not already been granted.\n *\n * @method\n * @platform iOS, Android\n * @returns {Promise<PluginPermissionsMap>} – A promise that resolves with the new permission statuses after the request is made.\n * @example\n * const permissionResults = await this.requestAllPermissions();\n */\n requestAllPermissions(): Promise<PluginPermissionsMap>;\n\n /**\n * Creates an event in the calendar by using the native calendar.\n * On iOS opens a native sheet and on Android opens an intent.\n *\n * @method\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>Android:</strong> readCalendar</li>\n * </ul>\n * @returns {Promise<{ result: string[] }>} A promise that resolves with an array of the ids of created events.\n * @throws Error If prompt gets cancelled.\n * @example\n * if (capacitor.getPlatform() === 'android') {\n * await this.requestPermission({ alias: 'readCalendar' });\n * { result } = result = await this.createEventWithPrompt();\n * } else {\n * { result } = await this.createEventWithPrompt();\n * }\n */\n createEventWithPrompt(): Promise<{ result: string[] }>;\n\n /**\n * Presents a prompt to the user to select calendars. This method is available only on iOS.\n *\n * @method selectCalendarsWithPrompt\n * @platform iOS\n * @param {object} options - Options for customizing the display and selection styles of the calendar chooser.\n * @async\n * @returns { Promise<{ result: Calendar[] }> } A promise that resolves with an array of selected calendars,\n * where each calendar object contains an ID and a title.\n * @example\n * if (capacitor.getPlatform() === 'ios') {\n * const { result } = await selectCalendarsWithPrompt();\n * console.log(result); // [{ id: '1', title: 'Work Calendar' }]\n * }\n */\n selectCalendarsWithPrompt(options: {\n displayStyle: CalendarChooserDisplayStyle;\n selectionStyle: CalendarChooserSelectionStyle;\n }): Promise<{ result: Calendar[] }>;\n\n /**\n * Retrieves a list of calendars available on the device.\n *\n * @async\n * @method listCalendars\n * @platform iOS, Android\n * @returns {Promise<{ result: Calendar[] }>} A promise that resolves with an array of calendars available on the device.\n * Each calendar object in the array contains an ID and a title.\n * @example\n * const { result } = await listCalendars();\n * console.log(result); // [{ id: '1', title: 'Work Calendar' }, { id: '2', title: 'Personal Calendar' }]\n */\n listCalendars(): Promise<{ result: Calendar[] }>;\n\n /**\n * Retrieves the default calendar set on the device.\n *\n * @method getDefaultCalendar\n * @platform iOS, Android\n * @returns {Promise<{ result: Calendar }>} A promise that resolves with the default calendar set on the device.\n * The returned calendar object contains an ID and a title.\n * @example\n * const { result } = await getDefaultCalendar();\n * console.log(result); // { id: '1', title: 'Default Calendar' }\n */\n getDefaultCalendar(): Promise<{ result: Calendar }>;\n\n /**\n * Creates an event with the provided options.\n *\n * @method createEvent\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS 17 ≤:</strong> writeCalendar</li>\n * <li><strong>iOS 10 ≤ x ≤ iOS 16:</strong> writeCalendar</li>\n * <li><strong>Android:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options - Options for creating the event.\n * @param {string} options.title - The title of the event.\n * @param {string} options.calendarId - The id of the destination calendar. (Optional)\n * @param {string} [options.location] - The location of the event. (Optional)\n * @param {number} [options.startDate] - The start date and time of the event. (Optional)\n * @param {number} [options.endDate] - The end date and time of the event. (Optional)\n * @param {boolean} [options.isAllDay] - Weather the event is for the entire day or not. (Optional)\n * @returns {Promise<{ result: string }>} A promise that resolves with the id of the created event.\n * @example\n * const now = Date.now();\n * const eventOptions = {\n * title: 'Team Meeting',\n * location: 'Conference Room A',\n * startDate: now,\n * endDate: now + 2 * 60 * 60 * 1000,\n * isAllDay: false\n * };\n * const { result } = await createEvent(eventOptions);\n */\n createEvent(options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n }): Promise<{ result: string }>;\n\n /**\n * Retrieves the default reminders list set on the device.\n *\n * @method getDefaultRemindersList\n * @platform iOS\n * @returns {Promise<{ result: RemindersList }>} A promise that resolves with the default reminder list set on the device.\n * The returned reminders list object contains an ID and a title.\n * @example\n * const { result } = await getDefaultRemindersList();\n * console.log(result); // { id: '1', title: 'Default Reminders List' }\n */\n getDefaultRemindersList(): Promise<{ result: RemindersList }>;\n\n /**\n * Retrieves all available reminders lists on the device.\n *\n * @async\n * @method getRemindersLists\n * @platform iOS\n * @returns {Promise<{ result: RemindersList[] }>} A promise that resolves with an array of reminders lists available on the device.\n * Each reminders list object in the array contains an ID and a title.\n * @example\n * const { result } = await getRemindersLists();\n * console.log(result); // [{ id: '1', title: 'Groceries' }, { id: '2', title: 'Subscriptions' }]\n */\n getRemindersLists(): Promise<{ result: RemindersList[] }>;\n\n /**\n * Creates a reminder with the provided options.\n *\n * @method createReminder\n * @platform iOS\n * @param {object} options - Options for creating the reminder.\n * @param {string} options.title - The title of the reminder.\n * @param {string} options.listId - The id of the destination reminders list. (Optional)\n * @param {number} [options.priority] - The priority of the reminder. A number between one and nine where nine\n * has the least priority and 0 means no priority at all. Values outside of this range will be rounded to the\n * nearest border. (Optional)\n * @param {boolean} [options.isCompleted] - Whether the reminder is completed already or not. (Optional)\n * @param {number} [options.startDate] - The start date of the reminder. (Optional)\n * @param {number} [options.dueDate] - The due date of the reminder. (Optional)\n * @param {number} [options.completionDate] - The date at which the reminder was completed. (Optional)\n * @param {string} [options.notes] - Additional notes about the reminder. (Optional)\n * @param {string} [options.url] - A URL to save under the reminder. (Optional)\n * @param {string} [options.location] - A location to save under the reminder. (Optional)\n * @param {string} [options.recurrence] - The rules for the recurrence of the reminder. (Optional)\n * @returns {Promise<{ reminderCreated: boolean }>} A Promise that resolves with an object indicating whether the reminder was created successfully.\n * The resolved object has a property 'reminderCreated' which is a boolean value representing whether the reminder was created.\n * @example\n * const now = Date.now();\n * const rules: ReminderRecurrenceRule = {\n * frequency: ReminderRecurrenceFrequency.MONTHLY,\n * interval: 10,\n * end: Date.now()\n * }\n * const reminderOptions = {\n * title: 'Buy cucumber',\n * listId: 'ABC12',\n * priority: 5,\n * isCompleted: false,\n * startDateComponents: now,\n * notes: 'Also buy tomatoes',\n * url: 'https://capacitor-calendar.pages.dev/',\n * location: 'My Local Supermarket',\n * recurrence: rules\n * };\n * const { reminderCreated } = await createReminder(reminderOptions);\n * console.log(reminderCreated); // true\n */\n createReminder(options: {\n title: string;\n listId?: string;\n priority?: number;\n isCompleted?: boolean;\n startDate?: number;\n dueDate?: number;\n completionDate?: number;\n notes?: string;\n url?: string;\n location?: string;\n recurrence?: ReminderRecurrenceRule;\n }): Promise<{ reminderCreated: boolean }>;\n\n /**\n * Opens the calendar app. Since the user leaves your app, use this method with caution.\n * It will open the calendar on today's date if no date is provided.\n *\n * @method openCalendar\n * @platform iOS, Android\n * @param {object} options - Options for opening the calendar.\n * @param {number} options.date - The date at which the calendar should be opened. (Optional)\n * @returns {Promise<void>}\n * @example\n * void CapacitorCalendar.openCalendar({ date: Date.now() });\n */\n openCalendar(options: { date?: number }): Promise<void>;\n\n /**\n * Opens the reminders app. Since the user leaves your app, use this method with caution.\n *\n * @method openReminders\n * @platform iOS\n * @returns {Promise<void>}\n * @example\n * void CapacitorCalendar.openReminders();\n */\n openReminders(): Promise<void>;\n\n /**\n * Retrieves the list of calendar events present in the given date range.\n *\n * @method listEventsInRange\n * @platform iOS, Android\n * @param {object} options Options for defining the date range.\n * @param {number} options.startDate The start of the date range.\n * @param {number} options.endDate The end of the date range.\n * @returns {Promise<{ result: CalendarEvent[] }>} A Promise that resolves with the list of events.\n * @example\n * const { result } = await CapacitorCalendar.listEventsInRange({\n * startDate: Date.now(),\n * endDate: Date.now() + 6 * 7 * 24 * 60 * 60 * 1000, // 6 weeks from now\n * })\n */\n listEventsInRange(options: { startDate: number; endDate: number }): Promise<{ result: CalendarEvent[] }>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAmB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS7D,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAC1C,eAAe,CAAC,QAAqC;QAC1D,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,gCAAgC,CAAC,CAAC;IACzF,CAAC;IAEM,mBAAmB;QACxB,MAAM,IAAI,CAAC,aA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AM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,gCAAgC,CAAC,CAAC;IACxF,CAAC;IAEM,YAAY,CAAC,QAA2B;QAC7C,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,gCAAgC,CAAC,CAAC;IACxF,CAAC;IAEM,aAAa;QAClB,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,gCAAgC,CAAC,CAAC;IACxF,CAAC;IAEM,iBAAiB,CAAC,QAAgD;QACvE,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,gCAAgC,CAAC,CAAC;IACxF,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { PermissionState, WebPlugin } from '@capacitor/core';\nimport { CapacitorCalendarPlugin } from './definitions';\nimport { PluginPermission } from './schemas/enums/plugin-permission';\nimport { ReminderRecurrenceRule } from './schemas/interfaces/reminder-recurrence-rule';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { RemindersList } from './schemas/interfaces/reminders-list';\nimport type { PluginPermissionsMap } from './schemas/interfaces/plugin-permissions-map';\nimport type { CalendarEvent } from './schemas/interfaces/calendar-event';\n\nexport class CapacitorCalendarWeb extends WebPlugin implements CapacitorCalendarPlugin {\n public checkPermission(_options: { alias: PluginPermission }): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.checkPermission.name} is not implemented on the web`);\n }\n\n public checkAllPermissions(): Promise<PluginPermissionsMap> {\n throw this.unimplemented(`${this.checkAllPermissions.name} is not implemented on the web`);\n }\n\n public requestPermission(_options: { alias: PluginPermission }): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.requestPermission.name} is not implemented on the web`);\n }\n\n public requestAllPermissions(): Promise<PluginPermissionsMap> {\n throw this.unimplemented(`${this.requestAllPermissions.name} is not implemented on the web`);\n }\n\n public createEventWithPrompt(): Promise<{ result: string[] }> {\n throw this.unimplemented(`${this.createEventWithPrompt.name} is not implemented on the web`);\n }\n\n public selectCalendarsWithPrompt(): Promise<{ result: Calendar[] }> {\n throw this.unimplemented(`${this.createEventWithPrompt.name} is not implemented on the web`);\n }\n\n public listCalendars(): Promise<{ result: Calendar[] }> {\n throw this.unimplemented(`${this.listCalendars.name} is not implemented on the web`);\n }\n\n public getDefaultCalendar(): Promise<{ result: Calendar }> {\n throw this.unimplemented(`${this.getDefaultCalendar.name} is not implemented on the web`);\n }\n\n public createEvent(_options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n }): Promise<{\n result: string
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAmB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS7D,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAC1C,eAAe,CAAC,QAAqC;QAC1D,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,gCAAgC,CAAC,CAAC;IACzF,CAAC;IAEM,mBAAmB;QACxB,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,gCAAgC,CAAC,CAAC;IAC7F,CAAC;IAEM,iBAAiB,CAAC,QAAqC;QAC5D,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,gCAAgC,CAAC,CAAC;IAC3F,CAAC;IAEM,qBAAqB;QAC1B,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,gCAAgC,CAAC,CAAC;IAC/F,CAAC;IAEM,qBAAqB;QAC1B,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,gCAAgC,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I,gCAAgC,CAAC,CAAC;IACxF,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { PermissionState, WebPlugin } from '@capacitor/core';\nimport { CapacitorCalendarPlugin } from './definitions';\nimport { PluginPermission } from './schemas/enums/plugin-permission';\nimport { ReminderRecurrenceRule } from './schemas/interfaces/reminder-recurrence-rule';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { RemindersList } from './schemas/interfaces/reminders-list';\nimport type { PluginPermissionsMap } from './schemas/interfaces/plugin-permissions-map';\nimport type { CalendarEvent } from './schemas/interfaces/calendar-event';\n\nexport class CapacitorCalendarWeb extends WebPlugin implements CapacitorCalendarPlugin {\n public checkPermission(_options: { alias: PluginPermission }): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.checkPermission.name} is not implemented on the web`);\n }\n\n public checkAllPermissions(): Promise<PluginPermissionsMap> {\n throw this.unimplemented(`${this.checkAllPermissions.name} is not implemented on the web`);\n }\n\n public requestPermission(_options: { alias: PluginPermission }): Promise<{ result: PermissionState }> {\n throw this.unimplemented(`${this.requestPermission.name} is not implemented on the web`);\n }\n\n public requestAllPermissions(): Promise<PluginPermissionsMap> {\n throw this.unimplemented(`${this.requestAllPermissions.name} is not implemented on the web`);\n }\n\n public createEventWithPrompt(): Promise<{ result: string[] }> {\n throw this.unimplemented(`${this.createEventWithPrompt.name} is not implemented on the web`);\n }\n\n public selectCalendarsWithPrompt(): Promise<{ result: Calendar[] }> {\n throw this.unimplemented(`${this.createEventWithPrompt.name} is not implemented on the web`);\n }\n\n public listCalendars(): Promise<{ result: Calendar[] }> {\n throw this.unimplemented(`${this.listCalendars.name} is not implemented on the web`);\n }\n\n public getDefaultCalendar(): Promise<{ result: Calendar }> {\n throw this.unimplemented(`${this.getDefaultCalendar.name} is not implemented on the web`);\n }\n\n public createEvent(_options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n }): Promise<{\n result: string;\n }> {\n throw this.unimplemented(`${this.createEvent.name} is not implemented on the web`);\n }\n\n public createReminder(_options: {\n title: string;\n listId?: string;\n priority?: number;\n isCompleted?: boolean;\n startDate?: number;\n dueDate?: number;\n completionDate?: number;\n notes?: string;\n url?: string;\n location?: string;\n recurrence?: ReminderRecurrenceRule;\n }): Promise<{ reminderCreated: boolean }> {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n\n public getDefaultRemindersList(): Promise<{ result: RemindersList }> {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n\n public getRemindersLists(): Promise<{ result: RemindersList[] }> {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n\n public openCalendar(_options: { date?: number }): Promise<void> {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n\n public openReminders(): Promise<void> {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n\n public listEventsInRange(_options: { startDate: number; endDate: number }): Promise<{ result: CalendarEvent[] }> {\n throw this.unimplemented(`${this.createReminder.name} is not implemented on the web`);\n }\n}\n"]}
|
|
@@ -191,7 +191,7 @@ public class CapacitorCalendarPlugin: CAPPlugin {
|
|
|
191
191
|
|
|
192
192
|
do {
|
|
193
193
|
let id = try calendar.createEvent(with: eventParameters)
|
|
194
|
-
call.resolve(["result":
|
|
194
|
+
call.resolve(["result": id])
|
|
195
195
|
} catch {
|
|
196
196
|
call.reject("[CapacitorCalendar.\(#function)] Unable to create event")
|
|
197
197
|
return
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ebarooni/capacitor-calendar",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "The Capacitor Calendar Plugin enables full calendar functionality on iOS and Android, with added reminder support for iOS devices.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|