mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-02 06:46:22 +01:00
Remove sort Photos tab by filename option
This is no longer supported in the revamped code
This commit is contained in:
parent
5be72240c5
commit
528699d7c5
16 changed files with 13 additions and 150 deletions
|
@ -60,12 +60,6 @@ class PrefController {
|
|||
value: value,
|
||||
);
|
||||
|
||||
Future<void> setPhotosTabSortByName(bool value) => _set<bool>(
|
||||
controller: _isPhotosTabSortByNameController,
|
||||
setter: (pref, value) => pref.setPhotosTabSortByName(value),
|
||||
value: value,
|
||||
);
|
||||
|
||||
Future<void> setViewerScreenBrightness(int value) => _set<int>(
|
||||
controller: _viewerScreenBrightnessController,
|
||||
setter: (pref, value) => pref.setViewerScreenBrightness(value),
|
||||
|
@ -216,9 +210,6 @@ class PrefController {
|
|||
late final _memoriesRangeController =
|
||||
BehaviorSubject.seeded(_c.pref.getMemoriesRangeOr(2));
|
||||
@npSubjectAccessor
|
||||
late final _isPhotosTabSortByNameController =
|
||||
BehaviorSubject.seeded(_c.pref.isPhotosTabSortByNameOr(false));
|
||||
@npSubjectAccessor
|
||||
late final _viewerScreenBrightnessController =
|
||||
BehaviorSubject.seeded(_c.pref.getViewerScreenBrightnessOr(-1));
|
||||
@npSubjectAccessor
|
||||
|
|
|
@ -61,13 +61,6 @@ extension $PrefControllerNpSubjectAccessor on PrefController {
|
|||
Stream<int> get memoriesRangeNew => memoriesRange.skip(1);
|
||||
Stream<int> get memoriesRangeChange => memoriesRange.distinct().skip(1);
|
||||
int get memoriesRangeValue => _memoriesRangeController.value;
|
||||
// _isPhotosTabSortByNameController
|
||||
ValueStream<bool> get isPhotosTabSortByName =>
|
||||
_isPhotosTabSortByNameController.stream;
|
||||
Stream<bool> get isPhotosTabSortByNameNew => isPhotosTabSortByName.skip(1);
|
||||
Stream<bool> get isPhotosTabSortByNameChange =>
|
||||
isPhotosTabSortByName.distinct().skip(1);
|
||||
bool get isPhotosTabSortByNameValue => _isPhotosTabSortByNameController.value;
|
||||
// _viewerScreenBrightnessController
|
||||
ValueStream<int> get viewerScreenBrightness =>
|
||||
_viewerScreenBrightnessController.stream;
|
||||
|
|
|
@ -100,6 +100,7 @@ enum PrefKey implements PrefKeyInterface {
|
|||
enhanceMaxHeight,
|
||||
hasShownEnhanceInfo,
|
||||
firstRunTime,
|
||||
@Deprecated("unused")
|
||||
isPhotosTabSortByName,
|
||||
shouldProcessExifWifiOnly,
|
||||
doubleTapExit,
|
||||
|
@ -164,6 +165,7 @@ enum PrefKey implements PrefKeyInterface {
|
|||
return "hasShownEnhanceInfo";
|
||||
case PrefKey.firstRunTime:
|
||||
return "firstRunTime";
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
case PrefKey.isPhotosTabSortByName:
|
||||
return "isPhotosTabSortByName";
|
||||
case PrefKey.shouldProcessExifWifiOnly:
|
||||
|
|
|
@ -205,15 +205,6 @@ extension PrefExtension on Pref {
|
|||
Future<bool> setFirstRunTime(int value) => _set<int>(
|
||||
PrefKey.firstRunTime, value, (key, value) => provider.setInt(key, value));
|
||||
|
||||
bool? isPhotosTabSortByName() =>
|
||||
provider.getBool(PrefKey.isPhotosTabSortByName);
|
||||
bool isPhotosTabSortByNameOr([bool def = false]) =>
|
||||
isPhotosTabSortByName() ?? def;
|
||||
Future<bool> setPhotosTabSortByName(bool value) => _set<bool>(
|
||||
PrefKey.isPhotosTabSortByName,
|
||||
value,
|
||||
(key, value) => provider.setBool(key, value));
|
||||
|
||||
bool? shouldProcessExifWifiOnly() =>
|
||||
provider.getBool(PrefKey.shouldProcessExifWifiOnly);
|
||||
bool shouldProcessExifWifiOnlyOr([bool def = true]) =>
|
||||
|
|
|
@ -45,7 +45,6 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
|||
on<_UpdateScrollDate>(_onUpdateScrollDate);
|
||||
|
||||
on<_SetEnableMemoryCollection>(_onSetEnableMemoryCollection);
|
||||
on<_SetSortByName>(_onSetSortByName);
|
||||
on<_SetMemoriesRange>(_onSetMemoriesRange);
|
||||
on<_UpdateDateTimeGroup>(_onUpdateDateTimeGroup);
|
||||
|
||||
|
@ -55,10 +54,6 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
|||
.add(accountPrefController.isEnableMemoryAlbumChange.listen((event) {
|
||||
add(_SetEnableMemoryCollection(event));
|
||||
}));
|
||||
_subscriptions
|
||||
.add(prefController.isPhotosTabSortByNameChange.listen((event) {
|
||||
add(_SetSortByName(event));
|
||||
}));
|
||||
_subscriptions.add(prefController.memoriesRangeChange.listen((event) {
|
||||
add(_SetMemoriesRange(event));
|
||||
}));
|
||||
|
@ -410,11 +405,6 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
|||
emit(state.copyWith(isEnableMemoryCollection: ev.value));
|
||||
}
|
||||
|
||||
void _onSetSortByName(_SetSortByName ev, Emitter<_State> emit) {
|
||||
_log.info(ev);
|
||||
_transformItems(state.files, state.filesSummary);
|
||||
}
|
||||
|
||||
void _onSetMemoriesRange(_SetMemoriesRange ev, Emitter<_State> emit) {
|
||||
_log.info(ev);
|
||||
_transformItems(state.files, state.filesSummary);
|
||||
|
@ -449,9 +439,6 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
|||
summary: summary,
|
||||
itemPerRow: state.itemPerRow,
|
||||
itemSize: state.itemSize,
|
||||
sort: prefController.isPhotosTabSortByNameValue
|
||||
? _ItemSort.filename
|
||||
: _ItemSort.dateTime,
|
||||
isGroupByDay: prefController.homePhotosZoomLevelValue >= 0,
|
||||
memoriesDayRange: prefController.memoriesRangeValue,
|
||||
locale: language_util.getSelectedLocale() ??
|
||||
|
|
|
@ -290,16 +290,6 @@ class _SetEnableMemoryCollection implements _Event {
|
|||
final bool value;
|
||||
}
|
||||
|
||||
@toString
|
||||
class _SetSortByName implements _Event {
|
||||
const _SetSortByName(this.value);
|
||||
|
||||
@override
|
||||
String toString() => _$toString();
|
||||
|
||||
final bool value;
|
||||
}
|
||||
|
||||
@toString
|
||||
class _SetMemoriesRange implements _Event {
|
||||
const _SetMemoriesRange(this.value);
|
||||
|
|
|
@ -106,8 +106,6 @@ class _DateItem extends _Item {
|
|||
final bool isMonthOnly;
|
||||
}
|
||||
|
||||
enum _ItemSort { dateTime, filename }
|
||||
|
||||
class _ItemTransformerArgument {
|
||||
const _ItemTransformerArgument({
|
||||
required this.account,
|
||||
|
@ -115,7 +113,6 @@ class _ItemTransformerArgument {
|
|||
this.summary,
|
||||
this.itemPerRow,
|
||||
this.itemSize,
|
||||
required this.sort,
|
||||
required this.isGroupByDay,
|
||||
required this.memoriesDayRange,
|
||||
required this.locale,
|
||||
|
@ -126,7 +123,6 @@ class _ItemTransformerArgument {
|
|||
final DbFilesSummary? summary;
|
||||
final int? itemPerRow;
|
||||
final double? itemSize;
|
||||
final _ItemSort sort;
|
||||
final bool isGroupByDay;
|
||||
final int memoriesDayRange;
|
||||
final Locale locale;
|
||||
|
|
|
@ -339,13 +339,6 @@ extension _$_SetEnableMemoryCollectionToString on _SetEnableMemoryCollection {
|
|||
}
|
||||
}
|
||||
|
||||
extension _$_SetSortByNameToString on _SetSortByName {
|
||||
String _$toString() {
|
||||
// ignore: unnecessary_string_interpolations
|
||||
return "_SetSortByName {value: $value}";
|
||||
}
|
||||
}
|
||||
|
||||
extension _$_SetMemoriesRangeToString on _SetMemoriesRange {
|
||||
String _$toString() {
|
||||
// ignore: unnecessary_string_interpolations
|
||||
|
|
|
@ -5,11 +5,9 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
|||
_Bloc({
|
||||
required this.prefController,
|
||||
}) : super(_State(
|
||||
isPhotosTabSortByName: prefController.isPhotosTabSortByNameValue,
|
||||
isDoubleTapExit: prefController.isDoubleTapExitValue,
|
||||
)) {
|
||||
on<_Init>(_onInit);
|
||||
on<_SetPhotosTabSortByName>(_onSetPhotosTabSortByName);
|
||||
on<_SetDoubleTapExit>(_onSetDoubleTapExit);
|
||||
}
|
||||
|
||||
|
@ -19,14 +17,6 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
|||
Future<void> _onInit(_Init ev, Emitter<_State> emit) async {
|
||||
_log.info(ev);
|
||||
await Future.wait([
|
||||
emit.forEach<bool>(
|
||||
prefController.isPhotosTabSortByNameChange,
|
||||
onData: (data) => state.copyWith(isPhotosTabSortByName: data),
|
||||
onError: (e, stackTrace) {
|
||||
_log.severe("[_onInit] Uncaught exception", e, stackTrace);
|
||||
return state.copyWith(error: ExceptionEvent(e, stackTrace));
|
||||
},
|
||||
),
|
||||
emit.forEach<bool>(
|
||||
prefController.isDoubleTapExitChange,
|
||||
onData: (data) => state.copyWith(isDoubleTapExit: data),
|
||||
|
@ -38,12 +28,6 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
|||
]);
|
||||
}
|
||||
|
||||
void _onSetPhotosTabSortByName(
|
||||
_SetPhotosTabSortByName ev, Emitter<_State> emit) {
|
||||
_log.info(ev);
|
||||
prefController.setPhotosTabSortByName(ev.value);
|
||||
}
|
||||
|
||||
void _onSetDoubleTapExit(_SetDoubleTapExit ev, Emitter<_State> emit) {
|
||||
_log.info(ev);
|
||||
prefController.setDoubleTapExit(ev.value);
|
||||
|
|
|
@ -4,7 +4,6 @@ part of '../misc_settings.dart';
|
|||
@toString
|
||||
class _State {
|
||||
const _State({
|
||||
required this.isPhotosTabSortByName,
|
||||
required this.isDoubleTapExit,
|
||||
this.error,
|
||||
});
|
||||
|
@ -12,7 +11,6 @@ class _State {
|
|||
@override
|
||||
String toString() => _$toString();
|
||||
|
||||
final bool isPhotosTabSortByName;
|
||||
final bool isDoubleTapExit;
|
||||
|
||||
final ExceptionEvent? error;
|
||||
|
@ -30,16 +28,6 @@ class _Init implements _Event {
|
|||
String toString() => _$toString();
|
||||
}
|
||||
|
||||
@toString
|
||||
class _SetPhotosTabSortByName implements _Event {
|
||||
const _SetPhotosTabSortByName(this.value);
|
||||
|
||||
@override
|
||||
String toString() => _$toString();
|
||||
|
||||
final bool value;
|
||||
}
|
||||
|
||||
@toString
|
||||
class _SetDoubleTapExit implements _Event {
|
||||
const _SetDoubleTapExit(this.value);
|
||||
|
|
|
@ -89,19 +89,6 @@ class _WrappedMiscSettingsState extends State<_WrappedMiscSettings>
|
|||
);
|
||||
},
|
||||
),
|
||||
_BlocSelector<bool>(
|
||||
selector: (state) => state.isPhotosTabSortByName,
|
||||
builder: (_, state) {
|
||||
return SwitchListTile(
|
||||
title: Text(
|
||||
L10n.global().settingsPhotosTabSortByNameTitle),
|
||||
value: state,
|
||||
onChanged: (value) {
|
||||
_bloc.add(_SetPhotosTabSortByName(value));
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -13,23 +13,15 @@ part of 'misc_settings.dart';
|
|||
// **************************************************************************
|
||||
|
||||
abstract class $_StateCopyWithWorker {
|
||||
_State call(
|
||||
{bool? isPhotosTabSortByName,
|
||||
bool? isDoubleTapExit,
|
||||
ExceptionEvent? error});
|
||||
_State call({bool? isDoubleTapExit, ExceptionEvent? error});
|
||||
}
|
||||
|
||||
class _$_StateCopyWithWorkerImpl implements $_StateCopyWithWorker {
|
||||
_$_StateCopyWithWorkerImpl(this.that);
|
||||
|
||||
@override
|
||||
_State call(
|
||||
{dynamic isPhotosTabSortByName,
|
||||
dynamic isDoubleTapExit,
|
||||
dynamic error = copyWithNull}) {
|
||||
_State call({dynamic isDoubleTapExit, dynamic error = copyWithNull}) {
|
||||
return _State(
|
||||
isPhotosTabSortByName:
|
||||
isPhotosTabSortByName as bool? ?? that.isPhotosTabSortByName,
|
||||
isDoubleTapExit: isDoubleTapExit as bool? ?? that.isDoubleTapExit,
|
||||
error: error == copyWithNull ? that.error : error as ExceptionEvent?);
|
||||
}
|
||||
|
@ -60,7 +52,7 @@ extension _$_BlocNpLog on _Bloc {
|
|||
extension _$_StateToString on _State {
|
||||
String _$toString() {
|
||||
// ignore: unnecessary_string_interpolations
|
||||
return "_State {isPhotosTabSortByName: $isPhotosTabSortByName, isDoubleTapExit: $isDoubleTapExit, error: $error}";
|
||||
return "_State {isDoubleTapExit: $isDoubleTapExit, error: $error}";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,13 +63,6 @@ extension _$_InitToString on _Init {
|
|||
}
|
||||
}
|
||||
|
||||
extension _$_SetPhotosTabSortByNameToString on _SetPhotosTabSortByName {
|
||||
String _$toString() {
|
||||
// ignore: unnecessary_string_interpolations
|
||||
return "_SetPhotosTabSortByName {value: $value}";
|
||||
}
|
||||
}
|
||||
|
||||
extension _$_SetDoubleTapExitToString on _SetDoubleTapExit {
|
||||
String _$toString() {
|
||||
// ignore: unnecessary_string_interpolations
|
||||
|
|
|
@ -7,7 +7,6 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
|||
required this.accountPrefController,
|
||||
}) : super(_State(
|
||||
isEnableMemories: accountPrefController.isEnableMemoryAlbumValue,
|
||||
isPhotosTabSortByName: prefController.isPhotosTabSortByNameValue,
|
||||
memoriesRange: prefController.memoriesRangeValue,
|
||||
)) {
|
||||
on<_Init>(_onInit);
|
||||
|
@ -29,14 +28,6 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
|||
return state.copyWith(error: ExceptionEvent(e, stackTrace));
|
||||
},
|
||||
),
|
||||
emit.forEach<bool>(
|
||||
prefController.isPhotosTabSortByNameChange,
|
||||
onData: (data) => state.copyWith(isPhotosTabSortByName: data),
|
||||
onError: (e, stackTrace) {
|
||||
_log.severe("[_onInit] Uncaught exception", e, stackTrace);
|
||||
return state.copyWith(error: ExceptionEvent(e, stackTrace));
|
||||
},
|
||||
),
|
||||
emit.forEach<int>(
|
||||
prefController.memoriesRangeChange,
|
||||
onData: (data) => state.copyWith(memoriesRange: data),
|
||||
|
|
|
@ -5,7 +5,6 @@ part of '../photos_settings.dart';
|
|||
class _State {
|
||||
const _State({
|
||||
required this.isEnableMemories,
|
||||
required this.isPhotosTabSortByName,
|
||||
required this.memoriesRange,
|
||||
this.error,
|
||||
});
|
||||
|
@ -14,7 +13,6 @@ class _State {
|
|||
String toString() => _$toString();
|
||||
|
||||
final bool isEnableMemories;
|
||||
final bool isPhotosTabSortByName;
|
||||
final int memoriesRange;
|
||||
|
||||
final ExceptionEvent? error;
|
||||
|
|
|
@ -83,28 +83,22 @@ class _WrappedPhotosSettingsState extends State<_WrappedPhotosSettings>
|
|||
[
|
||||
_BlocBuilder(
|
||||
buildWhen: (previous, current) =>
|
||||
previous.isEnableMemories != current.isEnableMemories ||
|
||||
previous.isPhotosTabSortByName !=
|
||||
current.isPhotosTabSortByName,
|
||||
previous.isEnableMemories != current.isEnableMemories,
|
||||
builder: (context, state) {
|
||||
return SwitchListTile(
|
||||
title: Text(L10n.global().settingsMemoriesTitle),
|
||||
subtitle: Text(L10n.global().settingsMemoriesSubtitle),
|
||||
value: state.isEnableMemories,
|
||||
onChanged: state.isPhotosTabSortByName
|
||||
? null
|
||||
: (value) {
|
||||
_bloc.add(_SetEnableMemories(value));
|
||||
},
|
||||
onChanged: (value) {
|
||||
_bloc.add(_SetEnableMemories(value));
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
_BlocBuilder(
|
||||
buildWhen: (previous, current) =>
|
||||
previous.memoriesRange != current.memoriesRange ||
|
||||
previous.isEnableMemories != current.isEnableMemories ||
|
||||
previous.isPhotosTabSortByName !=
|
||||
current.isPhotosTabSortByName,
|
||||
previous.isEnableMemories != current.isEnableMemories,
|
||||
builder: (context, state) {
|
||||
return ListTile(
|
||||
title: Text(L10n.global().settingsMemoriesRangeTitle),
|
||||
|
@ -112,8 +106,7 @@ class _WrappedPhotosSettingsState extends State<_WrappedPhotosSettings>
|
|||
.settingsMemoriesRangeValueText(
|
||||
state.memoriesRange)),
|
||||
onTap: () => _onMemoriesRangeTap(context),
|
||||
enabled: !state.isPhotosTabSortByName &&
|
||||
state.isEnableMemories,
|
||||
enabled: state.isEnableMemories,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
|
@ -14,10 +14,7 @@ part of 'photos_settings.dart';
|
|||
|
||||
abstract class $_StateCopyWithWorker {
|
||||
_State call(
|
||||
{bool? isEnableMemories,
|
||||
bool? isPhotosTabSortByName,
|
||||
int? memoriesRange,
|
||||
ExceptionEvent? error});
|
||||
{bool? isEnableMemories, int? memoriesRange, ExceptionEvent? error});
|
||||
}
|
||||
|
||||
class _$_StateCopyWithWorkerImpl implements $_StateCopyWithWorker {
|
||||
|
@ -26,13 +23,10 @@ class _$_StateCopyWithWorkerImpl implements $_StateCopyWithWorker {
|
|||
@override
|
||||
_State call(
|
||||
{dynamic isEnableMemories,
|
||||
dynamic isPhotosTabSortByName,
|
||||
dynamic memoriesRange,
|
||||
dynamic error = copyWithNull}) {
|
||||
return _State(
|
||||
isEnableMemories: isEnableMemories as bool? ?? that.isEnableMemories,
|
||||
isPhotosTabSortByName:
|
||||
isPhotosTabSortByName as bool? ?? that.isPhotosTabSortByName,
|
||||
memoriesRange: memoriesRange as int? ?? that.memoriesRange,
|
||||
error: error == copyWithNull ? that.error : error as ExceptionEvent?);
|
||||
}
|
||||
|
@ -63,7 +57,7 @@ extension _$_BlocNpLog on _Bloc {
|
|||
extension _$_StateToString on _State {
|
||||
String _$toString() {
|
||||
// ignore: unnecessary_string_interpolations
|
||||
return "_State {isEnableMemories: $isEnableMemories, isPhotosTabSortByName: $isPhotosTabSortByName, memoriesRange: $memoriesRange, error: $error}";
|
||||
return "_State {isEnableMemories: $isEnableMemories, memoriesRange: $memoriesRange, error: $error}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue