Add profiles sort option

This commit is contained in:
problematicconsumer
2023-07-26 16:42:31 +03:30
parent d741b7a427
commit 3dd21213ef
10 changed files with 206 additions and 25 deletions

View File

@@ -5,6 +5,7 @@ import 'package:fpdart/fpdart.dart';
import 'package:hiddify/data/local/dao/dao.dart';
import 'package:hiddify/data/repository/exception_handlers.dart';
import 'package:hiddify/domain/clash/clash.dart';
import 'package:hiddify/domain/enums.dart';
import 'package:hiddify/domain/profiles/profiles.dart';
import 'package:hiddify/services/files_editor_service.dart';
import 'package:hiddify/utils/utils.dart';
@@ -50,9 +51,12 @@ class ProfilesRepositoryImpl
}
@override
Stream<Either<ProfileFailure, List<Profile>>> watchAll() {
Stream<Either<ProfileFailure, List<Profile>>> watchAll({
ProfilesSort sort = ProfilesSort.lastUpdate,
SortMode mode = SortMode.ascending,
}) {
return profilesDao
.watchAll()
.watchAll(sort: sort, mode: mode)
.handleExceptions(ProfileUnexpectedFailure.new);
}