From e279230e9bbc753068fd091db75f5a76d437208b Mon Sep 17 00:00:00 2001 From: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> Date: Thu, 1 Nov 2018 16:31:35 +0800 Subject: [PATCH 01/25] Update PushConstants.java Added group functionality --- src/android/com/adobe/phonegap/push/PushConstants.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/android/com/adobe/phonegap/push/PushConstants.java b/src/android/com/adobe/phonegap/push/PushConstants.java index 9b4656a00..6aaeb2da7 100644 --- a/src/android/com/adobe/phonegap/push/PushConstants.java +++ b/src/android/com/adobe/phonegap/push/PushConstants.java @@ -102,4 +102,10 @@ public interface PushConstants { public static final String ONGOING = "ongoing"; public static final String LIST_CHANNELS = "listChannels"; public static final String CLEAR_NOTIFICATION = "clearNotification"; + public static final String CREATE_CHANNEL_GROUP = "createChannelGroup"; + public static final String LIST_CHANNEL_GROUPS = "listChannelGroups"; + public static final String DELETE_CHANNEL_GROUP = "deleteChannelGroup"; + public static final String GROUP_ID = "id"; + public static final String GROUP_NAME= "name"; + public static final String CHANNEL_GROUP_ID = "group_id"; } From 74098278121d430c116428e2a34a3186a5b9afe0 Mon Sep 17 00:00:00 2001 From: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> Date: Thu, 1 Nov 2018 16:34:45 +0800 Subject: [PATCH 02/25] Update PushPlugin.java --- .../com/adobe/phonegap/push/PushPlugin.java | 79 ++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/src/android/com/adobe/phonegap/push/PushPlugin.java b/src/android/com/adobe/phonegap/push/PushPlugin.java index 690b37776..64630b033 100644 --- a/src/android/com/adobe/phonegap/push/PushPlugin.java +++ b/src/android/com/adobe/phonegap/push/PushPlugin.java @@ -164,6 +164,45 @@ private void createDefaultNotificationChannelIfNeeded(JSONObject options) { } } } + + @TargetApi(26) + private void createChannelGroup(JSONObject group) throws JSONException { + // only call on Android O and above + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + final NotificationManager notificationManager = (NotificationManager) cordova.getActivity() + .getSystemService(Context.NOTIFICATION_SERVICE); + NotificationChannelGroup mGroup = new NotificationChannelGroup(group.optString(GROUP_ID, ""), group.optString(GROUP_NAME, "")); + notificationManager.createNotificationChannelGroup(mGroup); + } + } + + @TargetApi(26) + private JSONArray listChannelGroups() throws JSONException { + JSONArray channelGroups = new JSONArray(); + // only call on Android O and above + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + final NotificationManager notificationManager = (NotificationManager) cordova.getActivity() + .getSystemService(Context.NOTIFICATION_SERVICE); + List notificationChannelGroups = notificationManager.getNotificationChannelGroups(); + for (NotificationChannelGroup notificationChannelGroup : notificationChannelGroups) { + JSONObject channelGroup = new JSONObject(); + channelGroup.put(GROUP_ID, notificationChannelGroup.getId()); + channelGroup.put(GROUP_NAME, notificationChannelGroup.getName()); + channelGroups.put(channelGroup); + } + } + return channelGroups; + } + + @TargetApi(26) + private void deleteChannelGroup(String channelGroupId) { + // only call on Android O and above + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + final NotificationManager notificationManager = (NotificationManager) cordova.getActivity() + .getSystemService(Context.NOTIFICATION_SERVICE); + notificationManager.deleteNotificationChannelGroup(channelGroupId); + } + } @Override public boolean execute(final String action, final JSONArray data, final CallbackContext callbackContext) { @@ -431,7 +470,45 @@ public void run() { } } }); - } else { + } else if (CREATE_CHANNEL_GROUP.equals(action)) { + // un-subscribing for a topic + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + // call create channel + createChannelGroup(data.getJSONObject(0)); + callbackContext.success(); + } catch (JSONException e) { + callbackContext.error(e.getMessage()); + } + } + }); + } else if (LIST_CHANNEL_GROUPS.equals(action)) { + // un-subscribing for a topic + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + callbackContext.success(listChannelGroups()); + } catch (JSONException e) { + callbackContext.error(e.getMessage()); + } + } + }); + } else if (DELETE_CHANNEL_GROUP.equals(action)) { + // un-subscribing for a topic + cordova.getThreadPool().execute(new Runnable() { + public void run() { + try { + String channelGroupId = data.getString(0); + deleteChannelGroup(channelGroupId); + callbackContext.success(); + } catch (JSONException e) { + callbackContext.error(e.getMessage()); + } + } + }); + } + else { Log.e(LOG_TAG, "Invalid action : " + action); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.INVALID_ACTION)); return false; From 5c6b906b97ca35910ed080a777e5c2e8a0cd6643 Mon Sep 17 00:00:00 2001 From: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> Date: Thu, 1 Nov 2018 16:36:01 +0800 Subject: [PATCH 03/25] Update push.js --- www/push.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/www/push.js b/www/push.js index 7aea0c648..fa71ddf70 100644 --- a/www/push.js +++ b/www/push.js @@ -381,6 +381,19 @@ module.exports = { listChannels: function listChannels(successCallback, errorCallback) { exec(successCallback, errorCallback, 'PushNotification', 'listChannels', []); }, + + createChannelGroup: function createChannel(successCallback, errorCallback, channelGroup) { + exec(successCallback, errorCallback, 'PushNotification', 'createChannelGroup', [channelGroup]); + }, + + deleteChannelGroup: function deleteChannel(successCallback, errorCallback, channelGroupId) { + exec(successCallback, errorCallback, 'PushNotification', 'deleteChannelGroup', [channelGroupId]); + }, + + listChannelGroups: function listChannels(successCallback, errorCallback) { + exec(successCallback, errorCallback, 'PushNotification', 'listChannelGroups', []); + }, + /** * PushNotification Object. @@ -390,4 +403,4 @@ module.exports = { * .init helper method. */ PushNotification: PushNotification -}; \ No newline at end of file +}; From c84a96800a81d2471536b6018248fc597d829878 Mon Sep 17 00:00:00 2001 From: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> Date: Thu, 1 Nov 2018 16:41:16 +0800 Subject: [PATCH 04/25] Added channel group with createChannelGroup,deleteChannelGroup,ListChannelGroup createChannel can add channel group created and listChannel can show the channel group that channel belong to --- src/android/com/adobe/phonegap/push/PushPlugin.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/android/com/adobe/phonegap/push/PushPlugin.java b/src/android/com/adobe/phonegap/push/PushPlugin.java index 64630b033..2c75b57a8 100644 --- a/src/android/com/adobe/phonegap/push/PushPlugin.java +++ b/src/android/com/adobe/phonegap/push/PushPlugin.java @@ -69,6 +69,7 @@ private JSONArray listChannels() throws JSONException { JSONObject channel = new JSONObject(); channel.put(CHANNEL_ID, notificationChannel.getId()); channel.put(CHANNEL_DESCRIPTION, notificationChannel.getDescription()); + channel.put(CHANNEL_GROUP_ID, notificationChannel.getGroup()); channels.put(channel); } } @@ -96,7 +97,12 @@ private void createChannel(JSONObject channel) throws JSONException { NotificationChannel mChannel = new NotificationChannel(channel.getString(CHANNEL_ID), channel.optString(CHANNEL_DESCRIPTION, ""), channel.optInt(CHANNEL_IMPORTANCE, NotificationManager.IMPORTANCE_DEFAULT)); - + + String groupId=channel.optString(CHANNEL_GROUP_ID, ""); + if(groupId != null && !groupId.isEmpty() ) { + mChannel.setGroup(groupId); + } + int lightColor = channel.optInt(CHANNEL_LIGHT_COLOR, -1); if (lightColor != -1) { mChannel.setLightColor(lightColor); From 157ecc5400805c7e941365db8efd016c1bec73f6 Mon Sep 17 00:00:00 2001 From: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> Date: Thu, 1 Nov 2018 16:42:20 +0800 Subject: [PATCH 05/25] Update push.js --- src/js/push.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/js/push.js b/src/js/push.js index f952cacbf..d527a564a 100644 --- a/src/js/push.js +++ b/src/js/push.js @@ -337,6 +337,18 @@ module.exports = { listChannels: (successCallback, errorCallback) => { exec(successCallback, errorCallback, 'PushNotification', 'listChannels', []); }, + createChannelGroup: (successCallback, errorCallback, channelGroup) { + exec(successCallback, errorCallback, 'PushNotification', 'createChannelGroup', [channelGroup]); + }, + + deleteChannelGroup: (successCallback, errorCallback, channelGroupId) { + exec(successCallback, errorCallback, 'PushNotification', 'deleteChannelGroup', [channelGroupId]); + }, + + listChannelGroups: (successCallback, errorCallback) { + exec(successCallback, errorCallback, 'PushNotification', 'listChannelGroups', []); + }, + /** * PushNotification Object. From 3fbcffa6b4bbf2fb59e42fad88946bf7c3ac1abb Mon Sep 17 00:00:00 2001 From: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> Date: Thu, 1 Nov 2018 17:03:35 +0800 Subject: [PATCH 06/25] With channel group --- docs/API.md | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 2 deletions(-) diff --git a/docs/API.md b/docs/API.md index 0b1a9ea86..4af2ff9b7 100644 --- a/docs/API.md +++ b/docs/API.md @@ -5,6 +5,9 @@ - [.createChannel() - Android only](#pushnotificationcreatechannel) - [.deleteChannel() - Android only](#pushnotificationdeletechannel) - [.listChannels() - Android only](#pushnotificationlistchannels) +- [.createChannelGroup() - Android only](#pushnotificationcreatechannelgroup) +- [.deleteChannelGroup() - Android only](#pushnotificationdeletechannelgroup) +- [.listChannelGroups() - Android only](#pushnotificationlistchannelgroups) - [push.on()](#pushonevent-callback) - [push.on('registration')](#pushonregistration-callback) - [push.on('notification')](#pushonnotification-callback) @@ -224,6 +227,7 @@ A default channel with the id "PushPluginChannel" is created automatically. To m | `sound` | `String` | The name of the sound file to be played upon receipt of the notification in this channel. Cannot be changed after channel is created. | | `vibration` | `Boolean` or `Array` | Boolean sets whether notification posted to this channel should vibrate. Array sets custom vibration pattern. Example - vibration: `[2000, 1000, 500, 500]`. Cannot be changed after channel is created. | | `visibility` | `Int` | Sets whether notifications posted to this channel appear on the lockscreen or not, and if so, whether they appear in a redacted form. 0 = Private, 1 = Public, -1 = Secret. | +| `group_id` | `String` | Sets channel group id. Assign it to a Channel Group Created. Cannot be changed once set. | ## PushNotification.deleteChannel(successHandler, failureHandler, channelId) @@ -274,11 +278,111 @@ Returns a list of currently configured channels. ```javascript PushNotification.listChannels(channels => { for (let channel of channels) { - console.log(`ID: ${channel.id} Description: ${channel.description}`); + console.log(`ID: ${channel.id} Description: ${channel.description} GroupID: ${channel.group_id}`); } }); ``` +## PushNotification.createChannelGroup(successHandler, failureHandler, channel) + +Create a new notification channel group for Android O and above. + +### Parameters + +| Parameter | Type | Default | Description | +| ---------------- | ---------- | ------- | ------------------------------------------------------ | +| `successHandler` | `Function` | | Is called when the api successfully creates a channel. | +| `failureHandler` | `Function` | | Is called when the api fails to create a channel. | +| `channelGroup` | `Object` | | The options for the channel group. | + +### Example + +```javascript +PushNotification.createChannelGroup( + () => { + console.log('success'); + }, + () => { + console.log('error'); + }, + { + id: 'testchannelgroup', + name: 'My first test channel group' + } +); +``` + +The above will create a channel group for your app. You'll need to provide the `id` and `name` properties. + + + +### Channel Group properties + +| Property | Type | Description | +| -------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | `String` | The id of the channel group. | +| `name` | `String` | The user visible name of the channel group. | + +## PushNotification.deleteChannelGroup(successHandler, failureHandler, channelGroupId) + +Delete a notification channel for Android O and above. + +### Parameters + +| Parameter | Type | Default | Description | +| ---------------- | ---------- | ------- | ------------------------------------------------------------ | +| `successHandler` | `Function` | | Is called when the api successfully creates a channel group. | +| `failureHandler` | `Function` | | Is called when the api fails to create a channel group. | +| `channelGroupId` | `String` | | The ID of the channel group. | + +### Example + +```javascript +PushNotification.deleteChannelGroup( + () => { + console.log('success'); + }, + () => { + console.log('error'); + }, + 'testchannelgroup' +); +``` + +## PushNotification.listChannelGroups(successHandler) + +Returns a list of currently configured channel groups. + +### Parameters + +| Parameter | Type | Default | Description | +| ---------------- | ---------- | ------- | ------------------------------------------------------------------- | +| `successHandler` | `Function` | | Is called when the api successfully retrieves the list of channels. | + +### Callback parameters + +#### `successHandler` + +| Parameter | Type | Description | +| ---------- | ------------ | ------------------------------ | +| `channelGroups` | `JSONArrary` | List of channel group objects. | + +### Example + +```javascript +PushNotification.listChannelGroups(channelGroups => { + for (let channelGroup of channelGroups) { + console.log(`ID: ${channelGroup.id} Description: ${channelGroup.name}`); + } +}); +``` + + + + + + + ## push.on(event, callback) ### Parameters @@ -612,4 +716,4 @@ push.clearNotification(() => { }, () => { console.log('error'); }, 145); -``` \ No newline at end of file +``` From ad3cf961d69903bd55f8b1c7db55e5b4dace3d86 Mon Sep 17 00:00:00 2001 From: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> Date: Thu, 1 Nov 2018 17:19:29 +0800 Subject: [PATCH 07/25] Update API.md --- docs/API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/API.md b/docs/API.md index 4af2ff9b7..0242b47f0 100644 --- a/docs/API.md +++ b/docs/API.md @@ -283,7 +283,7 @@ PushNotification.listChannels(channels => { }); ``` -## PushNotification.createChannelGroup(successHandler, failureHandler, channel) +## PushNotification.createChannelGroup(successHandler, failureHandler, channelGroup) Create a new notification channel group for Android O and above. From 9f937232f9205e45b296a131b9ec3450344f95a6 Mon Sep 17 00:00:00 2001 From: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> Date: Thu, 1 Nov 2018 17:24:50 +0800 Subject: [PATCH 08/25] Update push.js --- src/js/push.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/push.js b/src/js/push.js index d527a564a..5538b36df 100644 --- a/src/js/push.js +++ b/src/js/push.js @@ -337,15 +337,15 @@ module.exports = { listChannels: (successCallback, errorCallback) => { exec(successCallback, errorCallback, 'PushNotification', 'listChannels', []); }, - createChannelGroup: (successCallback, errorCallback, channelGroup) { + createChannelGroup: (successCallback, errorCallback, channelGroup) => { exec(successCallback, errorCallback, 'PushNotification', 'createChannelGroup', [channelGroup]); }, - deleteChannelGroup: (successCallback, errorCallback, channelGroupId) { + deleteChannelGroup: (successCallback, errorCallback, channelGroupId) => { exec(successCallback, errorCallback, 'PushNotification', 'deleteChannelGroup', [channelGroupId]); }, - listChannelGroups: (successCallback, errorCallback) { + listChannelGroups: (successCallback, errorCallback) => { exec(successCallback, errorCallback, 'PushNotification', 'listChannelGroups', []); }, From c98680592834f505566d113d48c05ebbd0bb6aea Mon Sep 17 00:00:00 2001 From: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> Date: Fri, 2 Nov 2018 08:12:57 +0800 Subject: [PATCH 09/25] Update index.d.ts --- types/index.d.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index 33a003f4e..cc1bcba5e 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -290,9 +290,27 @@ declare namespace PhonegapPluginPush { notId?: string } + interface channel{ + id: string + description:string + importance: integer + vibration: boolean + } + + interface channelGroup{ + id: string + name:string + } + interface PushNotificationStatic { init(options: InitOptions): PushNotification new (options: InitOptions): PushNotification + createChannel(successHandler: () => any, errorHandler: () => any,channel):void + listChannels(successHandler: () => any):void + deleteChannel(successHandler: () => any, errorHandler: () => any, channelId:string ):void + createChannelGroup(successHandler: () => any, errorHandler: () => any,channelGroup):void + listChannelGroups(successHandler: () => any):void + deleteChannelGroup(successHandler: () => any, errorHandler: () => any, channelGroupId:string ):void } } From 97e046c12e9013fedeab518727e199bdd319616a Mon Sep 17 00:00:00 2001 From: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> Date: Fri, 2 Nov 2018 08:16:15 +0800 Subject: [PATCH 10/25] Update index.d.ts --- types/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/index.d.ts b/types/index.d.ts index cc1bcba5e..7ab166aea 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -292,6 +292,7 @@ declare namespace PhonegapPluginPush { interface channel{ id: string + name : string //camillebeaumont name and description fix description:string importance: integer vibration: boolean From 82201b75f8a7e1207c5dc0549e8be01685439126 Mon Sep 17 00:00:00 2001 From: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> Date: Fri, 2 Nov 2018 08:26:29 +0800 Subject: [PATCH 11/25] Added hasPermission and visibility Also added comments and clean up code to match the coding style --- types/index.d.ts | 52 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 7ab166aea..4d889710a 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -289,29 +289,61 @@ declare namespace PhonegapPluginPush { from?: string notId?: string } - + /** + * Set Channel Variable,once created cannot be changed programmtically for importance and vibration + */ interface channel{ + /** + * channel ID + */ id: string - name : string //camillebeaumont name and description fix - description:string + /** + * camillebeaumont name and description fix + */ + name: string + /** + * camillebeaumont name and description fix,channel description + */ + description: string + /** + * channel importance level + */ importance: integer + /** + * enable vibration for the notification + */ vibration: boolean + /** + * Set notitfication visibility + */ + visibility: integer + /** + * Set Channel Group + */ + groupId:string } interface channelGroup{ + /** + * Set Channel Group ID + */ id: string - name:string + /** + * Set Channel Group Name + */ + name: string } interface PushNotificationStatic { init(options: InitOptions): PushNotification new (options: InitOptions): PushNotification - createChannel(successHandler: () => any, errorHandler: () => any,channel):void - listChannels(successHandler: () => any):void - deleteChannel(successHandler: () => any, errorHandler: () => any, channelId:string ):void - createChannelGroup(successHandler: () => any, errorHandler: () => any,channelGroup):void - listChannelGroups(successHandler: () => any):void - deleteChannelGroup(successHandler: () => any, errorHandler: () => any, channelGroupId:string ):void + hasPermission(successHandler: () => any): void + createChannel(successHandler: () => any, errorHandler: () => any,channel): void + listChannels(successHandler: () => any): void + deleteChannel(successHandler: () => any, errorHandler: () => any, channelId: string ): void + createChannelGroup(successHandler: () => any, errorHandler: () => any,channelGroup): void + listChannelGroups(successHandler: () => any): void + deleteChannelGroup(successHandler: () => any, errorHandler: () => any, channelGroupId: string ): void } } From bc1c552780cb7d4da21b45111f32dfb9566188ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederico=20Galv=C3=A3o?= Date: Fri, 2 Nov 2018 08:57:24 +0800 Subject: [PATCH 12/25] Ok Co-Authored-By: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 4d889710a..569904224 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -302,7 +302,7 @@ declare namespace PhonegapPluginPush { */ name: string /** - * camillebeaumont name and description fix,channel description + * The user visible name of the channel. The recommended maximum length is 40 characters; the value may be truncated if it is too long. */ description: string /** From 5abe30984f1e8d7bcd526d154fe96dcc682e4fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederico=20Galv=C3=A3o?= Date: Fri, 2 Nov 2018 08:57:46 +0800 Subject: [PATCH 13/25] fredgalvo change Co-Authored-By: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 569904224..cf17274d8 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -306,7 +306,7 @@ declare namespace PhonegapPluginPush { */ description: string /** - * channel importance level + * The importance of the channel. This controls how interruptive notifications posted to this channel are. The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest. */ importance: integer /** From 27149d893809894fc579aca4e004ca5930a0a888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederico=20Galv=C3=A3o?= Date: Fri, 2 Nov 2018 09:00:16 +0800 Subject: [PATCH 14/25] Update types/index.d.ts Co-Authored-By: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index cf17274d8..148524b47 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -308,7 +308,7 @@ declare namespace PhonegapPluginPush { /** * The importance of the channel. This controls how interruptive notifications posted to this channel are. The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest. */ - importance: integer + importance: number /** * enable vibration for the notification */ From 14a0f584e1e048cb2668de1216be5da4533286fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederico=20Galv=C3=A3o?= Date: Fri, 2 Nov 2018 09:00:42 +0800 Subject: [PATCH 15/25] Update types/index.d.ts Co-Authored-By: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 148524b47..82357ed71 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -292,7 +292,7 @@ declare namespace PhonegapPluginPush { /** * Set Channel Variable,once created cannot be changed programmtically for importance and vibration */ - interface channel{ + interface Channel { /** * channel ID */ From 8bac2647622ac0a6900f9c95f5b8ae7ffd254cbe Mon Sep 17 00:00:00 2001 From: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> Date: Fri, 2 Nov 2018 09:04:03 +0800 Subject: [PATCH 16/25] Update index.d.ts --- types/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 82357ed71..c80212273 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -296,11 +296,11 @@ declare namespace PhonegapPluginPush { /** * channel ID */ - id: string + id?: string /** * camillebeaumont name and description fix */ - name: string + name?: string /** * The user visible name of the channel. The recommended maximum length is 40 characters; the value may be truncated if it is too long. */ @@ -308,15 +308,15 @@ declare namespace PhonegapPluginPush { /** * The importance of the channel. This controls how interruptive notifications posted to this channel are. The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest. */ - importance: number + importance?: number /** * enable vibration for the notification */ - vibration: boolean + vibration?: boolean /** * Set notitfication visibility */ - visibility: integer + visibility?: number /** * Set Channel Group */ @@ -327,11 +327,11 @@ declare namespace PhonegapPluginPush { /** * Set Channel Group ID */ - id: string + id?: string /** * Set Channel Group Name */ - name: string + name?: string } interface PushNotificationStatic { From 9510d9f29ab147ac7a02af67f46a21571536faa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederico=20Galv=C3=A3o?= Date: Fri, 2 Nov 2018 09:04:15 +0800 Subject: [PATCH 17/25] Update types/index.d.ts Co-Authored-By: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index c80212273..18566e386 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -294,7 +294,7 @@ declare namespace PhonegapPluginPush { */ interface Channel { /** - * channel ID + * The id of the channel. Must be unique per package. The value may be truncated if it is too long. */ id?: string /** From 3feeaab301e60b99f5795be1695e47d0f437e852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederico=20Galv=C3=A3o?= Date: Fri, 2 Nov 2018 09:04:34 +0800 Subject: [PATCH 18/25] Update types/index.d.ts Co-Authored-By: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 18566e386..2535561a6 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -323,7 +323,7 @@ declare namespace PhonegapPluginPush { groupId:string } - interface channelGroup{ + interface ChannelGroup { /** * Set Channel Group ID */ From fe9e7c0a7ecb5b30f88dfa7597a5f0660c3eb2eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederico=20Galv=C3=A3o?= Date: Fri, 2 Nov 2018 09:06:59 +0800 Subject: [PATCH 19/25] Update types/index.d.ts Co-Authored-By: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 2535561a6..c71855eb0 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -318,7 +318,7 @@ declare namespace PhonegapPluginPush { */ visibility?: number /** - * Set Channel Group + * Sets channel group id. Assign it to a Channel Group Created. Cannot be changed once set. */ groupId:string } From f3df474843d686367022f3104ed8b7eaf34b2d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederico=20Galv=C3=A3o?= Date: Fri, 2 Nov 2018 09:07:03 +0800 Subject: [PATCH 20/25] Update types/index.d.ts Co-Authored-By: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index c71855eb0..5f1d5ba24 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -314,7 +314,7 @@ declare namespace PhonegapPluginPush { */ vibration?: boolean /** - * Set notitfication visibility + * Sets whether notifications posted to this channel appear on the lockscreen or not, and if so, whether they appear in a redacted form. 0 = Private, 1 = Public, -1 = Secret. */ visibility?: number /** From 8a61e7cfaaf6783e5f628cef7339850663ae39f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederico=20Galv=C3=A3o?= Date: Fri, 2 Nov 2018 09:07:11 +0800 Subject: [PATCH 21/25] Update types/index.d.ts Co-Authored-By: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 5f1d5ba24..29832654c 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -310,7 +310,7 @@ declare namespace PhonegapPluginPush { */ importance?: number /** - * enable vibration for the notification + * Boolean sets whether notification posted to this channel should vibrate. Array sets custom vibration pattern. Example - vibration: [2000, 1000, 500, 500]. Cannot be changed after channel is created. */ vibration?: boolean /** From 617892f8db07f1143971df728d3f8b1a68ad5e47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederico=20Galv=C3=A3o?= Date: Fri, 2 Nov 2018 09:07:17 +0800 Subject: [PATCH 22/25] Update types/index.d.ts Co-Authored-By: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> --- types/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index 29832654c..663a1d160 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -309,6 +309,10 @@ declare namespace PhonegapPluginPush { * The importance of the channel. This controls how interruptive notifications posted to this channel are. The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest. */ importance?: number + /** + * The name of the sound file to be played upon receipt of the notification in this channel. Cannot be changed after channel is created. + */ + sound: string /** * Boolean sets whether notification posted to this channel should vibrate. Array sets custom vibration pattern. Example - vibration: [2000, 1000, 500, 500]. Cannot be changed after channel is created. */ From 05f5553039bf84eeac49ecdbf6916f53fca2f442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederico=20Galv=C3=A3o?= Date: Fri, 2 Nov 2018 09:07:41 +0800 Subject: [PATCH 23/25] Update types/index.d.ts Co-Authored-By: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 663a1d160..b96251540 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -333,7 +333,7 @@ declare namespace PhonegapPluginPush { */ id?: string /** - * Set Channel Group Name + * The user visible name of the channel group. */ name?: string } From 891023acd56ead07ac14d3ed1080f10c20e6d0e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederico=20Galv=C3=A3o?= Date: Fri, 2 Nov 2018 09:08:06 +0800 Subject: [PATCH 24/25] Update types/index.d.ts Co-Authored-By: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index b96251540..0f98c4fe6 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -329,7 +329,7 @@ declare namespace PhonegapPluginPush { interface ChannelGroup { /** - * Set Channel Group ID + * The id of the channel group. */ id?: string /** From 8a4ca82f0eda007dccf61e0b1a788e2a44310804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederico=20Galv=C3=A3o?= Date: Fri, 2 Nov 2018 09:11:03 +0800 Subject: [PATCH 25/25] Update types/index.d.ts Co-Authored-By: OliverOng1995 <44562019+OliverOng1995@users.noreply.github.com> --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 0f98c4fe6..a41779158 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -345,7 +345,7 @@ declare namespace PhonegapPluginPush { createChannel(successHandler: () => any, errorHandler: () => any,channel): void listChannels(successHandler: () => any): void deleteChannel(successHandler: () => any, errorHandler: () => any, channelId: string ): void - createChannelGroup(successHandler: () => any, errorHandler: () => any,channelGroup): void + createChannelGroup(successHandler: () => any, errorHandler: () => any, channelGroup: ChannelGroup): void listChannelGroups(successHandler: () => any): void deleteChannelGroup(successHandler: () => any, errorHandler: () => any, channelGroupId: string ): void }