cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sgreb...@apache.org
Subject cordova-plugin-inappbrowser git commit: CB-3360: Set custom inappbrowser user agent for android
Date Mon, 08 Feb 2016 19:40:23 GMT
Repository: cordova-plugin-inappbrowser
Updated Branches:
  refs/heads/master 4f3b4df7d -> 98b63cc37


CB-3360: Set custom inappbrowser user agent for android

github close #95


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

Branch: refs/heads/master
Commit: 98b63cc37e49466acc9b6b7f027c073fa5313e97
Parents: 4f3b4df
Author: Connor Pearson <cjp822@gmail.com>
Authored: Fri Mar 13 14:12:40 2015 -0400
Committer: sgrebnov <v-segreb@microsoft.com>
Committed: Mon Feb 8 22:40:27 2016 +0300

----------------------------------------------------------------------
 src/android/InAppBrowser.java | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/98b63cc3/src/android/InAppBrowser.java
----------------------------------------------------------------------
diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java
index b9da5d7..3a4a6a4 100644
--- a/src/android/InAppBrowser.java
+++ b/src/android/InAppBrowser.java
@@ -673,6 +673,16 @@ public class InAppBrowser extends CordovaPlugin {
                     settings.setMediaPlaybackRequiresUserGesture(mediaPlaybackRequiresUserGesture);
                 }
 
+                String overrideUserAgent = preferences.getString("OverrideUserAgent", null);
+                String appendUserAgent = preferences.getString("AppendUserAgent", null);
+                
+                if (overrideUserAgent != null) {
+                    settings.setUserAgentString(overrideUserAgent);
+                }
+                if (appendUserAgent != null) {
+                    settings.setUserAgentString(settings.getUserAgentString() + appendUserAgent);
+                }
+
                 //Toggle whether this is enabled or not!
                 Bundle appSettings = cordova.getActivity().getIntent().getExtras();
                 boolean enableDatabase = appSettings == null ? true : appSettings.getBoolean("InAppBrowserStorageEnabled",
true);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message