summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/phonegap-plugin-push/www/browser/push.js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/plugins/phonegap-plugin-push/www/browser/push.js')
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/www/browser/push.js31
1 files changed, 1 insertions, 30 deletions
diff --git a/StoneIsland/plugins/phonegap-plugin-push/www/browser/push.js b/StoneIsland/plugins/phonegap-plugin-push/www/browser/push.js
index 1badd77b..9b74d8a4 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/www/browser/push.js
+++ b/StoneIsland/plugins/phonegap-plugin-push/www/browser/push.js
@@ -29,12 +29,6 @@ var PushNotification = function(options) {
// store the options to this object instance
this.options = options;
- // subscription options
- var subOptions = {userVisibleOnly: true};
- if (this.options.browser && this.options.browser.applicationServerKey) {
- subOptions.applicationServerKey = urlBase64ToUint8Array(this.options.browser.applicationServerKey);
- }
-
// triggered on registration and notification
var that = this;
@@ -56,7 +50,7 @@ var PushNotification = function(options) {
})
.then(function(reg) {
serviceWorker = reg;
- reg.pushManager.subscribe(subOptions).then(function(sub) {
+ reg.pushManager.subscribe({userVisibleOnly: true}).then(function(sub) {
subscription = sub;
result = { 'registrationId': sub.endpoint.substring(sub.endpoint.lastIndexOf('/') + 1) };
that.emit('registration', result);
@@ -328,29 +322,6 @@ PushNotification.prototype.finish = function(successCallback, errorCallback, id)
* Push Notification Plugin.
*/
-/**
- * Converts the server key to an Uint8Array
- *
- * @param base64String
- *
- * @returns {Uint8Array}
- */
-function urlBase64ToUint8Array(base64String) {
- const padding = '='.repeat((4 - base64String.length % 4) % 4);
- const base64 = (base64String + padding)
- .replace(/\-/g, '+')
- .replace(/_/g, '/');
-
- const rawData = window.atob(base64);
- const outputArray = new Uint8Array(rawData.length);
-
- for (var i = 0; i < rawData.length; ++i) {
- outputArray[i] = rawData.charCodeAt(i);
- }
- return outputArray;
-}
-
-
module.exports = {
/**
* Register for Push Notifications.