You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2013/12/03 02:51:43 UTC
[1/2] git commit: CB-3420 WP feature hidden=yes implemented
Updated Branches:
refs/heads/dev d2b644e5d -> fadb170e5
CB-3420 WP feature hidden=yes implemented
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/9768ec2e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/9768ec2e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/9768ec2e
Branch: refs/heads/dev
Commit: 9768ec2ef0154aeba71a7de68b5e57feffc00836
Parents: e5101ba
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Mon Dec 2 17:50:57 2013 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Mon Dec 2 17:50:57 2013 -0800
----------------------------------------------------------------------
src/wp/InAppBrowser.cs | 131 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 131 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/9768ec2e/src/wp/InAppBrowser.cs
----------------------------------------------------------------------
diff --git a/src/wp/InAppBrowser.cs b/src/wp/InAppBrowser.cs
index 46e1384..4b3d18d 100644
--- a/src/wp/InAppBrowser.cs
+++ b/src/wp/InAppBrowser.cs
@@ -36,12 +36,45 @@ namespace WPCordovaClassLib.Cordova.Commands
private static ApplicationBarIconButton backButton;
private static ApplicationBarIconButton fwdButton;
+ protected ApplicationBar AppBar;
+
+ protected bool ShowLocation {get;set;}
+ protected bool StartHidden {get;set;}
+
public void open(string options)
{
+ // reset defaults on ShowLocation + StartHidden features
+ ShowLocation = true;
+ StartHidden = false;
+
string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
//BrowserOptions opts = JSON.JsonHelper.Deserialize<BrowserOptions>(options);
string urlLoc = args[0];
string target = args[1];
+ string featString = args[2];
+
+ string[] features = featString.Split(',');
+ foreach (string str in features)
+ {
+ try
+ {
+ string[] split = str.Split('=');
+ switch (split[0])
+ {
+ case "location":
+ ShowLocation = split[1].ToLower().StartsWith("yes");
+ break;
+ case "hidden":
+ StartHidden = split[1].ToLower().StartsWith("yes");
+ break;
+ }
+ }
+ catch(Exception)
+ {
+ // some sort of invalid param was passed, moving on ...
+ }
+
+ }
/*
_self - opens in the Cordova WebView if url is in the white-list, else it opens in the InAppBrowser
_blank - always open in the InAppBrowser
@@ -59,10 +92,99 @@ namespace WPCordovaClassLib.Cordova.Commands
ShowSystemBrowser(urlLoc);
break;
}
+ }
+ public void show(string options)
+ {
+ string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+
+ if (browser != null)
+ {
+ Deployment.Current.Dispatcher.BeginInvoke(() =>
+ {
+ browser.Visibility = Visibility.Visible;
+ AppBar.IsVisible = true;
+ });
+ }
}
+ public void injectScriptCode(string options)
+ {
+ string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+
+ bool bCallback = false;
+ if (bool.TryParse(args[1], out bCallback)) { };
+
+ string callbackId = args[2];
+
+ if (browser != null)
+ {
+ Deployment.Current.Dispatcher.BeginInvoke(() =>
+ {
+ var res = browser.InvokeScript("eval", new string[] { args[0] });
+
+ if (bCallback)
+ {
+ PluginResult result = new PluginResult(PluginResult.Status.OK, res.ToString());
+ result.KeepCallback = false;
+ this.DispatchCommandResult(result);
+ }
+
+ });
+ }
+ }
+
+ public void injectScriptFile(string options)
+ {
+ Debug.WriteLine("Error : Windows Phone org.apache.cordova.inappbrowser does not currently support executeScript");
+ string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+ // throw new NotImplementedException("Windows Phone does not currently support 'executeScript'");
+ }
+
+ public void injectStyleCode(string options)
+ {
+ Debug.WriteLine("Error : Windows Phone org.apache.cordova.inappbrowser does not currently support insertCSS");
+ return;
+
+ //string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+ //bool bCallback = false;
+ //if (bool.TryParse(args[1], out bCallback)) { };
+
+ //string callbackId = args[2];
+
+ //if (browser != null)
+ //{
+ //Deployment.Current.Dispatcher.BeginInvoke(() =>
+ //{
+ // if (bCallback)
+ // {
+ // string cssInsertString = "try{(function(doc){var c = '<style>body{background-color:#ffff00;}</style>'; doc.head.innerHTML += c;})(document);}catch(ex){alert('oops : ' + ex.message);}";
+ // //cssInsertString = cssInsertString.Replace("_VALUE_", args[0]);
+ // Debug.WriteLine("cssInsertString = " + cssInsertString);
+ // var res = browser.InvokeScript("eval", new string[] { cssInsertString });
+ // if (bCallback)
+ // {
+ // PluginResult result = new PluginResult(PluginResult.Status.OK, res.ToString());
+ // result.KeepCallback = false;
+ // this.DispatchCommandResult(result);
+ // }
+ // }
+
+ //});
+ //}
+ }
+
+ public void injectStyleFile(string options)
+ {
+ Debug.WriteLine("Error : Windows Phone org.apache.cordova.inappbrowser does not currently support insertCSS");
+ return;
+
+ //string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+ //throw new NotImplementedException("Windows Phone does not currently support 'insertCSS'");
+ }
+
+
private void ShowCordovaBrowser(string url)
{
Uri loc = new Uri(url, UriKind.RelativeOrAbsolute);
@@ -127,6 +249,12 @@ namespace WPCordovaClassLib.Cordova.Commands
browser.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(browser_NavigationFailed);
browser.Navigated += new EventHandler<System.Windows.Navigation.NavigationEventArgs>(browser_Navigated);
browser.Navigate(loc);
+
+ if (StartHidden)
+ {
+ browser.Visibility = Visibility.Collapsed;
+ }
+
//browser.IsGeolocationEnabled = opts.isGeolocationEnabled;
grid.Children.Add(browser);
}
@@ -156,6 +284,9 @@ namespace WPCordovaClassLib.Cordova.Commands
bar.Buttons.Add(closeBtn);
page.ApplicationBar = bar;
+ bar.IsVisible = !StartHidden;
+ AppBar = bar;
+
}
}
[2/2] git commit: Merge branch 'dev' of
https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser into dev
Posted by pu...@apache.org.
Merge branch 'dev' of https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser into dev
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/fadb170e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/fadb170e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/fadb170e
Branch: refs/heads/dev
Commit: fadb170e5042be87e8ac1d6256c604dea1be59ab
Parents: 9768ec2 d2b644e
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Mon Dec 2 17:51:28 2013 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Mon Dec 2 17:51:28 2013 -0800
----------------------------------------------------------------------
plugin.xml | 8 +++
src/ubuntu/InAppBrowser.qml | 69 +++++++++++++++++++++++++
src/ubuntu/close.png | Bin 0 -> 461 bytes
src/ubuntu/inappbrowser.cpp | 106 +++++++++++++++++++++++++++++++++++++++
src/ubuntu/inappbrowser.h | 61 ++++++++++++++++++++++
5 files changed, 244 insertions(+)
----------------------------------------------------------------------