2019-03-03 14:39:57 +08:00
|
|
|
/**
|
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*
|
|
|
|
* @format
|
|
|
|
*/
|
|
|
|
|
2019-08-14 12:14:14 -05:00
|
|
|
declare namespace CameraRoll {
|
|
|
|
type GroupType =
|
|
|
|
| 'Album'
|
|
|
|
| 'All'
|
|
|
|
| 'Event'
|
|
|
|
| 'Faces'
|
|
|
|
| 'Library'
|
|
|
|
| 'PhotoStream'
|
|
|
|
| 'SavedPhotos';
|
2019-03-03 14:39:57 +08:00
|
|
|
|
2019-08-14 12:14:14 -05:00
|
|
|
type AssetType = 'All' | 'Videos' | 'Photos';
|
2019-03-03 14:39:57 +08:00
|
|
|
|
2019-08-14 12:14:14 -05:00
|
|
|
interface GetPhotosParams {
|
|
|
|
first: number;
|
|
|
|
after?: string;
|
|
|
|
groupTypes?: GroupType;
|
|
|
|
groupName?: string;
|
|
|
|
assetType?: AssetType;
|
|
|
|
mimeTypes?: Array<string>;
|
|
|
|
}
|
2019-03-03 14:39:57 +08:00
|
|
|
|
2019-08-14 12:14:14 -05:00
|
|
|
interface PhotoIdentifier {
|
|
|
|
node: {
|
|
|
|
type: string,
|
|
|
|
group_name: string,
|
|
|
|
image: {
|
|
|
|
filename: string,
|
|
|
|
uri: string,
|
|
|
|
height: number,
|
|
|
|
width: number,
|
|
|
|
isStored?: boolean,
|
|
|
|
playableDuration: number,
|
|
|
|
},
|
|
|
|
timestamp: number,
|
|
|
|
location?: {
|
|
|
|
latitude?: number,
|
|
|
|
longitude?: number,
|
|
|
|
altitude?: number,
|
|
|
|
heading?: number,
|
|
|
|
speed?: number,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
2019-03-03 14:39:57 +08:00
|
|
|
|
2019-08-14 12:14:14 -05:00
|
|
|
interface PhotoIdentifiersPage {
|
|
|
|
edges: Array<PhotoIdentifier>;
|
|
|
|
page_info: {
|
|
|
|
has_next_page: boolean,
|
|
|
|
start_cursor?: string,
|
|
|
|
end_cursor?: string,
|
|
|
|
};
|
|
|
|
}
|
2019-03-03 14:39:57 +08:00
|
|
|
|
2019-08-14 21:00:20 +02:00
|
|
|
type SaveToCameraRollOptions = {
|
|
|
|
type?: 'photo' | 'video' | 'auto',
|
|
|
|
album?: string,
|
|
|
|
};
|
2019-03-03 14:39:57 +08:00
|
|
|
|
2019-08-14 12:14:14 -05:00
|
|
|
/**
|
|
|
|
* `CameraRoll.saveImageWithTag()` is deprecated. Use `CameraRoll.saveToCameraRoll()` instead.
|
|
|
|
*/
|
|
|
|
function saveImageWithTag(tag: string): Promise<string>;
|
2019-03-03 14:39:57 +08:00
|
|
|
|
2019-08-14 12:14:14 -05:00
|
|
|
/**
|
2019-11-08 00:13:24 +11:00
|
|
|
* Delete a photo from the camera roll or media library. photoUris is an array of photo uri's.
|
2019-08-14 12:14:14 -05:00
|
|
|
*/
|
2019-11-08 00:13:24 +11:00
|
|
|
function deletePhotos(photoUris: Array<string>): void;
|
|
|
|
|
2019-08-14 12:14:14 -05:00
|
|
|
/**
|
|
|
|
* Saves the photo or video to the camera roll or photo library.
|
|
|
|
*/
|
|
|
|
function saveToCameraRoll(tag: string, type?: 'photo' | 'video'): Promise<string>;
|
2019-03-03 14:39:57 +08:00
|
|
|
|
2019-08-14 21:00:20 +02:00
|
|
|
/**
|
|
|
|
* Saves the photo or video to the camera roll or photo library.
|
|
|
|
*/
|
|
|
|
function save(tag: string, options?: SaveToCameraRollOptions): Promise<string>
|
|
|
|
|
2019-08-14 12:14:14 -05:00
|
|
|
/**
|
|
|
|
* Returns a Promise with photo identifier objects from the local camera
|
|
|
|
* roll of the device matching shape defined by `getPhotosReturnChecker`.
|
|
|
|
*/
|
|
|
|
function getPhotos(params: GetPhotosParams): Promise<PhotoIdentifiersPage>;
|
2019-03-03 14:39:57 +08:00
|
|
|
}
|
2019-04-03 14:20:54 +03:00
|
|
|
|
2019-08-14 12:14:14 -05:00
|
|
|
export = CameraRoll;
|