@capacitor/local-notifications 6.0.0-alpha.2 → 6.0.0-beta.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.
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
10
10
  s.homepage = 'https://capacitorjs.com'
11
11
  s.author = package['author']
12
12
  s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
13
- s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'local-notifications/ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
13
+ s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}', 'local-notifications/ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '13.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
package/Package.swift ADDED
@@ -0,0 +1,28 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "CapacitorLocalNotifications",
6
+ platforms: [.iOS(.v13)],
7
+ products: [
8
+ .library(
9
+ name: "LocalNotificationsPlugin",
10
+ targets: ["LocalNotificationsPlugin"])
11
+ ],
12
+ dependencies: [
13
+ .package(url: "https://github.com/ionic-team/capacitor6-spm-test.git", branch: "main")
14
+ ],
15
+ targets: [
16
+ .target(
17
+ name: "LocalNotificationsPlugin",
18
+ dependencies: [
19
+ .product(name: "Capacitor", package: "capacitor6-spm-test"),
20
+ .product(name: "Cordova", package: "capacitor6-spm-test")
21
+ ],
22
+ path: "ios/Sources/LocalNotificationsPlugin"),
23
+ .testTarget(
24
+ name: "LocalNotificationsPluginTests",
25
+ dependencies: ["LocalNotificationsPlugin"],
26
+ path: "ios/Tests/LocalNotificationsPluginTests")
27
+ ]
28
+ )
package/README.md CHANGED
@@ -20,7 +20,9 @@ Starting on Android 12, scheduled notifications won't be exact unless this permi
20
20
  <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
21
21
  ```
22
22
 
23
- Note that even if the permission is present, users can still disable exact notifications from the app settings.
23
+ Note that even if the permission is present, users can still disable exact notifications from the app settings. Use `checkExactNotificationSetting()` to check the the value of the setting. If a user disables this setting, the app will restart and any notification scheduled with an exact alarm will be deleted. If your application depends on exact alarms, be sure to check this setting on app launch (for example, in [`App.appStateChange`](https://capacitorjs.com/docs/apis/app#addlistenerappstatechange-)) in order to provide fallbacks or alternative behavior.
24
+
25
+ On Android 14, there is a new permission called `USE_EXACT_ALARM`. Use this permission to use exact alarms without needing to request permission from the user. This should only be used if the use of exact alarms is central to your app's functionality. Read more about the implications of using this permission [here](https://developer.android.com/reference/android/Manifest.permission#USE_EXACT_ALARM).
24
26
 
25
27
  ## Configuration
26
28
 
@@ -94,6 +96,8 @@ If the device has entered [Doze](https://developer.android.com/training/monitori
94
96
  * [`listChannels()`](#listchannels)
95
97
  * [`checkPermissions()`](#checkpermissions)
96
98
  * [`requestPermissions()`](#requestpermissions)
99
+ * [`changeExactNotificationSetting()`](#changeexactnotificationsetting)
100
+ * [`checkExactNotificationSetting()`](#checkexactnotificationsetting)
97
101
  * [`addListener('localNotificationReceived', ...)`](#addlistenerlocalnotificationreceived)
98
102
  * [`addListener('localNotificationActionPerformed', ...)`](#addlistenerlocalnotificationactionperformed)
99
103
  * [`removeAllListeners()`](#removealllisteners)
@@ -321,6 +325,46 @@ Request permission to display local notifications.
321
325
  --------------------
322
326
 
323
327
 
328
+ ### changeExactNotificationSetting()
329
+
330
+ ```typescript
331
+ changeExactNotificationSetting() => Promise<SettingsPermissionStatus>
332
+ ```
333
+
334
+ Direct user to the application settings screen to configure exact alarms.
335
+
336
+ In the event that a user changes the settings from granted to denied, the application
337
+ will restart and any notification scheduled with an exact alarm will be deleted.
338
+
339
+ On Android &lt; 12, the user will NOT be directed to the application settings screen, instead this function will
340
+ return `granted`.
341
+
342
+ Only available on Android.
343
+
344
+ **Returns:** <code>Promise&lt;<a href="#settingspermissionstatus">SettingsPermissionStatus</a>&gt;</code>
345
+
346
+ **Since:** 6.0.0
347
+
348
+ --------------------
349
+
350
+
351
+ ### checkExactNotificationSetting()
352
+
353
+ ```typescript
354
+ checkExactNotificationSetting() => Promise<SettingsPermissionStatus>
355
+ ```
356
+
357
+ Check application setting for using exact alarms.
358
+
359
+ Only available on Android.
360
+
361
+ **Returns:** <code>Promise&lt;<a href="#settingspermissionstatus">SettingsPermissionStatus</a>&gt;</code>
362
+
363
+ **Since:** 6.0.0
364
+
365
+ --------------------
366
+
367
+
324
368
  ### addListener('localNotificationReceived', ...)
325
369
 
326
370
  ```typescript
@@ -652,6 +696,13 @@ An action that can be taken when a notification is displayed.
652
696
  | **`display`** | <code><a href="#permissionstate">PermissionState</a></code> | Permission state of displaying notifications. | 1.0.0 |
653
697
 
654
698
 
699
+ #### SettingsPermissionStatus
700
+
701
+ | Prop | Type | Description | Since |
702
+ | ----------------- | ----------------------------------------------------------- | --------------------------------------- | ----- |
703
+ | **`exact_alarm`** | <code><a href="#permissionstate">PermissionState</a></code> | Permission state of using exact alarms. | 6.0.0 |
704
+
705
+
655
706
  #### PluginListenerHandle
656
707
 
657
708
  | Prop | Type |
@@ -15,7 +15,7 @@ buildscript {
15
15
  }
16
16
  }
17
17
  dependencies {
18
- classpath 'com.android.tools.build:gradle:8.2.0-rc02'
18
+ classpath 'com.android.tools.build:gradle:8.2.0'
19
19
  if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
20
20
  classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
21
21
  }
@@ -378,6 +378,10 @@ public class LocalNotificationManager {
378
378
  PendingIntent pendingIntent
379
379
  ) {
380
380
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && !alarmManager.canScheduleExactAlarms()) {
381
+ Logger.warn(
382
+ "Capacitor/LocalNotification",
383
+ "Exact alarms not allowed in user settings. Notification scheduled with non-exact alarm."
384
+ );
381
385
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && schedule.allowWhileIdle()) {
382
386
  alarmManager.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, trigger, pendingIntent);
383
387
  } else {
@@ -1,12 +1,17 @@
1
1
  package com.capacitorjs.plugins.localnotifications;
2
2
 
3
+ import static android.provider.Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM;
4
+
3
5
  import android.Manifest;
6
+ import android.app.AlarmManager;
4
7
  import android.app.Notification;
5
8
  import android.app.NotificationManager;
6
9
  import android.content.Context;
7
10
  import android.content.Intent;
11
+ import android.net.Uri;
8
12
  import android.os.Build;
9
13
  import android.service.notification.StatusBarNotification;
14
+ import androidx.activity.result.ActivityResult;
10
15
  import com.getcapacitor.Bridge;
11
16
  import com.getcapacitor.JSArray;
12
17
  import com.getcapacitor.JSObject;
@@ -15,6 +20,7 @@ import com.getcapacitor.Plugin;
15
20
  import com.getcapacitor.PluginCall;
16
21
  import com.getcapacitor.PluginHandle;
17
22
  import com.getcapacitor.PluginMethod;
23
+ import com.getcapacitor.annotation.ActivityCallback;
18
24
  import com.getcapacitor.annotation.CapacitorPlugin;
19
25
  import com.getcapacitor.annotation.Permission;
20
26
  import com.getcapacitor.annotation.PermissionCallback;
@@ -221,13 +227,40 @@ public class LocalNotificationsPlugin extends Plugin {
221
227
  }
222
228
  }
223
229
 
230
+ @PluginMethod
231
+ public void changeExactNotificationSetting(PluginCall call) {
232
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
233
+ startActivityForResult(
234
+ call,
235
+ new Intent(ACTION_REQUEST_SCHEDULE_EXACT_ALARM, Uri.parse("package:" + getActivity().getPackageName())),
236
+ "alarmPermissionsCallback"
237
+ );
238
+ } else {
239
+ checkExactNotificationSetting(call);
240
+ }
241
+ }
242
+
243
+ @PluginMethod
244
+ public void checkExactNotificationSetting(PluginCall call) {
245
+ JSObject permissionsResultJSON = new JSObject();
246
+ permissionsResultJSON.put("exact_alarm", getExactAlarmPermissionText());
247
+
248
+ call.resolve(permissionsResultJSON);
249
+ }
250
+
224
251
  @PermissionCallback
225
252
  private void permissionsCallback(PluginCall call) {
226
253
  JSObject permissionsResultJSON = new JSObject();
227
254
  permissionsResultJSON.put("display", getNotificationPermissionText());
255
+
228
256
  call.resolve(permissionsResultJSON);
229
257
  }
230
258
 
259
+ @ActivityCallback
260
+ private void alarmPermissionsCallback(PluginCall call, ActivityResult result) {
261
+ checkExactNotificationSetting(call);
262
+ }
263
+
231
264
  private String getNotificationPermissionText() {
232
265
  if (manager.areNotificationsEnabled()) {
233
266
  return "granted";
@@ -236,6 +269,19 @@ public class LocalNotificationsPlugin extends Plugin {
236
269
  }
237
270
  }
238
271
 
272
+ private String getExactAlarmPermissionText() {
273
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
274
+ AlarmManager alarmManager = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE);
275
+ if (alarmManager.canScheduleExactAlarms()) {
276
+ return "granted";
277
+ } else {
278
+ return "denied";
279
+ }
280
+ }
281
+
282
+ return "granted";
283
+ }
284
+
239
285
  public static void fireReceived(JSObject notification) {
240
286
  LocalNotificationsPlugin localNotificationsPlugin = LocalNotificationsPlugin.getLocalNotificationsInstance();
241
287
  if (localNotificationsPlugin != null) {
@@ -59,9 +59,11 @@ public class TimedNotificationPublisher extends BroadcastReceiver {
59
59
 
60
60
  private boolean rescheduleNotificationIfNeeded(Context context, Intent intent, int id) {
61
61
  String dateString = intent.getStringExtra(CRON_KEY);
62
+
62
63
  if (dateString != null) {
63
64
  DateMatch date = DateMatch.fromMatchString(dateString);
64
65
  AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
66
+
65
67
  long trigger = date.nextTrigger(new Date());
66
68
  Intent clone = (Intent) intent.clone();
67
69
  int flags = PendingIntent.FLAG_CANCEL_CURRENT;
@@ -70,6 +72,10 @@ public class TimedNotificationPublisher extends BroadcastReceiver {
70
72
  }
71
73
  PendingIntent pendingIntent = PendingIntent.getBroadcast(context, id, clone, flags);
72
74
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && !alarmManager.canScheduleExactAlarms()) {
75
+ Logger.warn(
76
+ "Capacitor/LocalNotification",
77
+ "Exact alarms not allowed in user settings. Notification scheduled with non-exact alarm."
78
+ );
73
79
  alarmManager.set(AlarmManager.RTC, trigger, pendingIntent);
74
80
  } else {
75
81
  alarmManager.setExact(AlarmManager.RTC, trigger, pendingIntent);
package/dist/docs.json CHANGED
@@ -263,6 +263,40 @@
263
263
  ],
264
264
  "slug": "requestpermissions"
265
265
  },
266
+ {
267
+ "name": "changeExactNotificationSetting",
268
+ "signature": "() => Promise<SettingsPermissionStatus>",
269
+ "parameters": [],
270
+ "returns": "Promise<SettingsPermissionStatus>",
271
+ "tags": [
272
+ {
273
+ "name": "since",
274
+ "text": "6.0.0"
275
+ }
276
+ ],
277
+ "docs": "Direct user to the application settings screen to configure exact alarms.\n\nIn the event that a user changes the settings from granted to denied, the application\nwill restart and any notification scheduled with an exact alarm will be deleted.\n\nOn Android < 12, the user will NOT be directed to the application settings screen, instead this function will\nreturn `granted`.\n\nOnly available on Android.",
278
+ "complexTypes": [
279
+ "SettingsPermissionStatus"
280
+ ],
281
+ "slug": "changeexactnotificationsetting"
282
+ },
283
+ {
284
+ "name": "checkExactNotificationSetting",
285
+ "signature": "() => Promise<SettingsPermissionStatus>",
286
+ "parameters": [],
287
+ "returns": "Promise<SettingsPermissionStatus>",
288
+ "tags": [
289
+ {
290
+ "name": "since",
291
+ "text": "6.0.0"
292
+ }
293
+ ],
294
+ "docs": "Check application setting for using exact alarms.\n\nOnly available on Android.",
295
+ "complexTypes": [
296
+ "SettingsPermissionStatus"
297
+ ],
298
+ "slug": "checkexactnotificationsetting"
299
+ },
266
300
  {
267
301
  "name": "addListener",
268
302
  "signature": "(eventName: 'localNotificationReceived', listenerFunc: (notification: LocalNotificationSchema) => void) => Promise<PluginListenerHandle>",
@@ -2440,6 +2474,29 @@
2440
2474
  }
2441
2475
  ]
2442
2476
  },
2477
+ {
2478
+ "name": "SettingsPermissionStatus",
2479
+ "slug": "settingspermissionstatus",
2480
+ "docs": "",
2481
+ "tags": [],
2482
+ "methods": [],
2483
+ "properties": [
2484
+ {
2485
+ "name": "exact_alarm",
2486
+ "tags": [
2487
+ {
2488
+ "text": "6.0.0",
2489
+ "name": "since"
2490
+ }
2491
+ ],
2492
+ "docs": "Permission state of using exact alarms.",
2493
+ "complexTypes": [
2494
+ "PermissionState"
2495
+ ],
2496
+ "type": "PermissionState"
2497
+ }
2498
+ ]
2499
+ },
2443
2500
  {
2444
2501
  "name": "PluginListenerHandle",
2445
2502
  "slug": "pluginlistenerhandle",
@@ -136,6 +136,28 @@ export interface LocalNotificationsPlugin {
136
136
  * @since 1.0.0
137
137
  */
138
138
  requestPermissions(): Promise<PermissionStatus>;
139
+ /**
140
+ * Direct user to the application settings screen to configure exact alarms.
141
+ *
142
+ * In the event that a user changes the settings from granted to denied, the application
143
+ * will restart and any notification scheduled with an exact alarm will be deleted.
144
+ *
145
+ * On Android < 12, the user will NOT be directed to the application settings screen, instead this function will
146
+ * return `granted`.
147
+ *
148
+ * Only available on Android.
149
+ *
150
+ * @since 6.0.0
151
+ */
152
+ changeExactNotificationSetting(): Promise<SettingsPermissionStatus>;
153
+ /**
154
+ * Check application setting for using exact alarms.
155
+ *
156
+ * Only available on Android.
157
+ *
158
+ * @since 6.0.0
159
+ */
160
+ checkExactNotificationSetting(): Promise<SettingsPermissionStatus>;
139
161
  /**
140
162
  * Listen for when notifications are displayed.
141
163
  *
@@ -745,6 +767,14 @@ export interface PermissionStatus {
745
767
  */
746
768
  display: PermissionState;
747
769
  }
770
+ export interface SettingsPermissionStatus {
771
+ /**
772
+ * Permission state of using exact alarms.
773
+ *
774
+ * @since 6.0.0
775
+ */
776
+ exact_alarm: PermissionState;
777
+ }
748
778
  export interface ActionPerformed {
749
779
  /**
750
780
  * The identifier of the performed action.
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC;AA0jCxC;;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 * Get a list of notifications that are visible on the notifications screen.\n *\n * @since 4.0.0\n */\n getDeliveredNotifications(): Promise<DeliveredNotifications>;\n\n /**\n * Remove the specified notifications from the notifications screen.\n *\n * @since 4.0.0\n */\n removeDeliveredNotifications(\n delivered: DeliveredNotifications,\n ): Promise<void>;\n\n /**\n * Remove all the notifications from the notifications screen.\n *\n * @since 4.0.0\n */\n removeAllDeliveredNotifications(): Promise<void>;\n\n /**\n * Create a notification channel.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n createChannel(channel: Channel): Promise<void>;\n\n /**\n * Delete a notification channel.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n deleteChannel(args: { id: string }): 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>;\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>;\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 * On Android it's a 32-bit int.\n * So the value should be between -2147483648 and 2147483647 inclusive.\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.\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 DeliveredNotificationSchema {\n /**\n * The notification identifier.\n *\n * @since 4.0.0\n */\n id: number;\n\n /**\n * The notification tag.\n *\n * Only available on Android.\n *\n * @since 4.0.0\n */\n tag?: string;\n /**\n * The title of the notification.\n *\n * @since 4.0.0\n */\n title: string;\n\n /**\n * The body of the notification, shown below the title.\n *\n * @since 4.0.0\n */\n body: string;\n\n /**\n * The configured group of the notification.\n *\n *\n * Only available for Android.\n *\n * @since 4.0.0\n */\n group?: string;\n\n /**\n * If this notification is the summary for a group of notifications.\n *\n * Only available for Android.\n *\n * @since 4.0.0\n */\n groupSummary?: boolean;\n\n /**\n * Any additional data that was included in the\n * notification payload.\n *\n * Only available for Android.\n *\n * @since 4.0.0\n */\n data?: any;\n\n /**\n * Extra data to store within this notification.\n *\n * Only available for iOS.\n *\n * @since 4.0.0\n */\n extra?: any;\n\n /**\n * The attachments for this notification.\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n attachments?: Attachment[];\n\n /**\n * Action type ssociated with this notification.\n *\n * Only available for iOS.\n *\n * @since 4.0.0\n */\n actionTypeId?: string;\n\n /**\n * Schedule used to fire this notification.\n *\n * Only available for iOS.\n *\n * @since 4.0.0\n */\n schedule?: Schedule;\n\n /**\n * Sound that was used when the notification was displayed.\n *\n * Only available for iOS.\n *\n * @since 4.0.0\n */\n sound?: string;\n}\n\nexport interface DeliveredNotifications {\n /**\n * List of notifications that are visible on the\n * notifications screen.\n *\n * @since 1.0.0\n */\n notifications: DeliveredNotificationSchema[];\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 * @default `3`\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"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC;AA2lCxC;;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 * Get a list of notifications that are visible on the notifications screen.\n *\n * @since 4.0.0\n */\n getDeliveredNotifications(): Promise<DeliveredNotifications>;\n\n /**\n * Remove the specified notifications from the notifications screen.\n *\n * @since 4.0.0\n */\n removeDeliveredNotifications(\n delivered: DeliveredNotifications,\n ): Promise<void>;\n\n /**\n * Remove all the notifications from the notifications screen.\n *\n * @since 4.0.0\n */\n removeAllDeliveredNotifications(): Promise<void>;\n\n /**\n * Create a notification channel.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n createChannel(channel: Channel): Promise<void>;\n\n /**\n * Delete a notification channel.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n deleteChannel(args: { id: string }): 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 * Direct user to the application settings screen to configure exact alarms.\n *\n * In the event that a user changes the settings from granted to denied, the application\n * will restart and any notification scheduled with an exact alarm will be deleted.\n *\n * On Android < 12, the user will NOT be directed to the application settings screen, instead this function will\n * return `granted`.\n *\n * Only available on Android.\n *\n * @since 6.0.0\n */\n changeExactNotificationSetting(): Promise<SettingsPermissionStatus>;\n\n /**\n * Check application setting for using exact alarms.\n *\n * Only available on Android.\n *\n * @since 6.0.0\n */\n checkExactNotificationSetting(): Promise<SettingsPermissionStatus>;\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>;\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>;\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 * On Android it's a 32-bit int.\n * So the value should be between -2147483648 and 2147483647 inclusive.\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.\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 SettingsPermissionStatus {\n /**\n * Permission state of using exact alarms.\n *\n * @since 6.0.0\n */\n exact_alarm: 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 DeliveredNotificationSchema {\n /**\n * The notification identifier.\n *\n * @since 4.0.0\n */\n id: number;\n\n /**\n * The notification tag.\n *\n * Only available on Android.\n *\n * @since 4.0.0\n */\n tag?: string;\n /**\n * The title of the notification.\n *\n * @since 4.0.0\n */\n title: string;\n\n /**\n * The body of the notification, shown below the title.\n *\n * @since 4.0.0\n */\n body: string;\n\n /**\n * The configured group of the notification.\n *\n *\n * Only available for Android.\n *\n * @since 4.0.0\n */\n group?: string;\n\n /**\n * If this notification is the summary for a group of notifications.\n *\n * Only available for Android.\n *\n * @since 4.0.0\n */\n groupSummary?: boolean;\n\n /**\n * Any additional data that was included in the\n * notification payload.\n *\n * Only available for Android.\n *\n * @since 4.0.0\n */\n data?: any;\n\n /**\n * Extra data to store within this notification.\n *\n * Only available for iOS.\n *\n * @since 4.0.0\n */\n extra?: any;\n\n /**\n * The attachments for this notification.\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n attachments?: Attachment[];\n\n /**\n * Action type ssociated with this notification.\n *\n * Only available for iOS.\n *\n * @since 4.0.0\n */\n actionTypeId?: string;\n\n /**\n * Schedule used to fire this notification.\n *\n * Only available for iOS.\n *\n * @since 4.0.0\n */\n schedule?: Schedule;\n\n /**\n * Sound that was used when the notification was displayed.\n *\n * Only available for iOS.\n *\n * @since 4.0.0\n */\n sound?: string;\n}\n\nexport interface DeliveredNotifications {\n /**\n * List of notifications that are visible on the\n * notifications screen.\n *\n * @since 1.0.0\n */\n notifications: DeliveredNotificationSchema[];\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 * @default `3`\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/web.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
2
  import type { PermissionState } from '@capacitor/core';
3
- import type { DeliveredNotifications, EnabledResult, ListChannelsResult, LocalNotificationSchema, LocalNotificationsPlugin, PendingResult, PermissionStatus, ScheduleOptions, ScheduleResult } from './definitions';
3
+ import type { DeliveredNotifications, EnabledResult, ListChannelsResult, LocalNotificationSchema, LocalNotificationsPlugin, PendingResult, PermissionStatus, ScheduleOptions, ScheduleResult, SettingsPermissionStatus } from './definitions';
4
4
  export declare class LocalNotificationsWeb extends WebPlugin implements LocalNotificationsPlugin {
5
5
  protected pending: LocalNotificationSchema[];
6
6
  protected deliveredNotifications: Notification[];
@@ -15,6 +15,8 @@ export declare class LocalNotificationsWeb extends WebPlugin implements LocalNot
15
15
  registerActionTypes(): Promise<void>;
16
16
  cancel(pending: ScheduleResult): Promise<void>;
17
17
  areEnabled(): Promise<EnabledResult>;
18
+ changeExactNotificationSetting(): Promise<SettingsPermissionStatus>;
19
+ checkExactNotificationSetting(): Promise<SettingsPermissionStatus>;
18
20
  requestPermissions(): Promise<PermissionStatus>;
19
21
  checkPermissions(): Promise<PermissionStatus>;
20
22
  protected hasNotificationSupport: () => boolean;
package/dist/esm/web.js CHANGED
@@ -89,6 +89,12 @@ export class LocalNotificationsWeb extends WebPlugin {
89
89
  value: display === 'granted',
90
90
  };
91
91
  }
92
+ async changeExactNotificationSetting() {
93
+ throw this.unimplemented('Not implemented on web.');
94
+ }
95
+ async checkExactNotificationSetting() {
96
+ throw this.unimplemented('Not implemented on web.');
97
+ }
92
98
  async requestPermissions() {
93
99
  if (!this.hasNotificationSupport()) {
94
100
  throw this.unavailable('Notifications not supported in this browser.');
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAe5C,MAAM,OAAO,qBACX,SAAQ,SAAS;IADnB;;QAIY,YAAO,GAA8B,EAAE,CAAC;QACxC,2BAAsB,GAAmB,EAAE,CAAC;QAgH5C,2BAAsB,GAAG,GAAY,EAAE;YAC/C,IAAI,CAAC,CAAC,cAAc,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAE;gBAClE,OAAO,KAAK,CAAC;aACd;YAED,IAAI,YAAY,CAAC,UAAU,KAAK,SAAS,EAAE;gBACzC,2EAA2E;gBAC3E,iEAAiE;gBACjE,IAAI;oBACF,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC;iBACtB;gBAAC,OAAO,CAAC,EAAE;oBACV,IAAI,CAAC,CAAC,IAAI,IAAI,WAAW,EAAE;wBACzB,OAAO,KAAK,CAAC;qBACd;iBACF;aACF;YAED,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IAwFJ,CAAC;IAxNC,KAAK,CAAC,yBAAyB;QAC7B,MAAM,gBAAgB,GAAG,EAAE,CAAC;QAC5B,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,sBAAsB,EAAE;YACtD,MAAM,eAAe,GAA4B;gBAC/C,KAAK,EAAE,YAAY,CAAC,KAAK;gBACzB,EAAE,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC;gBAC9B,IAAI,EAAE,YA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in } from '@capacitor/core';\nimport type { PermissionState } from '@capacitor/core';\n\nimport type {\n DeliveredNotifications,\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 protected deliveredNotifications: Notification[] = [];\n\n async getDeliveredNotifications(): Promise<DeliveredNotifications> {\n const deliveredSchemas = [];\n for (const notification of this.deliveredNotifications) {\n const deliveredSchema: LocalNotificationSchema = {\n title: notification.title,\n id: parseInt(notification.tag),\n body: notification.body,\n };\n deliveredSchemas.push(deliveredSchema);\n }\n return {\n notifications: deliveredSchemas,\n };\n }\n async removeDeliveredNotifications(\n delivered: DeliveredNotifications,\n ): Promise<void> {\n for (const toRemove of delivered.notifications) {\n const found = this.deliveredNotifications.find(\n n => n.tag === String(toRemove.id),\n );\n found?.close();\n this.deliveredNotifications = this.deliveredNotifications.filter(\n () => !found,\n );\n }\n }\n async removeAllDeliveredNotifications(): Promise<void> {\n for (const notification of this.deliveredNotifications) {\n notification.close();\n }\n this.deliveredNotifications = [];\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 tag: String(notification.id),\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 localNotification.addEventListener(\n 'close',\n () => {\n this.deliveredNotifications = this.deliveredNotifications.filter(\n () => !this,\n );\n },\n false,\n );\n this.deliveredNotifications.push(localNotification);\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"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAgB5C,MAAM,OAAO,qBACX,SAAQ,SAAS;IADnB;;QAIY,YAAO,GAA8B,EAAE,CAAC;QACxC,2BAAsB,GAAmB,EAAE,CAAC;QAwH5C,2BAAsB,GAAG,GAAY,EAAE;YAC/C,IAAI,CAAC,CAAC,cAAc,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAE;gBAClE,OAAO,KAAK,CAAC;aACd;YAED,IAAI,YAAY,CAAC,UAAU,KAAK,SAAS,EAAE;gBACzC,2EAA2E;gBAC3E,iEAAiE;gBACjE,IAAI;oBACF,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC;iBACtB;gBAAC,OAAO,CAAC,EAAE;oBACV,IAAI,CAAC,CAAC,IAAI,IAAI,WAAW,EAAE;wBACzB,OAAO,KAAK,CAAC;qBACd;iBACF;aACF;YAED,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IAwFJ,CAAC;IAhOC,KAAK,CAAC,yBAAyB;QAC7B,MAAM,gBAAgB,GAAG,EAAE,CAAC;QAC5B,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,sBAAsB,EAAE;YACtD,MAAM,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O,iBAAiB,CAAC;IAC3B,CAAC;IAES,OAAO,CAAC,YAAqC;QACrD,MAAM,IAAI,GAAG;YACX,QAAQ,EAAE,KAAK;YACf,YAAY;SACb,CAAC;QACF,IAAI,CAAC,eAAe,CAAC,kCAAkC,EAAE,IAAI,CAAC,CAAC;IACjE,CAAC;IAES,MAAM,CAAC,YAAqC;QACpD,IAAI,CAAC,eAAe,CAAC,2BAA2B,EAAE,YAAY,CAAC,CAAC;IAClE,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { PermissionState } from '@capacitor/core';\n\nimport type {\n DeliveredNotifications,\n EnabledResult,\n ListChannelsResult,\n LocalNotificationSchema,\n LocalNotificationsPlugin,\n PendingResult,\n PermissionStatus,\n ScheduleOptions,\n ScheduleResult,\n SettingsPermissionStatus,\n} from './definitions';\n\nexport class LocalNotificationsWeb\n extends WebPlugin\n implements LocalNotificationsPlugin\n{\n protected pending: LocalNotificationSchema[] = [];\n protected deliveredNotifications: Notification[] = [];\n\n async getDeliveredNotifications(): Promise<DeliveredNotifications> {\n const deliveredSchemas = [];\n for (const notification of this.deliveredNotifications) {\n const deliveredSchema: LocalNotificationSchema = {\n title: notification.title,\n id: parseInt(notification.tag),\n body: notification.body,\n };\n deliveredSchemas.push(deliveredSchema);\n }\n return {\n notifications: deliveredSchemas,\n };\n }\n async removeDeliveredNotifications(\n delivered: DeliveredNotifications,\n ): Promise<void> {\n for (const toRemove of delivered.notifications) {\n const found = this.deliveredNotifications.find(\n n => n.tag === String(toRemove.id),\n );\n found?.close();\n this.deliveredNotifications = this.deliveredNotifications.filter(\n () => !found,\n );\n }\n }\n async removeAllDeliveredNotifications(): Promise<void> {\n for (const notification of this.deliveredNotifications) {\n notification.close();\n }\n this.deliveredNotifications = [];\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 changeExactNotificationSetting(): Promise<SettingsPermissionStatus> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async checkExactNotificationSetting(): Promise<SettingsPermissionStatus> {\n throw this.unimplemented('Not implemented on web.');\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 tag: String(notification.id),\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 localNotification.addEventListener(\n 'close',\n () => {\n this.deliveredNotifications = this.deliveredNotifications.filter(\n () => !this,\n );\n },\n false,\n );\n this.deliveredNotifications.push(localNotification);\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"]}
@@ -113,6 +113,12 @@ class LocalNotificationsWeb extends core.WebPlugin {
113
113
  value: display === 'granted',
114
114
  };
115
115
  }
116
+ async changeExactNotificationSetting() {
117
+ throw this.unimplemented('Not implemented on web.');
118
+ }
119
+ async checkExactNotificationSetting() {
120
+ throw this.unimplemented('Not implemented on web.');
121
+ }
116
122
  async requestPermissions() {
117
123
  if (!this.hasNotificationSupport()) {
118
124
  throw this.unavailable('Notifications not supported in this browser.');
@@ -1 +1 @@
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.deliveredNotifications = [];\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 getDeliveredNotifications() {\n const deliveredSchemas = [];\n for (const notification of this.deliveredNotifications) {\n const deliveredSchema = {\n title: notification.title,\n id: parseInt(notification.tag),\n body: notification.body,\n };\n deliveredSchemas.push(deliveredSchema);\n }\n return {\n notifications: deliveredSchemas,\n };\n }\n async removeDeliveredNotifications(delivered) {\n for (const toRemove of delivered.notifications) {\n const found = this.deliveredNotifications.find(n => n.tag === String(toRemove.id));\n found === null || found === void 0 ? void 0 : found.close();\n this.deliveredNotifications = this.deliveredNotifications.filter(() => !found);\n }\n }\n async removeAllDeliveredNotifications() {\n for (const notification of this.deliveredNotifications) {\n notification.close();\n }\n this.deliveredNotifications = [];\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 tag: String(notification.id),\n });\n localNotification.addEventListener('click', this.onClick.bind(this, notification), false);\n localNotification.addEventListener('show', this.onShow.bind(this, notification), false);\n localNotification.addEventListener('close', () => {\n this.deliveredNotifications = this.deliveredNotifications.filter(() => !this);\n }, false);\n this.deliveredNotifications.push(localNotification);\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,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;AAClD,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;AAC9C,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;AAClD,CAAC,EAAEA,eAAO,KAAKA,eAAO,GAAG,EAAE,CAAC,CAAC;;ACZxB,MAAC,kBAAkB,GAAGC,mBAAc,C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B,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,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM;AAC1D,YAAY,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC1F,SAAS,EAAE,KAAK,CAAC,CAAC;AAClB,QAAQ,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;AAC5D,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.deliveredNotifications = [];\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 getDeliveredNotifications() {\n const deliveredSchemas = [];\n for (const notification of this.deliveredNotifications) {\n const deliveredSchema = {\n title: notification.title,\n id: parseInt(notification.tag),\n body: notification.body,\n };\n deliveredSchemas.push(deliveredSchema);\n }\n return {\n notifications: deliveredSchemas,\n };\n }\n async removeDeliveredNotifications(delivered) {\n for (const toRemove of delivered.notifications) {\n const found = this.deliveredNotifications.find(n => n.tag === String(toRemove.id));\n found === null || found === void 0 ? void 0 : found.close();\n this.deliveredNotifications = this.deliveredNotifications.filter(() => !found);\n }\n }\n async removeAllDeliveredNotifications() {\n for (const notification of this.deliveredNotifications) {\n notification.close();\n }\n this.deliveredNotifications = [];\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 changeExactNotificationSetting() {\n throw this.unimplemented('Not implemented on web.');\n }\n async checkExactNotificationSetting() {\n throw this.unimplemented('Not implemented on web.');\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 tag: String(notification.id),\n });\n localNotification.addEventListener('click', this.onClick.bind(this, notification), false);\n localNotification.addEventListener('show', this.onShow.bind(this, notification), false);\n localNotification.addEventListener('close', () => {\n this.deliveredNotifications = this.deliveredNotifications.filter(() => !this);\n }, false);\n this.deliveredNotifications.push(localNotification);\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,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;AAClD,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;AAC9C,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;AAClD,CAAC,EAAEA,eAAO,KAAKA,eAAO,GAAG,EAAE,CAAC,CAAC;;ACZxB,MAAC,kBAAkB,GAAGC,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,SA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;AACxC,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,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM;AAC1D,YAAY,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC1F,SAAS,EAAE,KAAK,CAAC,CAAC;AAClB,QAAQ,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;AAC5D,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
@@ -110,6 +110,12 @@ var capacitorLocalNotifications = (function (exports, core) {
110
110
  value: display === 'granted',
111
111
  };
112
112
  }
113
+ async changeExactNotificationSetting() {
114
+ throw this.unimplemented('Not implemented on web.');
115
+ }
116
+ async checkExactNotificationSetting() {
117
+ throw this.unimplemented('Not implemented on web.');
118
+ }
113
119
  async requestPermissions() {
114
120
  if (!this.hasNotificationSupport()) {
115
121
  throw this.unavailable('Notifications not supported in this browser.');
@@ -1 +1 @@
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.deliveredNotifications = [];\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 getDeliveredNotifications() {\n const deliveredSchemas = [];\n for (const notification of this.deliveredNotifications) {\n const deliveredSchema = {\n title: notification.title,\n id: parseInt(notification.tag),\n body: notification.body,\n };\n deliveredSchemas.push(deliveredSchema);\n }\n return {\n notifications: deliveredSchemas,\n };\n }\n async removeDeliveredNotifications(delivered) {\n for (const toRemove of delivered.notifications) {\n const found = this.deliveredNotifications.find(n => n.tag === String(toRemove.id));\n found === null || found === void 0 ? void 0 : found.close();\n this.deliveredNotifications = this.deliveredNotifications.filter(() => !found);\n }\n }\n async removeAllDeliveredNotifications() {\n for (const notification of this.deliveredNotifications) {\n notification.close();\n }\n this.deliveredNotifications = [];\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 tag: String(notification.id),\n });\n localNotification.addEventListener('click', this.onClick.bind(this, notification), false);\n localNotification.addEventListener('show', this.onShow.bind(this, notification), false);\n localNotification.addEventListener('close', () => {\n this.deliveredNotifications = this.deliveredNotifications.filter(() => !this);\n }, false);\n this.deliveredNotifications.push(localNotification);\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,GAAG,UAAU,CAA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AAG,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;IACxC,SAAS,CAAC,CAAC;IACX,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,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM;IAC1D,YAAY,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1F,SAAS,EAAE,KAAK,CAAC,CAAC;IAClB,QAAQ,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC5D,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.deliveredNotifications = [];\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 getDeliveredNotifications() {\n const deliveredSchemas = [];\n for (const notification of this.deliveredNotifications) {\n const deliveredSchema = {\n title: notification.title,\n id: parseInt(notification.tag),\n body: notification.body,\n };\n deliveredSchemas.push(deliveredSchema);\n }\n return {\n notifications: deliveredSchemas,\n };\n }\n async removeDeliveredNotifications(delivered) {\n for (const toRemove of delivered.notifications) {\n const found = this.deliveredNotifications.find(n => n.tag === String(toRemove.id));\n found === null || found === void 0 ? void 0 : found.close();\n this.deliveredNotifications = this.deliveredNotifications.filter(() => !found);\n }\n }\n async removeAllDeliveredNotifications() {\n for (const notification of this.deliveredNotifications) {\n notification.close();\n }\n this.deliveredNotifications = [];\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 changeExactNotificationSetting() {\n throw this.unimplemented('Not implemented on web.');\n }\n async checkExactNotificationSetting() {\n throw this.unimplemented('Not implemented on web.');\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 tag: String(notification.id),\n });\n localNotification.addEventListener('click', this.onClick.bind(this, notification), false);\n localNotification.addEventListener('show', this.onShow.bind(this, notification), false);\n localNotification.addEventListener('close', () => {\n this.deliveredNotifications = this.deliveredNotifications.filter(() => !this);\n }, false);\n this.deliveredNotifications.push(localNotification);\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,GAAG,UAAU,CAAC;IAClD,CAAC,EAAEA,eAAO,KAAKA,eAAO,GAAG,EAAE,CAAC,CAAC;;ACZxB,UAAC,kBAAkB,GAAGC,mBAAc,CAAC,oBAAoB,EAAE;IAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,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AE;IACvE,YAAY,IAAI,EAAE,YAAY,CAAC,IAAI;IACnC,YAAY,GAAG,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;IACxC,SAAS,CAAC,CAAC;IACX,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,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM;IAC1D,YAAY,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1F,SAAS,EAAE,KAAK,CAAC,CAAC;IAClB,QAAQ,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC5D,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;;;;;;;;;;;;;;;;;"}
@@ -25,7 +25,26 @@ enum LocalNotificationError: LocalizedError {
25
25
 
26
26
  // swiftlint:disable type_body_length
27
27
  @objc(LocalNotificationsPlugin)
28
- public class LocalNotificationsPlugin: CAPPlugin {
28
+ public class LocalNotificationsPlugin: CAPPlugin, CAPBridgedPlugin {
29
+ public let identifier = "LocalNotificationsPlugin"
30
+ public let jsName = "LocalNotifications"
31
+ public let pluginMethods: [CAPPluginMethod] = [
32
+ CAPPluginMethod(name: "schedule", returnType: CAPPluginReturnPromise),
33
+ CAPPluginMethod(name: "requestPermissions", returnType: CAPPluginReturnPromise),
34
+ CAPPluginMethod(name: "checkPermissions", returnType: CAPPluginReturnPromise),
35
+ CAPPluginMethod(name: "checkExactNotificationSetting", returnType: CAPPluginReturnPromise),
36
+ CAPPluginMethod(name: "changeExactNotificationSetting", returnType: CAPPluginReturnPromise),
37
+ CAPPluginMethod(name: "cancel", returnType: CAPPluginReturnPromise),
38
+ CAPPluginMethod(name: "getPending", returnType: CAPPluginReturnPromise),
39
+ CAPPluginMethod(name: "registerActionTypes", returnType: CAPPluginReturnPromise),
40
+ CAPPluginMethod(name: "areEnabled", returnType: CAPPluginReturnPromise),
41
+ CAPPluginMethod(name: "getDeliveredNotifications", returnType: CAPPluginReturnPromise),
42
+ CAPPluginMethod(name: "removeAllDeliveredNotifications", returnType: CAPPluginReturnPromise),
43
+ CAPPluginMethod(name: "removeDeliveredNotifications", returnType: CAPPluginReturnPromise),
44
+ CAPPluginMethod(name: "createChannel", returnType: CAPPluginReturnPromise),
45
+ CAPPluginMethod(name: "deleteChannel", returnType: CAPPluginReturnPromise),
46
+ CAPPluginMethod(name: "listChannels", returnType: CAPPluginReturnPromise)
47
+ ]
29
48
  private let notificationDelegationHandler = LocalNotificationsHandler()
30
49
 
31
50
  override public func load() {
@@ -130,6 +149,14 @@ public class LocalNotificationsPlugin: CAPPlugin {
130
149
  }
131
150
  }
132
151
 
152
+ @objc public func checkExactNotificationSetting(_ call: CAPPluginCall) {
153
+ call.unimplemented()
154
+ }
155
+
156
+ @objc public func changeExactNotificationSetting(_ call: CAPPluginCall) {
157
+ call.unimplemented()
158
+ }
159
+
133
160
  /**
134
161
  * Cancel notifications by id
135
162
  */
@@ -0,0 +1,12 @@
1
+ import XCTest
2
+ @testable import LocalNotificationsPlugin
3
+
4
+ final class LocalNotificationsPluginTests: XCTestCase {
5
+ func testExample() throws {
6
+ // XCTest Documentation
7
+ // https://developer.apple.com/documentation/xctest
8
+
9
+ // Defining Test Cases and Test Methods
10
+ // https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods
11
+ }
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/local-notifications",
3
- "version": "6.0.0-alpha.2",
3
+ "version": "6.0.0-beta.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",
@@ -10,7 +10,9 @@
10
10
  "android/src/main/",
11
11
  "android/build.gradle",
12
12
  "dist/",
13
- "ios/Plugin/",
13
+ "ios/Sources",
14
+ "ios/Tests",
15
+ "Package.swift",
14
16
  "CapacitorLocalNotifications.podspec"
15
17
  ],
16
18
  "author": "Ionic <hi@ionicframework.com>",
@@ -29,7 +31,7 @@
29
31
  ],
30
32
  "scripts": {
31
33
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
32
- "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
34
+ "verify:ios": "xcodebuild build -scheme CapacitorLocalNotifications -sdk iphonesimulator17.0 -destination 'OS=17.0,name=iPhone 15'",
33
35
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
34
36
  "verify:web": "npm run build",
35
37
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
@@ -80,5 +82,5 @@
80
82
  "publishConfig": {
81
83
  "access": "public"
82
84
  },
83
- "gitHead": "af95940154b4286542e776f348c58faccbf16803"
85
+ "gitHead": "6e31d104334377cbaafe67a1fe58e252dba79c04"
84
86
  }
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>$(DEVELOPMENT_LANGUAGE)</string>
7
- <key>CFBundleExecutable</key>
8
- <string>$(EXECUTABLE_NAME)</string>
9
- <key>CFBundleIdentifier</key>
10
- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
- <key>CFBundleInfoDictionaryVersion</key>
12
- <string>6.0</string>
13
- <key>CFBundleName</key>
14
- <string>$(PRODUCT_NAME)</string>
15
- <key>CFBundlePackageType</key>
16
- <string>FMWK</string>
17
- <key>CFBundleShortVersionString</key>
18
- <string>1.0</string>
19
- <key>CFBundleVersion</key>
20
- <string>$(CURRENT_PROJECT_VERSION)</string>
21
- <key>NSPrincipalClass</key>
22
- <string></string>
23
- </dict>
24
- </plist>
@@ -1,10 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
-
3
- //! Project version number for Plugin.
4
- FOUNDATION_EXPORT double PluginVersionNumber;
5
-
6
- //! Project version string for Plugin.
7
- FOUNDATION_EXPORT const unsigned char PluginVersionString[];
8
-
9
- // In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
10
-
@@ -1,18 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import <Capacitor/Capacitor.h>
3
-
4
- CAP_PLUGIN(LocalNotificationsPlugin, "LocalNotifications",
5
- CAP_PLUGIN_METHOD(schedule, CAPPluginReturnPromise);
6
- CAP_PLUGIN_METHOD(requestPermissions, CAPPluginReturnPromise);
7
- CAP_PLUGIN_METHOD(checkPermissions, CAPPluginReturnPromise);
8
- CAP_PLUGIN_METHOD(cancel, CAPPluginReturnPromise);
9
- CAP_PLUGIN_METHOD(getPending, CAPPluginReturnPromise);
10
- CAP_PLUGIN_METHOD(registerActionTypes, CAPPluginReturnPromise);
11
- CAP_PLUGIN_METHOD(areEnabled, CAPPluginReturnPromise);
12
- CAP_PLUGIN_METHOD(getDeliveredNotifications, CAPPluginReturnPromise);
13
- CAP_PLUGIN_METHOD(removeAllDeliveredNotifications, CAPPluginReturnPromise);
14
- CAP_PLUGIN_METHOD(removeDeliveredNotifications, CAPPluginReturnPromise);
15
- CAP_PLUGIN_METHOD(createChannel, CAPPluginReturnPromise);
16
- CAP_PLUGIN_METHOD(deleteChannel, CAPPluginReturnPromise);
17
- CAP_PLUGIN_METHOD(listChannels, CAPPluginReturnPromise);
18
- )