diff --git a/mobile/android/app/src/main/kotlin/app/alextran/immich/BackgroundServicePlugin.kt b/mobile/android/app/src/main/kotlin/app/alextran/immich/BackgroundServicePlugin.kt index 0f08a2dc94..d2f52e37e4 100644 --- a/mobile/android/app/src/main/kotlin/app/alextran/immich/BackgroundServicePlugin.kt +++ b/mobile/android/app/src/main/kotlin/app/alextran/immich/BackgroundServicePlugin.kt @@ -243,15 +243,13 @@ class BackgroundServicePlugin : FlutterPlugin, MethodChannel.MethodCallHandler, return } - val primary = ContentUris.withAppendedId(contentUriForType(type), id) - val fallback = ContentUris.withAppendedId(MediaStore.Files.getContentUri(MediaStore.VOLUME_EXTERNAL), id) + val uri = ContentUris.withAppendedId(contentUriForType(type), id) try { - Log.i(TAG, "restoreFromTrashById: primary=$primary (type=$type,id=$id)") - restoreUris(listOf(primary), result) + Log.i(TAG, "restoreFromTrashById: uri=$uri (type=$type,id=$id)") + restoreUris(listOf(uri), result) } catch (e: Exception) { - Log.w(TAG, "restoreFromTrashById: primary failed, try fallback=$fallback", e) - restoreUris(listOf(fallback), result) + Log.w(TAG, "restoreFromTrashById failed", e) } } diff --git a/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImplBase.kt b/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImplBase.kt index aa10e29215..610545647d 100644 --- a/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImplBase.kt +++ b/mobile/android/app/src/main/kotlin/app/alextran/immich/sync/MessagesImplBase.kt @@ -32,12 +32,12 @@ sealed class AssetResult { open class NativeSyncApiImplBase(context: Context) { private val ctx: Context = context.applicationContext - internal var hashTask: Job? = null + private var hashTask: Job? = null companion object { private const val MAX_CONCURRENT_HASH_OPERATIONS = 16 - internal val hashSemaphore = Semaphore(MAX_CONCURRENT_HASH_OPERATIONS) - internal const val HASHING_CANCELLED_CODE = "HASH_CANCELLED" + private val hashSemaphore = Semaphore(MAX_CONCURRENT_HASH_OPERATIONS) + private const val HASHING_CANCELLED_CODE = "HASH_CANCELLED" const val MEDIA_SELECTION = "(${MediaStore.Files.FileColumns.MEDIA_TYPE} = ? OR ${MediaStore.Files.FileColumns.MEDIA_TYPE} = ?)" @@ -59,7 +59,7 @@ open class NativeSyncApiImplBase(context: Context) { add(MediaStore.MediaColumns.HEIGHT) add(MediaStore.MediaColumns.DURATION) add(MediaStore.MediaColumns.ORIENTATION) - // only available on Android 11 and above + // IS_FAVORITE is only available on Android 11 and above if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) { add(MediaStore.MediaColumns.IS_FAVORITE) } @@ -138,6 +138,7 @@ open class NativeSyncApiImplBase(context: Context) { val bucketId = c.getString(bucketIdColumn) val orientation = c.getInt(orientationColumn) val isFavorite = if (favoriteColumn == -1) false else c.getInt(favoriteColumn) != 0 + val asset = PlatformAsset( id, name, diff --git a/mobile/lib/infrastructure/repositories/trashed_local_asset.repository.dart b/mobile/lib/infrastructure/repositories/trashed_local_asset.repository.dart index 5ac4b2efbb..6bd6653203 100644 --- a/mobile/lib/infrastructure/repositories/trashed_local_asset.repository.dart +++ b/mobile/lib/infrastructure/repositories/trashed_local_asset.repository.dart @@ -133,8 +133,9 @@ class DriftTrashedLocalAssetRepository extends DriftDatabaseRepository { albumId: item.albumId, name: item.asset.name, type: item.asset.type, - checksum: effectiveChecksum == null ? const Value.absent() : Value(effectiveChecksum), + checksum: Value(effectiveChecksum), createdAt: Value(item.asset.createdAt), + updatedAt: Value(item.asset.updatedAt), width: Value(item.asset.width), height: Value(item.asset.height), durationInSeconds: Value(item.asset.durationInSeconds),