From 52b8496405d0c535d33675c9966f06d887a13855 Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Tue, 27 Aug 2024 11:57:11 -0500 Subject: [PATCH 1/2] Removed useExternalBrowser --- .../src/main/java/org/prebid/mobile/PrebidMobile.java | 1 - .../networking/parameters/BasicParameterBuilder.java | 2 +- .../rendering/utils/helpers/ExternalViewerUtils.java | 2 +- .../networking/parameters/BasicParameterBuilderTest.java | 8 +------- .../rendering/utils/helpers/ExternalViewerUtilsTest.java | 9 --------- 5 files changed, 3 insertions(+), 19 deletions(-) diff --git a/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/PrebidMobile.java b/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/PrebidMobile.java index c1f4c7d46..4c8643b40 100644 --- a/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/PrebidMobile.java +++ b/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/PrebidMobile.java @@ -46,7 +46,6 @@ public class PrebidMobile { public static boolean isCoppaEnabled = false; - public static boolean useExternalBrowser = false; /** * If true, the SDK sends "af=3,5", indicating support for MRAID diff --git a/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/rendering/networking/parameters/BasicParameterBuilder.java b/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/rendering/networking/parameters/BasicParameterBuilder.java index 84ce89725..1e742dd24 100644 --- a/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/rendering/networking/parameters/BasicParameterBuilder.java +++ b/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/rendering/networking/parameters/BasicParameterBuilder.java @@ -381,7 +381,7 @@ private void setCommonImpValues(Imp imp, String uuid) { //Send 1 for interstitial/interstitial video and 0 for banners imp.instl = isInterstitial ? 1 : 0; // 0 == embedded, 1 == native - imp.clickBrowser = !PrebidMobile.useExternalBrowser && browserActivityAvailable ? 0 : 1; + imp.clickBrowser = browserActivityAvailable ? 0 : 1; //set secure=1 for https or secure=0 for http if (!adConfiguration.isAdType(AdFormat.VAST)) { imp.secure = 1; diff --git a/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/rendering/utils/helpers/ExternalViewerUtils.java b/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/rendering/utils/helpers/ExternalViewerUtils.java index 9c2475df6..6ca852057 100644 --- a/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/rendering/utils/helpers/ExternalViewerUtils.java +++ b/PrebidMobile/PrebidMobile-core/src/main/java/org/prebid/mobile/rendering/utils/helpers/ExternalViewerUtils.java @@ -131,7 +131,7 @@ public static void startBrowser(Context context, String url, int broadcastId, intent.addFlags(FLAG_ACTIVITY_NEW_TASK); } - if (!PrebidMobile.useExternalBrowser && isActivityCallable(context, intent)) { + if (isActivityCallable(context, intent)) { startActivity(context, intent); notifyBrowserActionSuccess(BrowserActionResult.INTERNAL_BROWSER, onBrowserActionResultListener); } else { diff --git a/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/networking/parameters/BasicParameterBuilderTest.java b/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/networking/parameters/BasicParameterBuilderTest.java index 4a3ae0bc7..083c62b24 100644 --- a/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/networking/parameters/BasicParameterBuilderTest.java +++ b/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/networking/parameters/BasicParameterBuilderTest.java @@ -129,7 +129,6 @@ public void cleanup() throws Exception { TargetingParams.setOmidPartnerVersion(null); PrebidMobile.sendMraidSupportParams = true; - PrebidMobile.useExternalBrowser = false; PrebidMobile.isCoppaEnabled = false; PrebidMobile.clearStoredBidResponses(); PrebidMobile.setStoredAuctionResponse(null); @@ -635,7 +634,6 @@ public void whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityAvai adConfiguration.setAdFormat(AdFormat.BANNER); adConfiguration.addSize(new AdSize(320, 50)); - PrebidMobile.useExternalBrowser = false; BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, context.getResources(), @@ -654,8 +652,6 @@ public void whenAppendParametersAndUseExternalBrowserTrueAndBrowserActivityAvail adConfiguration.setAdFormat(AdFormat.BANNER); adConfiguration.addSize(new AdSize(320, 50)); - PrebidMobile.useExternalBrowser = true; - BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, context.getResources(), browserActivityAvailable @@ -673,8 +669,6 @@ public void whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityNotA adConfiguration.setAdFormat(AdFormat.BANNER); adConfiguration.addSize(new AdSize(320, 50)); - PrebidMobile.useExternalBrowser = false; - BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, context.getResources(), false); AdRequestInput adRequestInput = new AdRequestInput(); builder.appendBuilderParameters(adRequestInput); @@ -1149,7 +1143,7 @@ private Imp getExpectedImp(AdUnitConfiguration adConfiguration, String uuid) { imp.instl = isInterstitial ? 1 : 0; // 0 == embedded, 1 == native - imp.clickBrowser = !PrebidMobile.useExternalBrowser && browserActivityAvailable ? 0 : 1; + imp.clickBrowser = browserActivityAvailable ? 0 : 1; imp.id = uuid; imp.getExt().put("prebid", Prebid.getJsonObjectForImp(adConfiguration)); diff --git a/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/utils/helpers/ExternalViewerUtilsTest.java b/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/utils/helpers/ExternalViewerUtilsTest.java index 436ad8d93..d7d463fe6 100644 --- a/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/utils/helpers/ExternalViewerUtilsTest.java +++ b/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/utils/helpers/ExternalViewerUtilsTest.java @@ -54,11 +54,6 @@ public void setUp() throws Exception { MockitoAnnotations.initMocks(this); } - @After - public void tearDown() throws Exception { - PrebidMobile.useExternalBrowser = false; - } - @Test public void whenIsActivityCallableAndContextOrIntentNull_ReturnFalse() { assertFalse(ExternalViewerUtils.isActivityCallable(null, null)); @@ -107,7 +102,6 @@ public void whenLaunchApplicationUrl_StartActivity() throws ActionNotResolvedExc @Test public void whenStartBrowserAndUseExternalBrowserFalseAndActivityCallable_NotifyInternalBrowserSuccess() { - PrebidMobile.useExternalBrowser = false; PackageManager mockManager = mock(PackageManager.class); List mockList = Collections.singletonList(mock(ResolveInfo.class)); when(mockManager.queryIntentActivities(any(Intent.class), anyInt())).thenReturn(mockList); @@ -120,7 +114,6 @@ public void whenStartBrowserAndUseExternalBrowserFalseAndActivityCallable_Notify @Test public void whenStartBrowserAndUseExternalBrowserFalseAndActivityNotCallable_NotifyExternalBrowserSuccess() { - PrebidMobile.useExternalBrowser = false; PackageManager mockManager = mock(PackageManager.class); List mockList = Collections.singletonList(mock(ResolveInfo.class)); when(mockManager.queryIntentActivities(any(Intent.class), anyInt())).thenReturn(mockList); @@ -133,8 +126,6 @@ public void whenStartBrowserAndUseExternalBrowserFalseAndActivityNotCallable_Not @Test public void whenStartBrowserAndUseExternalBrowserTrue_NotifyExternalBrowserSuccess() { - PrebidMobile.useExternalBrowser = true; - ExternalViewerUtils.startBrowser(mockContext, "https://url.com", true, mockResultListener); verify(mockContext).startActivity(any(Intent.class)); verify(mockResultListener).onSuccess(OnBrowserActionResultListener.BrowserActionResult.EXTERNAL_BROWSER); From ce3a97550fc1de3a38c172280fa89160ffc2aa08 Mon Sep 17 00:00:00 2001 From: Jono Sligh Date: Tue, 27 Aug 2024 12:10:53 -0500 Subject: [PATCH 2/2] Removing tests checking for useExternalBrowser = true --- .../parameters/BasicParameterBuilderTest.java | 17 ----------------- .../utils/helpers/ExternalViewerUtilsTest.java | 7 ------- 2 files changed, 24 deletions(-) diff --git a/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/networking/parameters/BasicParameterBuilderTest.java b/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/networking/parameters/BasicParameterBuilderTest.java index 083c62b24..064d92b19 100644 --- a/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/networking/parameters/BasicParameterBuilderTest.java +++ b/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/networking/parameters/BasicParameterBuilderTest.java @@ -646,23 +646,6 @@ public void whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityAvai assertEquals(0, actualImp.clickBrowser.intValue()); } - @Test - public void whenAppendParametersAndUseExternalBrowserTrueAndBrowserActivityAvailable_ClickBrowserEqualsOne() { - AdUnitConfiguration adConfiguration = new AdUnitConfiguration(); - adConfiguration.setAdFormat(AdFormat.BANNER); - adConfiguration.addSize(new AdSize(320, 50)); - - BasicParameterBuilder builder = new BasicParameterBuilder(adConfiguration, - context.getResources(), - browserActivityAvailable - ); - AdRequestInput adRequestInput = new AdRequestInput(); - builder.appendBuilderParameters(adRequestInput); - - Imp actualImp = adRequestInput.getBidRequest().getImp().get(0); - assertEquals(1, actualImp.clickBrowser.intValue()); - } - @Test public void whenAppendParametersAndUseExternalBrowserFalseAndBrowserActivityNotAvailable_ClickBrowserEqualsOne() { AdUnitConfiguration adConfiguration = new AdUnitConfiguration(); diff --git a/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/utils/helpers/ExternalViewerUtilsTest.java b/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/utils/helpers/ExternalViewerUtilsTest.java index d7d463fe6..d584b0860 100644 --- a/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/utils/helpers/ExternalViewerUtilsTest.java +++ b/PrebidMobile/PrebidMobile-core/src/test/java/org/prebid/mobile/rendering/utils/helpers/ExternalViewerUtilsTest.java @@ -123,11 +123,4 @@ public void whenStartBrowserAndUseExternalBrowserFalseAndActivityNotCallable_Not verify(mockContext).startActivity(any(Intent.class)); verify(mockResultListener).onSuccess(OnBrowserActionResultListener.BrowserActionResult.INTERNAL_BROWSER); } - - @Test - public void whenStartBrowserAndUseExternalBrowserTrue_NotifyExternalBrowserSuccess() { - ExternalViewerUtils.startBrowser(mockContext, "https://url.com", true, mockResultListener); - verify(mockContext).startActivity(any(Intent.class)); - verify(mockResultListener).onSuccess(OnBrowserActionResultListener.BrowserActionResult.EXTERNAL_BROWSER); - } } \ No newline at end of file