improve tab (and other lexorank entities) sorting, ordering and reordering
This commit is contained in:
@@ -46,7 +46,9 @@ enum QuickTabSwitcherMode { lastUsedTabs, containerTabs }
|
||||
|
||||
enum TabIntentOpenSetting { regular, private, ask }
|
||||
|
||||
enum NewTabPosition { first, end }
|
||||
enum TabListDirection { newestFirst, oldestFirst }
|
||||
|
||||
enum TabBarDirection { newestFirst, oldestFirst }
|
||||
|
||||
enum TabBarPosition { top, bottom }
|
||||
|
||||
@@ -86,7 +88,8 @@ class GeneralSettings with FastEquatable {
|
||||
final bool showIsolatedTabUi;
|
||||
@JsonKey(name: 'defaultCreateTabType')
|
||||
final TabType storedDefaultCreateTabType;
|
||||
final NewTabPosition newTabPosition;
|
||||
final TabListDirection tabListDirection;
|
||||
final TabBarDirection tabBarDirection;
|
||||
final TabIntentOpenSetting tabIntentOpenSetting;
|
||||
final bool autoHideTabBar;
|
||||
final TabBarSwipeAction tabBarSwipeAction;
|
||||
@@ -140,7 +143,8 @@ class GeneralSettings with FastEquatable {
|
||||
required this.showContainerUi,
|
||||
required this.showIsolatedTabUi,
|
||||
required this.storedDefaultCreateTabType,
|
||||
required this.newTabPosition,
|
||||
required this.tabListDirection,
|
||||
required this.tabBarDirection,
|
||||
required this.tabIntentOpenSetting,
|
||||
required this.autoHideTabBar,
|
||||
required this.tabBarSwipeAction,
|
||||
@@ -195,7 +199,8 @@ class GeneralSettings with FastEquatable {
|
||||
bool? showContainerUi,
|
||||
bool? showIsolatedTabUi,
|
||||
TabType? storedDefaultCreateTabType,
|
||||
NewTabPosition? newTabPosition,
|
||||
TabListDirection? tabListDirection,
|
||||
TabBarDirection? tabBarDirection,
|
||||
TabIntentOpenSetting? tabIntentOpenSetting,
|
||||
bool? autoHideTabBar,
|
||||
TabBarSwipeAction? tabBarSwipeAction,
|
||||
@@ -248,7 +253,8 @@ class GeneralSettings with FastEquatable {
|
||||
showIsolatedTabUi = showIsolatedTabUi ?? true,
|
||||
storedDefaultCreateTabType =
|
||||
storedDefaultCreateTabType ?? TabType.regular,
|
||||
newTabPosition = newTabPosition ?? NewTabPosition.first,
|
||||
tabListDirection = tabListDirection ?? TabListDirection.newestFirst,
|
||||
tabBarDirection = tabBarDirection ?? TabBarDirection.newestFirst,
|
||||
tabIntentOpenSetting = tabIntentOpenSetting ?? TabIntentOpenSetting.ask,
|
||||
autoHideTabBar = autoHideTabBar ?? true,
|
||||
tabBarSwipeAction =
|
||||
@@ -295,8 +301,23 @@ class GeneralSettings with FastEquatable {
|
||||
blockExternalAppsEnabled = blockExternalAppsEnabled ?? false,
|
||||
externalAppIntentPolicies = externalAppIntentPolicies ?? const {};
|
||||
|
||||
factory GeneralSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$GeneralSettingsFromJson(json);
|
||||
factory GeneralSettings.fromJson(Map<String, dynamic> json) {
|
||||
// Migrate legacy `newTabPosition` setting to direction settings.
|
||||
// Old `first` (new tabs at top) → newestFirst; `end` → oldestFirst.
|
||||
// TODO: Drop this fallback (and the `newTabPosition` row in the user
|
||||
// settings DB) once enough releases have shipped that rolling back to a
|
||||
// version without `tabListDirection`/`tabBarDirection` is no longer a
|
||||
// concern.
|
||||
final legacyNewTabPosition = json['newTabPosition'];
|
||||
if (legacyNewTabPosition != null) {
|
||||
final mapped = legacyNewTabPosition == 'end'
|
||||
? 'oldestFirst'
|
||||
: 'newestFirst';
|
||||
json.putIfAbsent('tabListDirection', () => mapped);
|
||||
json.putIfAbsent('tabBarDirection', () => mapped);
|
||||
}
|
||||
return _$GeneralSettingsFromJson(json);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => _$GeneralSettingsToJson(this);
|
||||
|
||||
@@ -332,7 +353,8 @@ class GeneralSettings with FastEquatable {
|
||||
showContainerUi,
|
||||
showIsolatedTabUi,
|
||||
storedDefaultCreateTabType,
|
||||
newTabPosition,
|
||||
tabListDirection,
|
||||
tabBarDirection,
|
||||
tabIntentOpenSetting,
|
||||
autoHideTabBar,
|
||||
tabBarSwipeAction,
|
||||
|
||||
@@ -43,7 +43,9 @@ abstract class _$GeneralSettingsCWProxy {
|
||||
TabType storedDefaultCreateTabType,
|
||||
);
|
||||
|
||||
GeneralSettings newTabPosition(NewTabPosition newTabPosition);
|
||||
GeneralSettings tabListDirection(TabListDirection tabListDirection);
|
||||
|
||||
GeneralSettings tabBarDirection(TabBarDirection tabBarDirection);
|
||||
|
||||
GeneralSettings tabIntentOpenSetting(
|
||||
TabIntentOpenSetting tabIntentOpenSetting,
|
||||
@@ -154,7 +156,8 @@ abstract class _$GeneralSettingsCWProxy {
|
||||
bool showContainerUi,
|
||||
bool showIsolatedTabUi,
|
||||
TabType storedDefaultCreateTabType,
|
||||
NewTabPosition newTabPosition,
|
||||
TabListDirection tabListDirection,
|
||||
TabBarDirection tabBarDirection,
|
||||
TabIntentOpenSetting tabIntentOpenSetting,
|
||||
bool autoHideTabBar,
|
||||
TabBarSwipeAction tabBarSwipeAction,
|
||||
@@ -265,8 +268,12 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
) => call(storedDefaultCreateTabType: storedDefaultCreateTabType);
|
||||
|
||||
@override
|
||||
GeneralSettings newTabPosition(NewTabPosition newTabPosition) =>
|
||||
call(newTabPosition: newTabPosition);
|
||||
GeneralSettings tabListDirection(TabListDirection tabListDirection) =>
|
||||
call(tabListDirection: tabListDirection);
|
||||
|
||||
@override
|
||||
GeneralSettings tabBarDirection(TabBarDirection tabBarDirection) =>
|
||||
call(tabBarDirection: tabBarDirection);
|
||||
|
||||
@override
|
||||
GeneralSettings tabIntentOpenSetting(
|
||||
@@ -447,7 +454,8 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
Object? showContainerUi = const $CopyWithPlaceholder(),
|
||||
Object? showIsolatedTabUi = const $CopyWithPlaceholder(),
|
||||
Object? storedDefaultCreateTabType = const $CopyWithPlaceholder(),
|
||||
Object? newTabPosition = const $CopyWithPlaceholder(),
|
||||
Object? tabListDirection = const $CopyWithPlaceholder(),
|
||||
Object? tabBarDirection = const $CopyWithPlaceholder(),
|
||||
Object? tabIntentOpenSetting = const $CopyWithPlaceholder(),
|
||||
Object? autoHideTabBar = const $CopyWithPlaceholder(),
|
||||
Object? tabBarSwipeAction = const $CopyWithPlaceholder(),
|
||||
@@ -572,12 +580,18 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
? _value.storedDefaultCreateTabType
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: storedDefaultCreateTabType as TabType,
|
||||
newTabPosition:
|
||||
newTabPosition == const $CopyWithPlaceholder() ||
|
||||
newTabPosition == null
|
||||
? _value.newTabPosition
|
||||
tabListDirection:
|
||||
tabListDirection == const $CopyWithPlaceholder() ||
|
||||
tabListDirection == null
|
||||
? _value.tabListDirection
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: newTabPosition as NewTabPosition,
|
||||
: tabListDirection as TabListDirection,
|
||||
tabBarDirection:
|
||||
tabBarDirection == const $CopyWithPlaceholder() ||
|
||||
tabBarDirection == null
|
||||
? _value.tabBarDirection
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: tabBarDirection as TabBarDirection,
|
||||
tabIntentOpenSetting:
|
||||
tabIntentOpenSetting == const $CopyWithPlaceholder() ||
|
||||
tabIntentOpenSetting == null
|
||||
@@ -836,9 +850,13 @@ GeneralSettings _$GeneralSettingsFromJson(
|
||||
_$TabTypeEnumMap,
|
||||
json['defaultCreateTabType'],
|
||||
),
|
||||
newTabPosition: $enumDecodeNullable(
|
||||
_$NewTabPositionEnumMap,
|
||||
json['newTabPosition'],
|
||||
tabListDirection: $enumDecodeNullable(
|
||||
_$TabListDirectionEnumMap,
|
||||
json['tabListDirection'],
|
||||
),
|
||||
tabBarDirection: $enumDecodeNullable(
|
||||
_$TabBarDirectionEnumMap,
|
||||
json['tabBarDirection'],
|
||||
),
|
||||
tabIntentOpenSetting: $enumDecodeNullable(
|
||||
_$TabIntentOpenSettingEnumMap,
|
||||
@@ -937,7 +955,8 @@ Map<String, dynamic> _$GeneralSettingsToJson(
|
||||
'showIsolatedTabUi': instance.showIsolatedTabUi,
|
||||
'defaultCreateTabType':
|
||||
_$TabTypeEnumMap[instance.storedDefaultCreateTabType]!,
|
||||
'newTabPosition': _$NewTabPositionEnumMap[instance.newTabPosition]!,
|
||||
'tabListDirection': _$TabListDirectionEnumMap[instance.tabListDirection]!,
|
||||
'tabBarDirection': _$TabBarDirectionEnumMap[instance.tabBarDirection]!,
|
||||
'tabIntentOpenSetting':
|
||||
_$TabIntentOpenSettingEnumMap[instance.tabIntentOpenSetting]!,
|
||||
'autoHideTabBar': instance.autoHideTabBar,
|
||||
@@ -1012,9 +1031,14 @@ const _$TabTypeEnumMap = {
|
||||
TabType.isolated: 'isolated',
|
||||
};
|
||||
|
||||
const _$NewTabPositionEnumMap = {
|
||||
NewTabPosition.first: 'first',
|
||||
NewTabPosition.end: 'end',
|
||||
const _$TabListDirectionEnumMap = {
|
||||
TabListDirection.newestFirst: 'newestFirst',
|
||||
TabListDirection.oldestFirst: 'oldestFirst',
|
||||
};
|
||||
|
||||
const _$TabBarDirectionEnumMap = {
|
||||
TabBarDirection.newestFirst: 'newestFirst',
|
||||
TabBarDirection.oldestFirst: 'oldestFirst',
|
||||
};
|
||||
|
||||
const _$TabIntentOpenSettingEnumMap = {
|
||||
|
||||
Reference in New Issue
Block a user