Skip to content

Commit

Permalink
Ensure the tab is closed also when the intent is launched with FLAG_A…
Browse files Browse the repository at this point in the history
…CTIVITY_NO_HISTORY
  • Loading branch information
savy-91 committed Apr 20, 2021
1 parent 6e18699 commit 4964d37
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public void onCustomTabsConnected() {

@Override
public void onCustomTabsDisconnected() {

chromeCustomTabsActivity.close();
dispose();
}
Expand Down Expand Up @@ -126,6 +127,7 @@ public void onRelationshipValidationResult(@CustomTabsService.Relation int relat

@Override
public void onMethodCall(final MethodCall call, final MethodChannel.Result result) {

switch (call.method) {
case "close":
this.onStop();
Expand All @@ -136,6 +138,7 @@ public void onMethodCall(final MethodCall call, final MethodChannel.Result resul
Intent myIntent = new Intent(manager.plugin.activity, manager.plugin.activity.getClass());
myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
myIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

manager.plugin.activity.startActivity(myIntent);

dispose();
Expand Down Expand Up @@ -186,6 +189,8 @@ protected void onStart() {

@Override
protected void onStop() {
close();
dispose();
super.onStop();
customTabActivityHelper.unbindCustomTabsService(this);
}
Expand Down

0 comments on commit 4964d37

Please sign in to comment.