2023-08-04 21:12:29 +02:00
|
|
|
part of '../collection_settings.dart';
|
|
|
|
|
|
|
|
@npLog
|
2024-06-17 18:04:53 +02:00
|
|
|
class _Bloc extends Bloc<_Event, _State>
|
|
|
|
with BlocLogger, BlocForEachMixin<_Event, _State> {
|
2023-08-04 21:12:29 +02:00
|
|
|
_Bloc({
|
|
|
|
required this.prefController,
|
|
|
|
}) : super(_State(
|
2024-02-25 05:09:57 +01:00
|
|
|
isBrowserShowDate: prefController.isAlbumBrowserShowDateValue,
|
2023-08-04 21:12:29 +02:00
|
|
|
)) {
|
|
|
|
on<_Init>(_onInit);
|
|
|
|
on<_SetBrowserShowDate>(_onSetBrowserShowDate);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
String get tag => _log.fullName;
|
|
|
|
|
|
|
|
Future<void> _onInit(_Init ev, Emitter<_State> emit) async {
|
|
|
|
_log.info(ev);
|
2024-06-17 18:04:53 +02:00
|
|
|
return forEach(
|
|
|
|
emit,
|
2024-02-25 05:09:57 +01:00
|
|
|
prefController.isAlbumBrowserShowDateChange,
|
2023-08-04 21:12:29 +02:00
|
|
|
onData: (data) => state.copyWith(isBrowserShowDate: data),
|
|
|
|
onError: (e, stackTrace) {
|
|
|
|
_log.severe("[_onInit] Uncaught exception", e, stackTrace);
|
|
|
|
return state.copyWith(error: ExceptionEvent(e, stackTrace));
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void _onSetBrowserShowDate(_SetBrowserShowDate ev, Emitter<_State> emit) {
|
|
|
|
_log.info(ev);
|
|
|
|
prefController.setAlbumBrowserShowDate(ev.value);
|
|
|
|
}
|
|
|
|
|
|
|
|
final PrefController prefController;
|
|
|
|
}
|