diff --git a/bower.json b/bower.json index 2fad4178c..af6608d2f 100644 --- a/bower.json +++ b/bower.json @@ -11,7 +11,6 @@ "ecosystem:phonegap", "cordova-ios", "cordova-android", - "cordova-windows", "cordova-browser" ], "homepage": "https://github.com/phonegap/phonegap-plugin-push", diff --git a/docs/PLATFORM_SUPPORT.md b/docs/PLATFORM_SUPPORT.md index 9510cf81c..a5a4bd921 100644 --- a/docs/PLATFORM_SUPPORT.md +++ b/docs/PLATFORM_SUPPORT.md @@ -6,7 +6,6 @@ - Android (`cordova-android` 12.0.0 or higher) - Browser - iOS (`cordova-ios` 6.0.0 or higher) -- Windows Universal (not Windows Phone 8) ### Version 3.x.x diff --git a/docs/TYPESCRIPT.md b/docs/TYPESCRIPT.md index 093cc4e4b..70fc03256 100644 --- a/docs/TYPESCRIPT.md +++ b/docs/TYPESCRIPT.md @@ -17,8 +17,7 @@ const push = PushNotification.init({ alert: "true", badge: true, sound: 'false' - }, - windows: {} + } }); push.on('registration', (data) => { diff --git a/hooks/windows/setToastCapable.js b/hooks/windows/setToastCapable.js deleted file mode 100644 index ade622fe2..000000000 --- a/hooks/windows/setToastCapable.js +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = function (context) { - console.log('Updating appxmanifests with ToastCapable=true ...'); - var path = require('path'); - var fs = require('fs'); - - var platformProjPath = path.join(context.opts.projectRoot, 'platforms/windows'); - if (!fs.existsSync(platformProjPath)) { - platformProjPath = context.opts.projectRoot; - } - - var AppxManifest = require(path.join(platformProjPath, 'cordova/lib/AppxManifest')); - - ['package.phone.appxmanifest', 'package.windows.appxmanifest'].forEach(function (manifestPath) { - var manifest = AppxManifest.get(path.join(platformProjPath, manifestPath)); - manifest.getVisualElements().setToastCapable(true); - manifest.write(); - }); -}; diff --git a/package.json b/package.json index cbc57a47b..534981ebe 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "ecosystem:cordova", "cordova-ios", "cordova-android", - "cordova-windows", "cordova-browser" ], "author": "Erisu", @@ -66,7 +65,6 @@ "platforms": [ "ios", "android", - "windows", "browser" ] } diff --git a/plugin.xml b/plugin.xml index 8612a536d..a77915b58 100755 --- a/plugin.xml +++ b/plugin.xml @@ -132,15 +132,4 @@ - - - - - - - - - - - diff --git a/src/windows/PushPluginProxy.js b/src/windows/PushPluginProxy.js deleted file mode 100644 index bc922790b..000000000 --- a/src/windows/PushPluginProxy.js +++ /dev/null @@ -1,101 +0,0 @@ -var myApp = {}; -var pushNotifications = Windows.Networking.PushNotifications; - -var createNotificationJSON = function (e) { - var result = { message: '' }; // Added to identify callback as notification type in the API in case where notification has no message - var notificationPayload; - - switch (e.notificationType) { - case pushNotifications.PushNotificationType.toast: - case pushNotifications.PushNotificationType.tile: - if (e.notificationType === pushNotifications.PushNotificationType.toast) { - notificationPayload = e.toastNotification.content; - } else { - notificationPayload = e.tileNotification.content; - } - var texts = notificationPayload.getElementsByTagName('text'); - if (texts.length > 1) { - result.title = texts[0].innerText; - result.message = texts[1].innerText; - } else if (texts.length === 1) { - result.message = texts[0].innerText; - } - var images = notificationPayload.getElementsByTagName('image'); - if (images.length > 0) { - result.image = images[0].getAttribute('src'); - } - var soundFile = notificationPayload.getElementsByTagName('audio'); - if (soundFile.length > 0) { - result.sound = soundFile[0].getAttribute('src'); - } - break; - - case pushNotifications.PushNotificationType.badge: - notificationPayload = e.badgeNotification.content; - result.count = notificationPayload.getElementsByTagName('badge')[0].getAttribute('value'); - break; - - case pushNotifications.PushNotificationType.raw: - result.message = e.rawNotification.content; - break; - } - - result.additionalData = { coldstart: false }; // this gets called only when the app is running - result.additionalData.pushNotificationReceivedEventArgs = e; - return result; -}; - -module.exports = { - init: function (onSuccess, onFail, args) { - var onNotificationReceived = function (e) { - var result = createNotificationJSON(e); - onSuccess(result, { keepCallback: true }); - }; - - try { - pushNotifications.PushNotificationChannelManager.createPushNotificationChannelForApplicationAsync().done( - function (channel) { - var result = {}; - result.registrationId = channel.uri; - myApp.channel = channel; - channel.addEventListener('pushnotificationreceived', onNotificationReceived); - myApp.notificationEvent = onNotificationReceived; - onSuccess(result, { keepCallback: true }); - - var context = cordova.require('cordova/platform').activationContext; - var launchArgs = context ? (context.argument || context.args) : null; - if (launchArgs) { // If present, app launched through push notification - result = { message: '' }; // Added to identify callback as notification type in the API - result.launchArgs = launchArgs; - result.additionalData = { coldstart: true }; - onSuccess(result, { keepCallback: true }); - } - }, function (error) { - onFail(error); - }); - } catch (ex) { - onFail(ex); - } - }, - unregister: function (onSuccess, onFail, args) { - try { - myApp.channel.removeEventListener('pushnotificationreceived', myApp.notificationEvent); - myApp.channel.close(); - onSuccess(); - } catch (ex) { - onFail(ex); - } - }, - hasPermission: function (onSuccess) { - var notifier = Windows.UI.Notifications.ToastNotificationManager.createToastNotifier(); - - onSuccess({ isEnabled: !notifier.setting }); - }, - subscribe: function () { - console.log('Subscribe is unsupported'); - }, - unsubscribe: function () { - console.log('Subscribe is unsupported'); - } -}; -require('cordova/exec/proxy').add('PushNotification', module.exports); diff --git a/types/index.d.ts b/types/index.d.ts index 0c93dffcc..77c2b8484 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -229,13 +229,6 @@ declare namespace PhonegapPluginPush { */ topics?: string[] } - - /** - * Windows specific initialization options. - */ - windows?: { - - } } interface CategoryArray { @@ -273,7 +266,6 @@ declare namespace PhonegapPluginPush { title?: string /** * The number of messages to be displayed in the badge iOS or message count in the notification shade in Android. - * For windows, it represents the value in the badge notification which could be a number or a status glyph. */ count: string /**