mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-10-31 22:17:29 +00:00
refactor: Use transformers for blocs
This commit is contained in:
parent
21c0e200a9
commit
1ba8f324fe
|
@ -1,5 +1,6 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:bloc_concurrency/bloc_concurrency.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
@ -19,33 +20,43 @@ class BackupsBloc extends Bloc<BackupsEvent, BackupsState> {
|
|||
BackupsBloc() : super(BackupsInitial()) {
|
||||
on<BackupsServerLoaded>(
|
||||
_loadState,
|
||||
transformer: droppable(),
|
||||
);
|
||||
on<BackupsServerReset>(
|
||||
_resetState,
|
||||
transformer: droppable(),
|
||||
);
|
||||
on<BackupsStateChanged>(
|
||||
_updateState,
|
||||
transformer: droppable(),
|
||||
);
|
||||
on<InitializeBackupsRepository>(
|
||||
_initializeRepository,
|
||||
transformer: droppable(),
|
||||
);
|
||||
on<ForceSnapshotListUpdate>(
|
||||
_forceSnapshotListUpdate,
|
||||
transformer: droppable(),
|
||||
);
|
||||
on<CreateBackups>(
|
||||
_createBackups,
|
||||
transformer: sequential(),
|
||||
);
|
||||
on<RestoreBackup>(
|
||||
_restoreBackup,
|
||||
transformer: sequential(),
|
||||
);
|
||||
on<SetAutobackupPeriod>(
|
||||
_setAutobackupPeriod,
|
||||
transformer: restartable(),
|
||||
);
|
||||
on<SetAutobackupQuotas>(
|
||||
_setAutobackupQuotas,
|
||||
transformer: restartable(),
|
||||
);
|
||||
on<ForgetSnapshot>(
|
||||
_forgetSnapshot,
|
||||
transformer: sequential(),
|
||||
);
|
||||
|
||||
final connectionRepository = getIt<ApiConnectionRepository>();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:bloc_concurrency/bloc_concurrency.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:selfprivacy/config/get_it_config.dart';
|
||||
|
@ -17,12 +18,15 @@ class ServerJobsBloc extends Bloc<ServerJobsEvent, ServerJobsState> {
|
|||
) {
|
||||
on<ServerJobsListChanged>(
|
||||
_mapServerJobsListChangedToState,
|
||||
transformer: sequential(),
|
||||
);
|
||||
on<RemoveServerJob>(
|
||||
_mapRemoveServerJobToState,
|
||||
transformer: sequential(),
|
||||
);
|
||||
on<RemoveAllFinishedJobs>(
|
||||
_mapRemoveAllFinishedJobsToState,
|
||||
transformer: droppable(),
|
||||
);
|
||||
|
||||
final apiConnectionRepository = getIt<ApiConnectionRepository>();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:bloc_concurrency/bloc_concurrency.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
@ -14,15 +15,19 @@ class ServicesBloc extends Bloc<ServicesEvent, ServicesState> {
|
|||
ServicesBloc() : super(ServicesInitial()) {
|
||||
on<ServicesListUpdate>(
|
||||
_updateList,
|
||||
transformer: sequential(),
|
||||
);
|
||||
on<ServicesReload>(
|
||||
_reload,
|
||||
transformer: droppable(),
|
||||
);
|
||||
on<ServiceRestart>(
|
||||
_restart,
|
||||
transformer: sequential(),
|
||||
);
|
||||
on<ServiceMove>(
|
||||
_move,
|
||||
transformer: sequential(),
|
||||
);
|
||||
|
||||
final connectionRepository = getIt<ApiConnectionRepository>();
|
||||
|
|
|
@ -81,6 +81,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.1.2"
|
||||
bloc_concurrency:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: bloc_concurrency
|
||||
sha256: d945b33641a3c3f12fa12a1437e77f784444dd9a3a66a3a4f5aaa6e049154d36
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.3"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -11,6 +11,7 @@ dependencies:
|
|||
animations: ^2.0.8
|
||||
auto_route: ^7.8.4
|
||||
auto_size_text: ^3.0.0
|
||||
bloc_concurrency: ^0.2.3
|
||||
crypt: ^4.3.1
|
||||
cubit_form: ^2.0.1
|
||||
device_info_plus: ^9.1.1
|
||||
|
|
Loading…
Reference in a new issue