Make sure that when we want to open a new instance of a custom chrome tab, we are opening a new instance with the provided url and not an old instance.
This commit is contained in:
parent
f06bcdf695
commit
6e18699dd5
|
@ -8,7 +8,9 @@
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density" />
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density" />
|
||||||
<activity
|
<activity
|
||||||
android:theme="@style/ThemeTransparent"
|
android:theme="@style/ThemeTransparent"
|
||||||
android:name="com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.ChromeCustomTabsActivity" />
|
android:name="com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.ChromeCustomTabsActivity"
|
||||||
|
android:launchMode="singleInstance"
|
||||||
|
/>
|
||||||
<receiver android:name="com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.ActionBroadcastReceiver" />
|
<receiver android:name="com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.ActionBroadcastReceiver" />
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="io.flutter.embedded_views_preview"
|
android:name="io.flutter.embedded_views_preview"
|
||||||
|
|
|
@ -70,6 +70,9 @@ public class ChromeSafariBrowserManager implements MethodChannel.MethodCallHandl
|
||||||
if (CustomTabActivityHelper.isAvailable(activity)) {
|
if (CustomTabActivityHelper.isAvailable(activity)) {
|
||||||
intent = new Intent(activity, ChromeCustomTabsActivity.class);
|
intent = new Intent(activity, ChromeCustomTabsActivity.class);
|
||||||
intent.putExtras(extras);
|
intent.putExtras(extras);
|
||||||
|
if ((boolean) options.get("noHistory")) {
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
||||||
|
}
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
result.success(true);
|
result.success(true);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -35,6 +35,9 @@ class AndroidChromeCustomTabsOptions
|
||||||
///Set to `true` to enable Keep Alive. The default value is `false`.
|
///Set to `true` to enable Keep Alive. The default value is `false`.
|
||||||
bool keepAliveEnabled;
|
bool keepAliveEnabled;
|
||||||
|
|
||||||
|
//Set to `true` to launch the intent with the flag FLAG_ACTIVITY_NO_HISTORY
|
||||||
|
bool noHistory;
|
||||||
|
|
||||||
AndroidChromeCustomTabsOptions(
|
AndroidChromeCustomTabsOptions(
|
||||||
{this.addDefaultShareMenuItem = true,
|
{this.addDefaultShareMenuItem = true,
|
||||||
this.showTitle = true,
|
this.showTitle = true,
|
||||||
|
@ -42,7 +45,9 @@ class AndroidChromeCustomTabsOptions
|
||||||
this.enableUrlBarHiding = false,
|
this.enableUrlBarHiding = false,
|
||||||
this.instantAppsEnabled = false,
|
this.instantAppsEnabled = false,
|
||||||
this.packageName,
|
this.packageName,
|
||||||
this.keepAliveEnabled = false});
|
this.keepAliveEnabled = false,
|
||||||
|
this.noHistory = false
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
|
@ -53,7 +58,8 @@ class AndroidChromeCustomTabsOptions
|
||||||
"enableUrlBarHiding": enableUrlBarHiding,
|
"enableUrlBarHiding": enableUrlBarHiding,
|
||||||
"instantAppsEnabled": instantAppsEnabled,
|
"instantAppsEnabled": instantAppsEnabled,
|
||||||
"packageName": packageName,
|
"packageName": packageName,
|
||||||
"keepAliveEnabled": keepAliveEnabled
|
"keepAliveEnabled": keepAliveEnabled,
|
||||||
|
"noHistory": noHistory
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +74,7 @@ class AndroidChromeCustomTabsOptions
|
||||||
options.instantAppsEnabled = map["instantAppsEnabled"];
|
options.instantAppsEnabled = map["instantAppsEnabled"];
|
||||||
options.packageName = map["packageName"];
|
options.packageName = map["packageName"];
|
||||||
options.keepAliveEnabled = map["keepAliveEnabled"];
|
options.keepAliveEnabled = map["keepAliveEnabled"];
|
||||||
|
options.noHistory = map["noHistory"];
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue