diff --git a/CHANGELOG.md b/CHANGELOG.md index 33dd0171..901c3faf 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Merged "fix cert parsing for ios 12" [#1822](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1822) (thanks to [darkang3lz92](https://github.com/darkang3lz92)) - Merged "Fix iOS and macOS Forced unwrap null value HTTPCookie for CookieManager.setCookie" [#1677](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1677) (thanks to [maxmitz](https://github.com/maxmitz)) - Merged "android imm.isAcceptingText() crash fix" [#1827](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1827) (thanks to [AlexDochioiu](https://github.com/AlexDochioiu)) +- Merged "fix: chrome tab open failed due to chrome process not running" [#1772](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1772) (thanks to [YumengNevix](https://github.com/YumengNevix)) - Fixed "iOS about:blank popup not loading page" [#1500](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1500) ## 6.0.0-beta.25 diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/chrome_custom_tabs/ChromeCustomTabsActivity.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/chrome_custom_tabs/ChromeCustomTabsActivity.java index 8ba4efce..5ff051ad 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/chrome_custom_tabs/ChromeCustomTabsActivity.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/chrome_custom_tabs/ChromeCustomTabsActivity.java @@ -48,6 +48,7 @@ public class ChromeCustomTabsActivity extends Activity implements Disposable { protected final int CHROME_CUSTOM_TAB_REQUEST_CODE = 100; protected boolean onOpened = false; protected boolean onCompletedInitialLoad = false; + protected boolean isBindSuccess = false; @Nullable public ChromeSafariBrowserManager manager; @Nullable @@ -199,7 +200,8 @@ public class ChromeCustomTabsActivity extends Activity implements Disposable { public void customTabsConnected() { customTabsSession = customTabActivityHelper.getSession(); - if (initialUrl != null) { + // avoid webpage reopen if isBindSuccess is false: onServiceConnected->launchUrl + if (isBindSuccess && initialUrl != null) { launchUrl(initialUrl, initialHeaders, initialReferrer, initialOtherLikelyURLs); } } @@ -336,16 +338,11 @@ public class ChromeCustomTabsActivity extends Activity implements Disposable { @Override protected void onStart() { super.onStart(); - boolean isBindSuccess = customTabActivityHelper.bindCustomTabsService(this); + isBindSuccess = customTabActivityHelper.bindCustomTabsService(this); - if (!isBindSuccess) { + if (!isBindSuccess && initialUrl != null) { // chrome process not running, start tab directly - - if (initialUrl != null) { - launchUrlWithSession(null, initialUrl, initialHeaders, initialReferrer, initialOtherLikelyURLs); - //avoid webpage reopen: onServiceConnected->launchUrl - initialUrl = null; - } + launchUrlWithSession(null, initialUrl, initialHeaders, initialReferrer, initialOtherLikelyURLs); } } @@ -353,6 +350,7 @@ public class ChromeCustomTabsActivity extends Activity implements Disposable { protected void onStop() { super.onStop(); customTabActivityHelper.unbindCustomTabsService(this); + isBindSuccess = false; } @Override