@capgo/capacitor-alarm 7.3.3 → 7.3.5
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 +31 -13
- package/android/src/main/java/app/capgo/capacitor/alarm/CapgoAlarmPlugin.java +1 -1
- package/dist/docs.json +129 -20
- package/dist/esm/definitions.d.ts +92 -8
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Sources/CapgoAlarmPlugin/CapgoAlarmPlugin.swift +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
Manage native alarm Capacitor plugin
|
|
10
10
|
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
The most complete doc is available here: https://capgo.app/docs/plugins/alarm/
|
|
14
|
+
|
|
11
15
|
## Install
|
|
12
16
|
|
|
13
17
|
```bash
|
|
@@ -39,6 +43,8 @@ Note: This plugin only exposes native alarm actions (create/open). It does not i
|
|
|
39
43
|
<docgen-api>
|
|
40
44
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
41
45
|
|
|
46
|
+
Capacitor Alarm Plugin interface for managing native OS alarms.
|
|
47
|
+
|
|
42
48
|
### createAlarm(...)
|
|
43
49
|
|
|
44
50
|
```typescript
|
|
@@ -46,14 +52,16 @@ createAlarm(options: NativeAlarmCreateOptions) => Promise<NativeActionResult>
|
|
|
46
52
|
```
|
|
47
53
|
|
|
48
54
|
Create a native OS alarm using the platform clock app.
|
|
49
|
-
On Android this uses the Alarm Clock intent; on iOS this
|
|
55
|
+
On Android this uses the Alarm Clock intent; on iOS this uses AlarmKit if available (iOS 16+).
|
|
50
56
|
|
|
51
|
-
| Param | Type |
|
|
52
|
-
| ------------- | ----------------------------------------------------------------------------- |
|
|
53
|
-
| **`options`** | <code><a href="#nativealarmcreateoptions">NativeAlarmCreateOptions</a></code> |
|
|
57
|
+
| Param | Type | Description |
|
|
58
|
+
| ------------- | ----------------------------------------------------------------------------- | -------------------------------- |
|
|
59
|
+
| **`options`** | <code><a href="#nativealarmcreateoptions">NativeAlarmCreateOptions</a></code> | - Options for creating the alarm |
|
|
54
60
|
|
|
55
61
|
**Returns:** <code>Promise<<a href="#nativeactionresult">NativeActionResult</a>></code>
|
|
56
62
|
|
|
63
|
+
**Since:** 1.0.0
|
|
64
|
+
|
|
57
65
|
--------------------
|
|
58
66
|
|
|
59
67
|
|
|
@@ -67,6 +75,8 @@ Open the platform's native alarm list UI, if available.
|
|
|
67
75
|
|
|
68
76
|
**Returns:** <code>Promise<<a href="#nativeactionresult">NativeActionResult</a>></code>
|
|
69
77
|
|
|
78
|
+
**Since:** 1.0.0
|
|
79
|
+
|
|
70
80
|
--------------------
|
|
71
81
|
|
|
72
82
|
|
|
@@ -80,6 +90,8 @@ Get information about the OS and capabilities.
|
|
|
80
90
|
|
|
81
91
|
**Returns:** <code>Promise<<a href="#osinfo">OSInfo</a>></code>
|
|
82
92
|
|
|
93
|
+
**Since:** 1.0.0
|
|
94
|
+
|
|
83
95
|
--------------------
|
|
84
96
|
|
|
85
97
|
|
|
@@ -92,12 +104,14 @@ requestPermissions(options?: { exactAlarm?: boolean | undefined; } | undefined)
|
|
|
92
104
|
Request relevant permissions for alarm usage on the platform.
|
|
93
105
|
On Android, may route to settings for exact alarms.
|
|
94
106
|
|
|
95
|
-
| Param | Type |
|
|
96
|
-
| ------------- | -------------------------------------- |
|
|
97
|
-
| **`options`** | <code>{ exactAlarm?: boolean; }</code> |
|
|
107
|
+
| Param | Type | Description |
|
|
108
|
+
| ------------- | -------------------------------------- | ------------------------------------------------ |
|
|
109
|
+
| **`options`** | <code>{ exactAlarm?: boolean; }</code> | - Optional parameters for the permission request |
|
|
98
110
|
|
|
99
111
|
**Returns:** <code>Promise<<a href="#permissionresult">PermissionResult</a>></code>
|
|
100
112
|
|
|
113
|
+
**Since:** 1.0.0
|
|
114
|
+
|
|
101
115
|
--------------------
|
|
102
116
|
|
|
103
117
|
|
|
@@ -107,10 +121,12 @@ On Android, may route to settings for exact alarms.
|
|
|
107
121
|
getPluginVersion() => Promise<{ version: string; }>
|
|
108
122
|
```
|
|
109
123
|
|
|
110
|
-
Get the native Capacitor plugin version
|
|
124
|
+
Get the native Capacitor plugin version.
|
|
111
125
|
|
|
112
126
|
**Returns:** <code>Promise<{ version: string; }></code>
|
|
113
127
|
|
|
128
|
+
**Since:** 1.0.0
|
|
129
|
+
|
|
114
130
|
--------------------
|
|
115
131
|
|
|
116
132
|
|
|
@@ -119,10 +135,12 @@ Get the native Capacitor plugin version
|
|
|
119
135
|
|
|
120
136
|
#### NativeActionResult
|
|
121
137
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
|
125
|
-
|
|
|
138
|
+
Result of a native action.
|
|
139
|
+
|
|
140
|
+
| Prop | Type | Description |
|
|
141
|
+
| ------------- | -------------------- | -------------------------------------------- |
|
|
142
|
+
| **`success`** | <code>boolean</code> | Whether the action was successful |
|
|
143
|
+
| **`message`** | <code>string</code> | Optional message with additional information |
|
|
126
144
|
|
|
127
145
|
|
|
128
146
|
#### NativeAlarmCreateOptions
|
|
@@ -144,7 +162,7 @@ Returned info about current OS and capabilities.
|
|
|
144
162
|
|
|
145
163
|
| Prop | Type | Description |
|
|
146
164
|
| ------------------------------------ | -------------------- | ----------------------------------------------------------- |
|
|
147
|
-
| **`platform`** | <code>string</code> | 'ios' \| 'android' \| 'web'
|
|
165
|
+
| **`platform`** | <code>string</code> | Platform identifier: 'ios' \| 'android' \| 'web' |
|
|
148
166
|
| **`version`** | <code>string</code> | OS version string |
|
|
149
167
|
| **`supportsNativeAlarms`** | <code>boolean</code> | Whether the platform exposes a native alarm app integration |
|
|
150
168
|
| **`supportsScheduledNotifications`** | <code>boolean</code> | Whether scheduling local notifications is supported |
|
|
@@ -14,7 +14,7 @@ import com.getcapacitor.annotation.CapacitorPlugin;
|
|
|
14
14
|
@CapacitorPlugin(name = "CapgoAlarm")
|
|
15
15
|
public class CapgoAlarmPlugin extends Plugin {
|
|
16
16
|
|
|
17
|
-
private final String PLUGIN_VERSION = "7.3.
|
|
17
|
+
private final String PLUGIN_VERSION = "7.3.5";
|
|
18
18
|
|
|
19
19
|
// ===== Native OS Alarm helpers (Android) =====
|
|
20
20
|
@PluginMethod
|
package/dist/docs.json
CHANGED
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
"api": {
|
|
3
3
|
"name": "CapgoAlarmPlugin",
|
|
4
4
|
"slug": "capgoalarmplugin",
|
|
5
|
-
"docs": "",
|
|
6
|
-
"tags": [
|
|
5
|
+
"docs": "Capacitor Alarm Plugin interface for managing native OS alarms.",
|
|
6
|
+
"tags": [
|
|
7
|
+
{
|
|
8
|
+
"text": "1.0.0",
|
|
9
|
+
"name": "since"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
7
12
|
"methods": [
|
|
8
13
|
{
|
|
9
14
|
"name": "createAlarm",
|
|
@@ -11,13 +16,34 @@
|
|
|
11
16
|
"parameters": [
|
|
12
17
|
{
|
|
13
18
|
"name": "options",
|
|
14
|
-
"docs": "",
|
|
19
|
+
"docs": "- Options for creating the alarm",
|
|
15
20
|
"type": "NativeAlarmCreateOptions"
|
|
16
21
|
}
|
|
17
22
|
],
|
|
18
23
|
"returns": "Promise<NativeActionResult>",
|
|
19
|
-
"tags": [
|
|
20
|
-
|
|
24
|
+
"tags": [
|
|
25
|
+
{
|
|
26
|
+
"name": "param",
|
|
27
|
+
"text": "options - Options for creating the alarm"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "returns",
|
|
31
|
+
"text": "Promise that resolves with the action result"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "throws",
|
|
35
|
+
"text": "Error if alarm creation fails or permissions are not granted"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "since",
|
|
39
|
+
"text": "1.0.0"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "example",
|
|
43
|
+
"text": "```typescript\nconst result = await CapgoAlarm.createAlarm({\n hour: 7,\n minute: 30,\n label: 'Wake up',\n skipUi: false,\n vibrate: true\n});\nconsole.log('Alarm created:', result.success);\n```"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"docs": "Create a native OS alarm using the platform clock app.\nOn Android this uses the Alarm Clock intent; on iOS this uses AlarmKit if available (iOS 16+).",
|
|
21
47
|
"complexTypes": [
|
|
22
48
|
"NativeActionResult",
|
|
23
49
|
"NativeAlarmCreateOptions"
|
|
@@ -29,7 +55,24 @@
|
|
|
29
55
|
"signature": "() => Promise<NativeActionResult>",
|
|
30
56
|
"parameters": [],
|
|
31
57
|
"returns": "Promise<NativeActionResult>",
|
|
32
|
-
"tags": [
|
|
58
|
+
"tags": [
|
|
59
|
+
{
|
|
60
|
+
"name": "returns",
|
|
61
|
+
"text": "Promise that resolves with the action result"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "throws",
|
|
65
|
+
"text": "Error if opening alarms UI fails"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "since",
|
|
69
|
+
"text": "1.0.0"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "example",
|
|
73
|
+
"text": "```typescript\nconst result = await CapgoAlarm.openAlarms();\nif (result.success) {\n console.log('Alarms UI opened');\n}\n```"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
33
76
|
"docs": "Open the platform's native alarm list UI, if available.",
|
|
34
77
|
"complexTypes": [
|
|
35
78
|
"NativeActionResult"
|
|
@@ -41,7 +84,24 @@
|
|
|
41
84
|
"signature": "() => Promise<OSInfo>",
|
|
42
85
|
"parameters": [],
|
|
43
86
|
"returns": "Promise<OSInfo>",
|
|
44
|
-
"tags": [
|
|
87
|
+
"tags": [
|
|
88
|
+
{
|
|
89
|
+
"name": "returns",
|
|
90
|
+
"text": "Promise that resolves with OS information"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "throws",
|
|
94
|
+
"text": "Error if getting OS info fails"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "since",
|
|
98
|
+
"text": "1.0.0"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "example",
|
|
102
|
+
"text": "```typescript\nconst info = await CapgoAlarm.getOSInfo();\nconsole.log('Platform:', info.platform);\nconsole.log('Supports native alarms:', info.supportsNativeAlarms);\nif (info.platform === 'android') {\n console.log('Can schedule exact alarms:', info.canScheduleExactAlarms);\n}\n```"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
45
105
|
"docs": "Get information about the OS and capabilities.",
|
|
46
106
|
"complexTypes": [
|
|
47
107
|
"OSInfo"
|
|
@@ -54,12 +114,33 @@
|
|
|
54
114
|
"parameters": [
|
|
55
115
|
{
|
|
56
116
|
"name": "options",
|
|
57
|
-
"docs": "",
|
|
117
|
+
"docs": "- Optional parameters for the permission request",
|
|
58
118
|
"type": "{ exactAlarm?: boolean | undefined; } | undefined"
|
|
59
119
|
}
|
|
60
120
|
],
|
|
61
121
|
"returns": "Promise<PermissionResult>",
|
|
62
|
-
"tags": [
|
|
122
|
+
"tags": [
|
|
123
|
+
{
|
|
124
|
+
"name": "param",
|
|
125
|
+
"text": "options - Optional parameters for the permission request"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": "returns",
|
|
129
|
+
"text": "Promise that resolves with the permission result"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "throws",
|
|
133
|
+
"text": "Error if permission request fails"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "since",
|
|
137
|
+
"text": "1.0.0"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "example",
|
|
141
|
+
"text": "```typescript\nconst result = await CapgoAlarm.requestPermissions({ exactAlarm: true });\nif (result.granted) {\n console.log('Permissions granted');\n} else {\n console.log('Permissions denied');\n}\n```"
|
|
142
|
+
}
|
|
143
|
+
],
|
|
63
144
|
"docs": "Request relevant permissions for alarm usage on the platform.\nOn Android, may route to settings for exact alarms.",
|
|
64
145
|
"complexTypes": [
|
|
65
146
|
"PermissionResult"
|
|
@@ -74,14 +155,22 @@
|
|
|
74
155
|
"tags": [
|
|
75
156
|
{
|
|
76
157
|
"name": "returns",
|
|
77
|
-
"text": "
|
|
158
|
+
"text": "Promise that resolves with the plugin version"
|
|
78
159
|
},
|
|
79
160
|
{
|
|
80
161
|
"name": "throws",
|
|
81
|
-
"text": "
|
|
162
|
+
"text": "Error if getting the version fails"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "since",
|
|
166
|
+
"text": "1.0.0"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "example",
|
|
170
|
+
"text": "```typescript\nconst { version } = await CapgoAlarm.getPluginVersion();\nconsole.log('Plugin version:', version);\n```"
|
|
82
171
|
}
|
|
83
172
|
],
|
|
84
|
-
"docs": "Get the native Capacitor plugin version",
|
|
173
|
+
"docs": "Get the native Capacitor plugin version.",
|
|
85
174
|
"complexTypes": [],
|
|
86
175
|
"slug": "getpluginversion"
|
|
87
176
|
}
|
|
@@ -92,21 +181,26 @@
|
|
|
92
181
|
{
|
|
93
182
|
"name": "NativeActionResult",
|
|
94
183
|
"slug": "nativeactionresult",
|
|
95
|
-
"docs": "",
|
|
96
|
-
"tags": [
|
|
184
|
+
"docs": "Result of a native action.",
|
|
185
|
+
"tags": [
|
|
186
|
+
{
|
|
187
|
+
"text": "1.0.0",
|
|
188
|
+
"name": "since"
|
|
189
|
+
}
|
|
190
|
+
],
|
|
97
191
|
"methods": [],
|
|
98
192
|
"properties": [
|
|
99
193
|
{
|
|
100
194
|
"name": "success",
|
|
101
195
|
"tags": [],
|
|
102
|
-
"docs": "",
|
|
196
|
+
"docs": "Whether the action was successful",
|
|
103
197
|
"complexTypes": [],
|
|
104
198
|
"type": "boolean"
|
|
105
199
|
},
|
|
106
200
|
{
|
|
107
201
|
"name": "message",
|
|
108
202
|
"tags": [],
|
|
109
|
-
"docs": "",
|
|
203
|
+
"docs": "Optional message with additional information",
|
|
110
204
|
"complexTypes": [],
|
|
111
205
|
"type": "string | undefined"
|
|
112
206
|
}
|
|
@@ -116,7 +210,12 @@
|
|
|
116
210
|
"name": "NativeAlarmCreateOptions",
|
|
117
211
|
"slug": "nativealarmcreateoptions",
|
|
118
212
|
"docs": "Options for creating a native OS alarm via the platform clock app.",
|
|
119
|
-
"tags": [
|
|
213
|
+
"tags": [
|
|
214
|
+
{
|
|
215
|
+
"text": "1.0.0",
|
|
216
|
+
"name": "since"
|
|
217
|
+
}
|
|
218
|
+
],
|
|
120
219
|
"methods": [],
|
|
121
220
|
"properties": [
|
|
122
221
|
{
|
|
@@ -160,13 +259,18 @@
|
|
|
160
259
|
"name": "OSInfo",
|
|
161
260
|
"slug": "osinfo",
|
|
162
261
|
"docs": "Returned info about current OS and capabilities.",
|
|
163
|
-
"tags": [
|
|
262
|
+
"tags": [
|
|
263
|
+
{
|
|
264
|
+
"text": "1.0.0",
|
|
265
|
+
"name": "since"
|
|
266
|
+
}
|
|
267
|
+
],
|
|
164
268
|
"methods": [],
|
|
165
269
|
"properties": [
|
|
166
270
|
{
|
|
167
271
|
"name": "platform",
|
|
168
272
|
"tags": [],
|
|
169
|
-
"docs": "'ios' | 'android' | 'web'",
|
|
273
|
+
"docs": "Platform identifier: 'ios' | 'android' | 'web'",
|
|
170
274
|
"complexTypes": [],
|
|
171
275
|
"type": "string"
|
|
172
276
|
},
|
|
@@ -204,7 +308,12 @@
|
|
|
204
308
|
"name": "PermissionResult",
|
|
205
309
|
"slug": "permissionresult",
|
|
206
310
|
"docs": "Result of a permissions request.",
|
|
207
|
-
"tags": [
|
|
311
|
+
"tags": [
|
|
312
|
+
{
|
|
313
|
+
"text": "1.0.0",
|
|
314
|
+
"name": "since"
|
|
315
|
+
}
|
|
316
|
+
],
|
|
208
317
|
"methods": [],
|
|
209
318
|
"properties": [
|
|
210
319
|
{
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Options for creating a native OS alarm via the platform clock app.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
*/
|
|
2
6
|
export interface NativeAlarmCreateOptions {
|
|
3
7
|
/** Hour of day in 24h format (0-23) */
|
|
4
8
|
hour: number;
|
|
@@ -11,13 +15,24 @@ export interface NativeAlarmCreateOptions {
|
|
|
11
15
|
/** Android only: set alarm to vibrate */
|
|
12
16
|
vibrate?: boolean;
|
|
13
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Result of a native action.
|
|
20
|
+
*
|
|
21
|
+
* @since 1.0.0
|
|
22
|
+
*/
|
|
14
23
|
export interface NativeActionResult {
|
|
24
|
+
/** Whether the action was successful */
|
|
15
25
|
success: boolean;
|
|
26
|
+
/** Optional message with additional information */
|
|
16
27
|
message?: string;
|
|
17
28
|
}
|
|
18
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Returned info about current OS and capabilities.
|
|
31
|
+
*
|
|
32
|
+
* @since 1.0.0
|
|
33
|
+
*/
|
|
19
34
|
export interface OSInfo {
|
|
20
|
-
/** 'ios' | 'android' | 'web' */
|
|
35
|
+
/** Platform identifier: 'ios' | 'android' | 'web' */
|
|
21
36
|
platform: string;
|
|
22
37
|
/** OS version string */
|
|
23
38
|
version: string;
|
|
@@ -28,39 +43,108 @@ export interface OSInfo {
|
|
|
28
43
|
/** Android only: whether exact alarms are allowed */
|
|
29
44
|
canScheduleExactAlarms?: boolean;
|
|
30
45
|
}
|
|
31
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Result of a permissions request.
|
|
48
|
+
*
|
|
49
|
+
* @since 1.0.0
|
|
50
|
+
*/
|
|
32
51
|
export interface PermissionResult {
|
|
33
52
|
/** Overall grant for requested scope */
|
|
34
53
|
granted: boolean;
|
|
35
54
|
/** Optional details by permission key */
|
|
36
55
|
details?: Record<string, boolean>;
|
|
37
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Capacitor Alarm Plugin interface for managing native OS alarms.
|
|
59
|
+
*
|
|
60
|
+
* @since 1.0.0
|
|
61
|
+
*/
|
|
38
62
|
export interface CapgoAlarmPlugin {
|
|
39
63
|
/**
|
|
40
64
|
* Create a native OS alarm using the platform clock app.
|
|
41
|
-
* On Android this uses the Alarm Clock intent; on iOS this
|
|
65
|
+
* On Android this uses the Alarm Clock intent; on iOS this uses AlarmKit if available (iOS 16+).
|
|
66
|
+
*
|
|
67
|
+
* @param options - Options for creating the alarm
|
|
68
|
+
* @returns Promise that resolves with the action result
|
|
69
|
+
* @throws Error if alarm creation fails or permissions are not granted
|
|
70
|
+
* @since 1.0.0
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const result = await CapgoAlarm.createAlarm({
|
|
74
|
+
* hour: 7,
|
|
75
|
+
* minute: 30,
|
|
76
|
+
* label: 'Wake up',
|
|
77
|
+
* skipUi: false,
|
|
78
|
+
* vibrate: true
|
|
79
|
+
* });
|
|
80
|
+
* console.log('Alarm created:', result.success);
|
|
81
|
+
* ```
|
|
42
82
|
*/
|
|
43
83
|
createAlarm(options: NativeAlarmCreateOptions): Promise<NativeActionResult>;
|
|
44
84
|
/**
|
|
45
85
|
* Open the platform's native alarm list UI, if available.
|
|
86
|
+
*
|
|
87
|
+
* @returns Promise that resolves with the action result
|
|
88
|
+
* @throws Error if opening alarms UI fails
|
|
89
|
+
* @since 1.0.0
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const result = await CapgoAlarm.openAlarms();
|
|
93
|
+
* if (result.success) {
|
|
94
|
+
* console.log('Alarms UI opened');
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
46
97
|
*/
|
|
47
98
|
openAlarms(): Promise<NativeActionResult>;
|
|
48
99
|
/**
|
|
49
100
|
* Get information about the OS and capabilities.
|
|
101
|
+
*
|
|
102
|
+
* @returns Promise that resolves with OS information
|
|
103
|
+
* @throws Error if getting OS info fails
|
|
104
|
+
* @since 1.0.0
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const info = await CapgoAlarm.getOSInfo();
|
|
108
|
+
* console.log('Platform:', info.platform);
|
|
109
|
+
* console.log('Supports native alarms:', info.supportsNativeAlarms);
|
|
110
|
+
* if (info.platform === 'android') {
|
|
111
|
+
* console.log('Can schedule exact alarms:', info.canScheduleExactAlarms);
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
50
114
|
*/
|
|
51
115
|
getOSInfo(): Promise<OSInfo>;
|
|
52
116
|
/**
|
|
53
117
|
* Request relevant permissions for alarm usage on the platform.
|
|
54
118
|
* On Android, may route to settings for exact alarms.
|
|
119
|
+
*
|
|
120
|
+
* @param options - Optional parameters for the permission request
|
|
121
|
+
* @returns Promise that resolves with the permission result
|
|
122
|
+
* @throws Error if permission request fails
|
|
123
|
+
* @since 1.0.0
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const result = await CapgoAlarm.requestPermissions({ exactAlarm: true });
|
|
127
|
+
* if (result.granted) {
|
|
128
|
+
* console.log('Permissions granted');
|
|
129
|
+
* } else {
|
|
130
|
+
* console.log('Permissions denied');
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
55
133
|
*/
|
|
56
134
|
requestPermissions(options?: {
|
|
57
135
|
exactAlarm?: boolean;
|
|
58
136
|
}): Promise<PermissionResult>;
|
|
59
137
|
/**
|
|
60
|
-
* Get the native Capacitor plugin version
|
|
138
|
+
* Get the native Capacitor plugin version.
|
|
61
139
|
*
|
|
62
|
-
* @returns
|
|
63
|
-
* @throws
|
|
140
|
+
* @returns Promise that resolves with the plugin version
|
|
141
|
+
* @throws Error if getting the version fails
|
|
142
|
+
* @since 1.0.0
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* const { version } = await CapgoAlarm.getPluginVersion();
|
|
146
|
+
* console.log('Plugin version:', version);
|
|
147
|
+
* ```
|
|
64
148
|
*/
|
|
65
149
|
getPluginVersion(): Promise<{
|
|
66
150
|
version: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Options for creating a native OS alarm via the platform clock app.\n *\n * @since 1.0.0\n */\nexport interface NativeAlarmCreateOptions {\n /** Hour of day in 24h format (0-23) */\n hour: number;\n /** Minute of hour (0-59) */\n minute: number;\n /** Optional label for the alarm */\n label?: string;\n /** Android only: attempt to skip UI if possible */\n skipUi?: boolean;\n /** Android only: set alarm to vibrate */\n vibrate?: boolean;\n}\n\n/**\n * Result of a native action.\n *\n * @since 1.0.0\n */\nexport interface NativeActionResult {\n /** Whether the action was successful */\n success: boolean;\n /** Optional message with additional information */\n message?: string;\n}\n\n/**\n * Returned info about current OS and capabilities.\n *\n * @since 1.0.0\n */\nexport interface OSInfo {\n /** Platform identifier: 'ios' | 'android' | 'web' */\n platform: string;\n /** OS version string */\n version: string;\n /** Whether the platform exposes a native alarm app integration */\n supportsNativeAlarms: boolean;\n /** Whether scheduling local notifications is supported */\n supportsScheduledNotifications: boolean;\n /** Android only: whether exact alarms are allowed */\n canScheduleExactAlarms?: boolean;\n}\n\n/**\n * Result of a permissions request.\n *\n * @since 1.0.0\n */\nexport interface PermissionResult {\n /** Overall grant for requested scope */\n granted: boolean;\n /** Optional details by permission key */\n details?: Record<string, boolean>;\n}\n\n/**\n * Capacitor Alarm Plugin interface for managing native OS alarms.\n *\n * @since 1.0.0\n */\nexport interface CapgoAlarmPlugin {\n /**\n * Create a native OS alarm using the platform clock app.\n * On Android this uses the Alarm Clock intent; on iOS this uses AlarmKit if available (iOS 16+).\n *\n * @param options - Options for creating the alarm\n * @returns Promise that resolves with the action result\n * @throws Error if alarm creation fails or permissions are not granted\n * @since 1.0.0\n * @example\n * ```typescript\n * const result = await CapgoAlarm.createAlarm({\n * hour: 7,\n * minute: 30,\n * label: 'Wake up',\n * skipUi: false,\n * vibrate: true\n * });\n * console.log('Alarm created:', result.success);\n * ```\n */\n createAlarm(options: NativeAlarmCreateOptions): Promise<NativeActionResult>;\n\n /**\n * Open the platform's native alarm list UI, if available.\n *\n * @returns Promise that resolves with the action result\n * @throws Error if opening alarms UI fails\n * @since 1.0.0\n * @example\n * ```typescript\n * const result = await CapgoAlarm.openAlarms();\n * if (result.success) {\n * console.log('Alarms UI opened');\n * }\n * ```\n */\n openAlarms(): Promise<NativeActionResult>;\n\n /**\n * Get information about the OS and capabilities.\n *\n * @returns Promise that resolves with OS information\n * @throws Error if getting OS info fails\n * @since 1.0.0\n * @example\n * ```typescript\n * const info = await CapgoAlarm.getOSInfo();\n * console.log('Platform:', info.platform);\n * console.log('Supports native alarms:', info.supportsNativeAlarms);\n * if (info.platform === 'android') {\n * console.log('Can schedule exact alarms:', info.canScheduleExactAlarms);\n * }\n * ```\n */\n getOSInfo(): Promise<OSInfo>;\n\n /**\n * Request relevant permissions for alarm usage on the platform.\n * On Android, may route to settings for exact alarms.\n *\n * @param options - Optional parameters for the permission request\n * @returns Promise that resolves with the permission result\n * @throws Error if permission request fails\n * @since 1.0.0\n * @example\n * ```typescript\n * const result = await CapgoAlarm.requestPermissions({ exactAlarm: true });\n * if (result.granted) {\n * console.log('Permissions granted');\n * } else {\n * console.log('Permissions denied');\n * }\n * ```\n */\n requestPermissions(options?: { exactAlarm?: boolean }): Promise<PermissionResult>;\n\n /**\n * Get the native Capacitor plugin version.\n *\n * @returns Promise that resolves with the plugin version\n * @throws Error if getting the version fails\n * @since 1.0.0\n * @example\n * ```typescript\n * const { version } = await CapgoAlarm.getPluginVersion();\n * console.log('Plugin version:', version);\n * ```\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
|
|
@@ -7,7 +7,7 @@ import Capacitor
|
|
|
7
7
|
*/
|
|
8
8
|
@objc(CapgoAlarmPlugin)
|
|
9
9
|
public class CapgoAlarmPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
10
|
-
private let PLUGIN_VERSION: String = "7.3.
|
|
10
|
+
private let PLUGIN_VERSION: String = "7.3.5"
|
|
11
11
|
public let identifier = "CapgoAlarmPlugin"
|
|
12
12
|
public let jsName = "CapgoAlarm"
|
|
13
13
|
public let pluginMethods: [CAPPluginMethod] = [
|