finished implementing history with removal options
This commit is contained in:
@@ -63,6 +63,7 @@ class GeneralSettings with FastEquatable {
|
||||
final TabIntentOpenSetting tabIntentOpenSetting;
|
||||
final bool autoHideTabBar;
|
||||
final TabBarSwipeAction tabBarSwipeAction;
|
||||
final Duration historyAutoCleanInterval;
|
||||
|
||||
GeneralSettings({
|
||||
required this.themeMode,
|
||||
@@ -78,6 +79,7 @@ class GeneralSettings with FastEquatable {
|
||||
required this.tabIntentOpenSetting,
|
||||
required this.autoHideTabBar,
|
||||
required this.tabBarSwipeAction,
|
||||
required this.historyAutoCleanInterval,
|
||||
});
|
||||
|
||||
GeneralSettings.withDefaults({
|
||||
@@ -94,6 +96,7 @@ class GeneralSettings with FastEquatable {
|
||||
TabIntentOpenSetting? tabIntentOpenSetting,
|
||||
bool? autoHideTabBar,
|
||||
TabBarSwipeAction? tabBarSwipeAction,
|
||||
Duration? historyAutoCleanInterval,
|
||||
}) : themeMode = themeMode ?? ThemeMode.dark,
|
||||
enableReadability = enableReadability ?? true,
|
||||
enforceReadability = enforceReadability ?? false,
|
||||
@@ -107,7 +110,9 @@ class GeneralSettings with FastEquatable {
|
||||
tabIntentOpenSetting = tabIntentOpenSetting ?? TabIntentOpenSetting.ask,
|
||||
autoHideTabBar = autoHideTabBar ?? true,
|
||||
tabBarSwipeAction =
|
||||
tabBarSwipeAction ?? TabBarSwipeAction.switchLastOpened;
|
||||
tabBarSwipeAction ?? TabBarSwipeAction.switchLastOpened,
|
||||
historyAutoCleanInterval =
|
||||
historyAutoCleanInterval ?? const Duration(days: 90);
|
||||
|
||||
factory GeneralSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$GeneralSettingsFromJson(json);
|
||||
@@ -129,5 +134,6 @@ class GeneralSettings with FastEquatable {
|
||||
tabIntentOpenSetting,
|
||||
autoHideTabBar,
|
||||
tabBarSwipeAction,
|
||||
historyAutoCleanInterval,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ abstract class _$GeneralSettingsCWProxy {
|
||||
|
||||
GeneralSettings tabBarSwipeAction(TabBarSwipeAction tabBarSwipeAction);
|
||||
|
||||
GeneralSettings historyAutoCleanInterval(Duration historyAutoCleanInterval);
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `GeneralSettings(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
@@ -59,6 +61,7 @@ abstract class _$GeneralSettingsCWProxy {
|
||||
TabIntentOpenSetting tabIntentOpenSetting,
|
||||
bool autoHideTabBar,
|
||||
TabBarSwipeAction tabBarSwipeAction,
|
||||
Duration historyAutoCleanInterval,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -122,6 +125,10 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
GeneralSettings tabBarSwipeAction(TabBarSwipeAction tabBarSwipeAction) =>
|
||||
this(tabBarSwipeAction: tabBarSwipeAction);
|
||||
|
||||
@override
|
||||
GeneralSettings historyAutoCleanInterval(Duration historyAutoCleanInterval) =>
|
||||
this(historyAutoCleanInterval: historyAutoCleanInterval);
|
||||
|
||||
@override
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `GeneralSettings(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
@@ -143,6 +150,7 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
Object? tabIntentOpenSetting = const $CopyWithPlaceholder(),
|
||||
Object? autoHideTabBar = const $CopyWithPlaceholder(),
|
||||
Object? tabBarSwipeAction = const $CopyWithPlaceholder(),
|
||||
Object? historyAutoCleanInterval = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return GeneralSettings(
|
||||
themeMode: themeMode == const $CopyWithPlaceholder()
|
||||
@@ -203,6 +211,11 @@ class _$GeneralSettingsCWProxyImpl implements _$GeneralSettingsCWProxy {
|
||||
? _value.tabBarSwipeAction
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: tabBarSwipeAction as TabBarSwipeAction,
|
||||
historyAutoCleanInterval:
|
||||
historyAutoCleanInterval == const $CopyWithPlaceholder()
|
||||
? _value.historyAutoCleanInterval
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: historyAutoCleanInterval as Duration,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -247,6 +260,11 @@ GeneralSettings _$GeneralSettingsFromJson(Map<String, dynamic> json) =>
|
||||
_$TabBarSwipeActionEnumMap,
|
||||
json['tabBarSwipeAction'],
|
||||
),
|
||||
historyAutoCleanInterval: json['historyAutoCleanInterval'] == null
|
||||
? null
|
||||
: Duration(
|
||||
microseconds: (json['historyAutoCleanInterval'] as num).toInt(),
|
||||
),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$GeneralSettingsToJson(
|
||||
@@ -270,6 +288,7 @@ Map<String, dynamic> _$GeneralSettingsToJson(
|
||||
_$TabIntentOpenSettingEnumMap[instance.tabIntentOpenSetting]!,
|
||||
'autoHideTabBar': instance.autoHideTabBar,
|
||||
'tabBarSwipeAction': _$TabBarSwipeActionEnumMap[instance.tabBarSwipeAction]!,
|
||||
'historyAutoCleanInterval': instance.historyAutoCleanInterval.inMicroseconds,
|
||||
};
|
||||
|
||||
const _$ThemeModeEnumMap = {
|
||||
|
||||
@@ -96,6 +96,10 @@ class GeneralSettingsRepository extends _$GeneralSettingsRepository {
|
||||
DriftSqlType.string,
|
||||
db.typeMapping,
|
||||
),
|
||||
'historyAutoCleanInterval': settings['historyAutoCleanInterval']?.readAs(
|
||||
DriftSqlType.int,
|
||||
db.typeMapping,
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ final generalSettingsWithDefaultsProvider =
|
||||
typedef GeneralSettingsWithDefaultsRef =
|
||||
AutoDisposeProviderRef<GeneralSettings>;
|
||||
String _$generalSettingsRepositoryHash() =>
|
||||
r'0d207ae4ae9fd94b1257eb8aa4cfd73d4a47caf2';
|
||||
r'3e2a07b8956094cd9376a254d9aedaa80a3c45c4';
|
||||
|
||||
/// See also [GeneralSettingsRepository].
|
||||
@ProviderFor(GeneralSettingsRepository)
|
||||
|
||||
Reference in New Issue
Block a user