@capacitor/local-notifications 1.1.0 → 4.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,56 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 4.0.0-beta.0 (2022-06-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **local-notifications:** Add FLAG_MUTABLE to pending intents for SDK 31 support ([#914](https://github.com/ionic-team/capacitor-plugins/issues/914)) ([9ad0ce6](https://github.com/ionic-team/capacitor-plugins/commit/9ad0ce6f1497f425db907908be1b125e6ed83dbc))
12
+ * **local-notifications:** Handle case of not allowed exact notifications ([#954](https://github.com/ionic-team/capacitor-plugins/issues/954)) ([5016996](https://github.com/ionic-team/capacitor-plugins/commit/5016996b3a4e9824d8dd2bc4c71892fc5dbc7365))
13
+ * correct addListeners links ([#655](https://github.com/ionic-team/capacitor-plugins/issues/655)) ([f9871e7](https://github.com/ionic-team/capacitor-plugins/commit/f9871e7bd53478addb21155e148829f550c0e457))
14
+ * inline source code in esm map files ([#760](https://github.com/ionic-team/capacitor-plugins/issues/760)) ([a960489](https://github.com/ionic-team/capacitor-plugins/commit/a960489a19db0182b90d187a50deff9dfbe51038))
15
+ * Make removeAllListeners return a promise ([#895](https://github.com/ionic-team/capacitor-plugins/issues/895)) ([e5c49d6](https://github.com/ionic-team/capacitor-plugins/commit/e5c49d64445dca70286334e6a0441d8021197b13))
16
+ * remove postpublish scripts ([#656](https://github.com/ionic-team/capacitor-plugins/issues/656)) ([ed6ac49](https://github.com/ionic-team/capacitor-plugins/commit/ed6ac499ebf4a47525071ccbfc36c27503e11f60))
17
+ * **android:** fire localNotificationReceived event on Android ([#217](https://github.com/ionic-team/capacitor-plugins/issues/217)) ([d97682d](https://github.com/ionic-team/capacitor-plugins/commit/d97682d9f3d6f612993716c3bc35d3015c4e0c07))
18
+ * **local-notification:** Throw unavailable if Notification API not supported ([#285](https://github.com/ionic-team/capacitor-plugins/issues/285)) ([a90a88b](https://github.com/ionic-team/capacitor-plugins/commit/a90a88b217f5fa2a257416050afb476dd84d8051))
19
+ * **local-notifications:** Adding check for `new Notification` support ([#295](https://github.com/ionic-team/capacitor-plugins/issues/295)) ([a806f22](https://github.com/ionic-team/capacitor-plugins/commit/a806f22577209322bdc93ef7fe5490d3b0b6e42f))
20
+ * **local-notifications:** Checking for null schedule in notification JSObject ([#258](https://github.com/ionic-team/capacitor-plugins/issues/258)) ([73cb416](https://github.com/ionic-team/capacitor-plugins/commit/73cb4168329622bb5a6625c900090a01fc5eca99))
21
+ * **local-notifications:** don't store notifications if not scheduled ([#310](https://github.com/ionic-team/capacitor-plugins/issues/310)) ([c1445fd](https://github.com/ionic-team/capacitor-plugins/commit/c1445fddc69db27506f83b3ea56d8e90d4384346))
22
+ * **local-notifications:** extra not being returned on notification events ([#340](https://github.com/ionic-team/capacitor-plugins/issues/340)) ([5b03a7f](https://github.com/ionic-team/capacitor-plugins/commit/5b03a7fdbfd2e8293a9fc3726185b516d7efa9a9))
23
+ * **local-notifications:** Make getPending not return already fired notifications ([#256](https://github.com/ionic-team/capacitor-plugins/issues/256)) ([fb96f8a](https://github.com/ionic-team/capacitor-plugins/commit/fb96f8ab8c4776528e5825be6c2e19567462eef8))
24
+ * **local-notifications:** Opt out of Capacitor date serialization ([#264](https://github.com/ionic-team/capacitor-plugins/issues/264)) ([6e447d5](https://github.com/ionic-team/capacitor-plugins/commit/6e447d54aff3cac47df540addf2a0bf05238c158))
25
+ * **local-notifications:** requestPermissions and checkPermissions return if enabled ([#494](https://github.com/ionic-team/capacitor-plugins/issues/494)) ([555bb1f](https://github.com/ionic-team/capacitor-plugins/commit/555bb1f9bd02ccd999891a316e7ee0f8c1844e92))
26
+ * **local-notifications:** return schedule on as object ([#603](https://github.com/ionic-team/capacitor-plugins/issues/603)) ([ca34b01](https://github.com/ionic-team/capacitor-plugins/commit/ca34b01c73f14bb0ad14e8a501210e42a0e65b04))
27
+ * **local-notifications:** Throw errors if missing mandatory channel fields ([#577](https://github.com/ionic-team/capacitor-plugins/issues/577)) ([6bf3a4f](https://github.com/ionic-team/capacitor-plugins/commit/6bf3a4f0de8880588200ae60e73427fa6959ea20))
28
+ * **local-notifications:** use proper rollup config ([#528](https://github.com/ionic-team/capacitor-plugins/issues/528)) ([cd17daa](https://github.com/ionic-team/capacitor-plugins/commit/cd17daa02241f50299232212ad72722d8a35ee16))
29
+ * normalize use of integers for notification IDs ([#195](https://github.com/ionic-team/capacitor-plugins/issues/195)) ([b56e111](https://github.com/ionic-team/capacitor-plugins/commit/b56e1118227ee58d1872dbb32a18b8484290d3c7))
30
+ * **web:** fix scheduled notifications not being sent ([#220](https://github.com/ionic-team/capacitor-plugins/issues/220)) ([c8e92d6](https://github.com/ionic-team/capacitor-plugins/commit/c8e92d6a178f8b3278b1d3a9c364eb8120d28848))
31
+ * add es2017 lib to tsconfig ([#180](https://github.com/ionic-team/capacitor-plugins/issues/180)) ([2c3776c](https://github.com/ionic-team/capacitor-plugins/commit/2c3776c38ca025c5ee965dec10ccf1cdb6c02e2f))
32
+ * Use the event names from Capacitor 2 ([#215](https://github.com/ionic-team/capacitor-plugins/issues/215)) ([008fe9e](https://github.com/ionic-team/capacitor-plugins/commit/008fe9e9bf6a960b0ab7b6fc4d5014f10ba13df8))
33
+
34
+
35
+ ### Features
36
+
37
+ * set targetSDK default value to 31 ([#824](https://github.com/ionic-team/capacitor-plugins/issues/824)) ([3ee10de](https://github.com/ionic-team/capacitor-plugins/commit/3ee10de98067984c1a4e75295d001c5a895c47f4))
38
+ * set targetSDK default value to 32 ([#970](https://github.com/ionic-team/capacitor-plugins/issues/970)) ([fa70d96](https://github.com/ionic-team/capacitor-plugins/commit/fa70d96f141af751aae53ceb5642c46b204f5958))
39
+ * Upgrade gradle to 7.4 ([#826](https://github.com/ionic-team/capacitor-plugins/issues/826)) ([5db0906](https://github.com/ionic-team/capacitor-plugins/commit/5db0906f6264287c4f8e69dbaecf19d4d387824b))
40
+ * Use java 11 ([#910](https://github.com/ionic-team/capacitor-plugins/issues/910)) ([5acb2a2](https://github.com/ionic-team/capacitor-plugins/commit/5acb2a288a413492b163e4e97da46a085d9e4be0))
41
+ * **android:** implements Activity Result API changes for permissions and activity results ([#222](https://github.com/ionic-team/capacitor-plugins/issues/222)) ([f671b9f](https://github.com/ionic-team/capacitor-plugins/commit/f671b9f4b472806ef43db6dcf302d4503cf1828c))
42
+ * **local-notifications:** add more info to pending notifications ([#211](https://github.com/ionic-team/capacitor-plugins/issues/211)) ([7c50487](https://github.com/ionic-team/capacitor-plugins/commit/7c50487d40836380a27bd4c8d3655d83e0c3a720))
43
+ * **local-notifications:** Add weekday scheduling support for Android and iOS ([#756](https://github.com/ionic-team/capacitor-plugins/issues/756)) ([430b485](https://github.com/ionic-team/capacitor-plugins/commit/430b48592ce59ccc967dd9a081873d7dc3937e93))
44
+ * **local-notifications:** Adding summary text to grouped notifications ([#296](https://github.com/ionic-team/capacitor-plugins/issues/296)) ([f625bd2](https://github.com/ionic-team/capacitor-plugins/commit/f625bd28bc00dbd0b51d7bdecf5e6f3077dcc7a9))
45
+ * **local-notifications:** Fire local notifications while app is idle ([#237](https://github.com/ionic-team/capacitor-plugins/issues/237)) ([43380ef](https://github.com/ionic-team/capacitor-plugins/commit/43380efa8901adf9d669d0c1ef20038a2fd7df8e))
46
+ * **local-notifications:** Support for Big Text and Inbox Notification Style ([#280](https://github.com/ionic-team/capacitor-plugins/issues/280)) ([dc96ef9](https://github.com/ionic-team/capacitor-plugins/commit/dc96ef923725f5b53346431d35f82d5ff13f4e17))
47
+ * **local-notifications:** Support setting seconds in Schedule "on" ([#253](https://github.com/ionic-team/capacitor-plugins/issues/253)) ([4ec8d06](https://github.com/ionic-team/capacitor-plugins/commit/4ec8d06e0cb52403e541a05e5c3518d4c5ea754e))
48
+ * **web:** implement ActionPerformed and Received events ([#219](https://github.com/ionic-team/capacitor-plugins/issues/219)) ([e062901](https://github.com/ionic-team/capacitor-plugins/commit/e062901fc2e55cf6b6dc1ab20258d80a0be8b2d9))
49
+ * add commonjs output format ([#179](https://github.com/ionic-team/capacitor-plugins/issues/179)) ([8e9e098](https://github.com/ionic-team/capacitor-plugins/commit/8e9e09862064b3f6771d7facbc4008e995d9b463))
50
+ * Local Notifications plugin ([#94](https://github.com/ionic-team/capacitor-plugins/issues/94)) ([e59ba9c](https://github.com/ionic-team/capacitor-plugins/commit/e59ba9ceea78a26ec60e521825f228baa9d74577))
51
+
52
+
53
+
54
+
55
+
6
56
  # [1.1.0](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/local-notifications@1.0.10...@capacitor/local-notifications@1.1.0) (2022-01-19)
7
57
 
8
58
 
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
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
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'local-notifications/ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '12.0'
14
+ s.ios.deployment_target = '13.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
17
17
  end
package/README.md CHANGED
@@ -9,6 +9,16 @@ npm install @capacitor/local-notifications
9
9
  npx cap sync
10
10
  ```
11
11
 
12
+ ## Android
13
+
14
+ Starting on Android 12, scheduled notifications won't be exact unless this permission is added to your `AndroidManifest.xml`:
15
+
16
+ ```xml
17
+ <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
18
+ ```
19
+
20
+ Note that even if the permission is present, users can still disable exact notifications from the app settings.
21
+
12
22
  ## Configuration
13
23
 
14
24
  <docgen-config>
@@ -178,7 +188,7 @@ Check if notifications are enabled or not.
178
188
  ### createChannel(...)
179
189
 
180
190
  ```typescript
181
- createChannel(channel: NotificationChannel) => Promise<void>
191
+ createChannel(channel: Channel) => Promise<void>
182
192
  ```
183
193
 
184
194
  Create a notification channel.
@@ -197,16 +207,16 @@ Only available for Android.
197
207
  ### deleteChannel(...)
198
208
 
199
209
  ```typescript
200
- deleteChannel(channel: NotificationChannel) => Promise<void>
210
+ deleteChannel(args: { id: string; }) => Promise<void>
201
211
  ```
202
212
 
203
213
  Delete a notification channel.
204
214
 
205
215
  Only available for Android.
206
216
 
207
- | Param | Type |
208
- | ------------- | ------------------------------------------- |
209
- | **`channel`** | <code><a href="#channel">Channel</a></code> |
217
+ | Param | Type |
218
+ | ---------- | ---------------------------- |
219
+ | **`args`** | <code>{ id: string; }</code> |
210
220
 
211
221
  **Since:** 1.0.0
212
222
 
@@ -539,17 +549,17 @@ An action that can be taken when a notification is displayed.
539
549
 
540
550
  #### Channel
541
551
 
542
- | Prop | Type | Description | Since |
543
- | ----------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
544
- | **`id`** | <code>string</code> | The channel identifier. | 1.0.0 |
545
- | **`name`** | <code>string</code> | The human-friendly name of this channel (presented to the user). | 1.0.0 |
546
- | **`description`** | <code>string</code> | The description of this channel (presented to the user). | 1.0.0 |
547
- | **`sound`** | <code>string</code> | The sound that should be played for notifications posted to this channel. Notification channels with an importance of at least `3` should have a sound. The file name of a sound file should be specified relative to the android app `res/raw` directory. If the sound is not provided, or the sound file is not found no sound will be used. | 1.0.0 |
548
- | **`importance`** | <code><a href="#importance">Importance</a></code> | The level of interruption for notifications posted to this channel. | 1.0.0 |
549
- | **`visibility`** | <code><a href="#visibility">Visibility</a></code> | The visibility of notifications posted to this channel. This setting is for whether notifications posted to this channel appear on the lockscreen or not, and if so, whether they appear in a redacted form. | 1.0.0 |
550
- | **`lights`** | <code>boolean</code> | Whether notifications posted to this channel should display notification lights, on devices that support it. | 1.0.0 |
551
- | **`lightColor`** | <code>string</code> | The light color for notifications posted to this channel. Only supported if lights are enabled on this channel and the device supports it. Supported color formats are `#RRGGBB` and `#RRGGBBAA`. | 1.0.0 |
552
- | **`vibration`** | <code>boolean</code> | Whether notifications posted to this channel should vibrate. | 1.0.0 |
552
+ | Prop | Type | Description | Default | Since |
553
+ | ----------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ----- |
554
+ | **`id`** | <code>string</code> | The channel identifier. | | 1.0.0 |
555
+ | **`name`** | <code>string</code> | The human-friendly name of this channel (presented to the user). | | 1.0.0 |
556
+ | **`description`** | <code>string</code> | The description of this channel (presented to the user). | | 1.0.0 |
557
+ | **`sound`** | <code>string</code> | The sound that should be played for notifications posted to this channel. Notification channels with an importance of at least `3` should have a sound. The file name of a sound file should be specified relative to the android app `res/raw` directory. If the sound is not provided, or the sound file is not found no sound will be used. | | 1.0.0 |
558
+ | **`importance`** | <code><a href="#importance">Importance</a></code> | The level of interruption for notifications posted to this channel. | <code>`3`</code> | 1.0.0 |
559
+ | **`visibility`** | <code><a href="#visibility">Visibility</a></code> | The visibility of notifications posted to this channel. This setting is for whether notifications posted to this channel appear on the lockscreen or not, and if so, whether they appear in a redacted form. | | 1.0.0 |
560
+ | **`lights`** | <code>boolean</code> | Whether notifications posted to this channel should display notification lights, on devices that support it. | | 1.0.0 |
561
+ | **`lightColor`** | <code>string</code> | The light color for notifications posted to this channel. Only supported if lights are enabled on this channel and the device supports it. Supported color formats are `#RRGGBB` and `#RRGGBBAA`. | | 1.0.0 |
562
+ | **`vibration`** | <code>boolean</code> | Whether notifications posted to this channel should vibrate. | | 1.0.0 |
553
563
 
554
564
 
555
565
  #### ListChannelsResult
@@ -590,11 +600,6 @@ An action that can be taken when a notification is displayed.
590
600
  <code>'year' | 'month' | 'two-weeks' | 'week' | 'day' | 'hour' | 'minute' | 'second'</code>
591
601
 
592
602
 
593
- #### NotificationChannel
594
-
595
- <code><a href="#channel">Channel</a></code>
596
-
597
-
598
603
  #### Importance
599
604
 
600
605
  The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)
@@ -1,8 +1,8 @@
1
1
  ext {
2
- junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.1'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2.0'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.2'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.3.0'
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
6
6
  }
7
7
 
8
8
  buildscript {
@@ -11,17 +11,17 @@ buildscript {
11
11
  mavenCentral()
12
12
  }
13
13
  dependencies {
14
- classpath 'com.android.tools.build:gradle:4.2.1'
14
+ classpath 'com.android.tools.build:gradle:7.2.1'
15
15
  }
16
16
  }
17
17
 
18
18
  apply plugin: 'com.android.library'
19
19
 
20
20
  android {
21
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 29
21
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
22
22
  defaultConfig {
23
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
24
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29
23
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
24
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
25
25
  versionCode 1
26
26
  versionName "1.0"
27
27
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -36,15 +36,14 @@ android {
36
36
  abortOnError false
37
37
  }
38
38
  compileOptions {
39
- sourceCompatibility JavaVersion.VERSION_1_8
40
- targetCompatibility JavaVersion.VERSION_1_8
39
+ sourceCompatibility JavaVersion.VERSION_11
40
+ targetCompatibility JavaVersion.VERSION_11
41
41
  }
42
42
  }
43
43
 
44
44
  repositories {
45
45
  google()
46
46
  mavenCentral()
47
- jcenter()
48
47
  }
49
48
 
50
49
 
@@ -22,7 +22,7 @@ import com.getcapacitor.CapConfig;
22
22
  import com.getcapacitor.JSObject;
23
23
  import com.getcapacitor.Logger;
24
24
  import com.getcapacitor.PluginCall;
25
- import com.getcapacitor.android.R;
25
+ import com.getcapacitor.PluginConfig;
26
26
  import com.getcapacitor.plugin.util.AssetUtil;
27
27
  import java.text.SimpleDateFormat;
28
28
  import java.util.Date;
@@ -36,7 +36,6 @@ import org.json.JSONObject;
36
36
  */
37
37
  public class LocalNotificationManager {
38
38
 
39
- private static final String CONFIG_KEY_PREFIX = "plugins.LocalNotifications.";
40
39
  private static int defaultSoundID = AssetUtil.RESOURCE_ID_ZERO_VALUE;
41
40
  private static int defaultSmallIconID = AssetUtil.RESOURCE_ID_ZERO_VALUE;
42
41
  // Action constants
@@ -52,13 +51,13 @@ public class LocalNotificationManager {
52
51
  private Context context;
53
52
  private Activity activity;
54
53
  private NotificationStorage storage;
55
- private CapConfig config;
54
+ private PluginConfig config;
56
55
 
57
56
  public LocalNotificationManager(NotificationStorage notificationStorage, Activity activity, Context context, CapConfig config) {
58
57
  storage = notificationStorage;
59
58
  this.activity = activity;
60
59
  this.context = context;
61
- this.config = config;
60
+ this.config = config.getPluginConfiguration("LocalNotifications");
62
61
  }
63
62
 
64
63
  /**
@@ -223,7 +222,7 @@ public class LocalNotificationManager {
223
222
  mBuilder.setSmallIcon(localNotification.getSmallIcon(context, getDefaultSmallIcon(context)));
224
223
  mBuilder.setLargeIcon(localNotification.getLargeIcon(context));
225
224
 
226
- String iconColor = localNotification.getIconColor(config.getString(CONFIG_KEY_PREFIX + "iconColor"));
225
+ String iconColor = localNotification.getIconColor(config.getString("iconColor"));
227
226
  if (iconColor != null) {
228
227
  try {
229
228
  mBuilder.setColor(Color.parseColor(iconColor));
@@ -253,13 +252,11 @@ public class LocalNotificationManager {
253
252
  private void createActionIntents(LocalNotification localNotification, NotificationCompat.Builder mBuilder) {
254
253
  // Open intent
255
254
  Intent intent = buildIntent(localNotification, DEFAULT_PRESS_ACTION);
256
-
257
- PendingIntent pendingIntent = PendingIntent.getActivity(
258
- context,
259
- localNotification.getId(),
260
- intent,
261
- PendingIntent.FLAG_CANCEL_CURRENT
262
- );
255
+ int flags = PendingIntent.FLAG_CANCEL_CURRENT;
256
+ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
257
+ flags = flags | PendingIntent.FLAG_MUTABLE;
258
+ }
259
+ PendingIntent pendingIntent = PendingIntent.getActivity(context, localNotification.getId(), intent, flags);
263
260
  mBuilder.setContentIntent(pendingIntent);
264
261
 
265
262
  // Build action types
@@ -273,7 +270,7 @@ public class LocalNotificationManager {
273
270
  context,
274
271
  localNotification.getId() + notificationAction.getId().hashCode(),
275
272
  actionIntent,
276
- PendingIntent.FLAG_CANCEL_CURRENT
273
+ flags
277
274
  );
278
275
  NotificationCompat.Action.Builder actionBuilder = new NotificationCompat.Action.Builder(
279
276
  R.drawable.ic_transparent,
@@ -295,7 +292,11 @@ public class LocalNotificationManager {
295
292
  dissmissIntent.putExtra(ACTION_INTENT_KEY, "dismiss");
296
293
  LocalNotificationSchedule schedule = localNotification.getSchedule();
297
294
  dissmissIntent.putExtra(NOTIFICATION_IS_REMOVABLE_KEY, schedule == null || schedule.isRemovable());
298
- PendingIntent deleteIntent = PendingIntent.getBroadcast(context, localNotification.getId(), dissmissIntent, 0);
295
+ flags = 0;
296
+ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
297
+ flags = PendingIntent.FLAG_MUTABLE;
298
+ }
299
+ PendingIntent deleteIntent = PendingIntent.getBroadcast(context, localNotification.getId(), dissmissIntent, flags);
299
300
  mBuilder.setDeleteIntent(deleteIntent);
300
301
  }
301
302
 
@@ -330,12 +331,11 @@ public class LocalNotificationManager {
330
331
  Intent notificationIntent = new Intent(context, TimedNotificationPublisher.class);
331
332
  notificationIntent.putExtra(NOTIFICATION_INTENT_KEY, request.getId());
332
333
  notificationIntent.putExtra(TimedNotificationPublisher.NOTIFICATION_KEY, notification);
333
- PendingIntent pendingIntent = PendingIntent.getBroadcast(
334
- context,
335
- request.getId(),
336
- notificationIntent,
337
- PendingIntent.FLAG_CANCEL_CURRENT
338
- );
334
+ int flags = PendingIntent.FLAG_CANCEL_CURRENT;
335
+ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
336
+ flags = flags | PendingIntent.FLAG_MUTABLE;
337
+ }
338
+ PendingIntent pendingIntent = PendingIntent.getBroadcast(context, request.getId(), notificationIntent, flags);
339
339
 
340
340
  // Schedule at specific time (with repeating support)
341
341
  Date at = schedule.getAt();
@@ -348,11 +348,7 @@ public class LocalNotificationManager {
348
348
  long interval = at.getTime() - new Date().getTime();
349
349
  alarmManager.setRepeating(AlarmManager.RTC, at.getTime(), interval, pendingIntent);
350
350
  } else {
351
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && schedule.allowWhileIdle()) {
352
- alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC, at.getTime(), pendingIntent);
353
- } else {
354
- alarmManager.setExact(AlarmManager.RTC, at.getTime(), pendingIntent);
355
- }
351
+ setExactIfPossible(alarmManager, schedule, at.getTime(), pendingIntent);
356
352
  }
357
353
  return;
358
354
  }
@@ -373,15 +369,31 @@ public class LocalNotificationManager {
373
369
  if (on != null) {
374
370
  long trigger = on.nextTrigger(new Date());
375
371
  notificationIntent.putExtra(TimedNotificationPublisher.CRON_KEY, on.toMatchString());
376
- pendingIntent = PendingIntent.getBroadcast(context, request.getId(), notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
372
+ pendingIntent = PendingIntent.getBroadcast(context, request.getId(), notificationIntent, flags);
373
+ setExactIfPossible(alarmManager, schedule, trigger, pendingIntent);
374
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
375
+ Logger.debug(Logger.tags("LN"), "notification " + request.getId() + " will next fire at " + sdf.format(new Date(trigger)));
376
+ }
377
+ }
378
+
379
+ private void setExactIfPossible(
380
+ AlarmManager alarmManager,
381
+ LocalNotificationSchedule schedule,
382
+ long trigger,
383
+ PendingIntent pendingIntent
384
+ ) {
385
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && !alarmManager.canScheduleExactAlarms()) {
386
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && schedule.allowWhileIdle()) {
387
+ alarmManager.setAndAllowWhileIdle(AlarmManager.RTC, trigger, pendingIntent);
388
+ } else {
389
+ alarmManager.set(AlarmManager.RTC, trigger, pendingIntent);
390
+ }
391
+ } else {
377
392
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && schedule.allowWhileIdle()) {
378
393
  alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC, trigger, pendingIntent);
379
394
  } else {
380
395
  alarmManager.setExact(AlarmManager.RTC, trigger, pendingIntent);
381
396
  }
382
-
383
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
384
- Logger.debug(Logger.tags("LN"), "notification " + request.getId() + " will next fire at " + sdf.format(new Date(trigger)));
385
397
  }
386
398
  }
387
399
 
@@ -399,7 +411,11 @@ public class LocalNotificationManager {
399
411
 
400
412
  private void cancelTimerForNotification(Integer notificationId) {
401
413
  Intent intent = new Intent(context, TimedNotificationPublisher.class);
402
- PendingIntent pi = PendingIntent.getBroadcast(context, notificationId, intent, 0);
414
+ int flags = 0;
415
+ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
416
+ flags = PendingIntent.FLAG_MUTABLE;
417
+ }
418
+ PendingIntent pi = PendingIntent.getBroadcast(context, notificationId, intent, flags);
403
419
  if (pi != null) {
404
420
  AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
405
421
  alarmManager.cancel(pi);
@@ -428,7 +444,7 @@ public class LocalNotificationManager {
428
444
  if (defaultSoundID != AssetUtil.RESOURCE_ID_ZERO_VALUE) return defaultSoundID;
429
445
 
430
446
  int resId = AssetUtil.RESOURCE_ID_ZERO_VALUE;
431
- String soundConfigResourceName = config.getString(CONFIG_KEY_PREFIX + "sound");
447
+ String soundConfigResourceName = config.getString("sound");
432
448
  soundConfigResourceName = AssetUtil.getResourceBaseName(soundConfigResourceName);
433
449
 
434
450
  if (soundConfigResourceName != null) {
@@ -443,7 +459,7 @@ public class LocalNotificationManager {
443
459
  if (defaultSmallIconID != AssetUtil.RESOURCE_ID_ZERO_VALUE) return defaultSmallIconID;
444
460
 
445
461
  int resId = AssetUtil.RESOURCE_ID_ZERO_VALUE;
446
- String smallIconConfigResourceName = config.getString(CONFIG_KEY_PREFIX + "smallIcon");
462
+ String smallIconConfigResourceName = config.getString("smallIcon");
447
463
  smallIconConfigResourceName = AssetUtil.getResourceBaseName(smallIconConfigResourceName);
448
464
 
449
465
  if (smallIconConfigResourceName != null) {
@@ -5,6 +5,7 @@ import static android.os.Build.VERSION.SDK_INT;
5
5
  import android.content.BroadcastReceiver;
6
6
  import android.content.Context;
7
7
  import android.content.Intent;
8
+ import android.os.Build;
8
9
  import android.os.UserManager;
9
10
  import com.getcapacitor.CapConfig;
10
11
  import java.util.ArrayList;
@@ -15,7 +16,7 @@ public class LocalNotificationRestoreReceiver extends BroadcastReceiver {
15
16
 
16
17
  @Override
17
18
  public void onReceive(Context context, Intent intent) {
18
- if (SDK_INT >= 24) {
19
+ if (SDK_INT >= Build.VERSION_CODES.N) {
19
20
  UserManager um = context.getSystemService(UserManager.class);
20
21
  if (um == null || !um.isUserUnlocked()) return;
21
22
  }
@@ -141,7 +141,8 @@ public class LocalNotificationSchedule {
141
141
  public Long getEveryInterval() {
142
142
  switch (every) {
143
143
  case "year":
144
- return count * DateUtils.YEAR_IN_MILLIS;
144
+ // This case is just approximation as not all years have the same number of days
145
+ return count * DateUtils.WEEK_IN_MILLIS * 52;
145
146
  case "month":
146
147
  // This case is just approximation as months have different number of days
147
148
  return count * 30 * DateUtils.DAY_IN_MILLIS;
@@ -54,12 +54,8 @@ public class NotificationChannelManager {
54
54
  call.reject("Channel missing name");
55
55
  return;
56
56
  }
57
- if (call.getInt(CHANNEL_IMPORTANCE) != null) {
58
- channel.put(CHANNEL_IMPORTANCE, call.getInt(CHANNEL_IMPORTANCE));
59
- } else {
60
- call.reject("Channel missing importance");
61
- return;
62
- }
57
+
58
+ channel.put(CHANNEL_IMPORTANCE, call.getInt(CHANNEL_IMPORTANCE, NotificationManager.IMPORTANCE_DEFAULT));
63
59
  channel.put(CHANNEL_DESCRIPTION, call.getString(CHANNEL_DESCRIPTION, ""));
64
60
  channel.put(CHANNEL_VISIBILITY, call.getInt(CHANNEL_VISIBILITY, NotificationCompat.VISIBILITY_PUBLIC));
65
61
  channel.put(CHANNEL_SOUND, call.getString(CHANNEL_SOUND, null));
@@ -7,6 +7,7 @@ import android.app.PendingIntent;
7
7
  import android.content.BroadcastReceiver;
8
8
  import android.content.Context;
9
9
  import android.content.Intent;
10
+ import android.os.Build;
10
11
  import com.getcapacitor.JSObject;
11
12
  import com.getcapacitor.Logger;
12
13
  import java.text.SimpleDateFormat;
@@ -49,7 +50,11 @@ public class TimedNotificationPublisher extends BroadcastReceiver {
49
50
  long trigger = date.nextTrigger(new Date());
50
51
  Intent clone = (Intent) intent.clone();
51
52
  PendingIntent pendingIntent = PendingIntent.getBroadcast(context, id, clone, PendingIntent.FLAG_CANCEL_CURRENT);
52
- alarmManager.setExact(AlarmManager.RTC, trigger, pendingIntent);
53
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && !alarmManager.canScheduleExactAlarms()) {
54
+ alarmManager.set(AlarmManager.RTC, trigger, pendingIntent);
55
+ } else {
56
+ alarmManager.setExact(AlarmManager.RTC, trigger, pendingIntent);
57
+ }
53
58
  SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
54
59
  Logger.debug(Logger.tags("LN"), "notification " + id + " will next fire at " + sdf.format(new Date(trigger)));
55
60
  return true;
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:width="16dp"
4
+ android:height="16dp"
5
+ android:viewportHeight="108"
6
+ android:viewportWidth="108">
7
+
8
+ <path
9
+ android:width="1dp"
10
+ android:color="@android:color/transparent" />
11
+
12
+ </vector>
package/dist/docs.json CHANGED
@@ -115,7 +115,7 @@
115
115
  },
116
116
  {
117
117
  "name": "createChannel",
118
- "signature": "(channel: NotificationChannel) => Promise<void>",
118
+ "signature": "(channel: Channel) => Promise<void>",
119
119
  "parameters": [
120
120
  {
121
121
  "name": "channel",
@@ -132,18 +132,18 @@
132
132
  ],
133
133
  "docs": "Create a notification channel.\n\nOnly available for Android.",
134
134
  "complexTypes": [
135
- "NotificationChannel"
135
+ "Channel"
136
136
  ],
137
137
  "slug": "createchannel"
138
138
  },
139
139
  {
140
140
  "name": "deleteChannel",
141
- "signature": "(channel: NotificationChannel) => Promise<void>",
141
+ "signature": "(args: { id: string; }) => Promise<void>",
142
142
  "parameters": [
143
143
  {
144
- "name": "channel",
144
+ "name": "args",
145
145
  "docs": "",
146
- "type": "Channel"
146
+ "type": "{ id: string; }"
147
147
  }
148
148
  ],
149
149
  "returns": "Promise<void>",
@@ -154,9 +154,7 @@
154
154
  }
155
155
  ],
156
156
  "docs": "Delete a notification channel.\n\nOnly available for Android.",
157
- "complexTypes": [
158
- "NotificationChannel"
159
- ],
157
+ "complexTypes": [],
160
158
  "slug": "deletechannel"
161
159
  },
162
160
  {
@@ -2094,6 +2092,10 @@
2094
2092
  {
2095
2093
  "name": "importance",
2096
2094
  "tags": [
2095
+ {
2096
+ "text": "`3`",
2097
+ "name": "default"
2098
+ },
2097
2099
  {
2098
2100
  "text": "1.0.0",
2099
2101
  "name": "since"
@@ -2357,19 +2359,6 @@
2357
2359
  }
2358
2360
  ]
2359
2361
  },
2360
- {
2361
- "name": "NotificationChannel",
2362
- "slug": "notificationchannel",
2363
- "docs": "",
2364
- "types": [
2365
- {
2366
- "text": "Channel",
2367
- "complexTypes": [
2368
- "Channel"
2369
- ]
2370
- }
2371
- ]
2372
- },
2373
2362
  {
2374
2363
  "name": "Importance",
2375
2364
  "slug": "importance",
@@ -87,7 +87,7 @@ export interface LocalNotificationsPlugin {
87
87
  *
88
88
  * @since 1.0.0
89
89
  */
90
- createChannel(channel: NotificationChannel): Promise<void>;
90
+ createChannel(channel: Channel): Promise<void>;
91
91
  /**
92
92
  * Delete a notification channel.
93
93
  *
@@ -95,7 +95,9 @@ export interface LocalNotificationsPlugin {
95
95
  *
96
96
  * @since 1.0.0
97
97
  */
98
- deleteChannel(channel: NotificationChannel): Promise<void>;
98
+ deleteChannel(args: {
99
+ id: string;
100
+ }): Promise<void>;
99
101
  /**
100
102
  * Get a list of notification channels.
101
103
  *
@@ -793,9 +795,10 @@ export interface Channel {
793
795
  /**
794
796
  * The level of interruption for notifications posted to this channel.
795
797
  *
798
+ * @default `3`
796
799
  * @since 1.0.0
797
800
  */
798
- importance: Importance;
801
+ importance?: Importance;
799
802
  /**
800
803
  * The visibility of notifications posted to this channel.
801
804
  *
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC;AA66BxC;;GAEG;AACH,MAAM,CAAN,IAAY,OAQX;AARD,WAAY,OAAO;IACjB,yCAAU,CAAA;IACV,yCAAU,CAAA;IACV,2CAAW,CAAA;IACX,+CAAa,CAAA;IACb,6CAAY,CAAA;IACZ,yCAAU,CAAA;IACV,6CAAY,CAAA;AACd,CAAC,EARW,OAAO,KAAP,OAAO,QAQlB","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\nimport type { PermissionState, PluginListenerHandle } from '@capacitor/core';\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * On Android, the Local Notifications can be configured with the following options:\n */\n LocalNotifications?: {\n /**\n * Set the default status bar icon for notifications.\n *\n * Icons should be placed in your app's `res/drawable` folder. The value for\n * this option should be the drawable resource ID, which is the filename\n * without an extension.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n * @example \"ic_stat_icon_config_sample\"\n */\n smallIcon?: string;\n\n /**\n * Set the default color of status bar icons for notifications.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n * @example \"#488AFF\"\n */\n iconColor?: string;\n\n /**\n * Set the default notification sound for notifications.\n *\n * On Android 26+ it sets the default channel sound and can't be\n * changed unless the app is uninstalled.\n *\n * If the audio file is not found, it will result in the default system\n * sound being played on Android 21-25 and no sound on Android 26+.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n * @example \"beep.wav\"\n */\n sound?: string;\n };\n }\n}\n\nexport interface LocalNotificationsPlugin {\n /**\n * Schedule one or more local notifications.\n *\n * @since 1.0.0\n */\n schedule(options: ScheduleOptions): Promise<ScheduleResult>;\n\n /**\n * Get a list of pending notifications.\n *\n * @since 1.0.0\n */\n getPending(): Promise<PendingResult>;\n\n /**\n * Register actions to take when notifications are displayed.\n *\n * Only available for iOS and Android.\n *\n * @since 1.0.0\n */\n registerActionTypes(options: RegisterActionTypesOptions): Promise<void>;\n\n /**\n * Cancel pending notifications.\n *\n * @since 1.0.0\n */\n cancel(options: CancelOptions): Promise<void>;\n\n /**\n * Check if notifications are enabled or not.\n *\n * @deprecated Use `checkPermissions()` to check if the user has allowed\n * notifications to be displayed.\n * @since 1.0.0\n */\n areEnabled(): Promise<EnabledResult>;\n\n /**\n * Create a notification channel.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n createChannel(channel: NotificationChannel): Promise<void>;\n\n /**\n * Delete a notification channel.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n deleteChannel(channel: NotificationChannel): Promise<void>;\n\n /**\n * Get a list of notification channels.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n listChannels(): Promise<ListChannelsResult>;\n\n /**\n * Check permission to display local notifications.\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request permission to display local notifications.\n *\n * @since 1.0.0\n */\n requestPermissions(): Promise<PermissionStatus>;\n\n /**\n * Listen for when notifications are displayed.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'localNotificationReceived',\n listenerFunc: (notification: LocalNotificationSchema) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Listen for when an action is performed on a notification.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'localNotificationActionPerformed',\n listenerFunc: (notificationAction: ActionPerformed) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Remove all listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n}\n\n/**\n * The object that describes a local notification.\n *\n * @since 1.0.0\n */\nexport interface LocalNotificationDescriptor {\n /**\n * The notification identifier.\n *\n * @since 1.0.0\n */\n id: number;\n}\n\nexport interface ScheduleOptions {\n /**\n * The list of notifications to schedule.\n *\n * @since 1.0.0\n */\n notifications: LocalNotificationSchema[];\n}\n\nexport interface ScheduleResult {\n /**\n * The list of scheduled notifications.\n *\n * @since 1.0.0\n */\n notifications: LocalNotificationDescriptor[];\n}\n\nexport interface PendingResult {\n /**\n * The list of pending notifications.\n *\n * @since 1.0.0\n */\n notifications: PendingLocalNotificationSchema[];\n}\n\nexport interface RegisterActionTypesOptions {\n /**\n * The list of action types to register.\n *\n * @since 1.0.0\n */\n types: ActionType[];\n}\n\nexport interface CancelOptions {\n /**\n * The list of notifications to cancel.\n *\n * @since 1.0.0\n */\n notifications: LocalNotificationDescriptor[];\n}\n\n/**\n * A collection of actions.\n *\n * @since 1.0.0\n */\nexport interface ActionType {\n /**\n * The ID of the action type.\n *\n * Referenced in notifications by the `actionTypeId` key.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The list of actions associated with this action type.\n *\n * @since 1.0.0\n */\n actions?: Action[];\n\n /**\n * Sets `hiddenPreviewsBodyPlaceholder` of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosHiddenPreviewsBodyPlaceholder?: string;\n\n /**\n * Sets `customDismissAction` in the options of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosCustomDismissAction?: boolean;\n\n /**\n * Sets `allowInCarPlay` in the options of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosAllowInCarPlay?: boolean;\n\n /**\n * Sets `hiddenPreviewsShowTitle` in the options of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosHiddenPreviewsShowTitle?: boolean;\n\n /**\n * Sets `hiddenPreviewsShowSubtitle` in the options of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosHiddenPreviewsShowSubtitle?: boolean;\n}\n\n/**\n * An action that can be taken when a notification is displayed.\n *\n * @since 1.0.0\n */\nexport interface Action {\n /**\n * The action identifier.\n *\n * Referenced in the `'actionPerformed'` event as `actionId`.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The title text to display for this action.\n *\n * @since 1.0.0\n */\n title: string;\n\n /**\n * Sets `authenticationRequired` in the options of the\n * [`UNNotificationAction`](https://developer.apple.com/documentation/usernotifications/unnotificationaction).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n requiresAuthentication?: boolean;\n\n /**\n * Sets `foreground` in the options of the\n * [`UNNotificationAction`](https://developer.apple.com/documentation/usernotifications/unnotificationaction).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n foreground?: boolean;\n\n /**\n * Sets `destructive` in the options of the\n * [`UNNotificationAction`](https://developer.apple.com/documentation/usernotifications/unnotificationaction).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n destructive?: boolean;\n\n /**\n * Use a `UNTextInputNotificationAction` instead of a `UNNotificationAction`.\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n input?: boolean;\n\n /**\n * Sets `textInputButtonTitle` on the\n * [`UNTextInputNotificationAction`](https://developer.apple.com/documentation/usernotifications/untextinputnotificationaction).\n *\n * Only available for iOS when `input` is `true`.\n *\n * @since 1.0.0\n */\n inputButtonTitle?: string;\n\n /**\n * Sets `textInputPlaceholder` on the\n * [`UNTextInputNotificationAction`](https://developer.apple.com/documentation/usernotifications/untextinputnotificationaction).\n *\n * Only available for iOS when `input` is `true`.\n *\n * @since 1.0.0\n */\n inputPlaceholder?: string;\n}\n\n/**\n * Represents a notification attachment.\n *\n * @since 1.0.0\n */\nexport interface Attachment {\n /**\n * The attachment identifier.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The URL to the attachment.\n *\n * Use the `res` scheme to reference web assets, e.g.\n * `res:///assets/img/icon.png`. Also accepts `file` URLs.\n *\n * @since 1.0.0\n */\n url: string;\n\n /**\n * Attachment options.\n *\n * @since 1.0.0\n */\n options?: AttachmentOptions;\n}\n\nexport interface AttachmentOptions {\n /**\n * Sets the `UNNotificationAttachmentOptionsTypeHintKey` key in the hashable\n * options of\n * [`UNNotificationAttachment`](https://developer.apple.com/documentation/usernotifications/unnotificationattachment).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosUNNotificationAttachmentOptionsTypeHintKey?: string;\n\n /**\n * Sets the `UNNotificationAttachmentOptionsThumbnailHiddenKey` key in the\n * hashable options of\n * [`UNNotificationAttachment`](https://developer.apple.com/documentation/usernotifications/unnotificationattachment).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosUNNotificationAttachmentOptionsThumbnailHiddenKey?: string;\n\n /**\n * Sets the `UNNotificationAttachmentOptionsThumbnailClippingRectKey` key in\n * the hashable options of\n * [`UNNotificationAttachment`](https://developer.apple.com/documentation/usernotifications/unnotificationattachment).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosUNNotificationAttachmentOptionsThumbnailClippingRectKey?: string;\n\n /**\n * Sets the `UNNotificationAttachmentOptionsThumbnailTimeKey` key in the\n * hashable options of\n * [`UNNotificationAttachment`](https://developer.apple.com/documentation/usernotifications/unnotificationattachment).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosUNNotificationAttachmentOptionsThumbnailTimeKey?: string;\n}\n\nexport interface PendingLocalNotificationSchema {\n /**\n * The title of the notification.\n *\n * @since 1.0.0\n */\n title: string;\n\n /**\n * The body of the notification, shown below the title.\n *\n * @since 1.0.0\n */\n body: string;\n\n /**\n * The notification identifier.\n *\n * @since 1.0.0\n */\n id: number;\n\n /**\n * Schedule this notification for a later time.\n *\n * @since 1.0.0\n */\n schedule?: Schedule;\n\n /**\n * Set extra data to store within this notification.\n *\n * @since 1.0.0\n */\n extra?: any;\n}\n\nexport interface LocalNotificationSchema {\n /**\n * The title of the notification.\n *\n * @since 1.0.0\n */\n title: string;\n\n /**\n * The body of the notification, shown below the title.\n *\n * @since 1.0.0\n */\n body: string;\n\n /**\n * Sets a multiline text block for display in a big text notification style.\n *\n * @since 1.0.0\n */\n largeBody?: string;\n\n /**\n * Used to set the summary text detail in inbox and big text notification styles.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n summaryText?: string;\n /**\n * The notification identifier.\n *\n * @since 1.0.0\n */\n id: number;\n\n /**\n * Schedule this notification for a later time.\n *\n * @since 1.0.0\n */\n schedule?: Schedule;\n\n /**\n * Name of the audio file to play when this notification is displayed.\n *\n * Include the file extension with the filename.\n *\n * On iOS, the file should be in the app bundle.\n * On Android, the file should be in res/raw folder.\n *\n * Recommended format is `.wav` because is supported by both iOS and Android.\n *\n * Only available for iOS and Android < 26.\n * For Android 26+ use channelId of a channel configured with the desired sound.\n *\n * If the sound file is not found, (i.e. empty string or wrong name)\n * the default system notification sound will be used.\n * If not provided, it will produce the default sound on Android and no sound on iOS.\n *\n * @since 1.0.0\n */\n sound?: string;\n\n /**\n * Set a custom status bar icon.\n *\n * If set, this overrides the `smallIcon` option from Capacitor\n * configuration.\n *\n * Icons should be placed in your app's `res/drawable` folder. The value for\n * this option should be the drawable resource ID, which is the filename\n * without an extension.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n smallIcon?: string;\n\n /**\n * Set a large icon for notifications.\n *\n * Icons should be placed in your app's `res/drawable` folder. The value for\n * this option should be the drawable resource ID, which is the filename\n * without an extension.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n largeIcon?: string;\n\n /**\n * Set the color of the notification icon.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n iconColor?: string;\n\n /**\n * Set attachments for this notification.\n *\n * @since 1.0.0\n */\n attachments?: Attachment[];\n\n /**\n * Associate an action type with this notification.\n *\n * @since 1.0.0\n */\n actionTypeId?: string;\n\n /**\n * Set extra data to store within this notification.\n *\n * @since 1.0.0\n */\n extra?: any;\n\n /**\n * Used to group multiple notifications.\n *\n * Sets `threadIdentifier` on the\n * [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n threadIdentifier?: string;\n\n /**\n * The string this notification adds to the category's summary format string.\n *\n * Sets `summaryArgument` on the\n * [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent).\n *\n * Only available for iOS 12+.\n *\n * @since 1.0.0\n */\n summaryArgument?: string;\n\n /**\n * Used to group multiple notifications.\n *\n * Calls `setGroup()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n group?: string;\n\n /**\n * If true, this notification becomes the summary for a group of\n * notifications.\n *\n * Calls `setGroupSummary()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android when using `group`.\n *\n * @since 1.0.0\n */\n groupSummary?: boolean;\n\n /**\n * Specifies the channel the notification should be delivered on.\n *\n * If channel with the given name does not exist then the notification will\n * not fire. If not provided, it will use the default channel.\n *\n * Calls `setChannelId()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android 26+.\n *\n * @since 1.0.0\n */\n channelId?: string;\n\n /**\n * If true, the notification can't be swiped away.\n *\n * Calls `setOngoing()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n ongoing?: boolean;\n\n /**\n * If true, the notification is canceled when the user clicks on it.\n *\n * Calls `setAutoCancel()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n autoCancel?: boolean;\n\n /**\n * Sets a list of strings for display in an inbox style notification.\n *\n * Up to 5 strings are allowed.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n inboxList?: string[];\n}\n\n/**\n * Represents a schedule for a notification.\n *\n * Use either `at`, `on`, or `every` to schedule notifications.\n *\n * @since 1.0.0\n */\nexport interface Schedule {\n /**\n * Schedule a notification at a specific date and time.\n *\n * @since 1.0.0\n */\n at?: Date;\n\n /**\n * Repeat delivery of this notification at the date and time specified by\n * `at`.\n *\n * Only available for iOS and Android.\n *\n * @since 1.0.0\n */\n repeats?: boolean;\n\n /**\n * Allow this notification to fire while in [Doze](https://developer.android.com/training/monitoring-device-state/doze-standby)\n *\n * Only available for Android 23+.\n *\n * Note that these notifications can only fire [once per 9 minutes, per app](https://developer.android.com/training/monitoring-device-state/doze-standby#assessing_your_app).\n *\n * @since 1.0.0\n */\n allowWhileIdle?: boolean;\n\n /**\n * Schedule a notification on particular interval(s).\n *\n * This is similar to scheduling [cron](https://en.wikipedia.org/wiki/Cron)\n * jobs.\n *\n * Only available for iOS and Android.\n *\n * @since 1.0.0\n */\n on?: ScheduleOn;\n\n /**\n * Schedule a notification on a particular interval.\n *\n * @since 1.0.0\n */\n every?: ScheduleEvery;\n\n /**\n * Limit the number times a notification is delivered by the interval\n * specified by `every`.\n *\n * @since 1.0.0\n */\n count?: number;\n}\n\nexport interface ScheduleOn {\n year?: number;\n month?: number;\n day?: number;\n weekday?: Weekday;\n hour?: number;\n minute?: number;\n second?: number;\n}\n\nexport type ScheduleEvery =\n | 'year'\n | 'month'\n | 'two-weeks'\n | 'week'\n | 'day'\n | 'hour'\n | 'minute'\n | 'second';\n\nexport interface ListChannelsResult {\n /**\n * The list of notification channels.\n *\n * @since 1.0.0\n */\n channels: Channel[];\n}\n\nexport interface PermissionStatus {\n /**\n * Permission state of displaying notifications.\n *\n * @since 1.0.0\n */\n display: PermissionState;\n}\n\nexport interface ActionPerformed {\n /**\n * The identifier of the performed action.\n *\n * @since 1.0.0\n */\n actionId: string;\n\n /**\n * The value entered by the user on the notification.\n *\n * Only available on iOS for notifications with `input` set to `true`.\n *\n * @since 1.0.0\n */\n inputValue?: string;\n\n /**\n * The original notification schema.\n *\n * @since 1.0.0\n */\n notification: LocalNotificationSchema;\n}\n\n/**\n * @deprecated\n */\nexport interface EnabledResult {\n /**\n * Whether or not the device has local notifications enabled.\n *\n * @since 1.0.0\n */\n value: boolean;\n}\n\nexport interface Channel {\n /**\n * The channel identifier.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The human-friendly name of this channel (presented to the user).\n *\n * @since 1.0.0\n */\n name: string;\n\n /**\n * The description of this channel (presented to the user).\n *\n * @since 1.0.0\n */\n description?: string;\n\n /**\n * The sound that should be played for notifications posted to this channel.\n *\n * Notification channels with an importance of at least `3` should have a\n * sound.\n *\n * The file name of a sound file should be specified relative to the android\n * app `res/raw` directory.\n *\n * If the sound is not provided, or the sound file is not found no sound will be used.\n *\n * @since 1.0.0\n * @example \"jingle.wav\"\n */\n sound?: string;\n\n /**\n * The level of interruption for notifications posted to this channel.\n *\n * @since 1.0.0\n */\n importance: Importance;\n\n /**\n * The visibility of notifications posted to this channel.\n *\n * This setting is for whether notifications posted to this channel appear on\n * the lockscreen or not, and if so, whether they appear in a redacted form.\n *\n * @since 1.0.0\n */\n visibility?: Visibility;\n\n /**\n * Whether notifications posted to this channel should display notification\n * lights, on devices that support it.\n *\n * @since 1.0.0\n */\n lights?: boolean;\n\n /**\n * The light color for notifications posted to this channel.\n *\n * Only supported if lights are enabled on this channel and the device\n * supports it.\n *\n * Supported color formats are `#RRGGBB` and `#RRGGBBAA`.\n *\n * @since 1.0.0\n */\n lightColor?: string;\n\n /**\n * Whether notifications posted to this channel should vibrate.\n *\n * @since 1.0.0\n */\n vibration?: boolean;\n}\n\n/**\n * Day of the week. Used for scheduling notifications on a particular weekday.\n */\nexport enum Weekday {\n Sunday = 1,\n Monday = 2,\n Tuesday = 3,\n Wednesday = 4,\n Thursday = 5,\n Friday = 6,\n Saturday = 7,\n}\n\n/**\n * The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)\n * @since 1.0.0\n */\nexport type Importance = 1 | 2 | 3 | 4 | 5;\n\n/**\n * The notification visibility. For more details, see the [Android Developer Docs](https://developer.android.com/reference/androidx/core/app/NotificationCompat#VISIBILITY_PRIVATE)\n * @since 1.0.0\n */\nexport type Visibility = -1 | 0 | 1;\n\n/**\n * @deprecated Use 'Channel`.\n * @since 1.0.0\n */\nexport type NotificationChannel = Channel;\n\n/**\n * @deprecated Use `LocalNotificationDescriptor`.\n * @since 1.0.0\n */\nexport type LocalNotificationRequest = LocalNotificationDescriptor;\n\n/**\n * @deprecated Use `ScheduleResult`.\n * @since 1.0.0\n */\nexport type LocalNotificationScheduleResult = ScheduleResult;\n\n/**\n * @deprecated Use `PendingResult`.\n * @since 1.0.0\n */\nexport type LocalNotificationPendingList = PendingResult;\n\n/**\n * @deprecated Use `ActionType`.\n * @since 1.0.0\n */\nexport type LocalNotificationActionType = ActionType;\n\n/**\n * @deprecated Use `Action`.\n * @since 1.0.0\n */\nexport type LocalNotificationAction = Action;\n\n/**\n * @deprecated Use `EnabledResult`.\n * @since 1.0.0\n */\nexport type LocalNotificationEnabledResult = EnabledResult;\n\n/**\n * @deprecated Use `ListChannelsResult`.\n * @since 1.0.0\n */\nexport type NotificationChannelList = ListChannelsResult;\n\n/**\n * @deprecated Use `Attachment`.\n * @since 1.0.0\n */\nexport type LocalNotificationAttachment = Attachment;\n\n/**\n * @deprecated Use `AttachmentOptions`.\n * @since 1.0.0\n */\nexport type LocalNotificationAttachmentOptions = AttachmentOptions;\n\n/**\n * @deprecated Use `LocalNotificationSchema`.\n * @since 1.0.0\n */\nexport type LocalNotification = LocalNotificationSchema;\n\n/**\n * @deprecated Use `Schedule`.\n * @since 1.0.0\n */\nexport type LocalNotificationSchedule = Schedule;\n\n/**\n * @deprecated Use `ActionPerformed`.\n * @since 1.0.0\n */\nexport type LocalNotificationActionPerformed = ActionPerformed;\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC;AA86BxC;;GAEG;AACH,MAAM,CAAN,IAAY,OAQX;AARD,WAAY,OAAO;IACjB,yCAAU,CAAA;IACV,yCAAU,CAAA;IACV,2CAAW,CAAA;IACX,+CAAa,CAAA;IACb,6CAAY,CAAA;IACZ,yCAAU,CAAA;IACV,6CAAY,CAAA;AACd,CAAC,EARW,OAAO,KAAP,OAAO,QAQlB","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\nimport type { PermissionState, PluginListenerHandle } from '@capacitor/core';\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * On Android, the Local Notifications can be configured with the following options:\n */\n LocalNotifications?: {\n /**\n * Set the default status bar icon for notifications.\n *\n * Icons should be placed in your app's `res/drawable` folder. The value for\n * this option should be the drawable resource ID, which is the filename\n * without an extension.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n * @example \"ic_stat_icon_config_sample\"\n */\n smallIcon?: string;\n\n /**\n * Set the default color of status bar icons for notifications.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n * @example \"#488AFF\"\n */\n iconColor?: string;\n\n /**\n * Set the default notification sound for notifications.\n *\n * On Android 26+ it sets the default channel sound and can't be\n * changed unless the app is uninstalled.\n *\n * If the audio file is not found, it will result in the default system\n * sound being played on Android 21-25 and no sound on Android 26+.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n * @example \"beep.wav\"\n */\n sound?: string;\n };\n }\n}\n\nexport interface LocalNotificationsPlugin {\n /**\n * Schedule one or more local notifications.\n *\n * @since 1.0.0\n */\n schedule(options: ScheduleOptions): Promise<ScheduleResult>;\n\n /**\n * Get a list of pending notifications.\n *\n * @since 1.0.0\n */\n getPending(): Promise<PendingResult>;\n\n /**\n * Register actions to take when notifications are displayed.\n *\n * Only available for iOS and Android.\n *\n * @since 1.0.0\n */\n registerActionTypes(options: RegisterActionTypesOptions): Promise<void>;\n\n /**\n * Cancel pending notifications.\n *\n * @since 1.0.0\n */\n cancel(options: CancelOptions): Promise<void>;\n\n /**\n * Check if notifications are enabled or not.\n *\n * @deprecated Use `checkPermissions()` to check if the user has allowed\n * notifications to be displayed.\n * @since 1.0.0\n */\n areEnabled(): Promise<EnabledResult>;\n\n /**\n * Create a notification channel.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n createChannel(channel: 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> & PluginListenerHandle;\n\n /**\n * Listen for when an action is performed on a notification.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'localNotificationActionPerformed',\n listenerFunc: (notificationAction: ActionPerformed) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Remove all listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n}\n\n/**\n * The object that describes a local notification.\n *\n * @since 1.0.0\n */\nexport interface LocalNotificationDescriptor {\n /**\n * The notification identifier.\n *\n * @since 1.0.0\n */\n id: number;\n}\n\nexport interface ScheduleOptions {\n /**\n * The list of notifications to schedule.\n *\n * @since 1.0.0\n */\n notifications: LocalNotificationSchema[];\n}\n\nexport interface ScheduleResult {\n /**\n * The list of scheduled notifications.\n *\n * @since 1.0.0\n */\n notifications: LocalNotificationDescriptor[];\n}\n\nexport interface PendingResult {\n /**\n * The list of pending notifications.\n *\n * @since 1.0.0\n */\n notifications: PendingLocalNotificationSchema[];\n}\n\nexport interface RegisterActionTypesOptions {\n /**\n * The list of action types to register.\n *\n * @since 1.0.0\n */\n types: ActionType[];\n}\n\nexport interface CancelOptions {\n /**\n * The list of notifications to cancel.\n *\n * @since 1.0.0\n */\n notifications: LocalNotificationDescriptor[];\n}\n\n/**\n * A collection of actions.\n *\n * @since 1.0.0\n */\nexport interface ActionType {\n /**\n * The ID of the action type.\n *\n * Referenced in notifications by the `actionTypeId` key.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The list of actions associated with this action type.\n *\n * @since 1.0.0\n */\n actions?: Action[];\n\n /**\n * Sets `hiddenPreviewsBodyPlaceholder` of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosHiddenPreviewsBodyPlaceholder?: string;\n\n /**\n * Sets `customDismissAction` in the options of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosCustomDismissAction?: boolean;\n\n /**\n * Sets `allowInCarPlay` in the options of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosAllowInCarPlay?: boolean;\n\n /**\n * Sets `hiddenPreviewsShowTitle` in the options of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosHiddenPreviewsShowTitle?: boolean;\n\n /**\n * Sets `hiddenPreviewsShowSubtitle` in the options of the\n * [`UNNotificationCategory`](https://developer.apple.com/documentation/usernotifications/unnotificationcategory).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosHiddenPreviewsShowSubtitle?: boolean;\n}\n\n/**\n * An action that can be taken when a notification is displayed.\n *\n * @since 1.0.0\n */\nexport interface Action {\n /**\n * The action identifier.\n *\n * Referenced in the `'actionPerformed'` event as `actionId`.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The title text to display for this action.\n *\n * @since 1.0.0\n */\n title: string;\n\n /**\n * Sets `authenticationRequired` in the options of the\n * [`UNNotificationAction`](https://developer.apple.com/documentation/usernotifications/unnotificationaction).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n requiresAuthentication?: boolean;\n\n /**\n * Sets `foreground` in the options of the\n * [`UNNotificationAction`](https://developer.apple.com/documentation/usernotifications/unnotificationaction).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n foreground?: boolean;\n\n /**\n * Sets `destructive` in the options of the\n * [`UNNotificationAction`](https://developer.apple.com/documentation/usernotifications/unnotificationaction).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n destructive?: boolean;\n\n /**\n * Use a `UNTextInputNotificationAction` instead of a `UNNotificationAction`.\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n input?: boolean;\n\n /**\n * Sets `textInputButtonTitle` on the\n * [`UNTextInputNotificationAction`](https://developer.apple.com/documentation/usernotifications/untextinputnotificationaction).\n *\n * Only available for iOS when `input` is `true`.\n *\n * @since 1.0.0\n */\n inputButtonTitle?: string;\n\n /**\n * Sets `textInputPlaceholder` on the\n * [`UNTextInputNotificationAction`](https://developer.apple.com/documentation/usernotifications/untextinputnotificationaction).\n *\n * Only available for iOS when `input` is `true`.\n *\n * @since 1.0.0\n */\n inputPlaceholder?: string;\n}\n\n/**\n * Represents a notification attachment.\n *\n * @since 1.0.0\n */\nexport interface Attachment {\n /**\n * The attachment identifier.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The URL to the attachment.\n *\n * Use the `res` scheme to reference web assets, e.g.\n * `res:///assets/img/icon.png`. Also accepts `file` URLs.\n *\n * @since 1.0.0\n */\n url: string;\n\n /**\n * Attachment options.\n *\n * @since 1.0.0\n */\n options?: AttachmentOptions;\n}\n\nexport interface AttachmentOptions {\n /**\n * Sets the `UNNotificationAttachmentOptionsTypeHintKey` key in the hashable\n * options of\n * [`UNNotificationAttachment`](https://developer.apple.com/documentation/usernotifications/unnotificationattachment).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosUNNotificationAttachmentOptionsTypeHintKey?: string;\n\n /**\n * Sets the `UNNotificationAttachmentOptionsThumbnailHiddenKey` key in the\n * hashable options of\n * [`UNNotificationAttachment`](https://developer.apple.com/documentation/usernotifications/unnotificationattachment).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosUNNotificationAttachmentOptionsThumbnailHiddenKey?: string;\n\n /**\n * Sets the `UNNotificationAttachmentOptionsThumbnailClippingRectKey` key in\n * the hashable options of\n * [`UNNotificationAttachment`](https://developer.apple.com/documentation/usernotifications/unnotificationattachment).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosUNNotificationAttachmentOptionsThumbnailClippingRectKey?: string;\n\n /**\n * Sets the `UNNotificationAttachmentOptionsThumbnailTimeKey` key in the\n * hashable options of\n * [`UNNotificationAttachment`](https://developer.apple.com/documentation/usernotifications/unnotificationattachment).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n iosUNNotificationAttachmentOptionsThumbnailTimeKey?: string;\n}\n\nexport interface PendingLocalNotificationSchema {\n /**\n * The title of the notification.\n *\n * @since 1.0.0\n */\n title: string;\n\n /**\n * The body of the notification, shown below the title.\n *\n * @since 1.0.0\n */\n body: string;\n\n /**\n * The notification identifier.\n *\n * @since 1.0.0\n */\n id: number;\n\n /**\n * Schedule this notification for a later time.\n *\n * @since 1.0.0\n */\n schedule?: Schedule;\n\n /**\n * Set extra data to store within this notification.\n *\n * @since 1.0.0\n */\n extra?: any;\n}\n\nexport interface LocalNotificationSchema {\n /**\n * The title of the notification.\n *\n * @since 1.0.0\n */\n title: string;\n\n /**\n * The body of the notification, shown below the title.\n *\n * @since 1.0.0\n */\n body: string;\n\n /**\n * Sets a multiline text block for display in a big text notification style.\n *\n * @since 1.0.0\n */\n largeBody?: string;\n\n /**\n * Used to set the summary text detail in inbox and big text notification styles.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n summaryText?: string;\n /**\n * The notification identifier.\n *\n * @since 1.0.0\n */\n id: number;\n\n /**\n * Schedule this notification for a later time.\n *\n * @since 1.0.0\n */\n schedule?: Schedule;\n\n /**\n * Name of the audio file to play when this notification is displayed.\n *\n * Include the file extension with the filename.\n *\n * On iOS, the file should be in the app bundle.\n * On Android, the file should be in res/raw folder.\n *\n * Recommended format is `.wav` because is supported by both iOS and Android.\n *\n * Only available for iOS and Android < 26.\n * For Android 26+ use channelId of a channel configured with the desired sound.\n *\n * If the sound file is not found, (i.e. empty string or wrong name)\n * the default system notification sound will be used.\n * If not provided, it will produce the default sound on Android and no sound on iOS.\n *\n * @since 1.0.0\n */\n sound?: string;\n\n /**\n * Set a custom status bar icon.\n *\n * If set, this overrides the `smallIcon` option from Capacitor\n * configuration.\n *\n * Icons should be placed in your app's `res/drawable` folder. The value for\n * this option should be the drawable resource ID, which is the filename\n * without an extension.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n smallIcon?: string;\n\n /**\n * Set a large icon for notifications.\n *\n * Icons should be placed in your app's `res/drawable` folder. The value for\n * this option should be the drawable resource ID, which is the filename\n * without an extension.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n largeIcon?: string;\n\n /**\n * Set the color of the notification icon.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n iconColor?: string;\n\n /**\n * Set attachments for this notification.\n *\n * @since 1.0.0\n */\n attachments?: Attachment[];\n\n /**\n * Associate an action type with this notification.\n *\n * @since 1.0.0\n */\n actionTypeId?: string;\n\n /**\n * Set extra data to store within this notification.\n *\n * @since 1.0.0\n */\n extra?: any;\n\n /**\n * Used to group multiple notifications.\n *\n * Sets `threadIdentifier` on the\n * [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent).\n *\n * Only available for iOS.\n *\n * @since 1.0.0\n */\n threadIdentifier?: string;\n\n /**\n * The string this notification adds to the category's summary format string.\n *\n * Sets `summaryArgument` on the\n * [`UNMutableNotificationContent`](https://developer.apple.com/documentation/usernotifications/unmutablenotificationcontent).\n *\n * Only available for iOS 12+.\n *\n * @since 1.0.0\n */\n summaryArgument?: string;\n\n /**\n * Used to group multiple notifications.\n *\n * Calls `setGroup()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n group?: string;\n\n /**\n * If true, this notification becomes the summary for a group of\n * notifications.\n *\n * Calls `setGroupSummary()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android when using `group`.\n *\n * @since 1.0.0\n */\n groupSummary?: boolean;\n\n /**\n * Specifies the channel the notification should be delivered on.\n *\n * If channel with the given name does not exist then the notification will\n * not fire. If not provided, it will use the default channel.\n *\n * Calls `setChannelId()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android 26+.\n *\n * @since 1.0.0\n */\n channelId?: string;\n\n /**\n * If true, the notification can't be swiped away.\n *\n * Calls `setOngoing()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n ongoing?: boolean;\n\n /**\n * If true, the notification is canceled when the user clicks on it.\n *\n * Calls `setAutoCancel()` on\n * [`NotificationCompat.Builder`](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder)\n * with the provided value.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n autoCancel?: boolean;\n\n /**\n * Sets a list of strings for display in an inbox style notification.\n *\n * Up to 5 strings are allowed.\n *\n * Only available for Android.\n *\n * @since 1.0.0\n */\n inboxList?: string[];\n}\n\n/**\n * Represents a schedule for a notification.\n *\n * Use either `at`, `on`, or `every` to schedule notifications.\n *\n * @since 1.0.0\n */\nexport interface Schedule {\n /**\n * Schedule a notification at a specific date and time.\n *\n * @since 1.0.0\n */\n at?: Date;\n\n /**\n * Repeat delivery of this notification at the date and time specified by\n * `at`.\n *\n * Only available for iOS and Android.\n *\n * @since 1.0.0\n */\n repeats?: boolean;\n\n /**\n * Allow this notification to fire while in [Doze](https://developer.android.com/training/monitoring-device-state/doze-standby)\n *\n * Only available for Android 23+.\n *\n * Note that these notifications can only fire [once per 9 minutes, per app](https://developer.android.com/training/monitoring-device-state/doze-standby#assessing_your_app).\n *\n * @since 1.0.0\n */\n allowWhileIdle?: boolean;\n\n /**\n * Schedule a notification on particular interval(s).\n *\n * This is similar to scheduling [cron](https://en.wikipedia.org/wiki/Cron)\n * jobs.\n *\n * Only available for iOS and Android.\n *\n * @since 1.0.0\n */\n on?: ScheduleOn;\n\n /**\n * Schedule a notification on a particular interval.\n *\n * @since 1.0.0\n */\n every?: ScheduleEvery;\n\n /**\n * Limit the number times a notification is delivered by the interval\n * specified by `every`.\n *\n * @since 1.0.0\n */\n count?: number;\n}\n\nexport interface ScheduleOn {\n year?: number;\n month?: number;\n day?: number;\n weekday?: Weekday;\n hour?: number;\n minute?: number;\n second?: number;\n}\n\nexport type ScheduleEvery =\n | 'year'\n | 'month'\n | 'two-weeks'\n | 'week'\n | 'day'\n | 'hour'\n | 'minute'\n | 'second';\n\nexport interface ListChannelsResult {\n /**\n * The list of notification channels.\n *\n * @since 1.0.0\n */\n channels: Channel[];\n}\n\nexport interface PermissionStatus {\n /**\n * Permission state of displaying notifications.\n *\n * @since 1.0.0\n */\n display: PermissionState;\n}\n\nexport interface ActionPerformed {\n /**\n * The identifier of the performed action.\n *\n * @since 1.0.0\n */\n actionId: string;\n\n /**\n * The value entered by the user on the notification.\n *\n * Only available on iOS for notifications with `input` set to `true`.\n *\n * @since 1.0.0\n */\n inputValue?: string;\n\n /**\n * The original notification schema.\n *\n * @since 1.0.0\n */\n notification: LocalNotificationSchema;\n}\n\n/**\n * @deprecated\n */\nexport interface EnabledResult {\n /**\n * Whether or not the device has local notifications enabled.\n *\n * @since 1.0.0\n */\n value: boolean;\n}\n\nexport interface Channel {\n /**\n * The channel identifier.\n *\n * @since 1.0.0\n */\n id: string;\n\n /**\n * The human-friendly name of this channel (presented to the user).\n *\n * @since 1.0.0\n */\n name: string;\n\n /**\n * The description of this channel (presented to the user).\n *\n * @since 1.0.0\n */\n description?: string;\n\n /**\n * The sound that should be played for notifications posted to this channel.\n *\n * Notification channels with an importance of at least `3` should have a\n * sound.\n *\n * The file name of a sound file should be specified relative to the android\n * app `res/raw` directory.\n *\n * If the sound is not provided, or the sound file is not found no sound will be used.\n *\n * @since 1.0.0\n * @example \"jingle.wav\"\n */\n sound?: string;\n\n /**\n * The level of interruption for notifications posted to this channel.\n *\n * @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"]}
@@ -12,5 +12,5 @@ CAP_PLUGIN(LocalNotificationsPlugin, "LocalNotifications",
12
12
  CAP_PLUGIN_METHOD(createChannel, CAPPluginReturnPromise);
13
13
  CAP_PLUGIN_METHOD(deleteChannel, CAPPluginReturnPromise);
14
14
  CAP_PLUGIN_METHOD(listChannels, CAPPluginReturnPromise);
15
- CAP_PLUGIN_METHOD(removeAllListeners, CAPPluginReturnNone);
15
+ CAP_PLUGIN_METHOD(removeAllListeners, CAPPluginReturnPromise);
16
16
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/local-notifications",
3
- "version": "1.1.0",
3
+ "version": "4.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",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "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 && cd ..",
32
+ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
33
33
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
34
34
  "verify:web": "npm run build",
35
35
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
@@ -45,11 +45,11 @@
45
45
  "publish:cocoapod": "pod trunk push ./CapacitorLocalNotifications.podspec --allow-warnings"
46
46
  },
47
47
  "devDependencies": {
48
- "@capacitor/android": "^3.0.0",
49
- "@capacitor/cli": "^3.0.0",
50
- "@capacitor/core": "^3.0.0",
48
+ "@capacitor/android": "next",
49
+ "@capacitor/cli": "next",
50
+ "@capacitor/core": "next",
51
51
  "@capacitor/docgen": "0.0.18",
52
- "@capacitor/ios": "^3.0.0",
52
+ "@capacitor/ios": "next",
53
53
  "@ionic/eslint-config": "^0.3.0",
54
54
  "@ionic/prettier-config": "~1.0.1",
55
55
  "@ionic/swiftlint-config": "^1.1.2",
@@ -62,7 +62,7 @@
62
62
  "typescript": "~4.1.5"
63
63
  },
64
64
  "peerDependencies": {
65
- "@capacitor/core": "^3.0.0"
65
+ "@capacitor/core": "next"
66
66
  },
67
67
  "prettier": "@ionic/prettier-config",
68
68
  "swiftlint": "@ionic/swiftlint-config",
@@ -80,5 +80,5 @@
80
80
  "publishConfig": {
81
81
  "access": "public"
82
82
  },
83
- "gitHead": "f18ee6482e1ec8e5fb0290d51f598397133af990"
83
+ "gitHead": "fd7db8285f72990522da0adc889514c9804b6dae"
84
84
  }