diff --git a/README.md b/README.md
index 9d49c304..601779c3 100644
--- a/README.md
+++ b/README.md
@@ -83,7 +83,6 @@ function, which is typically less customizable.
- Android
- Browser
- iOS
-- Windows
## navigator.notification.confirm
@@ -127,7 +126,6 @@ indexing, so the value is `1`, `2`, `3`, etc.
- Android
- Browser
- iOS
-- Windows
### Android Quirks
@@ -135,12 +133,6 @@ indexing, so the value is `1`, `2`, `3`, etc.
- Android dialog title cannot exceed 2 lines of content, it will ignore any more than this.
-### Windows Quirks
-
-- On Windows8/8.1 it is not possible to add more than three buttons to MessageDialog instance.
-
-- On Windows Phone 8.1 it's not possible to show dialog with more than two buttons.
-
## navigator.notification.prompt
Displays a native dialog box that is more customizable than the browser's `prompt` function.
@@ -188,7 +180,6 @@ contains the following properties:
- Android
- Browser
- iOS
-- Windows
### Android Quirks
@@ -196,10 +187,6 @@ contains the following properties:
- On Android 3.0 and later, buttons are displayed in reverse order for devices that use the Holo theme.
-### Windows Quirks
-
-- On Windows prompt dialog is html-based due to lack of such native api.
-
## navigator.notification.beep
The device plays a beep sound.
@@ -218,7 +205,6 @@ The device plays a beep sound.
- Android
- Browser
- iOS
-- Windows 8
### Android Quirks
diff --git a/package.json b/package.json
index 1d3e6248..3170eb6b 100644
--- a/package.json
+++ b/package.json
@@ -8,8 +8,7 @@
"platforms": [
"android",
"browser",
- "ios",
- "windows"
+ "ios"
]
},
"repository": "github:apache/cordova-plugin-dialogs",
@@ -20,8 +19,7 @@
"ecosystem:cordova",
"cordova-android",
"cordova-browser",
- "cordova-ios",
- "cordova-windows"
+ "cordova-ios"
],
"scripts": {
"test": "npm run lint",
diff --git a/plugin.xml b/plugin.xml
index 9258a9ae..f66345a3 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -70,13 +70,4 @@
-
-
-
-
-
-
-
-
-
diff --git a/src/windows/NotificationProxy.js b/src/windows/NotificationProxy.js
deleted file mode 100644
index a3b04bbe..00000000
--- a/src/windows/NotificationProxy.js
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-/* global Windows, WinJS, toStaticHTML */
-
-var cordova = require('cordova');
-var urlutil = require('cordova/urlutil');
-
-var isAlertShowing = false;
-var alertStack = [];
-
-function createCSSElem (fileName) {
- var elemId = fileName.substr(0, fileName.lastIndexOf('.')) + '-plugin-style';
- // If the CSS element exists, don't recreate it.
- if (document.getElementById(elemId)) {
- return false;
- }
-
- // Create CSS and append it to DOM.
- var $elem = document.createElement('link');
- $elem.id = elemId;
- $elem.rel = 'stylesheet';
- $elem.type = 'text/css';
- $elem.href = urlutil.makeAbsolute('/www/css/' + fileName);
-
- document.head.appendChild($elem);
- return true;
-}
-
-// CB-8928: When toStaticHTML is undefined, prompt fails to run
-var _cleanHtml = function (html) {
- return html;
-};
-if (typeof toStaticHTML !== 'undefined') {
- _cleanHtml = toStaticHTML;
-}
-
-// Windows does not provide native UI for promp dialog so we use some
-// simple html-based implementation until it is available
-function createPromptDialog (title, message, buttons, defaultText, callback) {
- var isPhone = cordova.platformId === 'windows' && WinJS.Utilities.isPhone;
- var isWindows = !!cordova.platformId.match(/windows/);
-
- createCSSElem('notification.css');
-
- var dlgWrap = document.createElement('div');
- dlgWrap.className = 'dlgWrap';
-
- var dlg = document.createElement('div');
- dlg.className = 'dlgContainer';
-
- if (isWindows) {
- dlg.className += ' dlgContainer-windows';
- } else if (isPhone) {
- dlg.className += ' dlgContainer-phone';
- }
-
- // dialog layout template
- dlg.innerHTML = _cleanHtml(
- "
" + // title
- "
" + // message
- "
"
- ); // input fields
-
- dlg.querySelector('#lbl-title').appendChild(document.createTextNode(title));
- dlg.querySelector('#lbl-message').appendChild(document.createTextNode(message));
- dlg.querySelector('#prompt-input').setAttribute('placeholder', defaultText);
- dlg.querySelector('#prompt-input').setAttribute('value', defaultText);
-
- function makeButtonCallback (idx) {
- return function () {
- var value = dlg.querySelector('#prompt-input').value || defaultText;
- dlgWrap.parentNode.removeChild(dlgWrap);
-
- if (callback) {
- // eslint-disable-next-line standard/no-callback-literal
- callback({ input1: value, buttonIndex: idx });
- }
- };
- }
-
- function addButton (idx, label) {
- var button = document.createElement('button');
- button.className = 'dlgButton';
- button.tabIndex = idx;
- button.onclick = makeButtonCallback(idx + 1);
- if (idx === 0) {
- button.className += ' dlgButtonFirst';
- }
- button.appendChild(document.createTextNode(label));
- dlg.appendChild(button);
- }
-
- // reverse order is used since we align buttons to the right
- for (var idx = buttons.length - 1; idx >= 0; idx--) {
- addButton(idx, buttons[idx]);
- }
-
- dlgWrap.appendChild(dlg);
- document.body.appendChild(dlgWrap);
-
- // make sure input field is under focus
- dlg.querySelector('#prompt-input').select();
- // add Enter/Return key handling
- var defaultButton = dlg.querySelector('.dlgButtonFirst');
- dlg.addEventListener('keypress', function (e) {
- if (e.keyCode === 13) {
- // enter key
- if (defaultButton) {
- defaultButton.click();
- }
- }
- });
-
- return dlgWrap;
-}
-
-module.exports = {
- alert: function (win, loseX, args) {
- if (isAlertShowing) {
- var later = function () {
- module.exports.alert(win, loseX, args);
- };
- alertStack.push(later);
- return;
- }
- isAlertShowing = true;
-
- var message = args[0];
- var _title = args[1];
- var _buttonLabel = args[2];
-
- var md = new Windows.UI.Popups.MessageDialog(message, _title);
- md.commands.append(new Windows.UI.Popups.UICommand(_buttonLabel));
- md.showAsync().then(function () {
- isAlertShowing = false;
- if (win) {
- win();
- }
-
- if (alertStack.length) {
- setTimeout(alertStack.shift(), 0);
- }
- });
- },
-
- prompt: function (win, lose, args) {
- if (isAlertShowing) {
- var later = function () {
- module.exports.prompt(win, lose, args);
- };
- alertStack.push(later);
- return;
- }
-
- isAlertShowing = true;
-
- var message = args[0];
- var title = args[1];
- var buttons = args[2];
- var defaultText = args[3];
-
- try {
- createPromptDialog(title, message, buttons, defaultText, function (evt) {
- isAlertShowing = false;
- if (win) {
- win(evt);
- }
- });
- } catch (e) {
- // set isAlertShowing flag back to false in case of exception
- isAlertShowing = false;
- if (alertStack.length) {
- setTimeout(alertStack.shift(), 0);
- }
- // rethrow exception
- throw e;
- }
- },
-
- confirm: function (win, loseX, args) {
- if (isAlertShowing) {
- var later = function () {
- module.exports.confirm(win, loseX, args);
- };
- alertStack.push(later);
- return;
- }
-
- isAlertShowing = true;
-
- try {
- var message = args[0];
- var _title = args[1];
- var buttons = args[2];
-
- var md = new Windows.UI.Popups.MessageDialog(message, _title);
-
- buttons.forEach(function (buttonLabel) {
- md.commands.append(new Windows.UI.Popups.UICommand(buttonLabel));
- });
-
- md.showAsync().then(function (res) {
- isAlertShowing = false;
- var result = res ? buttons.indexOf(res.label) + 1 : 0;
- if (win) {
- win(result);
- }
- if (alertStack.length) {
- setTimeout(alertStack.shift(), 0);
- }
- });
- } catch (e) {
- // set isAlertShowing flag back to false in case of exception
- isAlertShowing = false;
- if (alertStack.length) {
- setTimeout(alertStack.shift(), 0);
- }
- // rethrow exception
- throw e;
- }
- },
-
- beep: function (winX, loseX, args) {
- // set a default args if it is not set
- args = args && args.length ? args : ['1'];
-
- var snd = new Audio('ms-winsoundevent:Notification.Default');
- var count = parseInt(args[0]) || 1;
- snd.msAudioCategory = 'Alerts';
-
- var onEvent = function () {
- if (count > 0) {
- snd.play();
- } else {
- snd.removeEventListener('ended', onEvent);
- snd = null;
- if (winX) {
- winX(); // notification.js just sends null, but this is future friendly
- }
- }
- count--;
- };
- snd.addEventListener('ended', onEvent);
- onEvent();
- },
-
- dismissPrevious: function () {
- console.warn('dismissPrevious() is not available on browser platform');
- },
-
- dismissAll: function () {
- console.warn('dismissAll() is not available on browser platform');
- }
-};
-
-require('cordova/exec/proxy').add('Notification', module.exports);
diff --git a/tests/tests.js b/tests/tests.js
index 7eb5ab79..7153073d 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -215,13 +215,10 @@ exports.defineManualTests = function (contentEl, createActionButton) {
'alert'
);
- // WP8.1 detection is necessary since it doesn't support confirm dialogs with more than 2 buttons
- var isRunningOnWP81 = cordova.platformId === 'windows' && navigator.userAgent.indexOf('Windows Phone') > -1;
-
createActionButton(
'Confirm Dialog - Deprecated',
function () {
- var buttons = isRunningOnWP81 ? 'Yes,No' : 'Yes,No,Maybe';
+ var buttons = 'Yes,No,Maybe';
confirmDialogA('You pressed confirm.', 'Confirm Dialog', buttons);
},
'confirm_deprecated'
@@ -230,7 +227,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
createActionButton(
'Confirm Dialog',
function () {
- var buttons = isRunningOnWP81 ? ['Yes', 'Actually, No'] : ['Yes', 'No', 'Maybe, Not Sure'];
+ var buttons = ['Yes', 'No', 'Maybe, Not Sure'];
confirmDialogB('You pressed confirm.', 'Confirm Dialog', buttons);
},
'confirm'
diff --git a/www/notification.js b/www/notification.js
index a06e2c9c..3d9a00a0 100644
--- a/www/notification.js
+++ b/www/notification.js
@@ -134,7 +134,7 @@ function convertButtonLabels (buttonLabels) {
// Some platforms take an array of button label names.
// Other platforms take a comma separated list.
// For compatibility, we convert to the desired type based on the platform.
- if (platform.id === 'android' || platform.id === 'ios' || platform.id === 'windows') {
+ if (platform.id === 'android' || platform.id === 'ios') {
if (typeof buttonLabels === 'string') {
buttonLabels = buttonLabels.split(','); // not crazy about changing the var type here
}
diff --git a/www/windows/notification.css b/www/windows/notification.css
deleted file mode 100644
index 785039ba..00000000
--- a/www/windows/notification.css
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-.dlgWrap {
- position: absolute;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.25);
- z-index: 100000;
- top: 0;
-}
-
-.dlgContainer {
- width: 100%;
- min-height: 180px;
- height: auto;
- overflow: auto;
- background-color: white;
- position: relative;
- line-height: 2;
- top: 50%;
- transform: translateY(-50%);
- padding: 0 30%;
-}
-
-.dlgContainer #lbl-title {
- font-size: 24pt;
-}
-
-.dlgContainer #prompt-input {
- width: 100%;
-}
-
-.dlgButton {
- margin: 8px 0 0 16px;
- float: right;
- font-size: 11pt;
- background-color: #cccccc;
- border: none;
- font-weight: 600;
- font-family: "Segoe UI", Arial, sans-serif;
- padding: 0 22px;
-}
-
-.dlgButton.dlgButtonFirst {
- color: white;
- background-color: #464646;
-}
-
-.dlgContainer.dlgContainer-windows {
- width: 50%;
- max-width: 680px;
- padding: 0 5%;
- top: 50%;
- left: 50%;
- position: fixed;
- transform: translate(-50%, -50%);
- border: 1px solid rgb(24, 160, 191);
- border-image: none;
- box-shadow: 0 0 14px 6px rgba(0,0,0,0.16);
- text-transform: none;
-}
-
-.dlgContainer.dlgContainer-phone {
- padding: 0 5%;
-}