Skip to content

Commit f0b20f7

Browse files
authoredOct 17, 2022
Prevent Browser Switch Results From Being Parsed Twice (#55)
* Fix issue that causes browser switch results from being parsed twice. * Update changelog. * Update comments. * Update changelog.
1 parent 5b2b4ec commit f0b20f7

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed
 

‎CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# browser-switch-android Release Notes
22

3+
## unreleased
4+
5+
* Fix issue that causes successful deep links to be parsed multiple times
6+
37
## 2.3.0
48

59
* Add BrowserSwitchClient#getResult() method to peek at a pending browser switch result before it is delivered

‎browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchClient.java

+3
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ public BrowserSwitchResult deliverResult(@NonNull FragmentActivity activity) {
118118
case BrowserSwitchStatus.SUCCESS:
119119
// ensure that success result is delivered exactly once
120120
persistentStore.clearActiveRequest(appContext);
121+
122+
// clear activity intent to prevent deep links from being parsed multiple times
123+
activity.setIntent(null);
121124
break;
122125
case BrowserSwitchStatus.CANCELED:
123126
// ensure that cancellation result is delivered exactly once, but allow for

‎browser-switch/src/test/java/com/braintreepayments/api/BrowserSwitchClientUnitTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ public void deliverResult_whenDeepLinkUrlExistsAndReturnUrlSchemeMatches_clearsR
240240
assertSame(deepLinkUrl, result.getDeepLinkUrl());
241241

242242
verify(persistentStore).clearActiveRequest(applicationContext);
243+
verify(activity).setIntent(null);
243244
}
244245

245246
@Test

0 commit comments

Comments
 (0)