chore: finish drift locked page (#20013)

* feat: overlay mechanism

* handle merged asset local id extraction

* locked view asset viewer actions

* pr feedback
This commit is contained in:
Alex 2025-07-18 13:16:22 -05:00 committed by GitHub
parent dcfe8d5ade
commit 5d244c6fec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 143 additions and 26 deletions

View file

@ -47,7 +47,18 @@ class ActionNotifier extends Notifier<void> {
}
List<String> _getLocalIdsForSource(ActionSource source) {
return _getIdsForSource<LocalAsset>(source).toIds().toList(growable: false);
final Set<BaseAsset> assets = _getAssets(source);
final List<String> localIds = [];
for (final asset in assets) {
if (asset is LocalAsset) {
localIds.add(asset.id);
} else if (asset is RemoteAsset && asset.localId != null) {
localIds.add(asset.localId!);
}
}
return localIds;
}
List<String> _getOwnedRemoteIdsForSource(ActionSource source) {
@ -162,8 +173,9 @@ class ActionNotifier extends Notifier<void> {
Future<ActionResult> moveToLockFolder(ActionSource source) async {
final ids = _getOwnedRemoteIdsForSource(source);
final localIds = _getLocalIdsForSource(source);
try {
await _service.moveToLockFolder(ids);
await _service.moveToLockFolder(ids, localIds);
return ActionResult(count: ids.length, success: true);
} catch (error, stack) {
_logger.severe('Failed to move assets to lock folder', error, stack);
@ -329,7 +341,3 @@ extension on Iterable<RemoteAsset> {
return whereType<RemoteAsset>().where((a) => a.ownerId == ownerId);
}
}
extension on Iterable<LocalAsset> {
Iterable<String> toIds() => map((e) => e.id);
}