Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions mobile/lib/utils/migration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -420,21 +420,24 @@ Future<void> _populateLocalAssetPlaybackStyle(Drift db) async {
});
}

final trashedAssetMap = await nativeApi.getTrashedAssets();
for (final entry in trashedAssetMap.cast<String, List<Object?>>().entries) {
final assets = entry.value.cast<PlatformAsset>();
await db.batch((batch) {
for (final asset in assets) {
batch.update(
db.trashedLocalAssetEntity,
TrashedLocalAssetEntityCompanion(playbackStyle: Value(_toPlaybackStyle(asset.playbackStyle))),
where: (t) => t.id.equals(asset.id),
);
}
});
if (Platform.isAndroid) {
final trashedAssetMap = await nativeApi.getTrashedAssets();
for (final entry in trashedAssetMap.cast<String, List<Object?>>().entries) {
final assets = entry.value.cast<PlatformAsset>();
await db.batch((batch) {
for (final asset in assets) {
batch.update(
db.trashedLocalAssetEntity,
TrashedLocalAssetEntityCompanion(playbackStyle: Value(_toPlaybackStyle(asset.playbackStyle))),
where: (t) => t.id.equals(asset.id),
);
}
});
}
dPrint(() => "[MIGRATION] Successfully populated playbackStyle for local and trashed assets");
} else {
dPrint(() => "[MIGRATION] Successfully populated playbackStyle for local assets");
}

dPrint(() => "[MIGRATION] Successfully populated playbackStyle for local and trashed assets");
} catch (error) {
dPrint(() => "[MIGRATION] Error while populating playbackStyle: $error");
}
Expand Down
Loading