feat: add cloud id during native sync

# Conflicts:
#	mobile/lib/platform/native_sync_api.g.dart
This commit is contained in:
shenlong-tanwen
2025-07-30 02:01:55 +05:30
parent ada4265cf9
commit ecbaca3cee
5 changed files with 56 additions and 0 deletions

View File

@@ -260,6 +260,7 @@ interface NativeSyncApi {
fun getAssetsCountSince(albumId: String, timestamp: Long): Long
fun getAssetsForAlbum(albumId: String, updatedTimeCond: Long?): List<PlatformAsset>
fun hashPaths(paths: List<String>): List<ByteArray?>
fun getCloudIdForAssetIds(assetIds: List<String>): Map<String, String?>
companion object {
/** The codec used by NativeSyncApi. */
@@ -418,6 +419,23 @@ interface NativeSyncApi {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.immich_mobile.NativeSyncApi.getCloudIdForAssetIds$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val assetIdsArg = args[0] as List<String>
val wrapped: List<Any?> = try {
listOf(api.getCloudIdForAssetIds(assetIdsArg))
} catch (exception: Throwable) {
MessagesPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
}
}
}

View File

@@ -234,4 +234,8 @@ open class NativeSyncApiImplBase(context: Context) {
}
}
}
fun getCloudIdForAssetIds(assetIds: List<String>): Map<String, String?> {
throw IllegalStateException("Method not supported on Android.")
}
}