Add profiles sort option
This commit is contained in:
1
lib/domain/enums.dart
Normal file
1
lib/domain/enums.dart
Normal file
@@ -0,0 +1 @@
|
||||
enum SortMode { ascending, descending }
|
||||
13
lib/domain/profiles/profile_enums.dart
Normal file
13
lib/domain/profiles/profile_enums.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'package:hiddify/core/locale/locale.dart';
|
||||
|
||||
enum ProfilesSort {
|
||||
lastUpdate,
|
||||
name;
|
||||
|
||||
String present(TranslationsEn t) {
|
||||
return switch (this) {
|
||||
lastUpdate => t.profile.sortBy.lastUpdate,
|
||||
name => t.profile.sortBy.name,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
export 'profile.dart';
|
||||
export 'profile_enums.dart';
|
||||
export 'profiles_failure.dart';
|
||||
export 'profiles_repository.dart';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:fpdart/fpdart.dart';
|
||||
import 'package:hiddify/domain/enums.dart';
|
||||
import 'package:hiddify/domain/profiles/profiles.dart';
|
||||
|
||||
abstract class ProfilesRepository {
|
||||
@@ -8,7 +9,10 @@ abstract class ProfilesRepository {
|
||||
|
||||
Stream<Either<ProfileFailure, bool>> watchHasAnyProfile();
|
||||
|
||||
Stream<Either<ProfileFailure, List<Profile>>> watchAll();
|
||||
Stream<Either<ProfileFailure, List<Profile>>> watchAll({
|
||||
ProfilesSort sort = ProfilesSort.lastUpdate,
|
||||
SortMode mode = SortMode.ascending,
|
||||
});
|
||||
|
||||
TaskEither<ProfileFailure, Unit> addByUrl(
|
||||
String url, {
|
||||
|
||||
Reference in New Issue
Block a user