feat(mobile): sync local asset width & height from platform (#18994)

* add width and height to sqlite entities

* sync width & height from platform

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong
2025-06-09 08:20:54 +05:30
committed by GitHub
parent e376366b7b
commit 75c24f0023
12 changed files with 267 additions and 12 deletions
+9 -1
View File
@@ -135,6 +135,8 @@ struct PlatformAsset: Hashable {
var type: Int64
var createdAt: Int64? = nil
var updatedAt: Int64? = nil
var width: Int64? = nil
var height: Int64? = nil
var durationInSeconds: Int64
@@ -145,7 +147,9 @@ struct PlatformAsset: Hashable {
let type = pigeonVar_list[2] as! Int64
let createdAt: Int64? = nilOrValue(pigeonVar_list[3])
let updatedAt: Int64? = nilOrValue(pigeonVar_list[4])
let durationInSeconds = pigeonVar_list[5] as! Int64
let width: Int64? = nilOrValue(pigeonVar_list[5])
let height: Int64? = nilOrValue(pigeonVar_list[6])
let durationInSeconds = pigeonVar_list[7] as! Int64
return PlatformAsset(
id: id,
@@ -153,6 +157,8 @@ struct PlatformAsset: Hashable {
type: type,
createdAt: createdAt,
updatedAt: updatedAt,
width: width,
height: height,
durationInSeconds: durationInSeconds
)
}
@@ -163,6 +169,8 @@ struct PlatformAsset: Hashable {
type,
createdAt,
updatedAt,
width,
height,
durationInSeconds,
]
}
+3 -3
View File
@@ -25,7 +25,9 @@ extension PHAsset {
type: Int64(mediaType.rawValue),
createdAt: creationDate.map { Int64($0.timeIntervalSince1970) },
updatedAt: modificationDate.map { Int64($0.timeIntervalSince1970) },
durationInSeconds: Int64(duration)
width: Int64(pixelWidth),
height: Int64(pixelHeight),
durationInSeconds: Int64(duration),
)
}
}
@@ -156,8 +158,6 @@ class NativeSyncApiImpl: NativeSyncApi {
id: asset.localIdentifier,
name: "",
type: 0,
createdAt: nil,
updatedAt: nil,
durationInSeconds: 0
)
if (updatedAssets.contains(AssetWrapper(with: predicate))) {