experimental gecko unmount setting
This commit is contained in:
@@ -205,6 +205,15 @@ class GeneralSettings with FastEquatable {
|
||||
/// overriding [globalDesktopMode] for that visit. See `hostMatchesRule`.
|
||||
final List<String> desktopModeSites;
|
||||
|
||||
/// Developer setting: when true, the GeckoView is unmounted whenever a
|
||||
/// full-cover route (settings, tab tray, search, …) is on top, freeing the
|
||||
/// engine's resources while it is occluded. On Android 12 and lower (API
|
||||
/// <= 31) this behavior is always applied to work around a native
|
||||
/// visibility bug; on Android 13+ the engine normally stays mounted to
|
||||
/// avoid reload/flicker, and this flag opts into the off-route unmounting
|
||||
/// there too. Defaults to false.
|
||||
final bool unmountGeckoViewOffRoute;
|
||||
|
||||
GeneralSettings({
|
||||
required this.themeMode,
|
||||
required this.uiScaleFactor,
|
||||
@@ -269,6 +278,7 @@ class GeneralSettings with FastEquatable {
|
||||
required this.pureBlack,
|
||||
required this.globalDesktopMode,
|
||||
required this.desktopModeSites,
|
||||
required this.unmountGeckoViewOffRoute,
|
||||
});
|
||||
|
||||
GeneralSettings.withDefaults({
|
||||
@@ -335,6 +345,7 @@ class GeneralSettings with FastEquatable {
|
||||
bool? pureBlack,
|
||||
bool? globalDesktopMode,
|
||||
List<String>? desktopModeSites,
|
||||
bool? unmountGeckoViewOffRoute,
|
||||
}) : themeMode = themeMode ?? ThemeMode.dark,
|
||||
uiScaleFactor = uiScaleFactor ?? defaultUiScaleFactor,
|
||||
disableAnimations = disableAnimations ?? false,
|
||||
@@ -410,7 +421,8 @@ class GeneralSettings with FastEquatable {
|
||||
acceptSuggestionOnSubmit = acceptSuggestionOnSubmit ?? false,
|
||||
pureBlack = pureBlack ?? false,
|
||||
globalDesktopMode = globalDesktopMode ?? false,
|
||||
desktopModeSites = desktopModeSites ?? const [];
|
||||
desktopModeSites = desktopModeSites ?? const [],
|
||||
unmountGeckoViewOffRoute = unmountGeckoViewOffRoute ?? false;
|
||||
|
||||
factory GeneralSettings.fromJson(Map<String, dynamic> json) {
|
||||
// Migrate legacy `newTabPosition` setting to direction settings.
|
||||
@@ -551,5 +563,6 @@ class GeneralSettings with FastEquatable {
|
||||
pureBlack,
|
||||
globalDesktopMode,
|
||||
desktopModeSites,
|
||||
unmountGeckoViewOffRoute,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -153,6 +153,8 @@ abstract class _$GeneralSettingsCWProxy {
|
||||
|
||||
GeneralSettings desktopModeSites(List<String> desktopModeSites);
|
||||
|
||||
GeneralSettings unmountGeckoViewOffRoute(bool unmountGeckoViewOffRoute);
|
||||
|
||||
/// Creates a new instance with the provided field values.
|
||||
/// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `GeneralSettings(...).copyWith.fieldName(value)`.
|
||||
///
|
||||
@@ -224,6 +226,7 @@ abstract class _$GeneralSettingsCWProxy {
|
||||
bool pureBlack,
|
||||
bool globalDesktopMode,
|
||||
List<String> desktopModeSites,
|
||||
bool unmountGeckoViewOffRoute,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -503,6 +506,10 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
GeneralSettings desktopModeSites(List<String> desktopModeSites) =>
|
||||
call(desktopModeSites: desktopModeSites);
|
||||
|
||||
@override
|
||||
GeneralSettings unmountGeckoViewOffRoute(bool unmountGeckoViewOffRoute) =>
|
||||
call(unmountGeckoViewOffRoute: unmountGeckoViewOffRoute);
|
||||
|
||||
@override
|
||||
/// Creates a new instance with the provided field values.
|
||||
/// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `GeneralSettings(...).copyWith.fieldName(value)`.
|
||||
@@ -577,6 +584,7 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
Object? pureBlack = const $CopyWithPlaceholder(),
|
||||
Object? globalDesktopMode = const $CopyWithPlaceholder(),
|
||||
Object? desktopModeSites = const $CopyWithPlaceholder(),
|
||||
Object? unmountGeckoViewOffRoute = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return GeneralSettings(
|
||||
themeMode: themeMode == const $CopyWithPlaceholder() || themeMode == null
|
||||
@@ -950,6 +958,12 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
? _value.desktopModeSites
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: desktopModeSites as List<String>,
|
||||
unmountGeckoViewOffRoute:
|
||||
unmountGeckoViewOffRoute == const $CopyWithPlaceholder() ||
|
||||
unmountGeckoViewOffRoute == null
|
||||
? _value.unmountGeckoViewOffRoute
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: unmountGeckoViewOffRoute as bool,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1089,6 +1103,7 @@ GeneralSettings _$GeneralSettingsFromJson(
|
||||
desktopModeSites: (json['desktopModeSites'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList(),
|
||||
unmountGeckoViewOffRoute: json['unmountGeckoViewOffRoute'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$GeneralSettingsToJson(
|
||||
@@ -1171,6 +1186,7 @@ Map<String, dynamic> _$GeneralSettingsToJson(
|
||||
'pureBlack': instance.pureBlack,
|
||||
'globalDesktopMode': instance.globalDesktopMode,
|
||||
'desktopModeSites': instance.desktopModeSites,
|
||||
'unmountGeckoViewOffRoute': instance.unmountGeckoViewOffRoute,
|
||||
};
|
||||
|
||||
const _$ThemeModeEnumMap = {
|
||||
|
||||
Reference in New Issue
Block a user