feat(all): Add modificationTimestamp field (#493)

* feat(android): Rename modified node field to more explicit name

* feat(ios): Return modificationDate in ios

* docs: Add modification date in ts, docs and examples
This commit is contained in:
Théo Poizat
2023-05-22 15:03:05 +02:00
committed by GitHub
parent 905dd24d70
commit a419ccce27
7 changed files with 9 additions and 1 deletions
+1
View File
@@ -112,6 +112,7 @@ export default class CameraRollExample extends React.Component<Props, State> {
<Text>{locationStr}</Text>
<Text>{asset.node.group_name}</Text>
<Text>{new Date(asset.node.timestamp * 1000).toString()}</Text>
<Text>{new Date(asset.node.modificationTimestamp * 1000).toString()}</Text>
</View>
</View>
</TouchableOpacity>
+1
View File
@@ -259,6 +259,7 @@ Returns a Promise which when resolved will be of the following shape:
* `playableDuration`: {number | null} : Only set for videos if the `include` parameter contains `playableDuration`. Will be null for images.
* `orientation`: {number | null} : Only set for images if the `include` parameter contains `orientation`. **Android only**
* `timestamp`: {number}
* `modificationTimestamp`: {number}
* `location`: {object | null} : Only set if the `include` parameter contains `location`. An object with the following shape:
* `latitude`: {number}
* `longitude`: {number}
@@ -622,7 +622,7 @@ public class CameraRollModule extends NativeCameraRollModuleSpec {
dateTaken = media.getLong(dateAddedIndex) * 1000;
}
node.putDouble("timestamp", dateTaken / 1000d);
node.putDouble("modified", media.getLong(dateModifiedIndex));
node.putDouble("modificationTimestamp", media.getLong(dateModifiedIndex));
}
/**
+1
View File
@@ -112,6 +112,7 @@ export default class CameraRollExample extends React.Component<Props, State> {
<Text>{locationStr}</Text>
<Text>{asset.node.group_name}</Text>
<Text>{new Date(asset.node.timestamp * 1000).toString()}</Text>
<Text>{new Date(asset.node.modificationTimestamp * 1000).toString()}</Text>
</View>
</View>
</TouchableOpacity>
+3
View File
@@ -446,6 +446,7 @@ RCT_EXPORT_METHOD(getPhotos:(NSDictionary *)params
: [NSNull null])
},
@"timestamp": @(asset.creationDate.timeIntervalSince1970),
@"modificationTimestamp": @(asset.modificationDate.timeIntervalSince1970),
@"location": (includeLocation && loc ? @{
@"latitude": @(loc.coordinate.latitude),
@"longitude": @(loc.coordinate.longitude),
@@ -598,6 +599,7 @@ RCT_EXPORT_METHOD(getPhotoByInternalID:(NSString *)internalId
@"fileSize": @(fileSize)
},
@"timestamp": @(asset.creationDate.timeIntervalSince1970),
@"modificationTimestamp": @(asset.modificationDate.timeIntervalSince1970),
@"location": (loc ? @{
@"latitude": @(loc.coordinate.latitude),
@"longitude": @(loc.coordinate.longitude),
@@ -639,6 +641,7 @@ RCT_EXPORT_METHOD(getPhotoByInternalID:(NSString *)internalId
@"fileSize": fileSize
},
@"timestamp": @(asset.creationDate.timeIntervalSince1970),
@"modificationTimestamp": @(asset.modificationDate.timeIntervalSince1970),
@"location": (loc ? @{
@"latitude": @(loc.coordinate.latitude),
@"longitude": @(loc.coordinate.longitude),
+1
View File
@@ -113,6 +113,7 @@ export type PhotoIdentifier = {
orientation: number | null;
};
timestamp: number;
modificationTimestamp: number;
location: {
latitude?: number;
longitude?: number;
+1
View File
@@ -24,6 +24,7 @@ type PhotoIdentifier = {
orientation: number | null;
};
timestamp: number;
modificationTimestamp: number;
location: {
latitude?: number;
longitude?: number;