feat: sync cloudId and eTag on sync

This commit is contained in:
shenlong-tanwen
2025-12-03 20:10:24 +05:30
parent 44b50bfa23
commit e76b6baf23
37 changed files with 9902 additions and 47 deletions

View File

@@ -390,4 +390,20 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {
return PHAsset.fetchAssets(in: album, options: options)
}
}
func getCloudIdForAssetIds(assetIds: [String]) throws -> [String : String?] {
guard #available(iOS 16, *) else {
return Dictionary(
uniqueKeysWithValues: assetIds.map { ($0, nil as String?) }
)
}
var mappings: [String: String?] = [:]
let result = PHPhotoLibrary.shared().cloudIdentifierMappings(forLocalIdentifiers: assetIds)
for (key, value) in result {
let id = try? value.get().stringValue
mappings[key] = id
}
return mappings;
}
}