updated chrome tab initial bind logic

This commit is contained in:
Lorenzo Pichilli 2023-11-11 14:10:40 +01:00
parent 828cc7d434
commit 7ec7a1756d
2 changed files with 8 additions and 9 deletions

View File

@ -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

View File

@ -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