advanced desktop mode
This commit is contained in:
@@ -159,6 +159,11 @@ class GeneralSettings with FastEquatable {
|
||||
/// still overrides this for an individual tab. Defaults to false.
|
||||
final bool globalDesktopMode;
|
||||
|
||||
/// Hosts that should always load in desktop mode. A tab navigating to a
|
||||
/// matching host (or any of its subdomains) is switched to desktop mode,
|
||||
/// overriding [globalDesktopMode] for that visit. See `hostMatchesRule`.
|
||||
final List<String> desktopModeSites;
|
||||
|
||||
GeneralSettings({
|
||||
required this.themeMode,
|
||||
required this.uiScaleFactor,
|
||||
@@ -220,6 +225,7 @@ class GeneralSettings with FastEquatable {
|
||||
required this.acceptSuggestionOnSubmit,
|
||||
required this.pureBlack,
|
||||
required this.globalDesktopMode,
|
||||
required this.desktopModeSites,
|
||||
});
|
||||
|
||||
GeneralSettings.withDefaults({
|
||||
@@ -283,6 +289,7 @@ class GeneralSettings with FastEquatable {
|
||||
bool? acceptSuggestionOnSubmit,
|
||||
bool? pureBlack,
|
||||
bool? globalDesktopMode,
|
||||
List<String>? desktopModeSites,
|
||||
}) : themeMode = themeMode ?? ThemeMode.dark,
|
||||
uiScaleFactor = uiScaleFactor ?? defaultUiScaleFactor,
|
||||
disableAnimations = disableAnimations ?? false,
|
||||
@@ -354,7 +361,8 @@ class GeneralSettings with FastEquatable {
|
||||
indexPrivateTabs = indexPrivateTabs ?? false,
|
||||
acceptSuggestionOnSubmit = acceptSuggestionOnSubmit ?? false,
|
||||
pureBlack = pureBlack ?? false,
|
||||
globalDesktopMode = globalDesktopMode ?? false;
|
||||
globalDesktopMode = globalDesktopMode ?? false,
|
||||
desktopModeSites = desktopModeSites ?? const [];
|
||||
|
||||
factory GeneralSettings.fromJson(Map<String, dynamic> json) {
|
||||
// Migrate legacy `newTabPosition` setting to direction settings.
|
||||
@@ -468,5 +476,6 @@ class GeneralSettings with FastEquatable {
|
||||
acceptSuggestionOnSubmit,
|
||||
pureBlack,
|
||||
globalDesktopMode,
|
||||
desktopModeSites,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -149,6 +149,8 @@ abstract class _$GeneralSettingsCWProxy {
|
||||
|
||||
GeneralSettings globalDesktopMode(bool globalDesktopMode);
|
||||
|
||||
GeneralSettings desktopModeSites(List<String> desktopModeSites);
|
||||
|
||||
/// 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)`.
|
||||
///
|
||||
@@ -217,6 +219,7 @@ abstract class _$GeneralSettingsCWProxy {
|
||||
bool acceptSuggestionOnSubmit,
|
||||
bool pureBlack,
|
||||
bool globalDesktopMode,
|
||||
List<String> desktopModeSites,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -481,6 +484,10 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
GeneralSettings globalDesktopMode(bool globalDesktopMode) =>
|
||||
call(globalDesktopMode: globalDesktopMode);
|
||||
|
||||
@override
|
||||
GeneralSettings desktopModeSites(List<String> desktopModeSites) =>
|
||||
call(desktopModeSites: desktopModeSites);
|
||||
|
||||
@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)`.
|
||||
@@ -551,6 +558,7 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
Object? acceptSuggestionOnSubmit = const $CopyWithPlaceholder(),
|
||||
Object? pureBlack = const $CopyWithPlaceholder(),
|
||||
Object? globalDesktopMode = const $CopyWithPlaceholder(),
|
||||
Object? desktopModeSites = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return GeneralSettings(
|
||||
themeMode: themeMode == const $CopyWithPlaceholder() || themeMode == null
|
||||
@@ -905,6 +913,12 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
? _value.globalDesktopMode
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: globalDesktopMode as bool,
|
||||
desktopModeSites:
|
||||
desktopModeSites == const $CopyWithPlaceholder() ||
|
||||
desktopModeSites == null
|
||||
? _value.desktopModeSites
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: desktopModeSites as List<String>,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1034,6 +1048,9 @@ GeneralSettings _$GeneralSettingsFromJson(
|
||||
acceptSuggestionOnSubmit: json['acceptSuggestionOnSubmit'] as bool?,
|
||||
pureBlack: json['pureBlack'] as bool?,
|
||||
globalDesktopMode: json['globalDesktopMode'] as bool?,
|
||||
desktopModeSites: (json['desktopModeSites'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$GeneralSettingsToJson(
|
||||
@@ -1112,6 +1129,7 @@ Map<String, dynamic> _$GeneralSettingsToJson(
|
||||
'acceptSuggestionOnSubmit': instance.acceptSuggestionOnSubmit,
|
||||
'pureBlack': instance.pureBlack,
|
||||
'globalDesktopMode': instance.globalDesktopMode,
|
||||
'desktopModeSites': instance.desktopModeSites,
|
||||
};
|
||||
|
||||
const _$ThemeModeEnumMap = {
|
||||
|
||||
Reference in New Issue
Block a user