Skip to content

Commit

Permalink
fix(android): make Browser plugin fire browserFinished (#2332)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Jan 23, 2020
1 parent 60cd80b commit 4f5a4fc
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class Browser extends Plugin {

private CustomTabsClient customTabsClient;
private CustomTabsSession currentSession;
private boolean fireFinished = false;

@PluginMethod()
public void open(PluginCall call) {
Expand Down Expand Up @@ -117,6 +118,9 @@ public void load() {
}

protected void handleOnResume() {
if (fireFinished) {
notifyListeners("browserFinished", new JSObject());
}
boolean ok = CustomTabsClient.bindCustomTabsService(getContext(), CUSTOM_TAB_PACKAGE_NAME, connection);
if (!ok) {
Log.e(getLogTag(), "Error binding to custom tabs service");
Expand All @@ -140,6 +144,12 @@ public void onNavigationEvent(int navigationEvent, Bundle extras) {
case NAVIGATION_FINISHED:
notifyListeners("browserPageLoaded", new JSObject());
break;
case TAB_HIDDEN:
fireFinished = true;
break;
case TAB_SHOWN:
fireFinished = false;
break;
}
}
});
Expand Down

0 comments on commit 4f5a4fc

Please sign in to comment.