@ebarooni/capacitor-calendar 0.5.1 → 0.6.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 +8 -8
- package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendar.kt +50 -44
- package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +46 -38
- package/dist/esm/definitions.d.ts +6 -6
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/schemas/enums/calendar-chooser-display-style.js.map +1 -1
- package/dist/esm/schemas/enums/calendar-chooser-selection-style.js.map +1 -1
- package/dist/esm/schemas/enums/plugin-permission.js.map +1 -1
- package/dist/esm/schemas/enums/reminder-recurrence-frequency.js.map +1 -1
- package/dist/esm/schemas/interfaces/calendar.js.map +1 -1
- package/dist/esm/schemas/interfaces/plugin-permissions-map.js.map +1 -1
- package/dist/esm/schemas/interfaces/reminder-recurrence-rule.d.ts +1 -1
- package/dist/esm/schemas/interfaces/reminder-recurrence-rule.js.map +1 -1
- package/dist/esm/schemas/interfaces/reminders-list.js.map +1 -1
- package/dist/esm/web.d.ts +3 -3
- package/dist/esm/web.js +1 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +2 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +2 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorCalendar.swift +50 -45
- package/ios/Plugin/CapacitorCalendarPlugin.swift +79 -64
- package/ios/Plugin/CapacitorReminders.swift +90 -57
- package/ios/Plugin/EventCreationParameters.swift +18 -0
- package/ios/Plugin/RecurrenceParameters.swift +15 -0
- package/ios/Plugin/ReminderCreationParameters.swift +23 -0
- package/package.json +30 -20
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
<h1 align="center">CapacitorCalendar</h1>
|
|
2
1
|
<p align="center">
|
|
2
|
+
<img src="assets/images/text-logo.png" alt="capacitor-calendar-logo" height="136"/>
|
|
3
|
+
<br>
|
|
3
4
|
<em>
|
|
4
5
|
The Capacitor Calendar Plugin enables full calendar functionality on iOS and Android, with added reminder support for iOS devices.
|
|
5
6
|
</em>
|
|
@@ -28,20 +29,19 @@ npx cap sync
|
|
|
28
29
|
## Support Range
|
|
29
30
|
|
|
30
31
|
| Platform | range |
|
|
31
|
-
|
|
32
|
+
| :------: | :-----------------------: |
|
|
32
33
|
| iOS | ≥ 13 |
|
|
33
34
|
| Android | ≥ 7 (SDK 24 or Nougat) |
|
|
34
35
|
|
|
35
36
|
## [Demo (click for details)](./example/README.md)
|
|
36
37
|
|
|
37
|
-
|
|
38
38
|
| iOS 17 | Android 14 |
|
|
39
|
-
|
|
39
|
+
| :------------------------------------: | :----------------------------------------: |
|
|
40
40
|
|  |  |
|
|
41
41
|
|
|
42
42
|
On iOS, `readCalendar` permission is not needed when you a
|
|
43
43
|
|
|
44
|
-
re creating an event using the native prompt.
|
|
44
|
+
re creating an event using the native prompt.
|
|
45
45
|
The video is just for showing the functionality, otherwise the `createEventWithPrompt` method works without the `readCalendar` authorization.
|
|
46
46
|
|
|
47
47
|
## MVP
|
|
@@ -56,11 +56,11 @@ The video is just for showing the functionality, otherwise the `createEventWithP
|
|
|
56
56
|
|
|
57
57
|
## Permissions
|
|
58
58
|
|
|
59
|
-
To be able to use the plugin, you will need to add the required permissions to your app. The required platform-specific
|
|
59
|
+
To be able to use the plugin, you will need to add the required permissions to your app. The required platform-specific
|
|
60
60
|
permissions can be found below:
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
- [iOS](./ios/PERMISSIONS.md)
|
|
63
|
+
- [Android](./android/PERMISSIONS.md)
|
|
64
64
|
|
|
65
65
|
## API
|
|
66
66
|
|
|
@@ -28,19 +28,20 @@ class CapacitorCalendar() {
|
|
|
28
28
|
|
|
29
29
|
@Throws(Exception::class)
|
|
30
30
|
fun listCalendars(context: Context): JSArray {
|
|
31
|
-
val projection =
|
|
31
|
+
val projection =
|
|
32
|
+
arrayOf(
|
|
32
33
|
CalendarContract.Calendars._ID,
|
|
33
|
-
CalendarContract.Calendars.CALENDAR_DISPLAY_NAME
|
|
34
|
-
|
|
34
|
+
CalendarContract.Calendars.CALENDAR_DISPLAY_NAME,
|
|
35
|
+
)
|
|
35
36
|
|
|
36
37
|
val calendars = JSArray()
|
|
37
38
|
|
|
38
39
|
context.contentResolver.query(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
CalendarContract.Calendars.CONTENT_URI,
|
|
41
|
+
projection,
|
|
42
|
+
null,
|
|
43
|
+
null,
|
|
44
|
+
null,
|
|
44
45
|
)?.use { cursor ->
|
|
45
46
|
val idColumnIndex = cursor.getColumnIndex(CalendarContract.Calendars._ID)
|
|
46
47
|
val nameColumnIndex = cursor.getColumnIndex(CalendarContract.Calendars.CALENDAR_DISPLAY_NAME)
|
|
@@ -48,10 +49,11 @@ class CapacitorCalendar() {
|
|
|
48
49
|
while (cursor.moveToNext()) {
|
|
49
50
|
val id = cursor.getLong(idColumnIndex)
|
|
50
51
|
val title = cursor.getString(nameColumnIndex)
|
|
51
|
-
val calendar =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
val calendar =
|
|
53
|
+
JSObject().apply {
|
|
54
|
+
put("id", id)
|
|
55
|
+
put("title", title)
|
|
56
|
+
}
|
|
55
57
|
|
|
56
58
|
calendars.put(calendar)
|
|
57
59
|
}
|
|
@@ -62,20 +64,21 @@ class CapacitorCalendar() {
|
|
|
62
64
|
|
|
63
65
|
@Throws(Exception::class)
|
|
64
66
|
fun getDefaultCalendar(context: Context): JSObject {
|
|
65
|
-
val projection =
|
|
67
|
+
val projection =
|
|
68
|
+
arrayOf(
|
|
66
69
|
CalendarContract.Calendars._ID,
|
|
67
|
-
CalendarContract.Calendars.CALENDAR_DISPLAY_NAME
|
|
68
|
-
|
|
70
|
+
CalendarContract.Calendars.CALENDAR_DISPLAY_NAME,
|
|
71
|
+
)
|
|
69
72
|
|
|
70
73
|
val selection = "${CalendarContract.Calendars.IS_PRIMARY} = ?"
|
|
71
74
|
val selectionArgs = arrayOf("1")
|
|
72
75
|
|
|
73
76
|
context.contentResolver.query(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
CalendarContract.Calendars.CONTENT_URI,
|
|
78
|
+
projection,
|
|
79
|
+
selection,
|
|
80
|
+
selectionArgs,
|
|
81
|
+
null,
|
|
79
82
|
)?.use { cursor ->
|
|
80
83
|
if (cursor.moveToFirst()) {
|
|
81
84
|
val idColumnIndex = cursor.getColumnIndex(CalendarContract.Calendars._ID)
|
|
@@ -83,10 +86,11 @@ class CapacitorCalendar() {
|
|
|
83
86
|
val id = cursor.getLong(idColumnIndex)
|
|
84
87
|
val title = cursor.getString(nameColumnIndex)
|
|
85
88
|
|
|
86
|
-
val calendarObject =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
val calendarObject =
|
|
90
|
+
JSObject().apply {
|
|
91
|
+
put("id", id)
|
|
92
|
+
put("title", title)
|
|
93
|
+
}
|
|
90
94
|
return calendarObject
|
|
91
95
|
} else {
|
|
92
96
|
throw Exception("No primary calendar found")
|
|
@@ -97,30 +101,32 @@ class CapacitorCalendar() {
|
|
|
97
101
|
|
|
98
102
|
@Throws(Exception::class)
|
|
99
103
|
fun createEvent(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
context: Context,
|
|
105
|
+
title: String,
|
|
106
|
+
calendarId: String?,
|
|
107
|
+
location: String?,
|
|
108
|
+
startDate: String?,
|
|
109
|
+
endDate: String?,
|
|
110
|
+
isAllDay: Boolean?,
|
|
107
111
|
): Uri? {
|
|
108
|
-
val isoFormatter =
|
|
109
|
-
|
|
110
|
-
|
|
112
|
+
val isoFormatter =
|
|
113
|
+
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.getDefault()).apply {
|
|
114
|
+
timeZone = TimeZone.getTimeZone("UTC")
|
|
115
|
+
}
|
|
111
116
|
val startMillis = startDate?.let { isoFormatter.parse(it)?.time } ?: Calendar.getInstance().timeInMillis
|
|
112
117
|
val endMillis = endDate?.let { isoFormatter.parse(it)?.time } ?: (startMillis + 3600 * 1000)
|
|
113
118
|
|
|
114
|
-
val values =
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
val values =
|
|
120
|
+
ContentValues().apply {
|
|
121
|
+
put(CalendarContract.Events.DTSTART, startMillis)
|
|
122
|
+
put(CalendarContract.Events.DTEND, endMillis)
|
|
123
|
+
put(CalendarContract.Events.TITLE, title)
|
|
124
|
+
location?.let { put(CalendarContract.Events.EVENT_LOCATION, it) }
|
|
125
|
+
put(CalendarContract.Events.CALENDAR_ID, calendarId ?: getDefaultCalendar(context).getString("id"))
|
|
126
|
+
put(CalendarContract.Events.EVENT_TIMEZONE, TimeZone.getDefault().id)
|
|
127
|
+
isAllDay?.let { put(CalendarContract.Events.ALL_DAY, if (it) 1 else 0) }
|
|
128
|
+
}
|
|
123
129
|
|
|
124
130
|
return context.contentResolver.insert(CalendarContract.Events.CONTENT_URI, values)
|
|
125
131
|
}
|
|
126
|
-
}
|
|
132
|
+
}
|
|
@@ -3,7 +3,6 @@ package dev.barooni.capacitor.calendar
|
|
|
3
3
|
import android.Manifest
|
|
4
4
|
import android.content.Intent
|
|
5
5
|
import android.provider.CalendarContract
|
|
6
|
-
import android.util.Log
|
|
7
6
|
import androidx.activity.result.ActivityResult
|
|
8
7
|
import com.getcapacitor.JSObject
|
|
9
8
|
import com.getcapacitor.Plugin
|
|
@@ -14,25 +13,24 @@ import com.getcapacitor.annotation.CapacitorPlugin
|
|
|
14
13
|
import com.getcapacitor.annotation.Permission
|
|
15
14
|
import com.getcapacitor.annotation.PermissionCallback
|
|
16
15
|
|
|
17
|
-
|
|
18
16
|
@CapacitorPlugin(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
name = "CapacitorCalendar",
|
|
18
|
+
permissions = [
|
|
19
|
+
Permission(
|
|
20
|
+
alias = "readCalendar",
|
|
21
|
+
strings = [
|
|
22
|
+
Manifest.permission.READ_CALENDAR,
|
|
23
|
+
],
|
|
24
|
+
),
|
|
25
|
+
Permission(
|
|
26
|
+
alias = "writeCalendar",
|
|
27
|
+
strings = [
|
|
28
|
+
Manifest.permission.WRITE_CALENDAR,
|
|
29
|
+
],
|
|
30
|
+
),
|
|
31
|
+
],
|
|
34
32
|
)
|
|
35
|
-
class CapacitorCalendarPlugin: Plugin() {
|
|
33
|
+
class CapacitorCalendarPlugin : Plugin() {
|
|
36
34
|
private var implementation = CapacitorCalendar()
|
|
37
35
|
|
|
38
36
|
@PluginMethod
|
|
@@ -40,9 +38,9 @@ class CapacitorCalendarPlugin: Plugin() {
|
|
|
40
38
|
try {
|
|
41
39
|
implementation.eventsCount = implementation.getTotalEventsCount(context)
|
|
42
40
|
return startActivityForResult(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
call,
|
|
42
|
+
Intent(Intent.ACTION_INSERT).setData(CalendarContract.Events.CONTENT_URI),
|
|
43
|
+
"openCalendarIntentActivityCallback",
|
|
46
44
|
)
|
|
47
45
|
} catch (error: Exception) {
|
|
48
46
|
call.reject("", "[CapacitorCalendar.${::openCalendarIntentActivityCallback.name}] Could not create the event")
|
|
@@ -51,19 +49,23 @@ class CapacitorCalendarPlugin: Plugin() {
|
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
@ActivityCallback
|
|
54
|
-
private fun openCalendarIntentActivityCallback(
|
|
52
|
+
private fun openCalendarIntentActivityCallback(
|
|
53
|
+
call: PluginCall?,
|
|
54
|
+
result: ActivityResult,
|
|
55
|
+
) {
|
|
55
56
|
if (call == null) {
|
|
56
57
|
throw Exception("[CapacitorCalendar.${::createEventWithPrompt.name}] Call is not defined")
|
|
57
58
|
}
|
|
58
59
|
val currentEventsCount: Int = implementation.getTotalEventsCount(context)
|
|
59
|
-
val createEventResult =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
val createEventResult =
|
|
61
|
+
if (currentEventsCount > implementation.eventsCount) {
|
|
62
|
+
true
|
|
63
|
+
} else if (implementation.eventsCount == currentEventsCount) {
|
|
64
|
+
false
|
|
65
|
+
} else {
|
|
66
|
+
call.reject("", "[CapacitorCalendar.${::openCalendarIntentActivityCallback.name}] Could not create the event")
|
|
67
|
+
return
|
|
68
|
+
}
|
|
67
69
|
val ret = JSObject()
|
|
68
70
|
ret.put("eventCreated", createEventResult)
|
|
69
71
|
call.resolve(ret)
|
|
@@ -72,10 +74,14 @@ class CapacitorCalendarPlugin: Plugin() {
|
|
|
72
74
|
@PluginMethod
|
|
73
75
|
fun checkPermission(call: PluginCall) {
|
|
74
76
|
try {
|
|
75
|
-
val permissionName =
|
|
77
|
+
val permissionName =
|
|
78
|
+
call.getString("alias")
|
|
76
79
|
?: throw Exception("[CapacitorCalendar.${::checkPermission.name}] Permission name is not defined")
|
|
77
|
-
val permissionState =
|
|
78
|
-
|
|
80
|
+
val permissionState =
|
|
81
|
+
getPermissionState(permissionName)
|
|
82
|
+
?: throw Exception(
|
|
83
|
+
"[CapacitorCalendar.${::checkPermission.name}] Could not determine the status of the requested permission",
|
|
84
|
+
)
|
|
79
85
|
val ret = JSObject()
|
|
80
86
|
ret.put("result", permissionState)
|
|
81
87
|
call.resolve(ret)
|
|
@@ -98,12 +104,13 @@ class CapacitorCalendarPlugin: Plugin() {
|
|
|
98
104
|
@PluginMethod
|
|
99
105
|
fun requestPermission(call: PluginCall) {
|
|
100
106
|
try {
|
|
101
|
-
val alias =
|
|
107
|
+
val alias =
|
|
108
|
+
call.getString("alias")
|
|
102
109
|
?: throw Exception("[CapacitorCalendar.${::requestPermission.name}] Permission name is not defined")
|
|
103
110
|
return requestPermissionForAlias(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
111
|
+
alias,
|
|
112
|
+
call,
|
|
113
|
+
"requestPermissionCallback",
|
|
107
114
|
)
|
|
108
115
|
} catch (error: Exception) {
|
|
109
116
|
call.reject("", error.message)
|
|
@@ -166,7 +173,8 @@ class CapacitorCalendarPlugin: Plugin() {
|
|
|
166
173
|
@PluginMethod
|
|
167
174
|
fun createEvent(call: PluginCall) {
|
|
168
175
|
try {
|
|
169
|
-
val title =
|
|
176
|
+
val title =
|
|
177
|
+
call.getString("title")
|
|
170
178
|
?: throw Exception("[CapacitorCalendar.${::createEvent.name}] A title for the event was not provided")
|
|
171
179
|
val calendarId = call.getString("calendarId")
|
|
172
180
|
val location = call.getString("location")
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CalendarChooserDisplayStyle } from
|
|
2
|
-
import { CalendarChooserSelectionStyle } from
|
|
3
|
-
import { PluginPermission } from
|
|
1
|
+
import { CalendarChooserDisplayStyle } from './schemas/enums/calendar-chooser-display-style';
|
|
2
|
+
import { CalendarChooserSelectionStyle } from './schemas/enums/calendar-chooser-selection-style';
|
|
3
|
+
import { PluginPermission } from './schemas/enums/plugin-permission';
|
|
4
4
|
import type { PermissionState } from '@capacitor/core';
|
|
5
|
-
import type { Calendar } from
|
|
6
|
-
import type { RemindersList } from
|
|
5
|
+
import type { Calendar } from './schemas/interfaces/calendar';
|
|
6
|
+
import type { RemindersList } from './schemas/interfaces/reminders-list';
|
|
7
7
|
import type { PluginPermissionsMap } from './schemas/interfaces/plugin-permissions-map';
|
|
8
|
-
import type { ReminderRecurrenceRule } from
|
|
8
|
+
import type { ReminderRecurrenceRule } from './schemas/interfaces/reminder-recurrence-rule';
|
|
9
9
|
export interface CapacitorCalendarPlugin {
|
|
10
10
|
/**
|
|
11
11
|
* Checks the current authorization status of a specific permission.
|
|
@@ -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\";\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 * This method does not need any read or write authorization from the user on iOS. However, the entries in the Info.plist file are still needed.\n * On Android, the user has to authorize for read access.\n *\n * @method\n * @platform iOS, Android\n * @returns {Promise<{ eventCreated: boolean }>} – A promise that resolves with the result of the action.\n * @example\n * let result: CalendarEventActionResult;\n * if (capacitor.getPlatform() === 'android') {\n * const readCalendarStatus = (await this.requestPermission({ alias: 'readCalendar' })).result;\n * if (readCalendarStatus === 'granted') {\n * result = await this.createEventWithPrompt();\n * } else {\n * // handle the case when user rejects the permission\n * }\n * } else {\n * result = await this.createEventWithPrompt();\n * }\n */\n createEventWithPrompt(): Promise<{ eventCreated: boolean }>;\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 /**\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 * @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 {Date} [options.startDate] - The start date and time of the event. (Optional)\n * @param {Date} [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<{ eventCreated: boolean }>} A Promise that resolves with an object indicating whether the event was created successfully.\n * The resolved object has a property 'eventCreated' which is a boolean value representing whether the event was created.\n * @example\n * const now = Date.now();\n * const eventOptions = {\n * title: 'Team Meeting',\n * location: 'Conference Room A',\n * startDate: new Date(now),\n * endDate: new Date(now + 2 * 60 * 60 * 1000),\n * isAllDay: false\n * };\n * const { eventCreated } = await createEvent(eventOptions);\n * console.log(eventCreated); // true\n */\n createEvent(options: { title: string, calendarId?: string, location?: string, startDate?: Date, endDate?: Date, isAllDay?: boolean }): Promise<{ eventCreated: boolean }>;\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"]}
|
|
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';\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 * This method does not need any read or write authorization from the user on iOS. However, the entries in the Info.plist file are still needed.\n * On Android, the user has to authorize for read access.\n *\n * @method\n * @platform iOS, Android\n * @returns {Promise<{ eventCreated: boolean }>} – A promise that resolves with the result of the action.\n * @example\n * let result: CalendarEventActionResult;\n * if (capacitor.getPlatform() === 'android') {\n * const readCalendarStatus = (await this.requestPermission({ alias: 'readCalendar' })).result;\n * if (readCalendarStatus === 'granted') {\n * result = await this.createEventWithPrompt();\n * } else {\n * // handle the case when user rejects the permission\n * }\n * } else {\n * result = await this.createEventWithPrompt();\n * }\n */\n createEventWithPrompt(): Promise<{ eventCreated: boolean }>;\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 * @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 {Date} [options.startDate] - The start date and time of the event. (Optional)\n * @param {Date} [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<{ eventCreated: boolean }>} A Promise that resolves with an object indicating whether the event was created successfully.\n * The resolved object has a property 'eventCreated' which is a boolean value representing whether the event was created.\n * @example\n * const now = Date.now();\n * const eventOptions = {\n * title: 'Team Meeting',\n * location: 'Conference Room A',\n * startDate: new Date(now),\n * endDate: new Date(now + 2 * 60 * 60 * 1000),\n * isAllDay: false\n * };\n * const { eventCreated } = await createEvent(eventOptions);\n * console.log(eventCreated); // true\n */\n createEvent(options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: Date;\n endDate?: Date;\n isAllDay?: boolean;\n }): Promise<{ eventCreated: boolean }>;\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"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { CalendarChooserSelectionStyle } from './schemas/enums/calendar-chooser-
|
|
|
4
4
|
import { PluginPermission } from './schemas/enums/plugin-permission';
|
|
5
5
|
import { ReminderRecurrenceFrequency } from './schemas/enums/reminder-recurrence-frequency';
|
|
6
6
|
const CapacitorCalendar = registerPlugin('CapacitorCalendar', {
|
|
7
|
-
web: () => import('./web').then(m => new m.CapacitorCalendarWeb()),
|
|
7
|
+
web: () => import('./web').then((m) => new m.CapacitorCalendarWeb()),
|
|
8
8
|
});
|
|
9
9
|
export * from './definitions';
|
|
10
10
|
export { CalendarChooserSelectionStyle, CalendarChooserDisplayStyle, PluginPermission, ReminderRecurrenceFrequency, CapacitorCalendar, };
|
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;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAO5F,MAAM,iBAAiB,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAO5F,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;AAE9B,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,EAC3B,gBAAgB,EAEhB,2BAA2B,EAC3B,iBAAiB,GAClB,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\nimport { 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 { ReminderRecurrenceFrequency } from './schemas/enums/reminder-recurrence-frequency';\nimport type { CapacitorCalendarPlugin } from './definitions';\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';\n\nconst CapacitorCalendar = registerPlugin<CapacitorCalendarPlugin>('CapacitorCalendar', {\n web: () => import('./web').then((m) => new m.CapacitorCalendarWeb()),\n});\n\nexport * from './definitions';\nexport type { Calendar, RemindersList, ReminderRecurrenceRule };\nexport {\n CalendarChooserSelectionStyle,\n CalendarChooserDisplayStyle,\n PluginPermission,\n PluginPermissionsMap,\n ReminderRecurrenceFrequency,\n CapacitorCalendar,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-chooser-display-style.js","sourceRoot":"","sources":["../../../../src/schemas/enums/calendar-chooser-display-style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,2BAUX;AAVD,WAAY,2BAA2B;
|
|
1
|
+
{"version":3,"file":"calendar-chooser-display-style.js","sourceRoot":"","sources":["../../../../src/schemas/enums/calendar-chooser-display-style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,2BAUX;AAVD,WAAY,2BAA2B;IACrC;;OAEG;IACH,+FAAa,CAAA;IAEb;;OAEG;IACH,mHAAuB,CAAA;AACzB,CAAC,EAVW,2BAA2B,KAA3B,2BAA2B,QAUtC","sourcesContent":["/**\n * Enum representing the display styles for the calendar chooser.\n * @enum\n * @platform iOS\n */\nexport enum CalendarChooserDisplayStyle {\n /**\n * Display all calendars available for selection.\n */\n ALL_CALENDARS,\n\n /**\n * Display only writable calendars available for selection.\n */\n WRITABLE_CALENDARS_ONLY,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-chooser-selection-style.js","sourceRoot":"","sources":["../../../../src/schemas/enums/calendar-chooser-selection-style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,6BAUX;AAVD,WAAY,6BAA6B;
|
|
1
|
+
{"version":3,"file":"calendar-chooser-selection-style.js","sourceRoot":"","sources":["../../../../src/schemas/enums/calendar-chooser-selection-style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,6BAUX;AAVD,WAAY,6BAA6B;IACvC;;OAEG;IACH,qFAAM,CAAA;IAEN;;OAEG;IACH,yFAAQ,CAAA;AACV,CAAC,EAVW,6BAA6B,KAA7B,6BAA6B,QAUxC","sourcesContent":["/**\n * Enum representing the selection style for the calendar chooser.\n * @enum\n * @platform iOS\n */\nexport enum CalendarChooserSelectionStyle {\n /**\n * Allows only a single selection in the calendar chooser.\n */\n SINGLE,\n\n /**\n * Allows multiple selections in the calendar chooser.\n */\n MULTIPLE,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-permission.js","sourceRoot":"","sources":["../../../../src/schemas/enums/plugin-permission.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAwBX;AAxBD,WAAY,gBAAgB;
|
|
1
|
+
{"version":3,"file":"plugin-permission.js","sourceRoot":"","sources":["../../../../src/schemas/enums/plugin-permission.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAwBX;AAxBD,WAAY,gBAAgB;IAC1B;;;OAGG;IACH,kDAA8B,CAAA;IAE9B;;;OAGG;IACH,oDAAgC,CAAA;IAEhC;;;OAGG;IACH,oDAAgC,CAAA;IAEhC;;;OAGG;IACH,sDAAkC,CAAA;AACpC,CAAC,EAxBW,gBAAgB,KAAhB,gBAAgB,QAwB3B","sourcesContent":["export enum PluginPermission {\n /**\n * Represents the permission state for reading calendar.\n * @platform iOS, Android\n */\n READ_CALENDAR = 'readCalendar',\n\n /**\n * Represents the permission state for writing calendar.\n * @platform iOS, Android\n */\n WRITE_CALENDAR = 'writeCalendar',\n\n /**\n * Represents the permission state for reading reminders.\n * @platform iOS\n */\n READ_REMINDERS = 'readReminders',\n\n /**\n * Represents the permission state for writing reminders.\n * @platform iOS\n */\n WRITE_REMINDERS = 'writeReminders',\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reminder-recurrence-frequency.js","sourceRoot":"","sources":["../../../../src/schemas/enums/reminder-recurrence-frequency.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,2BAKX;AALD,WAAY,2BAA2B;
|
|
1
|
+
{"version":3,"file":"reminder-recurrence-frequency.js","sourceRoot":"","sources":["../../../../src/schemas/enums/reminder-recurrence-frequency.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,2BAKX;AALD,WAAY,2BAA2B;IACrC,+EAAK,CAAA;IACL,iFAAM,CAAA;IACN,mFAAO,CAAA;IACP,iFAAM,CAAA;AACR,CAAC,EALW,2BAA2B,KAA3B,2BAA2B,QAKtC","sourcesContent":["export enum ReminderRecurrenceFrequency {\n DAILY,\n WEEKLY,\n MONTHLY,\n YEARLY,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/calendar.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents a calendar object with an ID and title.\n *\n * @interface Calendar\n * @platform iOS, Android\n * @property {string} id - The unique identifier of the calendar.\n * @property {string} title - The title or name of the calendar.\n */\nexport interface Calendar {\n
|
|
1
|
+
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/calendar.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents a calendar object with an ID and title.\n *\n * @interface Calendar\n * @platform iOS, Android\n * @property {string} id - The unique identifier of the calendar.\n * @property {string} title - The title or name of the calendar.\n */\nexport interface Calendar {\n id: string;\n title: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-permissions-map.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/plugin-permissions-map.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\nexport interface PluginPermissionsMap {\n
|
|
1
|
+
{"version":3,"file":"plugin-permissions-map.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/plugin-permissions-map.ts"],"names":[],"mappings":"","sourcesContent":["import type { PermissionState } from '@capacitor/core';\n\nexport interface PluginPermissionsMap {\n [permission: string]: PermissionState;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reminder-recurrence-rule.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/reminder-recurrence-rule.ts"],"names":[],"mappings":"","sourcesContent":["import {ReminderRecurrenceFrequency} from
|
|
1
|
+
{"version":3,"file":"reminder-recurrence-rule.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/reminder-recurrence-rule.ts"],"names":[],"mappings":"","sourcesContent":["import { ReminderRecurrenceFrequency } from '../enums/reminder-recurrence-frequency';\n\nexport interface ReminderRecurrenceRule {\n /**\n * How frequent should the reminder repeat.\n *\n * @example\n * // if frequency is set to weekly, the reminder will repeat on a weekly basis.\n * const rules: ReminderRecurrenceRule = {\n * frequency: ReminderRecurrenceFrequency.WEEKLY,\n * interval: 1,\n * }\n */\n frequency: ReminderRecurrenceFrequency;\n\n /**\n * The interval should be a number greater than 0. For values lower than 1 the method will throw an error.\n *\n * @example\n * // if interval is set to 2 and frequency is set to daily, the reminder will repeat every 2 days.\n * const rules: ReminderRecurrenceRule = {\n * frequency: ReminderRecurrenceFrequency.DAILY,\n * interval: 2,\n * }\n */\n interval: number;\n\n /**\n * When provided, the reminder will stop repeating at the given time.\n *\n * @example\n * const rules: ReminderRecurrenceRule = {\n * frequency: ReminderRecurrenceFrequency.MONTHLY,\n * interval: 10,\n * end: Date.now()\n * }\n */\n end?: number;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reminders-list.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/reminders-list.ts"],"names":[],"mappings":"","sourcesContent":["import {Calendar} from './calendar';\n\nexport interface RemindersList extends Calendar {
|
|
1
|
+
{"version":3,"file":"reminders-list.js","sourceRoot":"","sources":["../../../../src/schemas/interfaces/reminders-list.ts"],"names":[],"mappings":"","sourcesContent":["import { Calendar } from './calendar';\n\nexport interface RemindersList extends Calendar {}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PermissionState, WebPlugin } from '@capacitor/core';
|
|
2
2
|
import { CapacitorCalendarPlugin } from './definitions';
|
|
3
3
|
import { PluginPermission } from './schemas/enums/plugin-permission';
|
|
4
|
-
import { ReminderRecurrenceRule } from
|
|
5
|
-
import type { Calendar } from
|
|
6
|
-
import type { RemindersList } from
|
|
4
|
+
import { ReminderRecurrenceRule } from './schemas/interfaces/reminder-recurrence-rule';
|
|
5
|
+
import type { Calendar } from './schemas/interfaces/calendar';
|
|
6
|
+
import type { RemindersList } from './schemas/interfaces/reminders-list';
|
|
7
7
|
import type { PluginPermissionsMap } from './schemas/interfaces/plugin-permissions-map';
|
|
8
8
|
export declare class CapacitorCalendarWeb extends WebPlugin implements CapacitorCalendarPlugin {
|
|
9
9
|
checkPermission(_options: {
|
package/dist/esm/web.js
CHANGED
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAmB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ7D,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,CAAC,CAAC;IAC/F,CAAC;IAEM,yBAAyB;QAC9B,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,gCAAgC,CAAC,CAAC;IAC/F,CAAC;IAEM,aAAa;QAClB,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,gCAAgC,CAAC,CAAC;IACvF,CAAC;IAEM,kBAAkB;QACvB,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,gCAAgC,CAAC,CAAC;IAC5F,CAAC;IAEM,WAAW,CAAC,QAOlB;QAGC,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,gCAAgC,CAAC,CAAC;IACrF,CAAC;IAEM,cAAc,CAAC,QAYrB;QACC,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,gCAAgC,CAAC,CAAC;IACxF,CAAC;IAEM,uBAAuB;QAC5B,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,gCAAgC,CAAC,CAAC;IACxF,CAAC;IAEM,iBAAiB;QACtB,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';\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<{ eventCreated: boolean }> {\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?: Date;\n endDate?: Date;\n isAllDay?: boolean;\n }): Promise<{\n eventCreated: boolean;\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"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -69,9 +69,10 @@ exports.ReminderRecurrenceFrequency = void 0;
|
|
|
69
69
|
})(exports.ReminderRecurrenceFrequency || (exports.ReminderRecurrenceFrequency = {}));
|
|
70
70
|
|
|
71
71
|
const CapacitorCalendar = core.registerPlugin('CapacitorCalendar', {
|
|
72
|
-
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CapacitorCalendarWeb()),
|
|
72
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorCalendarWeb()),
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
75
76
|
class CapacitorCalendarWeb extends core.WebPlugin {
|
|
76
77
|
checkPermission(_options) {
|
|
77
78
|
throw this.unimplemented(`${this.checkPermission.name} is not implemented on the web`);
|