From 9ad748c109323a862e32962f66a834253b9f6b8c Mon Sep 17 00:00:00 2001 From: Henning Nielsen Lund Date: Sat, 21 Jul 2018 00:57:47 +0200 Subject: [PATCH 1/2] Custom Tabs was first added in Samsung Internet 4.0 At the moment all versions of the Samsung Internet Browser is set to support Custom Tabs. Support for Custom Tabs was first added in version 4.0. fixes: #382 Signed-off-by: Henning Nielsen Lund --- CONTRIBUTORS | 1 + library/java/net/openid/appauth/browser/Browsers.java | 6 ++++++ .../net/openid/appauth/browser/VersionedBrowserMatcher.java | 2 +- .../net/openid/appauth/browser/AnyBrowserMatcherTest.java | 2 ++ .../net/openid/appauth/browser/BrowserWhitelistTest.java | 3 ++- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 225c16b9..034bee8b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -13,3 +13,4 @@ Alex Chau Benjamin Franz Rebecka Gulliksson Rahul Ravikumar +Henning Nielsen Lund diff --git a/library/java/net/openid/appauth/browser/Browsers.java b/library/java/net/openid/appauth/browser/Browsers.java index bcf28d61..ea47dd7b 100644 --- a/library/java/net/openid/appauth/browser/Browsers.java +++ b/library/java/net/openid/appauth/browser/Browsers.java @@ -135,6 +135,12 @@ public static final class SBrowser { public static final Set SIGNATURE_SET = Collections.singleton(SIGNATURE_HASH); + /** + * The version in which Custom Tabs were introduced in Samsung Internet. + */ + public static final DelimitedVersion MINIMUM_VERSION_FOR_CUSTOM_TAB = + DelimitedVersion.parse("4.0"); + /** * Creates a browser descriptor for the specified version of SBrowser, when * used as a standalone browser. diff --git a/library/java/net/openid/appauth/browser/VersionedBrowserMatcher.java b/library/java/net/openid/appauth/browser/VersionedBrowserMatcher.java index 85deeaed..b1e9dc9f 100644 --- a/library/java/net/openid/appauth/browser/VersionedBrowserMatcher.java +++ b/library/java/net/openid/appauth/browser/VersionedBrowserMatcher.java @@ -68,7 +68,7 @@ public class VersionedBrowserMatcher implements BrowserMatcher { Browsers.SBrowser.PACKAGE_NAME, Browsers.SBrowser.SIGNATURE_SET, true, - VersionRange.ANY_VERSION); + VersionRange.atLeast(Browsers.SBrowser.MINIMUM_VERSION_FOR_CUSTOM_TAB)); private String mPackageName; private Set mSignatureHashes; diff --git a/library/javatests/net/openid/appauth/browser/AnyBrowserMatcherTest.java b/library/javatests/net/openid/appauth/browser/AnyBrowserMatcherTest.java index b388eeeb..dd982ccd 100644 --- a/library/javatests/net/openid/appauth/browser/AnyBrowserMatcherTest.java +++ b/library/javatests/net/openid/appauth/browser/AnyBrowserMatcherTest.java @@ -34,5 +34,7 @@ public void testMatches() { .isTrue(); assertThat(AnyBrowserMatcher.INSTANCE.matches(Browsers.SBrowser.standaloneBrowser("2.1"))) .isTrue(); + assertThat(AnyBrowserMatcher.INSTANCE.matches(Browsers.SBrowser.customTab("4.0"))) + .isTrue(); } } diff --git a/library/javatests/net/openid/appauth/browser/BrowserWhitelistTest.java b/library/javatests/net/openid/appauth/browser/BrowserWhitelistTest.java index b95a0d6a..a970a3b1 100644 --- a/library/javatests/net/openid/appauth/browser/BrowserWhitelistTest.java +++ b/library/javatests/net/openid/appauth/browser/BrowserWhitelistTest.java @@ -62,7 +62,8 @@ public void testMatches_firefoxOrSamsung() { assertThat(whitelist.matches(Browsers.Chrome.customTab("46"))).isFalse(); assertThat(whitelist.matches(Browsers.Firefox.standaloneBrowser("10"))).isTrue(); assertThat(whitelist.matches(Browsers.SBrowser.standaloneBrowser("10"))).isTrue(); - assertThat(whitelist.matches(Browsers.SBrowser.customTab("10"))).isTrue(); + assertThat(whitelist.matches(Browsers.SBrowser.customTab("4.0"))).isTrue(); + assertThat(whitelist.matches(Browsers.SBrowser.customTab("3.9"))).isFalse(); } } From 37efd2eb3328ae13b1d7dd4af7c70aba35d503df Mon Sep 17 00:00:00 2001 From: Henning Nielsen Lund Date: Sat, 21 Jul 2018 00:57:47 +0200 Subject: [PATCH 2/2] Custom Tabs was first added in Samsung Internet 4.0 At the moment all versions of the Samsung Internet Browser is set to support Custom Tabs. Support for Custom Tabs was first added in version 4.0. fixes: #382 Signed-off-by: Henning Nielsen Lund --- CONTRIBUTORS | 1 + library/java/net/openid/appauth/browser/Browsers.java | 6 ++++++ .../net/openid/appauth/browser/VersionedBrowserMatcher.java | 2 +- .../net/openid/appauth/browser/AnyBrowserMatcherTest.java | 2 ++ .../net/openid/appauth/browser/BrowserWhitelistTest.java | 3 ++- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 225c16b9..034bee8b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -13,3 +13,4 @@ Alex Chau Benjamin Franz Rebecka Gulliksson Rahul Ravikumar +Henning Nielsen Lund diff --git a/library/java/net/openid/appauth/browser/Browsers.java b/library/java/net/openid/appauth/browser/Browsers.java index bcf28d61..e0475a32 100644 --- a/library/java/net/openid/appauth/browser/Browsers.java +++ b/library/java/net/openid/appauth/browser/Browsers.java @@ -135,6 +135,12 @@ public static final class SBrowser { public static final Set SIGNATURE_SET = Collections.singleton(SIGNATURE_HASH); + /** + * The version in which Custom Tabs were introduced in Samsung Internet. + */ + public static final DelimitedVersion MINIMUM_VERSION_FOR_CUSTOM_TAB = + DelimitedVersion.parse("4.0"); + /** * Creates a browser descriptor for the specified version of SBrowser, when * used as a standalone browser. diff --git a/library/java/net/openid/appauth/browser/VersionedBrowserMatcher.java b/library/java/net/openid/appauth/browser/VersionedBrowserMatcher.java index 85deeaed..0866d4b4 100644 --- a/library/java/net/openid/appauth/browser/VersionedBrowserMatcher.java +++ b/library/java/net/openid/appauth/browser/VersionedBrowserMatcher.java @@ -68,7 +68,7 @@ public class VersionedBrowserMatcher implements BrowserMatcher { Browsers.SBrowser.PACKAGE_NAME, Browsers.SBrowser.SIGNATURE_SET, true, - VersionRange.ANY_VERSION); + VersionRange.atLeast(Browsers.SBrowser.MINIMUM_VERSION_FOR_CUSTOM_TAB)); private String mPackageName; private Set mSignatureHashes; diff --git a/library/javatests/net/openid/appauth/browser/AnyBrowserMatcherTest.java b/library/javatests/net/openid/appauth/browser/AnyBrowserMatcherTest.java index b388eeeb..dd982ccd 100644 --- a/library/javatests/net/openid/appauth/browser/AnyBrowserMatcherTest.java +++ b/library/javatests/net/openid/appauth/browser/AnyBrowserMatcherTest.java @@ -34,5 +34,7 @@ public void testMatches() { .isTrue(); assertThat(AnyBrowserMatcher.INSTANCE.matches(Browsers.SBrowser.standaloneBrowser("2.1"))) .isTrue(); + assertThat(AnyBrowserMatcher.INSTANCE.matches(Browsers.SBrowser.customTab("4.0"))) + .isTrue(); } } diff --git a/library/javatests/net/openid/appauth/browser/BrowserWhitelistTest.java b/library/javatests/net/openid/appauth/browser/BrowserWhitelistTest.java index b95a0d6a..a970a3b1 100644 --- a/library/javatests/net/openid/appauth/browser/BrowserWhitelistTest.java +++ b/library/javatests/net/openid/appauth/browser/BrowserWhitelistTest.java @@ -62,7 +62,8 @@ public void testMatches_firefoxOrSamsung() { assertThat(whitelist.matches(Browsers.Chrome.customTab("46"))).isFalse(); assertThat(whitelist.matches(Browsers.Firefox.standaloneBrowser("10"))).isTrue(); assertThat(whitelist.matches(Browsers.SBrowser.standaloneBrowser("10"))).isTrue(); - assertThat(whitelist.matches(Browsers.SBrowser.customTab("10"))).isTrue(); + assertThat(whitelist.matches(Browsers.SBrowser.customTab("4.0"))).isTrue(); + assertThat(whitelist.matches(Browsers.SBrowser.customTab("3.9"))).isFalse(); } }