Skip to content

Commit

Permalink
Prevent Browser Switch Results From Being Parsed Twice (#55)
Browse files Browse the repository at this point in the history
* Fix issue that causes browser switch results from being parsed twice.

* Update changelog.

* Update comments.

* Update changelog.
  • Loading branch information
sshropshire committed Oct 17, 2022
1 parent 5b2b4ec commit f0b20f7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# browser-switch-android Release Notes

## unreleased

* Fix issue that causes successful deep links to be parsed multiple times

## 2.3.0

* Add BrowserSwitchClient#getResult() method to peek at a pending browser switch result before it is delivered
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ public BrowserSwitchResult deliverResult(@NonNull FragmentActivity activity) {
case BrowserSwitchStatus.SUCCESS:
// ensure that success result is delivered exactly once
persistentStore.clearActiveRequest(appContext);

// clear activity intent to prevent deep links from being parsed multiple times
activity.setIntent(null);
break;
case BrowserSwitchStatus.CANCELED:
// ensure that cancellation result is delivered exactly once, but allow for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ public void deliverResult_whenDeepLinkUrlExistsAndReturnUrlSchemeMatches_clearsR
assertSame(deepLinkUrl, result.getDeepLinkUrl());

verify(persistentStore).clearActiveRequest(applicationContext);
verify(activity).setIntent(null);
}

@Test
Expand Down

0 comments on commit f0b20f7

Please sign in to comment.