@capacitor/local-notifications 1.0.3 → 1.0.8

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,61 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.0.8](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/local-notifications@1.0.7...@capacitor/local-notifications@1.0.8) (2021-10-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * remove postpublish scripts ([#656](https://github.com/ionic-team/capacitor-plugins/issues/656)) ([ed6ac49](https://github.com/ionic-team/capacitor-plugins/commit/ed6ac499ebf4a47525071ccbfc36c27503e11f60))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.0.7](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/local-notifications@1.0.6...@capacitor/local-notifications@1.0.7) (2021-10-13)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * correct addListeners links ([#655](https://github.com/ionic-team/capacitor-plugins/issues/655)) ([f9871e7](https://github.com/ionic-team/capacitor-plugins/commit/f9871e7bd53478addb21155e148829f550c0e457))
23
+
24
+
25
+
26
+
27
+
28
+ ## [1.0.6](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/local-notifications@1.0.5...@capacitor/local-notifications@1.0.6) (2021-09-15)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **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))
34
+
35
+
36
+
37
+
38
+
39
+ ## [1.0.5](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/local-notifications@1.0.4...@capacitor/local-notifications@1.0.5) (2021-09-01)
40
+
41
+
42
+ ### Bug Fixes
43
+
44
+ * **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))
45
+
46
+
47
+
48
+
49
+
50
+ ## [1.0.4](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/local-notifications@1.0.3...@capacitor/local-notifications@1.0.4) (2021-08-18)
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * **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))
56
+
57
+
58
+
59
+
60
+
6
61
  ## [1.0.3](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/local-notifications@1.0.2...@capacitor/local-notifications@1.0.3) (2021-07-07)
7
62
 
8
63
 
@@ -7,10 +7,10 @@ Pod::Spec.new do |s|
7
7
  s.version = package['version']
8
8
  s.summary = package['description']
9
9
  s.license = package['license']
10
- s.homepage = package['repository']['url']
10
+ s.homepage = 'https://capacitorjs.com'
11
11
  s.author = package['author']
12
- s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
- s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
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}'
14
14
  s.ios.deployment_target = '12.0'
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
package/README.md CHANGED
@@ -78,8 +78,8 @@ If the device has entered [Doze](https://developer.android.com/training/monitori
78
78
  * [`listChannels()`](#listchannels)
79
79
  * [`checkPermissions()`](#checkpermissions)
80
80
  * [`requestPermissions()`](#requestpermissions)
81
- * [`addListener('localNotificationReceived', ...)`](#addlistenerlocalnotificationreceived-)
82
- * [`addListener('localNotificationActionPerformed', ...)`](#addlistenerlocalnotificationactionperformed-)
81
+ * [`addListener('localNotificationReceived', ...)`](#addlistenerlocalnotificationreceived)
82
+ * [`addListener('localNotificationActionPerformed', ...)`](#addlistenerlocalnotificationactionperformed)
83
83
  * [`removeAllListeners()`](#removealllisteners)
84
84
  * [Interfaces](#interfaces)
85
85
  * [Type Aliases](#type-aliases)
@@ -595,11 +595,15 @@ An action that can be taken when a notification is displayed.
595
595
 
596
596
  #### Importance
597
597
 
598
+ The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)
599
+
598
600
  <code>1 | 2 | 3 | 4 | 5</code>
599
601
 
600
602
 
601
603
  #### Visibility
602
604
 
605
+ The notification visibility. For more details, see the [Android Developer Docs](https://developer.android.com/reference/androidx/core/app/NotificationCompat#VISIBILITY_PRIVATE)
606
+
603
607
  <code>-1 | 0 | 1</code>
604
608
 
605
609
 
@@ -312,7 +312,7 @@ public class LocalNotification {
312
312
  jsSchedule.put("at", schedule.getAt());
313
313
  jsSchedule.put("every", schedule.getEvery());
314
314
  jsSchedule.put("count", schedule.getCount());
315
- jsSchedule.put("on", schedule.getOn());
315
+ jsSchedule.put("on", schedule.getOnObj());
316
316
  jsSchedule.put("repeats", schedule.isRepeating());
317
317
  jsNotification.put("schedule", jsSchedule);
318
318
  }
@@ -20,7 +20,10 @@ public class LocalNotificationSchedule {
20
20
 
21
21
  private Boolean whileIdle;
22
22
 
23
+ private JSObject scheduleObj;
24
+
23
25
  public LocalNotificationSchedule(JSObject schedule) throws ParseException {
26
+ this.scheduleObj = schedule;
24
27
  // Every specific unit of time (always constant)
25
28
  buildEveryElement(schedule);
26
29
  // Count of units of time from every to repeat on
@@ -72,6 +75,10 @@ public class LocalNotificationSchedule {
72
75
  return on;
73
76
  }
74
77
 
78
+ public JSObject getOnObj() {
79
+ return this.scheduleObj.getJSObject("on");
80
+ }
81
+
75
82
  public void setOn(DateMatch on) {
76
83
  this.on = on;
77
84
  }
@@ -42,11 +42,26 @@ public class NotificationChannelManager {
42
42
  public void createChannel(PluginCall call) {
43
43
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
44
44
  JSObject channel = new JSObject();
45
- channel.put(CHANNEL_ID, call.getString(CHANNEL_ID));
46
- channel.put(CHANNEL_NAME, call.getString(CHANNEL_NAME));
45
+ if (call.getString(CHANNEL_ID) != null) {
46
+ channel.put(CHANNEL_ID, call.getString(CHANNEL_ID));
47
+ } else {
48
+ call.reject("Channel missing identifier");
49
+ return;
50
+ }
51
+ if (call.getString(CHANNEL_NAME) != null) {
52
+ channel.put(CHANNEL_NAME, call.getString(CHANNEL_NAME));
53
+ } else {
54
+ call.reject("Channel missing name");
55
+ return;
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
+ }
47
63
  channel.put(CHANNEL_DESCRIPTION, call.getString(CHANNEL_DESCRIPTION, ""));
48
64
  channel.put(CHANNEL_VISIBILITY, call.getInt(CHANNEL_VISIBILITY, NotificationCompat.VISIBILITY_PUBLIC));
49
- channel.put(CHANNEL_IMPORTANCE, call.getInt(CHANNEL_IMPORTANCE));
50
65
  channel.put(CHANNEL_SOUND, call.getString(CHANNEL_SOUND, null));
51
66
  channel.put(CHANNEL_VIBRATE, call.getBoolean(CHANNEL_VIBRATE, false));
52
67
  channel.put(CHANNEL_USE_LIGHTS, call.getBoolean(CHANNEL_USE_LIGHTS, false));
package/dist/docs.json CHANGED
@@ -237,7 +237,7 @@
237
237
  "PluginListenerHandle",
238
238
  "LocalNotificationSchema"
239
239
  ],
240
- "slug": "addlistenerlocalnotificationreceived-"
240
+ "slug": "addlistenerlocalnotificationreceived"
241
241
  },
242
242
  {
243
243
  "name": "addListener",
@@ -266,7 +266,7 @@
266
266
  "PluginListenerHandle",
267
267
  "ActionPerformed"
268
268
  ],
269
- "slug": "addlistenerlocalnotificationactionperformed-"
269
+ "slug": "addlistenerlocalnotificationactionperformed"
270
270
  },
271
271
  {
272
272
  "name": "removeAllListeners",
@@ -2315,7 +2315,7 @@
2315
2315
  {
2316
2316
  "name": "Importance",
2317
2317
  "slug": "importance",
2318
- "docs": "",
2318
+ "docs": "The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)",
2319
2319
  "types": [
2320
2320
  {
2321
2321
  "text": "1",
@@ -2342,7 +2342,7 @@
2342
2342
  {
2343
2343
  "name": "Visibility",
2344
2344
  "slug": "visibility",
2345
- "docs": "",
2345
+ "docs": "The notification visibility. For more details, see the [Android Developer Docs](https://developer.android.com/reference/androidx/core/app/NotificationCompat#VISIBILITY_PRIVATE)",
2346
2346
  "types": [
2347
2347
  {
2348
2348
  "text": "-1",
@@ -819,7 +819,15 @@ export interface Channel {
819
819
  */
820
820
  vibration?: boolean;
821
821
  }
822
+ /**
823
+ * The importance level. For more details, see the [Android Developer Docs](https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT)
824
+ * @since 1.0.0
825
+ */
822
826
  export declare type Importance = 1 | 2 | 3 | 4 | 5;
827
+ /**
828
+ * The notification visibility. For more details, see the [Android Developer Docs](https://developer.android.com/reference/androidx/core/app/NotificationCompat#VISIBILITY_PRIVATE)
829
+ * @since 1.0.0
830
+ */
823
831
  export declare type Visibility = -1 | 0 | 1;
824
832
  /**
825
833
  * @deprecated Use 'Channel`.
package/dist/plugin.js CHANGED
@@ -1,4 +1,4 @@
1
- var capacitorHaptics = (function (exports, core) {
1
+ var capacitorLocalNotifications = (function (exports, core) {
2
2
  'use strict';
3
3
 
4
4
  const LocalNotifications = core.registerPlugin('LocalNotifications', {
@@ -147,5 +147,5 @@ var capacitorHaptics = (function (exports, core) {
147
147
 
148
148
  return exports;
149
149
 
150
- }({}, capacitorLocalNotifications));
150
+ })({}, capacitorExports);
151
151
  //# sourceMappingURL=plugin.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/local-notifications",
3
- "version": "1.0.3",
3
+ "version": "1.0.8",
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",
@@ -41,13 +41,14 @@
41
41
  "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
42
42
  "clean": "rimraf ./dist",
43
43
  "watch": "tsc --watch",
44
- "prepublishOnly": "npm run build"
44
+ "prepublishOnly": "npm run build",
45
+ "publish:cocoapod": "pod trunk push ./CapacitorLocalNotifications.podspec --allow-warnings"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@capacitor/android": "^3.0.0",
48
49
  "@capacitor/cli": "^3.0.0",
49
50
  "@capacitor/core": "^3.0.0",
50
- "@capacitor/docgen": "0.0.17",
51
+ "@capacitor/docgen": "0.0.18",
51
52
  "@capacitor/ios": "^3.0.0",
52
53
  "@ionic/eslint-config": "^0.3.0",
53
54
  "@ionic/prettier-config": "~1.0.1",
@@ -79,5 +80,5 @@
79
80
  "publishConfig": {
80
81
  "access": "public"
81
82
  },
82
- "gitHead": "671617ad0a766b122a262c468aa19d0558876be2"
83
+ "gitHead": "eadbffd4bf9f0859bd301a639ab4e0c3337ea8db"
83
84
  }