@capacitor/local-notifications 1.0.10 → 1.1.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/CHANGELOG.md +16 -0
- package/README.md +26 -8
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/capacitorjs/plugins/localnotifications/DateMatch.java +45 -10
- package/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationSchedule.java +1 -0
- package/dist/docs.json +59 -1
- package/dist/esm/definitions.d.ts +13 -0
- package/dist/esm/definitions.js +13 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +15 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +15 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/LocalNotificationsPlugin.swift +3 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.1.0](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/local-notifications@1.0.10...@capacitor/local-notifications@1.1.0) (2022-01-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* inline source code in esm map files ([#760](https://github.com/ionic-team/capacitor-plugins/issues/760)) ([a960489](https://github.com/ionic-team/capacitor-plugins/commit/a960489a19db0182b90d187a50deff9dfbe51038))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **local-notifications:** Add weekday scheduling support for Android and iOS ([#756](https://github.com/ionic-team/capacitor-plugins/issues/756)) ([430b485](https://github.com/ionic-team/capacitor-plugins/commit/430b48592ce59ccc967dd9a081873d7dc3937e93))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [1.0.10](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/local-notifications@1.0.9...@capacitor/local-notifications@1.0.10) (2022-01-10)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @capacitor/local-notifications
|
package/README.md
CHANGED
|
@@ -83,6 +83,7 @@ If the device has entered [Doze](https://developer.android.com/training/monitori
|
|
|
83
83
|
* [`removeAllListeners()`](#removealllisteners)
|
|
84
84
|
* [Interfaces](#interfaces)
|
|
85
85
|
* [Type Aliases](#type-aliases)
|
|
86
|
+
* [Enums](#enums)
|
|
86
87
|
|
|
87
88
|
</docgen-index>
|
|
88
89
|
|
|
@@ -434,14 +435,15 @@ Enables basic storage and retrieval of dates and times.
|
|
|
434
435
|
|
|
435
436
|
#### ScheduleOn
|
|
436
437
|
|
|
437
|
-
| Prop
|
|
438
|
-
|
|
|
439
|
-
| **`year`**
|
|
440
|
-
| **`month`**
|
|
441
|
-
| **`day`**
|
|
442
|
-
| **`
|
|
443
|
-
| **`
|
|
444
|
-
| **`
|
|
438
|
+
| Prop | Type |
|
|
439
|
+
| ------------- | ------------------------------------------- |
|
|
440
|
+
| **`year`** | <code>number</code> |
|
|
441
|
+
| **`month`** | <code>number</code> |
|
|
442
|
+
| **`day`** | <code>number</code> |
|
|
443
|
+
| **`weekday`** | <code><a href="#weekday">Weekday</a></code> |
|
|
444
|
+
| **`hour`** | <code>number</code> |
|
|
445
|
+
| **`minute`** | <code>number</code> |
|
|
446
|
+
| **`second`** | <code>number</code> |
|
|
445
447
|
|
|
446
448
|
|
|
447
449
|
#### Attachment
|
|
@@ -611,4 +613,20 @@ The notification visibility. For more details, see the [Android Developer Docs](
|
|
|
611
613
|
|
|
612
614
|
<code>'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'</code>
|
|
613
615
|
|
|
616
|
+
|
|
617
|
+
### Enums
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
#### Weekday
|
|
621
|
+
|
|
622
|
+
| Members | Value |
|
|
623
|
+
| --------------- | -------------- |
|
|
624
|
+
| **`Sunday`** | <code>1</code> |
|
|
625
|
+
| **`Monday`** | <code>2</code> |
|
|
626
|
+
| **`Tuesday`** | <code>3</code> |
|
|
627
|
+
| **`Wednesday`** | <code>4</code> |
|
|
628
|
+
| **`Thursday`** | <code>5</code> |
|
|
629
|
+
| **`Friday`** | <code>6</code> |
|
|
630
|
+
| **`Saturday`** | <code>7</code> |
|
|
631
|
+
|
|
614
632
|
</docgen-api>
|
package/android/build.gradle
CHANGED
|
@@ -14,6 +14,7 @@ public class DateMatch {
|
|
|
14
14
|
private Integer year;
|
|
15
15
|
private Integer month;
|
|
16
16
|
private Integer day;
|
|
17
|
+
private Integer weekday;
|
|
17
18
|
private Integer hour;
|
|
18
19
|
private Integer minute;
|
|
19
20
|
private Integer second;
|
|
@@ -48,6 +49,14 @@ public class DateMatch {
|
|
|
48
49
|
this.day = day;
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
public Integer getWeekday() {
|
|
53
|
+
return weekday;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public void setWeekday(Integer weekday) {
|
|
57
|
+
this.weekday = weekday;
|
|
58
|
+
}
|
|
59
|
+
|
|
51
60
|
public Integer getHour() {
|
|
52
61
|
return hour;
|
|
53
62
|
}
|
|
@@ -106,6 +115,8 @@ public class DateMatch {
|
|
|
106
115
|
incrementUnit = Calendar.YEAR;
|
|
107
116
|
} else if (unit == Calendar.DAY_OF_MONTH) {
|
|
108
117
|
incrementUnit = Calendar.MONTH;
|
|
118
|
+
} else if (unit == Calendar.DAY_OF_WEEK) {
|
|
119
|
+
incrementUnit = Calendar.WEEK_OF_MONTH;
|
|
109
120
|
} else if (unit == Calendar.HOUR_OF_DAY) {
|
|
110
121
|
incrementUnit = Calendar.DAY_OF_MONTH;
|
|
111
122
|
} else if (unit == Calendar.MINUTE) {
|
|
@@ -135,6 +146,10 @@ public class DateMatch {
|
|
|
135
146
|
next.set(Calendar.DAY_OF_MONTH, day);
|
|
136
147
|
if (unit == -1) unit = Calendar.DAY_OF_MONTH;
|
|
137
148
|
}
|
|
149
|
+
if (weekday != null) {
|
|
150
|
+
next.set(Calendar.DAY_OF_WEEK, weekday);
|
|
151
|
+
if (unit == -1) unit = Calendar.DAY_OF_WEEK;
|
|
152
|
+
}
|
|
138
153
|
if (hour != null) {
|
|
139
154
|
next.set(Calendar.HOUR_OF_DAY, hour);
|
|
140
155
|
if (unit == -1) unit = Calendar.HOUR_OF_DAY;
|
|
@@ -160,6 +175,8 @@ public class DateMatch {
|
|
|
160
175
|
month +
|
|
161
176
|
", day=" +
|
|
162
177
|
day +
|
|
178
|
+
", weekday=" +
|
|
179
|
+
weekday +
|
|
163
180
|
", hour=" +
|
|
164
181
|
hour +
|
|
165
182
|
", minute=" +
|
|
@@ -180,6 +197,7 @@ public class DateMatch {
|
|
|
180
197
|
if (year != null ? !year.equals(dateMatch.year) : dateMatch.year != null) return false;
|
|
181
198
|
if (month != null ? !month.equals(dateMatch.month) : dateMatch.month != null) return false;
|
|
182
199
|
if (day != null ? !day.equals(dateMatch.day) : dateMatch.day != null) return false;
|
|
200
|
+
if (weekday != null ? !weekday.equals(dateMatch.weekday) : dateMatch.weekday != null) return false;
|
|
183
201
|
if (hour != null ? !hour.equals(dateMatch.hour) : dateMatch.hour != null) return false;
|
|
184
202
|
if (minute != null ? !minute.equals(dateMatch.minute) : dateMatch.minute != null) return false;
|
|
185
203
|
return second != null ? second.equals(dateMatch.second) : dateMatch.second == null;
|
|
@@ -190,6 +208,7 @@ public class DateMatch {
|
|
|
190
208
|
int result = year != null ? year.hashCode() : 0;
|
|
191
209
|
result = 31 * result + (month != null ? month.hashCode() : 0);
|
|
192
210
|
result = 31 * result + (day != null ? day.hashCode() : 0);
|
|
211
|
+
result = 31 * result + (weekday != null ? weekday.hashCode() : 0);
|
|
193
212
|
result = 31 * result + (hour != null ? hour.hashCode() : 0);
|
|
194
213
|
result = 31 * result + (minute != null ? minute.hashCode() : 0);
|
|
195
214
|
result = 31 + result + (second != null ? second.hashCode() : 0);
|
|
@@ -203,7 +222,21 @@ public class DateMatch {
|
|
|
203
222
|
*/
|
|
204
223
|
public String toMatchString() {
|
|
205
224
|
String matchString =
|
|
206
|
-
year +
|
|
225
|
+
year +
|
|
226
|
+
separator +
|
|
227
|
+
month +
|
|
228
|
+
separator +
|
|
229
|
+
day +
|
|
230
|
+
separator +
|
|
231
|
+
weekday +
|
|
232
|
+
separator +
|
|
233
|
+
hour +
|
|
234
|
+
separator +
|
|
235
|
+
minute +
|
|
236
|
+
separator +
|
|
237
|
+
second +
|
|
238
|
+
separator +
|
|
239
|
+
unit;
|
|
207
240
|
return matchString.replace("null", "*");
|
|
208
241
|
}
|
|
209
242
|
|
|
@@ -216,23 +249,25 @@ public class DateMatch {
|
|
|
216
249
|
public static DateMatch fromMatchString(String matchString) {
|
|
217
250
|
DateMatch date = new DateMatch();
|
|
218
251
|
String[] split = matchString.split(separator);
|
|
219
|
-
if (split != null && split.length ==
|
|
252
|
+
if (split != null && split.length == 7) {
|
|
220
253
|
date.setYear(getValueFromCronElement(split[0]));
|
|
221
254
|
date.setMonth(getValueFromCronElement(split[1]));
|
|
222
255
|
date.setDay(getValueFromCronElement(split[2]));
|
|
223
|
-
date.
|
|
224
|
-
date.
|
|
225
|
-
date.
|
|
256
|
+
date.setWeekday(getValueFromCronElement(split[3]));
|
|
257
|
+
date.setHour(getValueFromCronElement(split[4]));
|
|
258
|
+
date.setMinute(getValueFromCronElement(split[5]));
|
|
259
|
+
date.setUnit(getValueFromCronElement(split[6]));
|
|
226
260
|
}
|
|
227
261
|
|
|
228
|
-
if (split != null && split.length ==
|
|
262
|
+
if (split != null && split.length == 8) {
|
|
229
263
|
date.setYear(getValueFromCronElement(split[0]));
|
|
230
264
|
date.setMonth(getValueFromCronElement(split[1]));
|
|
231
265
|
date.setDay(getValueFromCronElement(split[2]));
|
|
232
|
-
date.
|
|
233
|
-
date.
|
|
234
|
-
date.
|
|
235
|
-
date.
|
|
266
|
+
date.setWeekday(getValueFromCronElement(split[3]));
|
|
267
|
+
date.setHour(getValueFromCronElement(split[4]));
|
|
268
|
+
date.setMinute(getValueFromCronElement(split[5]));
|
|
269
|
+
date.setSecond(getValueFromCronElement(split[6]));
|
|
270
|
+
date.setUnit(getValueFromCronElement(split[7]));
|
|
236
271
|
}
|
|
237
272
|
|
|
238
273
|
return date;
|
|
@@ -65,6 +65,7 @@ public class LocalNotificationSchedule {
|
|
|
65
65
|
on.setYear(onJson.getInteger("year"));
|
|
66
66
|
on.setMonth(onJson.getInteger("month"));
|
|
67
67
|
on.setDay(onJson.getInteger("day"));
|
|
68
|
+
on.setWeekday(onJson.getInteger("weekday"));
|
|
68
69
|
on.setHour(onJson.getInteger("hour"));
|
|
69
70
|
on.setMinute(onJson.getInteger("minute"));
|
|
70
71
|
on.setSecond(onJson.getInteger("second"));
|
package/dist/docs.json
CHANGED
|
@@ -1516,6 +1516,15 @@
|
|
|
1516
1516
|
"complexTypes": [],
|
|
1517
1517
|
"type": "number | undefined"
|
|
1518
1518
|
},
|
|
1519
|
+
{
|
|
1520
|
+
"name": "weekday",
|
|
1521
|
+
"tags": [],
|
|
1522
|
+
"docs": "",
|
|
1523
|
+
"complexTypes": [
|
|
1524
|
+
"Weekday"
|
|
1525
|
+
],
|
|
1526
|
+
"type": "Weekday"
|
|
1527
|
+
},
|
|
1519
1528
|
{
|
|
1520
1529
|
"name": "hour",
|
|
1521
1530
|
"tags": [],
|
|
@@ -2258,7 +2267,56 @@
|
|
|
2258
2267
|
]
|
|
2259
2268
|
}
|
|
2260
2269
|
],
|
|
2261
|
-
"enums": [
|
|
2270
|
+
"enums": [
|
|
2271
|
+
{
|
|
2272
|
+
"name": "Weekday",
|
|
2273
|
+
"slug": "weekday",
|
|
2274
|
+
"members": [
|
|
2275
|
+
{
|
|
2276
|
+
"name": "Sunday",
|
|
2277
|
+
"value": "1",
|
|
2278
|
+
"tags": [],
|
|
2279
|
+
"docs": ""
|
|
2280
|
+
},
|
|
2281
|
+
{
|
|
2282
|
+
"name": "Monday",
|
|
2283
|
+
"value": "2",
|
|
2284
|
+
"tags": [],
|
|
2285
|
+
"docs": ""
|
|
2286
|
+
},
|
|
2287
|
+
{
|
|
2288
|
+
"name": "Tuesday",
|
|
2289
|
+
"value": "3",
|
|
2290
|
+
"tags": [],
|
|
2291
|
+
"docs": ""
|
|
2292
|
+
},
|
|
2293
|
+
{
|
|
2294
|
+
"name": "Wednesday",
|
|
2295
|
+
"value": "4",
|
|
2296
|
+
"tags": [],
|
|
2297
|
+
"docs": ""
|
|
2298
|
+
},
|
|
2299
|
+
{
|
|
2300
|
+
"name": "Thursday",
|
|
2301
|
+
"value": "5",
|
|
2302
|
+
"tags": [],
|
|
2303
|
+
"docs": ""
|
|
2304
|
+
},
|
|
2305
|
+
{
|
|
2306
|
+
"name": "Friday",
|
|
2307
|
+
"value": "6",
|
|
2308
|
+
"tags": [],
|
|
2309
|
+
"docs": ""
|
|
2310
|
+
},
|
|
2311
|
+
{
|
|
2312
|
+
"name": "Saturday",
|
|
2313
|
+
"value": "7",
|
|
2314
|
+
"tags": [],
|
|
2315
|
+
"docs": ""
|
|
2316
|
+
}
|
|
2317
|
+
]
|
|
2318
|
+
}
|
|
2319
|
+
],
|
|
2262
2320
|
"typeAliases": [
|
|
2263
2321
|
{
|
|
2264
2322
|
"name": "ScheduleEvery",
|
|
@@ -701,6 +701,7 @@ export interface ScheduleOn {
|
|
|
701
701
|
year?: number;
|
|
702
702
|
month?: number;
|
|
703
703
|
day?: number;
|
|
704
|
+
weekday?: Weekday;
|
|
704
705
|
hour?: number;
|
|
705
706
|
minute?: number;
|
|
706
707
|
second?: number;
|
|
@@ -829,6 +830,18 @@ export interface Channel {
|
|
|
829
830
|
*/
|
|
830
831
|
vibration?: boolean;
|
|
831
832
|
}
|
|
833
|
+
/**
|
|
834
|
+
* Day of the week. Used for scheduling notifications on a particular weekday.
|
|
835
|
+
*/
|
|
836
|
+
export declare enum Weekday {
|
|
837
|
+
Sunday = 1,
|
|
838
|
+
Monday = 2,
|
|
839
|
+
Tuesday = 3,
|
|
840
|
+
Wednesday = 4,
|
|
841
|
+
Thursday = 5,
|
|
842
|
+
Friday = 6,
|
|
843
|
+
Saturday = 7
|
|
844
|
+
}
|
|
832
845
|
/**
|
|
833
846
|
* The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)
|
|
834
847
|
* @since 1.0.0
|
package/dist/esm/definitions.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
/// <reference types="@capacitor/cli" />
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Day of the week. Used for scheduling notifications on a particular weekday.
|
|
4
|
+
*/
|
|
5
|
+
export var Weekday;
|
|
6
|
+
(function (Weekday) {
|
|
7
|
+
Weekday[Weekday["Sunday"] = 1] = "Sunday";
|
|
8
|
+
Weekday[Weekday["Monday"] = 2] = "Monday";
|
|
9
|
+
Weekday[Weekday["Tuesday"] = 3] = "Tuesday";
|
|
10
|
+
Weekday[Weekday["Wednesday"] = 4] = "Wednesday";
|
|
11
|
+
Weekday[Weekday["Thursday"] = 5] = "Thursday";
|
|
12
|
+
Weekday[Weekday["Friday"] = 6] = "Friday";
|
|
13
|
+
Weekday[Weekday["Saturday"] = 7] = "Saturday";
|
|
14
|
+
})(Weekday || (Weekday = {}));
|
|
3
15
|
//# sourceMappingURL=definitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC"}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC;AA66BxC;;GAEG;AACH,MAAM,CAAN,IAAY,OAQX;AARD,WAAY,OAAO;IACjB,yCAAU,CAAA;IACV,yCAAU,CAAA;IACV,2CAAW,CAAA;IACX,+CAAa,CAAA;IACb,6CAAY,CAAA;IACZ,yCAAU,CAAA;IACV,6CAAY,CAAA;AACd,CAAC,EARW,OAAO,KAAP,OAAO,QAQlB","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\nimport type { PermissionState, PluginListenerHandle } from '@capacitor/core';\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * On Android, the Local Notifications can be configured with the following options:\n */\n LocalNotifications?: {\n /**\n * Set the default status bar icon for notifications.\n *\n * Icons should be placed in your app's `res/drawable` folder. The value for\n * this option should be the drawable resource ID, which is the filename\n * without an extension.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n * @example \"ic_stat_icon_config_sample\"\n */\n smallIcon?: string;\n\n /**\n * Set the default color of status bar icons for notifications.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n * @example \"#488AFF\"\n */\n iconColor?: string;\n\n /**\n * Set the default notification sound for notifications.\n *\n * On Android 26+ it sets the default channel sound and can't be\n * changed unless the app is uninstalled.\n *\n * If the audio file is not found, it will result in the default system\n * sound being played on Android 21-25 and no sound on Android 26+.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n * @example \"beep.wav\"\n */\n sound?: string;\n };\n }\n}\n\nexport interface LocalNotificationsPlugin {\n /**\n * Schedule one or more local notifications.\n *\n * @since 1.0.0\n */\n schedule(options: ScheduleOptions): Promise<ScheduleResult>;\n\n /**\n * Get a list of pending notifications.\n *\n * @since 1.0.0\n */\n getPending(): Promise<PendingResult>;\n\n /**\n * Register actions to take when notifications are displayed.\n *\n * Only available for iOS and Android.\n *\n * @since 1.0.0\n */\n registerActionTypes(options: RegisterActionTypesOptions): Promise<void>;\n\n /**\n * Cancel pending notifications.\n *\n * @since 1.0.0\n */\n cancel(options: CancelOptions): Promise<void>;\n\n /**\n * Check if notifications are enabled or not.\n *\n * @deprecated Use `checkPermissions()` to check if the user has allowed\n * notifications to be displayed.\n * @since 1.0.0\n */\n areEnabled(): Promise<EnabledResult>;\n\n /**\n * Create a notification channel.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n createChannel(channel: NotificationChannel): Promise<void>;\n\n /**\n * Delete a notification channel.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n deleteChannel(channel: NotificationChannel): Promise<void>;\n\n /**\n * Get a list of notification channels.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n listChannels(): Promise<ListChannelsResult>;\n\n /**\n * Check permission to display local notifications.\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request permission to display local notifications.\n *\n * @since 1.0.0\n */\n requestPermissions(): Promise<PermissionStatus>;\n\n /**\n * Listen for when notifications are displayed.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'localNotificationReceived',\n listenerFunc: (notification: LocalNotificationSchema) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Listen for when an action is performed on a notification.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'localNotificationActionPerformed',\n listenerFunc: (notificationAction: ActionPerformed) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Remove all listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n}\n\n/**\n * The object that describes a local notification.\n *\n * @since 1.0.0\n */\nexport interface LocalNotificationDescriptor {\n /**\n * The notification identifier.\n *\n * @since 1.0.0\n */\n id: number;\n}\n\nexport interface ScheduleOptions {\n /**\n * The list of notifications to schedule.\n *\n * @since 1.0.0\n */\n notifications: LocalNotificationSchema[];\n}\n\nexport interface ScheduleResult {\n /**\n * The list of scheduled notifications.\n *\n * @since 1.0.0\n */\n notifications: LocalNotificationDescriptor[];\n}\n\nexport interface PendingResult {\n /**\n * The list of pending notifications.\n *\n * @since 1.0.0\n */\n notifications: PendingLocalNotificationSchema[];\n}\n\nexport interface RegisterActionTypesOptions {\n /**\n * The list of action types to register.\n *\n * @since 1.0.0\n */\n types: ActionType[];\n}\n\nexport interface CancelOptions {\n /**\n * The list of notifications to cancel.\n *\n * @since 1.0.0\n */\n notifications: LocalNotificationDescriptor[];\n}\n\n/**\n * A collection of actions.\n *\n * @since 1.0.0\n */\nexport interface ActionType {\n /**\n * The ID of the action type.\n *\n * Referenced in notifications by the `actionTypeId` key.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The list of actions associated with this action type.\n *\n * @since 1.0.0\n */\n actions?: Action[];\n\n /**\n * Sets `hiddenPreviewsBodyPlaceholder` of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosHiddenPreviewsBodyPlaceholder?: string;\n\n /**\n * Sets `customDismissAction` in the options of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosCustomDismissAction?: boolean;\n\n /**\n * Sets `allowInCarPlay` in the options of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosAllowInCarPlay?: boolean;\n\n /**\n * Sets `hiddenPreviewsShowTitle` in the options of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosHiddenPreviewsShowTitle?: boolean;\n\n /**\n * Sets `hiddenPreviewsShowSubtitle` in the options of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosHiddenPreviewsShowSubtitle?: boolean;\n}\n\n/**\n * An action that can be taken when a notification is displayed.\n *\n * @since 1.0.0\n */\nexport interface Action {\n /**\n * The action identifier.\n *\n * Referenced in the `'actionPerformed'` event as `actionId`.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The title text to display for this action.\n *\n * @since 1.0.0\n */\n title: string;\n\n /**\n * Sets `authenticationRequired` in the options of the\n * [`UNNotificationAction`](https://developer.apple.com/documentation/usernotifications/unnotificationaction).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n requiresAuthentication?: boolean;\n\n /**\n * Sets `foreground` in the options of the\n * [`UNNotificationAction`](https://developer.apple.com/documentation/usernotifications/unnotificationaction).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n foreground?: boolean;\n\n /**\n * Sets `destructive` in the options of the\n * [`UNNotificationAction`](https://developer.apple.com/documentation/usernotifications/unnotificationaction).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n destructive?: boolean;\n\n /**\n * Use a `UNTextInputNotificationAction` instead of a `UNNotificationAction`.\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n input?: boolean;\n\n /**\n * Sets `textInputButtonTitle` on the\n * [`UNTextInputNotificationAction`](https://developer.apple.com/documentation/usernotifications/untextinputnotificationaction).\n *\n * Only available for iOS when `input` is `true`.\n *\n * @since 1.0.0\n */\n inputButtonTitle?: string;\n\n /**\n * Sets `textInputPlaceholder` on the\n * [`UNTextInputNotificationAction`](https://developer.apple.com/documentation/usernotifications/untextinputnotificationaction).\n *\n * Only available for iOS when `input` is `true`.\n *\n * @since 1.0.0\n */\n inputPlaceholder?: string;\n}\n\n/**\n * Represents a notification attachment.\n *\n * @since 1.0.0\n */\nexport interface Attachment {\n /**\n * The attachment identifier.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The URL to the attachment.\n *\n * Use the `res` scheme to reference web assets, e.g.\n * `res:///assets/img/icon.png`. Also accepts `file` URLs.\n *\n * @since 1.0.0\n */\n url: string;\n\n /**\n * Attachment options.\n *\n * @since 1.0.0\n */\n options?: AttachmentOptions;\n}\n\nexport interface AttachmentOptions {\n /**\n * Sets the `UNNotificationAttachmentOptionsTypeHintKey` key in the hashable\n * options of\n * [`UNNotificationAttachment`](https://developer.apple.com/documentation/usernotifications/unnotificationattachment).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosUNNotificationAttachmentOptionsTypeHintKey?: string;\n\n /**\n * Sets the `UNNotificationAttachmentOptionsThumbnailHiddenKey` key in the\n * hashable options of\n * [`UNNotificationAttachment`](https://developer.apple.com/documentation/usernotifications/unnotificationattachment).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosUNNotificationAttachmentOptionsThumbnailHiddenKey?: string;\n\n /**\n * Sets the `UNNotificationAttachmentOptionsThumbnailClippingRectKey` key in\n * the hashable options of\n * [`UNNotificationAttachment`](https://developer.apple.com/documentation/usernotifications/unnotificationattachment).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosUNNotificationAttachmentOptionsThumbnailClippingRectKey?: string;\n\n /**\n * Sets the `UNNotificationAttachmentOptionsThumbnailTimeKey` key in the\n * hashable options of\n * [`UNNotificationAttachment`](https://developer.apple.com/documentation/usernotifications/unnotificationattachment).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosUNNotificationAttachmentOptionsThumbnailTimeKey?: string;\n}\n\nexport interface PendingLocalNotificationSchema {\n /**\n * The title of the notification.\n *\n * @since 1.0.0\n */\n title: string;\n\n /**\n * The body of the notification, shown below the title.\n *\n * @since 1.0.0\n */\n body: string;\n\n /**\n * The notification identifier.\n *\n * @since 1.0.0\n */\n id: number;\n\n /**\n * Schedule this notification for a later time.\n *\n * @since 1.0.0\n */\n schedule?: Schedule;\n\n /**\n * Set extra data to store within this notification.\n *\n * @since 1.0.0\n */\n extra?: any;\n}\n\nexport interface LocalNotificationSchema {\n /**\n * The title of the notification.\n *\n * @since 1.0.0\n */\n title: string;\n\n /**\n * The body of the notification, shown below the title.\n *\n * @since 1.0.0\n */\n body: string;\n\n /**\n * Sets a multiline text block for display in a big text notification style.\n *\n * @since 1.0.0\n */\n largeBody?: string;\n\n /**\n * Used to set the summary text detail in inbox and big text notification styles.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n summaryText?: string;\n /**\n * The notification identifier.\n *\n * @since 1.0.0\n */\n id: number;\n\n /**\n * Schedule this notification for a later time.\n *\n * @since 1.0.0\n */\n schedule?: Schedule;\n\n /**\n * Name of the audio file to play when this notification is displayed.\n *\n * Include the file extension with the filename.\n *\n * On iOS, the file should be in the app bundle.\n * On Android, the file should be in res/raw folder.\n *\n * Recommended format is `.wav` because is supported by both iOS and Android.\n *\n * Only available for iOS and Android < 26.\n * For Android 26+ use channelId of a channel configured with the desired sound.\n *\n * If the sound file is not found, (i.e. empty string or wrong name)\n * the default system notification sound will be used.\n * If not provided, it will produce the default sound on Android and no sound on iOS.\n *\n * @since 1.0.0\n */\n sound?: string;\n\n /**\n * Set a custom status bar icon.\n *\n * If set, this overrides the `smallIcon` option from Capacitor\n * configuration.\n *\n * Icons should be placed in your app's `res/drawable` folder. The value for\n * this option should be the drawable resource ID, which is the filename\n * without an extension.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n smallIcon?: string;\n\n /**\n * Set a large icon for notifications.\n *\n * Icons should be placed in your app's `res/drawable` folder. The value for\n * this option should be the drawable resource ID, which is the filename\n * without an extension.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n largeIcon?: string;\n\n /**\n * Set the color of the notification icon.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n iconColor?: string;\n\n /**\n * Set attachments for this notification.\n *\n * @since 1.0.0\n */\n attachments?: Attachment[];\n\n /**\n * Associate an action type with this notification.\n *\n * @since 1.0.0\n */\n actionTypeId?: string;\n\n /**\n * Set extra data to store within this notification.\n *\n * @since 1.0.0\n */\n extra?: any;\n\n /**\n * Used to group multiple notifications.\n *\n * Sets `threadIdentifier` on the\n * [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n threadIdentifier?: string;\n\n /**\n * The string this notification adds to the category's summary format string.\n *\n * Sets `summaryArgument` on the\n * [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent).\n *\n * Only available for iOS 12+.\n *\n * @since 1.0.0\n */\n summaryArgument?: string;\n\n /**\n * Used to group multiple notifications.\n *\n * Calls `setGroup()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n group?: string;\n\n /**\n * If true, this notification becomes the summary for a group of\n * notifications.\n *\n * Calls `setGroupSummary()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android when using `group`.\n *\n * @since 1.0.0\n */\n groupSummary?: boolean;\n\n /**\n * Specifies the channel the notification should be delivered on.\n *\n * If channel with the given name does not exist then the notification will\n * not fire. If not provided, it will use the default channel.\n *\n * Calls `setChannelId()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android 26+.\n *\n * @since 1.0.0\n */\n channelId?: string;\n\n /**\n * If true, the notification can't be swiped away.\n *\n * Calls `setOngoing()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n ongoing?: boolean;\n\n /**\n * If true, the notification is canceled when the user clicks on it.\n *\n * Calls `setAutoCancel()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n autoCancel?: boolean;\n\n /**\n * Sets a list of strings for display in an inbox style notification.\n *\n * Up to 5 strings are allowed.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n inboxList?: string[];\n}\n\n/**\n * Represents a schedule for a notification.\n *\n * Use either `at`, `on`, or `every` to schedule notifications.\n *\n * @since 1.0.0\n */\nexport interface Schedule {\n /**\n * Schedule a notification at a specific date and time.\n *\n * @since 1.0.0\n */\n at?: Date;\n\n /**\n * Repeat delivery of this notification at the date and time specified by\n * `at`.\n *\n * Only available for iOS and Android.\n *\n * @since 1.0.0\n */\n repeats?: boolean;\n\n /**\n * Allow this notification to fire while in [Doze](https://developer.android.com/training/monitoring-device-state/doze-standby)\n *\n * Only available for Android 23+.\n *\n * Note that these notifications can only fire [once per 9 minutes, per app](https://developer.android.com/training/monitoring-device-state/doze-standby#assessing_your_app).\n *\n * @since 1.0.0\n */\n allowWhileIdle?: boolean;\n\n /**\n * Schedule a notification on particular interval(s).\n *\n * This is similar to scheduling [cron](https://en.wikipedia.org/wiki/Cron)\n * jobs.\n *\n * Only available for iOS and Android.\n *\n * @since 1.0.0\n */\n on?: ScheduleOn;\n\n /**\n * Schedule a notification on a particular interval.\n *\n * @since 1.0.0\n */\n every?: ScheduleEvery;\n\n /**\n * Limit the number times a notification is delivered by the interval\n * specified by `every`.\n *\n * @since 1.0.0\n */\n count?: number;\n}\n\nexport interface ScheduleOn {\n year?: number;\n month?: number;\n day?: number;\n weekday?: Weekday;\n hour?: number;\n minute?: number;\n second?: number;\n}\n\nexport type ScheduleEvery =\n | 'year'\n | 'month'\n | 'two-weeks'\n | 'week'\n | 'day'\n | 'hour'\n | 'minute'\n | 'second';\n\nexport interface ListChannelsResult {\n /**\n * The list of notification channels.\n *\n * @since 1.0.0\n */\n channels: Channel[];\n}\n\nexport interface PermissionStatus {\n /**\n * Permission state of displaying notifications.\n *\n * @since 1.0.0\n */\n display: PermissionState;\n}\n\nexport interface ActionPerformed {\n /**\n * The identifier of the performed action.\n *\n * @since 1.0.0\n */\n actionId: string;\n\n /**\n * The value entered by the user on the notification.\n *\n * Only available on iOS for notifications with `input` set to `true`.\n *\n * @since 1.0.0\n */\n inputValue?: string;\n\n /**\n * The original notification schema.\n *\n * @since 1.0.0\n */\n notification: LocalNotificationSchema;\n}\n\n/**\n * @deprecated\n */\nexport interface EnabledResult {\n /**\n * Whether or not the device has local notifications enabled.\n *\n * @since 1.0.0\n */\n value: boolean;\n}\n\nexport interface Channel {\n /**\n * The channel identifier.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The human-friendly name of this channel (presented to the user).\n *\n * @since 1.0.0\n */\n name: string;\n\n /**\n * The description of this channel (presented to the user).\n *\n * @since 1.0.0\n */\n description?: string;\n\n /**\n * The sound that should be played for notifications posted to this channel.\n *\n * Notification channels with an importance of at least `3` should have a\n * sound.\n *\n * The file name of a sound file should be specified relative to the android\n * app `res/raw` directory.\n *\n * If the sound is not provided, or the sound file is not found no sound will be used.\n *\n * @since 1.0.0\n * @example \"jingle.wav\"\n */\n sound?: string;\n\n /**\n * The level of interruption for notifications posted to this channel.\n *\n * @since 1.0.0\n */\n importance: Importance;\n\n /**\n * The visibility of notifications posted to this channel.\n *\n * This setting is for whether notifications posted to this channel appear on\n * the lockscreen or not, and if so, whether they appear in a redacted form.\n *\n * @since 1.0.0\n */\n visibility?: Visibility;\n\n /**\n * Whether notifications posted to this channel should display notification\n * lights, on devices that support it.\n *\n * @since 1.0.0\n */\n lights?: boolean;\n\n /**\n * The light color for notifications posted to this channel.\n *\n * Only supported if lights are enabled on this channel and the device\n * supports it.\n *\n * Supported color formats are `#RRGGBB` and `#RRGGBBAA`.\n *\n * @since 1.0.0\n */\n lightColor?: string;\n\n /**\n * Whether notifications posted to this channel should vibrate.\n *\n * @since 1.0.0\n */\n vibration?: boolean;\n}\n\n/**\n * Day of the week. Used for scheduling notifications on a particular weekday.\n */\nexport enum Weekday {\n Sunday = 1,\n Monday = 2,\n Tuesday = 3,\n Wednesday = 4,\n Thursday = 5,\n Friday = 6,\n Saturday = 7,\n}\n\n/**\n * The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)\n * @since 1.0.0\n */\nexport type Importance = 1 | 2 | 3 | 4 | 5;\n\n/**\n * The notification visibility. For more details, see the [Android Developer Docs](https://developer.android.com/reference/androidx/core/app/NotificationCompat#VISIBILITY_PRIVATE)\n * @since 1.0.0\n */\nexport type Visibility = -1 | 0 | 1;\n\n/**\n * @deprecated Use 'Channel`.\n * @since 1.0.0\n */\nexport type NotificationChannel = Channel;\n\n/**\n * @deprecated Use `LocalNotificationDescriptor`.\n * @since 1.0.0\n */\nexport type LocalNotificationRequest = LocalNotificationDescriptor;\n\n/**\n * @deprecated Use `ScheduleResult`.\n * @since 1.0.0\n */\nexport type LocalNotificationScheduleResult = ScheduleResult;\n\n/**\n * @deprecated Use `PendingResult`.\n * @since 1.0.0\n */\nexport type LocalNotificationPendingList = PendingResult;\n\n/**\n * @deprecated Use `ActionType`.\n * @since 1.0.0\n */\nexport type LocalNotificationActionType = ActionType;\n\n/**\n * @deprecated Use `Action`.\n * @since 1.0.0\n */\nexport type LocalNotificationAction = Action;\n\n/**\n * @deprecated Use `EnabledResult`.\n * @since 1.0.0\n */\nexport type LocalNotificationEnabledResult = EnabledResult;\n\n/**\n * @deprecated Use `ListChannelsResult`.\n * @since 1.0.0\n */\nexport type NotificationChannelList = ListChannelsResult;\n\n/**\n * @deprecated Use `Attachment`.\n * @since 1.0.0\n */\nexport type LocalNotificationAttachment = Attachment;\n\n/**\n * @deprecated Use `AttachmentOptions`.\n * @since 1.0.0\n */\nexport type LocalNotificationAttachmentOptions = AttachmentOptions;\n\n/**\n * @deprecated Use `LocalNotificationSchema`.\n * @since 1.0.0\n */\nexport type LocalNotification = LocalNotificationSchema;\n\n/**\n * @deprecated Use `Schedule`.\n * @since 1.0.0\n */\nexport type LocalNotificationSchedule = Schedule;\n\n/**\n * @deprecated Use `ActionPerformed`.\n * @since 1.0.0\n */\nexport type LocalNotificationActionPerformed = ActionPerformed;\n"]}
|
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;AAIjD,MAAM,kBAAkB,GAAG,cAAc,CACvC,oBAAoB,EACpB;IACE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;CACpE,CACF,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,kBAAkB,GAAG,cAAc,CACvC,oBAAoB,EACpB;IACE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;CACpE,CACF,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { LocalNotificationsPlugin } from './definitions';\n\nconst LocalNotifications = registerPlugin<LocalNotificationsPlugin>(\n 'LocalNotifications',\n {\n web: () => import('./web').then(m => new m.LocalNotificationsWeb()),\n },\n);\n\nexport * from './definitions';\nexport { LocalNotifications };\n"]}
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAc5C,MAAM,OAAO,qBACX,SAAQ,SAAS;IADnB;;QAIY,YAAO,GAA8B,EAAE,CAAC;QA+ExC,2BAAsB,GAAG,GAAY,EAAE;YAC/C,IAAI,CAAC,CAAC,cAAc,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC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C,2BAA2B,EAAE,YAAY,CAAC,CAAC;IAClE,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { PermissionState } from '@capacitor/core';\n\nimport type {\n EnabledResult,\n ListChannelsResult,\n LocalNotificationSchema,\n LocalNotificationsPlugin,\n PendingResult,\n PermissionStatus,\n ScheduleOptions,\n ScheduleResult,\n} from './definitions';\n\nexport class LocalNotificationsWeb\n extends WebPlugin\n implements LocalNotificationsPlugin\n{\n protected pending: LocalNotificationSchema[] = [];\n\n async createChannel(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async deleteChannel(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async listChannels(): Promise<ListChannelsResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async schedule(options: ScheduleOptions): Promise<ScheduleResult> {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n\n for (const notification of options.notifications) {\n this.sendNotification(notification);\n }\n\n return {\n notifications: options.notifications.map(notification => ({\n id: notification.id,\n })),\n };\n }\n\n async getPending(): Promise<PendingResult> {\n return {\n notifications: this.pending,\n };\n }\n\n async registerActionTypes(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async cancel(pending: ScheduleResult): Promise<void> {\n this.pending = this.pending.filter(\n notification =>\n !pending.notifications.find(n => n.id === notification.id),\n );\n }\n\n async areEnabled(): Promise<EnabledResult> {\n const { display } = await this.checkPermissions();\n\n return {\n value: display === 'granted',\n };\n }\n\n async requestPermissions(): Promise<PermissionStatus> {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n\n const display = this.transformNotificationPermission(\n await Notification.requestPermission(),\n );\n\n return { display };\n }\n\n async checkPermissions(): Promise<PermissionStatus> {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n\n const display = this.transformNotificationPermission(\n Notification.permission,\n );\n\n return { display };\n }\n\n protected hasNotificationSupport = (): boolean => {\n if (!('Notification' in window) || !Notification.requestPermission) {\n return false;\n }\n\n if (Notification.permission !== 'granted') {\n // don't test for `new Notification` if permission has already been granted\n // otherwise this sends a real notification on supported browsers\n try {\n new Notification('');\n } catch (e) {\n if (e.name == 'TypeError') {\n return false;\n }\n }\n }\n\n return true;\n };\n\n protected transformNotificationPermission(\n permission: NotificationPermission,\n ): PermissionState {\n switch (permission) {\n case 'granted':\n return 'granted';\n case 'denied':\n return 'denied';\n default:\n return 'prompt';\n }\n }\n\n protected sendPending(): void {\n const toRemove: LocalNotificationSchema[] = [];\n const now = new Date().getTime();\n\n for (const notification of this.pending) {\n if (\n notification.schedule?.at &&\n notification.schedule.at.getTime() <= now\n ) {\n this.buildNotification(notification);\n toRemove.push(notification);\n }\n }\n\n this.pending = this.pending.filter(\n notification => !toRemove.find(n => n === notification),\n );\n }\n\n protected sendNotification(notification: LocalNotificationSchema): void {\n if (notification.schedule?.at) {\n const diff = notification.schedule.at.getTime() - new Date().getTime();\n\n this.pending.push(notification);\n setTimeout(() => {\n this.sendPending();\n }, diff);\n return;\n }\n this.buildNotification(notification);\n }\n\n protected buildNotification(\n notification: LocalNotificationSchema,\n ): Notification {\n const localNotification = new Notification(notification.title, {\n body: notification.body,\n });\n localNotification.addEventListener(\n 'click',\n this.onClick.bind(this, notification),\n false,\n );\n localNotification.addEventListener(\n 'show',\n this.onShow.bind(this, notification),\n false,\n );\n return localNotification;\n }\n\n protected onClick(notification: LocalNotificationSchema): void {\n const data = {\n actionId: 'tap',\n notification,\n };\n this.notifyListeners('localNotificationActionPerformed', data);\n }\n\n protected onShow(notification: LocalNotificationSchema): void {\n this.notifyListeners('localNotificationReceived', notification);\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -4,6 +4,21 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var core = require('@capacitor/core');
|
|
6
6
|
|
|
7
|
+
/// <reference types="@capacitor/cli" />
|
|
8
|
+
/**
|
|
9
|
+
* Day of the week. Used for scheduling notifications on a particular weekday.
|
|
10
|
+
*/
|
|
11
|
+
exports.Weekday = void 0;
|
|
12
|
+
(function (Weekday) {
|
|
13
|
+
Weekday[Weekday["Sunday"] = 1] = "Sunday";
|
|
14
|
+
Weekday[Weekday["Monday"] = 2] = "Monday";
|
|
15
|
+
Weekday[Weekday["Tuesday"] = 3] = "Tuesday";
|
|
16
|
+
Weekday[Weekday["Wednesday"] = 4] = "Wednesday";
|
|
17
|
+
Weekday[Weekday["Thursday"] = 5] = "Thursday";
|
|
18
|
+
Weekday[Weekday["Friday"] = 6] = "Friday";
|
|
19
|
+
Weekday[Weekday["Saturday"] = 7] = "Saturday";
|
|
20
|
+
})(exports.Weekday || (exports.Weekday = {}));
|
|
21
|
+
|
|
7
22
|
const LocalNotifications = core.registerPlugin('LocalNotifications', {
|
|
8
23
|
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.LocalNotificationsWeb()),
|
|
9
24
|
});
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst LocalNotifications = registerPlugin('LocalNotifications', {\n web: () => import('./web').then(m => new m.LocalNotificationsWeb()),\n});\nexport * from './definitions';\nexport { LocalNotifications };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class LocalNotificationsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.pending = [];\n this.hasNotificationSupport = () => {\n if (!('Notification' in window) || !Notification.requestPermission) {\n return false;\n }\n if (Notification.permission !== 'granted') {\n // don't test for `new Notification` if permission has already been granted\n // otherwise this sends a real notification on supported browsers\n try {\n new Notification('');\n }\n catch (e) {\n if (e.name == 'TypeError') {\n return false;\n }\n }\n }\n return true;\n };\n }\n async createChannel() {\n throw this.unimplemented('Not implemented on web.');\n }\n async deleteChannel() {\n throw this.unimplemented('Not implemented on web.');\n }\n async listChannels() {\n throw this.unimplemented('Not implemented on web.');\n }\n async schedule(options) {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n for (const notification of options.notifications) {\n this.sendNotification(notification);\n }\n return {\n notifications: options.notifications.map(notification => ({\n id: notification.id,\n })),\n };\n }\n async getPending() {\n return {\n notifications: this.pending,\n };\n }\n async registerActionTypes() {\n throw this.unimplemented('Not implemented on web.');\n }\n async cancel(pending) {\n this.pending = this.pending.filter(notification => !pending.notifications.find(n => n.id === notification.id));\n }\n async areEnabled() {\n const { display } = await this.checkPermissions();\n return {\n value: display === 'granted',\n };\n }\n async requestPermissions() {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n const display = this.transformNotificationPermission(await Notification.requestPermission());\n return { display };\n }\n async checkPermissions() {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n const display = this.transformNotificationPermission(Notification.permission);\n return { display };\n }\n transformNotificationPermission(permission) {\n switch (permission) {\n case 'granted':\n return 'granted';\n case 'denied':\n return 'denied';\n default:\n return 'prompt';\n }\n }\n sendPending() {\n var _a;\n const toRemove = [];\n const now = new Date().getTime();\n for (const notification of this.pending) {\n if (((_a = notification.schedule) === null || _a === void 0 ? void 0 : _a.at) &&\n notification.schedule.at.getTime() <= now) {\n this.buildNotification(notification);\n toRemove.push(notification);\n }\n }\n this.pending = this.pending.filter(notification => !toRemove.find(n => n === notification));\n }\n sendNotification(notification) {\n var _a;\n if ((_a = notification.schedule) === null || _a === void 0 ? void 0 : _a.at) {\n const diff = notification.schedule.at.getTime() - new Date().getTime();\n this.pending.push(notification);\n setTimeout(() => {\n this.sendPending();\n }, diff);\n return;\n }\n this.buildNotification(notification);\n }\n buildNotification(notification) {\n const localNotification = new Notification(notification.title, {\n body: notification.body,\n });\n localNotification.addEventListener('click', this.onClick.bind(this, notification), false);\n localNotification.addEventListener('show', this.onShow.bind(this, notification), false);\n return localNotification;\n }\n onClick(notification) {\n const data = {\n actionId: 'tap',\n notification,\n };\n this.notifyListeners('localNotificationActionPerformed', data);\n }\n onShow(notification) {\n this.notifyListeners('localNotificationReceived', notification);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;AAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;AACvE,CAAC;;ACFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;AACrD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;AAC5B,QAAQ,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;AAC1B,QAAQ,IAAI,CAAC,sBAAsB,GAAG,MAAM;AAC5C,YAAY,IAAI,EAAE,cAAc,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAE;AAChF,gBAAgB,OAAO,KAAK,CAAC;AAC7B,aAAa;AACb,YAAY,IAAI,YAAY,CAAC,UAAU,KAAK,SAAS,EAAE;AACvD;AACA;AACA,gBAAgB,IAAI;AACpB,oBAAoB,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC;AACzC,iBAAiB;AACjB,gBAAgB,OAAO,CAAC,EAAE;AAC1B,oBAAoB,IAAI,CAAC,CAAC,IAAI,IAAI,WAAW,EAAE;AAC/C,wBAAwB,OAAO,KAAK,CAAC;AACrC,qBAAqB;AACrB,iBAAiB;AACjB,aAAa;AACb,YAAY,OAAO,IAAI,CAAC;AACxB,SAAS,CAAC;AACV,KAAK;AACL,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL,IAAI,MAAM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QAAQ,MAAM,iBAAiB,GAAG,IAAI,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE;AACvE,YAAY,IAAI,EAAE,YAAY,CAAC,IAAI;AACnC,SAAS,CAAC,CAAC;AACX,QAAQ,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;AAClG,QAAQ,iBAAiB,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;AAChG,QAAQ,OAAO,iBAAiB,CAAC;AACjC,KAAK;AACL,IAAI,OAAO,CAAC,YAAY,EAAE;AAC1B,QAAQ,MAAM,IAAI,GAAG;AACrB,YAAY,QAAQ,EAAE,KAAK;AAC3B,YAAY,YAAY;AACxB,SAAS,CAAC;AACV,QAAQ,IAAI,CAAC,eAAe,CAAC,kCAAkC,EAAE,IAAI,CAAC,CAAC;AACvE,KAAK;AACL,IAAI,MAAM,CAAC,YAAY,EAAE;AACzB,QAAQ,IAAI,CAAC,eAAe,CAAC,2BAA2B,EAAE,YAAY,CAAC,CAAC;AACxE,KAAK;AACL;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n/**\n * Day of the week. Used for scheduling notifications on a particular weekday.\n */\nexport var Weekday;\n(function (Weekday) {\n Weekday[Weekday[\"Sunday\"] = 1] = \"Sunday\";\n Weekday[Weekday[\"Monday\"] = 2] = \"Monday\";\n Weekday[Weekday[\"Tuesday\"] = 3] = \"Tuesday\";\n Weekday[Weekday[\"Wednesday\"] = 4] = \"Wednesday\";\n Weekday[Weekday[\"Thursday\"] = 5] = \"Thursday\";\n Weekday[Weekday[\"Friday\"] = 6] = \"Friday\";\n Weekday[Weekday[\"Saturday\"] = 7] = \"Saturday\";\n})(Weekday || (Weekday = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst LocalNotifications = registerPlugin('LocalNotifications', {\n web: () => import('./web').then(m => new m.LocalNotificationsWeb()),\n});\nexport * from './definitions';\nexport { LocalNotifications };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class LocalNotificationsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.pending = [];\n this.hasNotificationSupport = () => {\n if (!('Notification' in window) || !Notification.requestPermission) {\n return false;\n }\n if (Notification.permission !== 'granted') {\n // don't test for `new Notification` if permission has already been granted\n // otherwise this sends a real notification on supported browsers\n try {\n new Notification('');\n }\n catch (e) {\n if (e.name == 'TypeError') {\n return false;\n }\n }\n }\n return true;\n };\n }\n async createChannel() {\n throw this.unimplemented('Not implemented on web.');\n }\n async deleteChannel() {\n throw this.unimplemented('Not implemented on web.');\n }\n async listChannels() {\n throw this.unimplemented('Not implemented on web.');\n }\n async schedule(options) {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n for (const notification of options.notifications) {\n this.sendNotification(notification);\n }\n return {\n notifications: options.notifications.map(notification => ({\n id: notification.id,\n })),\n };\n }\n async getPending() {\n return {\n notifications: this.pending,\n };\n }\n async registerActionTypes() {\n throw this.unimplemented('Not implemented on web.');\n }\n async cancel(pending) {\n this.pending = this.pending.filter(notification => !pending.notifications.find(n => n.id === notification.id));\n }\n async areEnabled() {\n const { display } = await this.checkPermissions();\n return {\n value: display === 'granted',\n };\n }\n async requestPermissions() {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n const display = this.transformNotificationPermission(await Notification.requestPermission());\n return { display };\n }\n async checkPermissions() {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n const display = this.transformNotificationPermission(Notification.permission);\n return { display };\n }\n transformNotificationPermission(permission) {\n switch (permission) {\n case 'granted':\n return 'granted';\n case 'denied':\n return 'denied';\n default:\n return 'prompt';\n }\n }\n sendPending() {\n var _a;\n const toRemove = [];\n const now = new Date().getTime();\n for (const notification of this.pending) {\n if (((_a = notification.schedule) === null || _a === void 0 ? void 0 : _a.at) &&\n notification.schedule.at.getTime() <= now) {\n this.buildNotification(notification);\n toRemove.push(notification);\n }\n }\n this.pending = this.pending.filter(notification => !toRemove.find(n => n === notification));\n }\n sendNotification(notification) {\n var _a;\n if ((_a = notification.schedule) === null || _a === void 0 ? void 0 : _a.at) {\n const diff = notification.schedule.at.getTime() - new Date().getTime();\n this.pending.push(notification);\n setTimeout(() => {\n this.sendPending();\n }, diff);\n return;\n }\n this.buildNotification(notification);\n }\n buildNotification(notification) {\n const localNotification = new Notification(notification.title, {\n body: notification.body,\n });\n localNotification.addEventListener('click', this.onClick.bind(this, notification), false);\n localNotification.addEventListener('show', this.onShow.bind(this, notification), false);\n return localNotification;\n }\n onClick(notification) {\n const data = {\n actionId: 'tap',\n notification,\n };\n this.notifyListeners('localNotificationActionPerformed', data);\n }\n onShow(notification) {\n this.notifyListeners('localNotificationReceived', notification);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["Weekday","registerPlugin","WebPlugin"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACWA,yBAAQ;AACnB,CAAC,UAAU,OAAO,EAAE;AACpB,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;AAC9C,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;AAC9C,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;AAChD,IAAI,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC;AACpD,IAAI,OAAO,CAAC,OA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AAY,CAAC,CAAC;AAC7C,KAAK;AACL,IAAI,iBAAiB,CAAC,YAAY,EAAE;AACpC,QAAQ,MAAM,iBAAiB,GAAG,IAAI,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE;AACvE,YAAY,IAAI,EAAE,YAAY,CAAC,IAAI;AACnC,SAAS,CAAC,CAAC;AACX,QAAQ,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;AAClG,QAAQ,iBAAiB,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;AAChG,QAAQ,OAAO,iBAAiB,CAAC;AACjC,KAAK;AACL,IAAI,OAAO,CAAC,YAAY,EAAE;AAC1B,QAAQ,MAAM,IAAI,GAAG;AACrB,YAAY,QAAQ,EAAE,KAAK;AAC3B,YAAY,YAAY;AACxB,SAAS,CAAC;AACV,QAAQ,IAAI,CAAC,eAAe,CAAC,kCAAkC,EAAE,IAAI,CAAC,CAAC;AACvE,KAAK;AACL,IAAI,MAAM,CAAC,YAAY,EAAE;AACzB,QAAQ,IAAI,CAAC,eAAe,CAAC,2BAA2B,EAAE,YAAY,CAAC,CAAC;AACxE,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
var capacitorLocalNotifications = (function (exports, core) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
/// <reference types="@capacitor/cli" />
|
|
5
|
+
/**
|
|
6
|
+
* Day of the week. Used for scheduling notifications on a particular weekday.
|
|
7
|
+
*/
|
|
8
|
+
exports.Weekday = void 0;
|
|
9
|
+
(function (Weekday) {
|
|
10
|
+
Weekday[Weekday["Sunday"] = 1] = "Sunday";
|
|
11
|
+
Weekday[Weekday["Monday"] = 2] = "Monday";
|
|
12
|
+
Weekday[Weekday["Tuesday"] = 3] = "Tuesday";
|
|
13
|
+
Weekday[Weekday["Wednesday"] = 4] = "Wednesday";
|
|
14
|
+
Weekday[Weekday["Thursday"] = 5] = "Thursday";
|
|
15
|
+
Weekday[Weekday["Friday"] = 6] = "Friday";
|
|
16
|
+
Weekday[Weekday["Saturday"] = 7] = "Saturday";
|
|
17
|
+
})(exports.Weekday || (exports.Weekday = {}));
|
|
18
|
+
|
|
4
19
|
const LocalNotifications = core.registerPlugin('LocalNotifications', {
|
|
5
20
|
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.LocalNotificationsWeb()),
|
|
6
21
|
});
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst LocalNotifications = registerPlugin('LocalNotifications', {\n web: () => import('./web').then(m => new m.LocalNotificationsWeb()),\n});\nexport * from './definitions';\nexport { LocalNotifications };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class LocalNotificationsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.pending = [];\n this.hasNotificationSupport = () => {\n if (!('Notification' in window) || !Notification.requestPermission) {\n return false;\n }\n if (Notification.permission !== 'granted') {\n // don't test for `new Notification` if permission has already been granted\n // otherwise this sends a real notification on supported browsers\n try {\n new Notification('');\n }\n catch (e) {\n if (e.name == 'TypeError') {\n return false;\n }\n }\n }\n return true;\n };\n }\n async createChannel() {\n throw this.unimplemented('Not implemented on web.');\n }\n async deleteChannel() {\n throw this.unimplemented('Not implemented on web.');\n }\n async listChannels() {\n throw this.unimplemented('Not implemented on web.');\n }\n async schedule(options) {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n for (const notification of options.notifications) {\n this.sendNotification(notification);\n }\n return {\n notifications: options.notifications.map(notification => ({\n id: notification.id,\n })),\n };\n }\n async getPending() {\n return {\n notifications: this.pending,\n };\n }\n async registerActionTypes() {\n throw this.unimplemented('Not implemented on web.');\n }\n async cancel(pending) {\n this.pending = this.pending.filter(notification => !pending.notifications.find(n => n.id === notification.id));\n }\n async areEnabled() {\n const { display } = await this.checkPermissions();\n return {\n value: display === 'granted',\n };\n }\n async requestPermissions() {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n const display = this.transformNotificationPermission(await Notification.requestPermission());\n return { display };\n }\n async checkPermissions() {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n const display = this.transformNotificationPermission(Notification.permission);\n return { display };\n }\n transformNotificationPermission(permission) {\n switch (permission) {\n case 'granted':\n return 'granted';\n case 'denied':\n return 'denied';\n default:\n return 'prompt';\n }\n }\n sendPending() {\n var _a;\n const toRemove = [];\n const now = new Date().getTime();\n for (const notification of this.pending) {\n if (((_a = notification.schedule) === null || _a === void 0 ? void 0 : _a.at) &&\n notification.schedule.at.getTime() <= now) {\n this.buildNotification(notification);\n toRemove.push(notification);\n }\n }\n this.pending = this.pending.filter(notification => !toRemove.find(n => n === notification));\n }\n sendNotification(notification) {\n var _a;\n if ((_a = notification.schedule) === null || _a === void 0 ? void 0 : _a.at) {\n const diff = notification.schedule.at.getTime() - new Date().getTime();\n this.pending.push(notification);\n setTimeout(() => {\n this.sendPending();\n }, diff);\n return;\n }\n this.buildNotification(notification);\n }\n buildNotification(notification) {\n const localNotification = new Notification(notification.title, {\n body: notification.body,\n });\n localNotification.addEventListener('click', this.onClick.bind(this, notification), false);\n localNotification.addEventListener('show', this.onShow.bind(this, notification), false);\n return localNotification;\n }\n onClick(notification) {\n const data = {\n actionId: 'tap',\n notification,\n };\n this.notifyListeners('localNotificationActionPerformed', data);\n }\n onShow(notification) {\n this.notifyListeners('localNotificationReceived', notification);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"m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AI,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;IAClG,QAAQ,iBAAiB,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;IAChG,QAAQ,OAAO,iBAAiB,CAAC;IACjC,KAAK;IACL,IAAI,OAAO,CAAC,YAAY,EAAE;IAC1B,QAAQ,MAAM,IAAI,GAAG;IACrB,YAAY,QAAQ,EAAE,KAAK;IAC3B,YAAY,YAAY;IACxB,SAAS,CAAC;IACV,QAAQ,IAAI,CAAC,eAAe,CAAC,kCAAkC,EAAE,IAAI,CAAC,CAAC;IACvE,KAAK;IACL,IAAI,MAAM,CAAC,YAAY,EAAE;IACzB,QAAQ,IAAI,CAAC,eAAe,CAAC,2BAA2B,EAAE,YAAY,CAAC,CAAC;IACxE,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n/**\n * Day of the week. Used for scheduling notifications on a particular weekday.\n */\nexport var Weekday;\n(function (Weekday) {\n Weekday[Weekday[\"Sunday\"] = 1] = \"Sunday\";\n Weekday[Weekday[\"Monday\"] = 2] = \"Monday\";\n Weekday[Weekday[\"Tuesday\"] = 3] = \"Tuesday\";\n Weekday[Weekday[\"Wednesday\"] = 4] = \"Wednesday\";\n Weekday[Weekday[\"Thursday\"] = 5] = \"Thursday\";\n Weekday[Weekday[\"Friday\"] = 6] = \"Friday\";\n Weekday[Weekday[\"Saturday\"] = 7] = \"Saturday\";\n})(Weekday || (Weekday = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst LocalNotifications = registerPlugin('LocalNotifications', {\n web: () => import('./web').then(m => new m.LocalNotificationsWeb()),\n});\nexport * from './definitions';\nexport { LocalNotifications };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class LocalNotificationsWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.pending = [];\n this.hasNotificationSupport = () => {\n if (!('Notification' in window) || !Notification.requestPermission) {\n return false;\n }\n if (Notification.permission !== 'granted') {\n // don't test for `new Notification` if permission has already been granted\n // otherwise this sends a real notification on supported browsers\n try {\n new Notification('');\n }\n catch (e) {\n if (e.name == 'TypeError') {\n return false;\n }\n }\n }\n return true;\n };\n }\n async createChannel() {\n throw this.unimplemented('Not implemented on web.');\n }\n async deleteChannel() {\n throw this.unimplemented('Not implemented on web.');\n }\n async listChannels() {\n throw this.unimplemented('Not implemented on web.');\n }\n async schedule(options) {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n for (const notification of options.notifications) {\n this.sendNotification(notification);\n }\n return {\n notifications: options.notifications.map(notification => ({\n id: notification.id,\n })),\n };\n }\n async getPending() {\n return {\n notifications: this.pending,\n };\n }\n async registerActionTypes() {\n throw this.unimplemented('Not implemented on web.');\n }\n async cancel(pending) {\n this.pending = this.pending.filter(notification => !pending.notifications.find(n => n.id === notification.id));\n }\n async areEnabled() {\n const { display } = await this.checkPermissions();\n return {\n value: display === 'granted',\n };\n }\n async requestPermissions() {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n const display = this.transformNotificationPermission(await Notification.requestPermission());\n return { display };\n }\n async checkPermissions() {\n if (!this.hasNotificationSupport()) {\n throw this.unavailable('Notifications not supported in this browser.');\n }\n const display = this.transformNotificationPermission(Notification.permission);\n return { display };\n }\n transformNotificationPermission(permission) {\n switch (permission) {\n case 'granted':\n return 'granted';\n case 'denied':\n return 'denied';\n default:\n return 'prompt';\n }\n }\n sendPending() {\n var _a;\n const toRemove = [];\n const now = new Date().getTime();\n for (const notification of this.pending) {\n if (((_a = notification.schedule) === null || _a === void 0 ? void 0 : _a.at) &&\n notification.schedule.at.getTime() <= now) {\n this.buildNotification(notification);\n toRemove.push(notification);\n }\n }\n this.pending = this.pending.filter(notification => !toRemove.find(n => n === notification));\n }\n sendNotification(notification) {\n var _a;\n if ((_a = notification.schedule) === null || _a === void 0 ? void 0 : _a.at) {\n const diff = notification.schedule.at.getTime() - new Date().getTime();\n this.pending.push(notification);\n setTimeout(() => {\n this.sendPending();\n }, diff);\n return;\n }\n this.buildNotification(notification);\n }\n buildNotification(notification) {\n const localNotification = new Notification(notification.title, {\n body: notification.body,\n });\n localNotification.addEventListener('click', this.onClick.bind(this, notification), false);\n localNotification.addEventListener('show', this.onShow.bind(this, notification), false);\n return localNotification;\n }\n onClick(notification) {\n const data = {\n actionId: 'tap',\n notification,\n };\n this.notifyListeners('localNotificationActionPerformed', data);\n }\n onShow(notification) {\n this.notifyListeners('localNotificationReceived', notification);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["Weekday","registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;AACWA,6BAAQ;IACnB,CAAC,UAAU,OAAO,EAAE;IACpB,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;IAC9C,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;IAC9C,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC;IAChD,IAAI,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC;IACpD,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;IAClD,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;IAC9C,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GA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QAAQ,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;IAClG,QAAQ,iBAAiB,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;IAChG,QAAQ,OAAO,iBAAiB,CAAC;IACjC,KAAK;IACL,IAAI,OAAO,CAAC,YAAY,EAAE;IAC1B,QAAQ,MAAM,IAAI,GAAG;IACrB,YAAY,QAAQ,EAAE,KAAK;IAC3B,YAAY,YAAY;IACxB,SAAS,CAAC;IACV,QAAQ,IAAI,CAAC,eAAe,CAAC,kCAAkC,EAAE,IAAI,CAAC,CAAC;IACvE,KAAK;IACL,IAAI,MAAM,CAAC,YAAY,EAAE;IACzB,QAAQ,IAAI,CAAC,eAAe,CAAC,2BAA2B,EAAE,YAAY,CAAC,CAAC;IACxE,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/local-notifications",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "The Local Notifications API provides a way to schedule device notifications locally (i.e. without a server sending push notifications).",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "f18ee6482e1ec8e5fb0290d51f598397133af990"
|
|
84
84
|
}
|