You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sg...@apache.org on 2014/11/13 07:52:58 UTC
[1/3] cordova-plugin-dialogs git commit: CB-7639 Update docs + manual
tests
Repository: cordova-plugin-dialogs
Updated Branches:
refs/heads/master 06a1dea0a -> 305020a52
CB-7639 Update docs + manual tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/commit/305020a5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/305020a5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/305020a5
Branch: refs/heads/master
Commit: 305020a5279caf1a780890cdbd4c8762d35c716e
Parents: cd9c3bb
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Thu Sep 25 17:21:54 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Wed Nov 12 22:50:35 2014 -0800
----------------------------------------------------------------------
doc/index.md | 8 ++++++++
tests/tests.js | 15 ++++++++++-----
2 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/305020a5/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
index 442849c..758dbbf 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -80,6 +80,7 @@ function, which is typically less customizable.
- Tizen
- Windows Phone 7 and 8
- Windows 8
+- Windows
### Windows Phone 7 and 8 Quirks
@@ -143,6 +144,7 @@ indexing, so the value is `1`, `2`, `3`, etc.
- Tizen
- Windows Phone 7 and 8
- Windows 8
+- Windows
### Windows Phone 7 and 8 Quirks
@@ -152,6 +154,12 @@ indexing, so the value is `1`, `2`, `3`, etc.
- Calls to `alert` and `confirm` are non-blocking, so the result is only available asynchronously.
+### 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.
+
### Firefox OS Quirks:
Both native-blocking `window.confirm()` and non-blocking `navigator.notification.confirm()` are available.
http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/305020a5/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 6e61b00..eedf82d 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -163,12 +163,17 @@ exports.defineManualTests = function (contentEl, createActionButton) {
alertDialog('You pressed alert.', 'Alert Dialog', 'Continue');
}, '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 () {
- confirmDialogA('You pressed confirm.', 'Confirm Dialog', 'Yes,No,Maybe');
+ var buttons = isRunningOnWP81 ? 'Yes,No' : 'Yes,No,Maybe';
+ confirmDialogA('You pressed confirm.', 'Confirm Dialog', buttons);
}, 'confirm_deprecated');
createActionButton('Confirm Dialog', function () {
- confirmDialogB('You pressed confirm.', 'Confirm Dialog', ['Yes', 'No', 'Maybe, Not Sure']);
+ var buttons = isRunningOnWP81 ? ['Yes', 'Actually, No'] : ['Yes', 'No', 'Maybe, Not Sure'];
+ confirmDialogB('You pressed confirm.', 'Confirm Dialog', buttons);
}, 'confirm');
createActionButton('Prompt Dialog', function () {
@@ -176,14 +181,14 @@ exports.defineManualTests = function (contentEl, createActionButton) {
}, 'prompt');
createActionButton('Built-in Alert Dialog', function () {
- alert('You pressed alert');
+ typeof alert === 'function' && alert('You pressed alert');
}, 'built_in_alert');
createActionButton('Built-in Confirm Dialog', function () {
- confirm('You selected confirm');
+ typeof confirm === 'function' && confirm('You selected confirm');
}, 'built_in_confirm');
createActionButton('Built-in Prompt Dialog', function () {
- prompt('This is a prompt', 'Default value');
+ typeof prompt === 'function' && prompt('This is a prompt', 'Default value');
}, 'built_in_prompt');
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[3/3] cordova-plugin-dialogs git commit: CB-7639 Handle button labels
as array on windows
Posted by sg...@apache.org.
CB-7639 Handle button labels as array on windows
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/commit/d8d422a4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/d8d422a4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/d8d422a4
Branch: refs/heads/master
Commit: d8d422a4712665a0a63b74aa319769893d6fe17d
Parents: 06a1dea
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Thu Sep 25 17:04:33 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Wed Nov 12 22:50:35 2014 -0800
----------------------------------------------------------------------
src/windows8/NotificationProxy.js | 24 ++++++++----------------
www/notification.js | 5 +++--
2 files changed, 11 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/d8d422a4/src/windows8/NotificationProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/NotificationProxy.js b/src/windows8/NotificationProxy.js
index c6bad95..362d431 100644
--- a/src/windows8/NotificationProxy.js
+++ b/src/windows8/NotificationProxy.js
@@ -68,30 +68,22 @@ module.exports = {
isAlertShowing = true;
var message = args[0];
- var _title = args[1];
- var _buttonLabels = args[2];
-
- var result;
+ var title = args[1];
+ var buttons = args[2];
- var btnList = [];
- function commandHandler (command) {
- result = btnList[command.label];
- }
+ var md = new Windows.UI.Popups.MessageDialog(message, title);
- var md = new Windows.UI.Popups.MessageDialog(message, _title);
- var button = _buttonLabels.split(',');
+ buttons.forEach(function(buttonLabel) {
+ md.commands.append(new Windows.UI.Popups.UICommand(buttonLabel));
+ });
- for (var i = 0; i<button.length; i++) {
- btnList[button[i]] = i+1;
- md.commands.append(new Windows.UI.Popups.UICommand(button[i],commandHandler));
- }
- md.showAsync().then(function() {
+ md.showAsync().then(function(res) {
isAlertShowing = false;
+ var result = res ? buttons.indexOf(res.label) + 1 : 0;
win && win(result);
if (alertStack.length) {
setTimeout(alertStack.shift(), 0);
}
-
});
},
http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/d8d422a4/www/notification.js
----------------------------------------------------------------------
diff --git a/www/notification.js b/www/notification.js
index 6bf815c..c3f70d0 100644
--- a/www/notification.js
+++ b/www/notification.js
@@ -63,10 +63,11 @@ module.exports = {
// 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 == "amazon-fireos" || platform.id == "android" || platform.id == "ios" || platform.id == "windowsphone" || platform.id == "firefoxos" || platform.id == "ubuntu") {
+ if (platform.id == "amazon-fireos" || platform.id == "android" || platform.id == "ios" ||
+ platform.id == "windowsphone" || platform.id == "firefoxos" || platform.id == "ubuntu" ||
+ platform.id == "windows8" || platform.id == "windows") {
if (typeof _buttonLabels === 'string') {
- var buttonLabelString = _buttonLabels;
_buttonLabels = _buttonLabels.split(","); // not crazy about changing the var type here
}
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[2/3] cordova-plugin-dialogs git commit: CB-7639 Revert back
isAlertShowing flag in case of exception to prevent queuing of future
dialogs.
Posted by sg...@apache.org.
CB-7639 Revert back isAlertShowing flag in case of exception to prevent queuing of future dialogs.
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/commit/cd9c3bb5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/cd9c3bb5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/cd9c3bb5
Branch: refs/heads/master
Commit: cd9c3bb5b1d8a047aeb8615f756cc19dc43eda4e
Parents: d8d422a
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Thu Sep 25 17:18:18 2014 +0400
Committer: sgrebnov <v-...@microsoft.com>
Committed: Wed Nov 12 22:50:35 2014 -0800
----------------------------------------------------------------------
src/windows8/NotificationProxy.js | 39 ++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/cd9c3bb5/src/windows8/NotificationProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/NotificationProxy.js b/src/windows8/NotificationProxy.js
index 362d431..e18c703 100644
--- a/src/windows8/NotificationProxy.js
+++ b/src/windows8/NotificationProxy.js
@@ -67,24 +67,35 @@ module.exports = {
isAlertShowing = true;
- 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) {
+ 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;
+ win && win(result);
+ if (alertStack.length) {
+ setTimeout(alertStack.shift(), 0);
+ }
+
+ });
+ } catch (e) {
+ // set isAlertShowing flag back to false in case of exception
isAlertShowing = false;
- var result = res ? buttons.indexOf(res.label) + 1 : 0;
- win && win(result);
if (alertStack.length) {
setTimeout(alertStack.shift(), 0);
}
- });
+ // rethrow exception
+ throw e;
+ }
},
beep:function(winX, loseX, args) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org