Skip to content

Commit

Permalink
🐛 Fix potential precision lost when converting NSTimeInterval on iOS
Browse files Browse the repository at this point in the history
Fixes #1185
  • Loading branch information
AlexV525 committed Sep 15, 2024
1 parent d9e7a4f commit 7a9598d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ios/Classes/core/PMConvertUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,12 @@ + (NSDictionary *)convertAssetToMap:(NSArray<PMAssetEntity *> *)array
return @{@"data": data};
}

+ (NSDictionary *)convertPHAssetToMap:(PHAsset *)asset
needTitle:(BOOL)needTitle {
long createDt = (int) asset.creationDate.timeIntervalSince1970;
long modifiedDt = (int) asset.modificationDate.timeIntervalSince1970;
+ (NSDictionary *)convertPHAssetToMap:(PHAsset *)asset needTitle:(BOOL)needTitle {
long createDt = (long) asset.creationDate.timeIntervalSince1970;
long modifiedDt = (long) asset.modificationDate.timeIntervalSince1970;
long duration = (long) asset.duration;

int typeInt = 0;

if (asset.isVideo) {
typeInt = 2;
} else if (asset.isImage) {
Expand All @@ -91,7 +90,7 @@ + (NSDictionary *)convertPHAssetToMap:(PHAsset *)asset
@"width": @(asset.pixelWidth),
@"height": @(asset.pixelHeight),
@"favorite": @(asset.favorite),
@"duration": @((long) asset.duration),
@"duration": @(duration),
@"type": @(typeInt),
@"modifiedDt": @(modifiedDt),
@"lng": @(asset.location.coordinate.longitude),
Expand Down

0 comments on commit 7a9598d

Please sign in to comment.