mirror of
https://github.com/status-im/react-native-camera-roll.git
synced 2026-08-29 12:21:09 +00:00
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:
@@ -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>
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -113,6 +113,7 @@ export type PhotoIdentifier = {
|
||||
orientation: number | null;
|
||||
};
|
||||
timestamp: number;
|
||||
modificationTimestamp: number;
|
||||
location: {
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
|
||||
@@ -24,6 +24,7 @@ type PhotoIdentifier = {
|
||||
orientation: number | null;
|
||||
};
|
||||
timestamp: number;
|
||||
modificationTimestamp: number;
|
||||
location: {
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
|
||||
Reference in New Issue
Block a user