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