UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

142 lines (139 loc) • 5.25 kB
import { Platform } from "react-native"; import { NitroModules } from "react-native-nitro-modules"; import { rethrowNativeError } from "../nativeError.native.js"; import { PhotoLibrary as PhotoLibrary$1 } from "./unavailable.native.js"; var hybrid; function native() { hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = NitroModules.createHybridObject("OnePhotoLibrary"); return hybrid; } function getAddPermissionStatus() { try { return native().getAddPermissionStatus(); } catch (error) { return rethrowNativeError(error); } } function requestAddPermission() { return native().requestAddPermission().catch(rethrowNativeError); } function getReadPermissionStatus() { try { return native().getReadPermissionStatus(); } catch (error) { return rethrowNativeError(error); } } function requestReadPermission() { return native().requestReadPermission().catch(rethrowNativeError); } function presentLimitedLibraryPicker() { return native().presentLimitedLibraryPicker().catch(rethrowNativeError); } function listAssets() { var offset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, limit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 50; return native().listAssets(offset, limit).catch(rethrowNativeError); } function getAsset(identifier) { return native().getAsset(identifier).catch(rethrowNativeError); } function listAlbums() { var offset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, limit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 50; return native().listAlbums(offset, limit).catch(rethrowNativeError); } function getAlbum(identifier) { return native().getAlbum(identifier).catch(rethrowNativeError); } function createAlbum(title) { return native().createAlbum(title).catch(rethrowNativeError); } function renameAlbum(identifier, title) { return native().renameAlbum(identifier, title).catch(rethrowNativeError); } function listAlbumAssets(identifier) { var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, limit = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 50; return native().listAlbumAssets(identifier, offset, limit).catch(rethrowNativeError); } function addAssetToAlbum(albumIdentifier, assetIdentifier) { return native().addAssetToAlbum(albumIdentifier, assetIdentifier).catch(rethrowNativeError); } function removeAssetFromAlbum(albumIdentifier, assetIdentifier) { return native().removeAssetFromAlbum(albumIdentifier, assetIdentifier).catch(rethrowNativeError); } function deleteAlbum(identifier) { return native().deleteAlbum(identifier).catch(rethrowNativeError); } function setFavorite(identifier, favorite) { return native().setFavorite(identifier, favorite).catch(rethrowNativeError); } function deleteAsset(identifier) { return native().deleteAsset(identifier).catch(rethrowNativeError); } function replaceImageContent(identifier, uri) { return native().replaceImageContent(identifier, uri).catch(rethrowNativeError); } function replaceVideoContent(identifier, uri) { return native().replaceVideoContent(identifier, uri).catch(rethrowNativeError); } function revertAssetContent(identifier) { return native().revertAssetContent(identifier).catch(rethrowNativeError); } function exportOriginalAsset(identifier) { var allowNetwork = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; return native().exportOriginalAsset(identifier, allowNetwork).catch(rethrowNativeError); } function exportCurrentImage(identifier) { var allowNetwork = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; return native().exportCurrentImage(identifier, allowNetwork).catch(rethrowNativeError); } function exportCurrentVideo(identifier) { var allowNetwork = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; return native().exportCurrentVideo(identifier, allowNetwork).catch(rethrowNativeError); } function saveImage(uri) { return native().saveImage(uri).catch(rethrowNativeError); } function saveVideo(uri) { return native().saveVideo(uri).catch(rethrowNativeError); } var nativePhotoLibrary = Object.freeze({ getAddPermissionStatus, requestAddPermission, getReadPermissionStatus, requestReadPermission, presentLimitedLibraryPicker, listAssets, getAsset, listAlbums, getAlbum, createAlbum, renameAlbum, listAlbumAssets, addAssetToAlbum, removeAssetFromAlbum, deleteAlbum, setFavorite, deleteAsset, replaceImageContent, replaceVideoContent, revertAssetContent, exportOriginalAsset, exportCurrentImage, exportCurrentVideo, saveImage, saveVideo }); var androidPhotoLibrary = Object.freeze({ ...nativePhotoLibrary, createAlbum: PhotoLibrary$1.createAlbum, renameAlbum: PhotoLibrary$1.renameAlbum, addAssetToAlbum: PhotoLibrary$1.addAssetToAlbum, removeAssetFromAlbum: PhotoLibrary$1.removeAssetFromAlbum, deleteAlbum: PhotoLibrary$1.deleteAlbum, replaceImageContent: PhotoLibrary$1.replaceImageContent, replaceVideoContent: PhotoLibrary$1.replaceVideoContent, revertAssetContent: PhotoLibrary$1.revertAssetContent }); var PhotoLibrary = Platform.OS === "android" ? androidPhotoLibrary : nativePhotoLibrary; export { PhotoLibrary }; //# sourceMappingURL=index.native.js.map