Refactor profile tile

This commit is contained in:
problematicconsumer
2023-07-24 19:45:58 +03:30
parent 49948398b5
commit 0f0d52e55b
16 changed files with 389 additions and 424 deletions

View File

@@ -1,5 +1,6 @@
import 'dart:async';
import 'package:fpdart/fpdart.dart';
import 'package:hiddify/data/data_providers.dart';
import 'package:hiddify/domain/profiles/profiles.dart';
import 'package:hiddify/utils/utils.dart';
@@ -26,6 +27,15 @@ class ProfilesNotifier extends _$ProfilesNotifier with AppLogger {
}).run();
}
Future<Unit?> updateProfile(Profile profile) async {
loggy.debug("updating profile");
return ref
.read(profilesRepositoryProvider)
.update(profile)
.getOrElse((l) => throw l)
.run();
}
Future<void> deleteProfile(Profile profile) async {
loggy.debug('deleting profile: ${profile.name}');
await _profilesRepo.delete(profile.id).mapLeft(