You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/12/10 01:30:42 UTC

[1/6] git commit: [CB-2682] [CB-2683] add prompt dialog to Notification API for WP

Updated Branches:
  refs/heads/dev 96c5fa74e -> 6f46067b9


[CB-2682] [CB-2683] add prompt dialog to Notification API for WP


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/f046a01e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/f046a01e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/f046a01e

Branch: refs/heads/dev
Commit: f046a01e227d1279efb5df9204b2fbc6b9153d13
Parents: da54b61
Author: sgrebnov <se...@gmail.com>
Authored: Wed Aug 7 13:02:37 2013 +0400
Committer: sgrebnov <se...@gmail.com>
Committed: Wed Aug 7 13:02:37 2013 +0400

----------------------------------------------------------------------
 src/wp/Notification.cs | 113 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 113 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/f046a01e/src/wp/Notification.cs
----------------------------------------------------------------------
diff --git a/src/wp/Notification.cs b/src/wp/Notification.cs
index 339978a..8ce3668 100644
--- a/src/wp/Notification.cs
+++ b/src/wp/Notification.cs
@@ -87,6 +87,22 @@ namespace WPCordovaClassLib.Cordova.Commands
             public string buttonLabel;
         }
 
+        [DataContract]
+        public class PromptResult
+        {
+            [DataMember]
+            public int buttonIndex;
+
+            [DataMember]
+            public string input1;
+
+            public PromptResult(int index, string text)
+            {
+                this.buttonIndex = index;
+                this.input1 = text;
+            }
+        }
+
         public void alert(string options)
         {
             string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
@@ -129,6 +145,56 @@ namespace WPCordovaClassLib.Cordova.Commands
             });
         }
 
+        public void prompt(string options)
+        {
+            string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+            string message = args[0];
+            string title = args[1];
+            string buttonLabelsArray = args[2];
+            string[] buttonLabels = JSON.JsonHelper.Deserialize<string[]>(buttonLabelsArray);
+            string defaultText = args[3];
+            string aliasCurrentCommandCallbackId = args[4];
+
+            Deployment.Current.Dispatcher.BeginInvoke(() =>
+            {
+                PhoneApplicationPage page = Page;
+                if (page != null)
+                {
+                    Grid grid = page.FindName("LayoutRoot") as Grid;
+                    if (grid != null)
+                    {
+                        var previous = notifyBox;
+                        notifyBox = new NotificationBox();
+                        notifyBox.Tag = new NotifBoxData { previous = previous, callbackId = aliasCurrentCommandCallbackId };
+                        notifyBox.PageTitle.Text = title;
+                        notifyBox.SubTitle.Text = message;
+                        TextBox textBox = new TextBox();
+                        textBox.Text = defaultText;
+                        notifyBox.TitlePanel.Children.Add(textBox);
+
+                        for (int i = 0; i < buttonLabels.Length; ++i)
+                        {
+                            Button button = new Button();
+                            button.Content = buttonLabels[i];
+                            button.Tag = i + 1;
+                            button.Click += promptBoxbutton_Click;
+                            notifyBox.TitlePanel.Children.Add(button);
+                        }
+
+                        grid.Children.Add(notifyBox);
+                        if (previous != null)
+                        {
+                            page.BackKeyPress += page_BackKeyPress;
+                        }
+                    }
+                }
+                else
+                {
+                    DispatchCommandResult(new PluginResult(PluginResult.Status.INSTANTIATION_EXCEPTION));
+                }
+            });
+        }
+
         public void confirm(string options)
         {
             string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
@@ -182,6 +248,53 @@ namespace WPCordovaClassLib.Cordova.Commands
             });
         }
 
+        void promptBoxbutton_Click(object sender, RoutedEventArgs e)
+        {
+            Button button = sender as Button;
+            FrameworkElement promptBox = null;
+            int buttonIndex = 0;
+            string callbackId = string.Empty;
+            string text = string.Empty;
+            if (button != null)
+            {
+                buttonIndex = (int)button.Tag;
+                promptBox = button.Parent as FrameworkElement;
+                while ((promptBox = promptBox.Parent as FrameworkElement) != null &&
+                       !(promptBox is NotificationBox)) ;
+            }
+
+            if (promptBox != null)
+            {
+                foreach (UIElement element in (promptBox as NotificationBox).TitlePanel.Children)
+                {
+                    if (element is TextBox)
+                    {
+                        text = (element as TextBox).Text;
+                        break;
+                    }
+                }
+                PhoneApplicationPage page = Page;
+                if (page != null)
+                {
+                    Grid grid = page.FindName("LayoutRoot") as Grid;
+                    if (grid != null)
+                    {
+                        grid.Children.Remove(promptBox);
+                    }
+
+                    NotifBoxData data = promptBox.Tag as NotifBoxData;
+                    promptBox = data.previous as NotificationBox;
+                    callbackId = data.callbackId as string;
+
+                    if (promptBox == null)
+                    {
+                        page.BackKeyPress -= page_BackKeyPress;
+                    }
+                }
+            }
+            DispatchCommandResult(new PluginResult(PluginResult.Status.OK, new PromptResult(buttonIndex, text)), callbackId);
+        }
+
         void page_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
         {
             PhoneApplicationPage page = sender as PhoneApplicationPage;


[6/6] git commit: Merge branch 'dev' of https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs into dev

Posted by st...@apache.org.
Merge branch 'dev' of https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs into dev


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/6f46067b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/6f46067b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/6f46067b

Branch: refs/heads/dev
Commit: 6f46067b9e9a9f6173082b08582788d7a76ddb96
Parents: eece560 96c5fa7
Author: Steven Gill <st...@gmail.com>
Authored: Mon Dec 9 16:30:41 2013 -0800
Committer: Steven Gill <st...@gmail.com>
Committed: Mon Dec 9 16:30:41 2013 -0800

----------------------------------------------------------------------
 www/notification.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[4/6] git commit: move images from css to img

Posted by st...@apache.org.
move images from css to img


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/b44c1385
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/b44c1385
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/b44c1385

Branch: refs/heads/dev
Commit: b44c1385a3e1762dc56b6018588400f10fab8320
Parents: f8aa748
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Mon Dec 9 22:41:26 2013 +0100
Committer: Piotr Zalewa <pi...@zalewa.info>
Committed: Mon Dec 9 22:41:26 2013 +0100

----------------------------------------------------------------------
 plugin.xml | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/b44c1385/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 613420d..635af3b 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -24,12 +24,12 @@
         </config-file>                                         
         
 		<asset src="www/firefoxos/notification.css" target="css/notification.css" />
-		<asset src="www/firefoxos/danger-press.png" target="css/danger-press.png" />
-		<asset src="www/firefoxos/danger.png" target="css/danger.png" />
-		<asset src="www/firefoxos/default.png" target="css/default.png" />
-		<asset src="www/firefoxos/gradient.png" target="css/gradient.png" />
-		<asset src="www/firefoxos/pattern.png" target="css/pattern.png" />
-		<asset src="www/firefoxos/recommend.png" target="css/recommend.png" />
+		<asset src="www/firefoxos/danger-press.png" target="img/danger-press.png" />
+		<asset src="www/firefoxos/danger.png" target="img/danger.png" />
+		<asset src="www/firefoxos/default.png" target="img/default.png" />
+		<asset src="www/firefoxos/gradient.png" target="img/gradient.png" />
+		<asset src="www/firefoxos/pattern.png" target="img/pattern.png" />
+		<asset src="www/firefoxos/recommend.png" target="img/recommend.png" />
         <js-module src="src/firefoxos/notification.js" name="dialogs-impl">
           <runs />
         </js-module>


[3/6] git commit: Merge branch 'dev'

Posted by st...@apache.org.
Merge branch 'dev'


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/f8aa7481
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/f8aa7481
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/f8aa7481

Branch: refs/heads/dev
Commit: f8aa7481b0686576e8a96fda50c1989cdf1551e4
Parents: 0d508c5 10ea81e
Author: Steven Gill <st...@gmail.com>
Authored: Wed Dec 4 15:23:17 2013 -0800
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Dec 4 15:23:17 2013 -0800

----------------------------------------------------------------------
 RELEASENOTES.md                   |  6 +++
 plugin.xml                        | 26 ++++++++++-
 src/ubuntu/notification.cpp       | 81 ++++++++++++++++++++++++++++++++++
 src/ubuntu/notification.h         | 63 ++++++++++++++++++++++++++
 src/ubuntu/notification.qml       | 44 ++++++++++++++++++
 src/windows8/NotificationProxy.js | 35 ++++++++-------
 test/cordova-incl.js              |  6 ++-
 www/notification.js               |  3 +-
 8 files changed, 244 insertions(+), 20 deletions(-)
----------------------------------------------------------------------



[5/6] git commit: Merge branch 'master' of github.com:zalun/cordova-plugin-dialogs into dev

Posted by st...@apache.org.
Merge branch 'master' of github.com:zalun/cordova-plugin-dialogs into dev


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/eece560f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/eece560f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/eece560f

Branch: refs/heads/dev
Commit: eece560f633c36bafb95917adcf5b76ecee136da
Parents: 2fbdea5 b44c138
Author: Steven Gill <st...@gmail.com>
Authored: Mon Dec 9 16:30:03 2013 -0800
Committer: Steven Gill <st...@gmail.com>
Committed: Mon Dec 9 16:30:03 2013 -0800

----------------------------------------------------------------------
 plugin.xml             |  12 ++---
 src/wp/Notification.cs | 113 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 119 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/eece560f/plugin.xml
----------------------------------------------------------------------


[2/6] git commit: Merge branch 'master' of https://github.com/sgrebnov/cordova-plugin-dialogs

Posted by st...@apache.org.
Merge branch 'master' of https://github.com/sgrebnov/cordova-plugin-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/0d508c52
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/0d508c52
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/0d508c52

Branch: refs/heads/dev
Commit: 0d508c524fd0915114078f23b6c93e4be61b460a
Parents: 439fd25 f046a01
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Nov 27 18:20:20 2013 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Nov 27 18:20:20 2013 -0800

----------------------------------------------------------------------
 src/wp/Notification.cs | 113 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 113 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/0d508c52/src/wp/Notification.cs
----------------------------------------------------------------------