Merge branch 'YumengNevix-master'

This commit is contained in:
Lorenzo Pichilli 2023-11-11 14:10:54 +01:00
commit 341508519c
3 changed files with 24 additions and 7 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 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 "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 "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) - Fixed "iOS about:blank popup not loading page" [#1500](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1500)
## 6.0.0-beta.25 ## 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 final int CHROME_CUSTOM_TAB_REQUEST_CODE = 100;
protected boolean onOpened = false; protected boolean onOpened = false;
protected boolean onCompletedInitialLoad = false; protected boolean onCompletedInitialLoad = false;
protected boolean isBindSuccess = false;
@Nullable @Nullable
public ChromeSafariBrowserManager manager; public ChromeSafariBrowserManager manager;
@Nullable @Nullable
@ -165,8 +166,16 @@ public class ChromeCustomTabsActivity extends Activity implements Disposable {
@Nullable Map<String, String> headers, @Nullable Map<String, String> headers,
@Nullable String referrer, @Nullable String referrer,
@Nullable List<String> otherLikelyURLs) { @Nullable List<String> otherLikelyURLs) {
launchUrlWithSession(customTabsSession, url, headers, referrer, otherLikelyURLs);
}
public void launchUrlWithSession(@Nullable CustomTabsSession session,
@NonNull String url,
@Nullable Map<String, String> headers,
@Nullable String referrer,
@Nullable List<String> otherLikelyURLs) {
mayLaunchUrl(url, otherLikelyURLs); mayLaunchUrl(url, otherLikelyURLs);
builder = new CustomTabsIntent.Builder(customTabsSession); builder = new CustomTabsIntent.Builder(session);
prepareCustomTabs(); prepareCustomTabs();
CustomTabsIntent customTabsIntent = builder.build(); CustomTabsIntent customTabsIntent = builder.build();
@ -191,7 +200,8 @@ public class ChromeCustomTabsActivity extends Activity implements Disposable {
public void customTabsConnected() { public void customTabsConnected() {
customTabsSession = customTabActivityHelper.getSession(); customTabsSession = customTabActivityHelper.getSession();
if (initialUrl != null) { // avoid webpage reopen if isBindSuccess is false: onServiceConnected->launchUrl
if (isBindSuccess && initialUrl != null) {
launchUrl(initialUrl, initialHeaders, initialReferrer, initialOtherLikelyURLs); launchUrl(initialUrl, initialHeaders, initialReferrer, initialOtherLikelyURLs);
} }
} }
@ -328,13 +338,19 @@ public class ChromeCustomTabsActivity extends Activity implements Disposable {
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
customTabActivityHelper.bindCustomTabsService(this); isBindSuccess = customTabActivityHelper.bindCustomTabsService(this);
if (!isBindSuccess && initialUrl != null) {
// chrome process not running, start tab directly
launchUrlWithSession(null, initialUrl, initialHeaders, initialReferrer, initialOtherLikelyURLs);
}
} }
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
customTabActivityHelper.unbindCustomTabsService(this); customTabActivityHelper.unbindCustomTabsService(this);
isBindSuccess = false;
} }
@Override @Override

View File

@ -122,14 +122,14 @@ public class CustomTabActivityHelper implements ServiceConnectionCallback {
* Binds the Activity to the Custom Tabs Service. * Binds the Activity to the Custom Tabs Service.
* @param activity the activity to be binded to the service. * @param activity the activity to be binded to the service.
*/ */
public void bindCustomTabsService(Activity activity) { public boolean bindCustomTabsService(Activity activity) {
if (mClient != null) return; if (mClient != null) return true;
String packageName = CustomTabsHelper.getPackageNameToUse(activity); String packageName = CustomTabsHelper.getPackageNameToUse(activity);
if (packageName == null) return; if (packageName == null) return false;
mConnection = new ServiceConnection(this); mConnection = new ServiceConnection(this);
CustomTabsClient.bindCustomTabsService(activity, packageName, mConnection); return CustomTabsClient.bindCustomTabsService(activity, packageName, mConnection);
} }
/** /**