mirror of
https://github.com/status-im/react-native-cameraroll.git
synced 2025-01-12 02:44:13 +00:00
7850dd538f
* deletePhotos works in iOS * Deletion works on Android. * Removing unnecessary commented out code. * Updated typescript typings. * Made readme more accurate based on being able to retrieve failure from the iOS API. * Let formatter run, also now rejecting the promise when there's any error on deletion on Android.
96 lines
2.3 KiB
TypeScript
96 lines
2.3 KiB
TypeScript
/**
|
|
* 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
|
|
*/
|
|
|
|
declare namespace CameraRoll {
|
|
type GroupType =
|
|
| 'Album'
|
|
| 'All'
|
|
| 'Event'
|
|
| 'Faces'
|
|
| 'Library'
|
|
| 'PhotoStream'
|
|
| 'SavedPhotos';
|
|
|
|
type AssetType = 'All' | 'Videos' | 'Photos';
|
|
|
|
interface GetPhotosParams {
|
|
first: number;
|
|
after?: string;
|
|
groupTypes?: GroupType;
|
|
groupName?: string;
|
|
assetType?: AssetType;
|
|
mimeTypes?: Array<string>;
|
|
}
|
|
|
|
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,
|
|
},
|
|
};
|
|
}
|
|
|
|
interface PhotoIdentifiersPage {
|
|
edges: Array<PhotoIdentifier>;
|
|
page_info: {
|
|
has_next_page: boolean,
|
|
start_cursor?: string,
|
|
end_cursor?: string,
|
|
};
|
|
}
|
|
|
|
type SaveToCameraRollOptions = {
|
|
type?: 'photo' | 'video' | 'auto',
|
|
album?: string,
|
|
};
|
|
|
|
/**
|
|
* `CameraRoll.saveImageWithTag()` is deprecated. Use `CameraRoll.saveToCameraRoll()` instead.
|
|
*/
|
|
function saveImageWithTag(tag: string): Promise<string>;
|
|
|
|
/**
|
|
* Delete a photo from the camera roll or media library. photoUris is an array of photo uri's.
|
|
*/
|
|
function deletePhotos(photoUris: Array<string>): void;
|
|
|
|
/**
|
|
* Saves the photo or video to the camera roll or photo library.
|
|
*/
|
|
function saveToCameraRoll(tag: string, type?: 'photo' | 'video'): Promise<string>;
|
|
|
|
/**
|
|
* Saves the photo or video to the camera roll or photo library.
|
|
*/
|
|
function save(tag: string, options?: SaveToCameraRollOptions): Promise<string>
|
|
|
|
/**
|
|
* 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>;
|
|
}
|
|
|
|
export = CameraRoll;
|