fix(mobile): restore button in asset viewer (#8919)

* fix:(mobile): spell error in top_control_app_bar.dart in function buildAddToAlbumButtom

* fix(mobile): add restore button to individual image view of trashed assets

* formatting
This commit is contained in:
Conner Hnatiuk 2024-04-26 00:01:03 -06:00 committed by GitHub
parent 59537f8f1b
commit 3e03f5348f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 70 additions and 2 deletions

View file

@ -75,6 +75,28 @@ class TrashNotifier extends StateNotifier<bool> {
return false;
}
Future<bool> restoreAsset(Asset asset) async {
try {
final result = await _trashService.restoreAsset(asset);
if (result) {
final remoteAsset = asset.isRemote;
asset.isTrashed = false;
if (remoteAsset) {
await _db.writeTxn(() async {
await _db.assets.put(asset);
});
}
return true;
}
} catch (error, stack) {
_log.severe("Cannot restore asset", error, stack);
}
return false;
}
Future<bool> restoreAssets(Iterable<Asset> assetList) async {
try {
final result = await _trashService.restoreAssets(assetList);