mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat(mobile): configure detail viewer asset loading (#1044)
This commit is contained in:
parent
da87b1256c
commit
424b11cf50
12 changed files with 138 additions and 131 deletions
|
|
@ -32,20 +32,20 @@ class AssetService {
|
|||
AssetService(this._apiService, this._backupService, this._backgroundService);
|
||||
|
||||
/// Returns `null` if the server state did not change, else list of assets
|
||||
Future<List<Asset>?> getRemoteAssets({required bool hasCache}) async {
|
||||
Future<Pair<List<Asset>?, String?>> getRemoteAssets({String? etag}) async {
|
||||
try {
|
||||
final Box box = Hive.box(userInfoBox);
|
||||
final Pair<List<AssetResponseDto>, String?>? remote = await _apiService
|
||||
.assetApi
|
||||
.getAllAssetsWithETag(eTag: hasCache ? box.get(assetEtagKey) : null);
|
||||
final Pair<List<AssetResponseDto>, String?>? remote =
|
||||
await _apiService.assetApi.getAllAssetsWithETag(eTag: etag);
|
||||
if (remote == null) {
|
||||
return null;
|
||||
return const Pair(null, null);
|
||||
}
|
||||
box.put(assetEtagKey, remote.second);
|
||||
return remote.first.map(Asset.remote).toList(growable: false);
|
||||
return Pair(
|
||||
remote.first.map(Asset.remote).toList(growable: false),
|
||||
remote.second,
|
||||
);
|
||||
} catch (e, stack) {
|
||||
log.severe('Error while getting remote assets', e, stack);
|
||||
return null;
|
||||
return const Pair(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue