mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-02-02 14:16:58 +00:00
refactor(job): Force services to always reload after jobs execution
This commit is contained in:
parent
d0be867aa6
commit
26466bb8d5
|
@ -23,8 +23,6 @@ class JobsCubit extends Cubit<JobsState> {
|
||||||
final UsersCubit usersCubit;
|
final UsersCubit usersCubit;
|
||||||
final ServicesCubit servicesCubit;
|
final ServicesCubit servicesCubit;
|
||||||
|
|
||||||
bool hasServiceJobs = false;
|
|
||||||
|
|
||||||
void addJob(final ClientJob job) {
|
void addJob(final ClientJob job) {
|
||||||
final List<ClientJob> newJobsList = [];
|
final List<ClientJob> newJobsList = [];
|
||||||
if (state is JobsStateWithJobs) {
|
if (state is JobsStateWithJobs) {
|
||||||
|
@ -112,12 +110,7 @@ class JobsCubit extends Cubit<JobsState> {
|
||||||
|
|
||||||
await api.pullConfigurationUpdate();
|
await api.pullConfigurationUpdate();
|
||||||
await api.apply();
|
await api.apply();
|
||||||
|
await servicesCubit.load();
|
||||||
if (hasServiceJobs) {
|
|
||||||
await servicesCubit.load();
|
|
||||||
}
|
|
||||||
|
|
||||||
hasServiceJobs = false;
|
|
||||||
|
|
||||||
emit(JobsStateEmpty());
|
emit(JobsStateEmpty());
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,6 @@ class ServiceToggleJob extends ToggleJob {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void execute(final JobsCubit cubit) async {
|
void execute(final JobsCubit cubit) async {
|
||||||
cubit.hasServiceJobs = true;
|
|
||||||
await cubit.api.switchService(service.id, needToTurnOn);
|
await cubit.api.switchService(service.id, needToTurnOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue