Skip to content

Commit

Permalink
refactor(mobile): asset provider (#16159)
Browse files Browse the repository at this point in the history
* refactor(mobile): asset provider

* wip

* wip: delete local assets

* wip: delete remote assets

* wip: deletion logic

* refactor

* pr feedback
  • Loading branch information
alextran1502 authored Feb 18, 2025
1 parent 70d08a2 commit 9d4aee3
Show file tree
Hide file tree
Showing 24 changed files with 326 additions and 299 deletions.
2 changes: 2 additions & 0 deletions mobile/lib/interfaces/album.interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ abstract interface class IAlbumRepository implements IDatabaseRepository {
Stream<Album?> watchAlbum(int id);

Stream<RenderList> getRenderListStream(Album album);

Future<void> clearTable();
}

enum AlbumSort { remoteId, localId }
6 changes: 5 additions & 1 deletion mobile/lib/interfaces/asset.interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ abstract interface class IAssetRepository implements IDatabaseRepository {

Future<void> deleteAllByRemoteId(List<String> ids, {AssetState? state});

Future<void> deleteById(List<int> ids);
Future<void> deleteByIds(List<int> ids);

Future<List<Asset>> getMatches({
required List<Asset> assets,
Expand All @@ -59,6 +59,10 @@ abstract interface class IAssetRepository implements IDatabaseRepository {
Future<List<String>> getAllDuplicatedAssetIds();

Future<List<Asset>> getStackAssets(String stackId);

Future<void> clearTable();

Stream<Asset?> watchAsset(int id, {bool fireImmediately = false});
}

enum AssetSort { checksum, ownerIdChecksum }
2 changes: 2 additions & 0 deletions mobile/lib/interfaces/etag.interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ abstract interface class IETagRepository implements IDatabaseRepository {
Future<void> upsertAll(List<ETag> etags);

Future<void> deleteByIds(List<String> ids);

Future<void> clearTable();
}
2 changes: 2 additions & 0 deletions mobile/lib/interfaces/exif_info.interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ abstract interface class IExifInfoRepository implements IDatabaseRepository {
Future<List<ExifInfo>> updateAll(List<ExifInfo> exifInfos);

Future<void> delete(int id);

Future<void> clearTable();
}
2 changes: 2 additions & 0 deletions mobile/lib/interfaces/user.interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ abstract interface class IUserRepository implements IDatabaseRepository {
Future<void> deleteById(List<int> ids);

Future<User> me();

Future<void> clearTable();
}

enum UserSort { id }
Loading

0 comments on commit 9d4aee3

Please sign in to comment.