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:59 UTC

[2/3] cordova-plugin-dialogs git commit: CB-7639 Revert back isAlertShowing flag in case of exception to prevent queuing of future dialogs.

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