UNPKG

one

Version:

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

163 lines (161 loc) • 6.82 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var index_native_exports = {}; __export(index_native_exports, { PhotoLibrary: () => PhotoLibrary }); module.exports = __toCommonJS(index_native_exports); var import_react_native = require("react-native"); var import_react_native_nitro_modules = require("react-native-nitro-modules"); var import_nativeError = require("../nativeError.native.js"); var import_unavailable = require("./unavailable.native.js"); var hybrid; function native() { hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = import_react_native_nitro_modules.NitroModules.createHybridObject("OnePhotoLibrary"); return hybrid; } function getAddPermissionStatus() { try { return native().getAddPermissionStatus(); } catch (error) { return (0, import_nativeError.rethrowNativeError)(error); } } function requestAddPermission() { return native().requestAddPermission().catch(import_nativeError.rethrowNativeError); } function getReadPermissionStatus() { try { return native().getReadPermissionStatus(); } catch (error) { return (0, import_nativeError.rethrowNativeError)(error); } } function requestReadPermission() { return native().requestReadPermission().catch(import_nativeError.rethrowNativeError); } function presentLimitedLibraryPicker() { return native().presentLimitedLibraryPicker().catch(import_nativeError.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(import_nativeError.rethrowNativeError); } function getAsset(identifier) { return native().getAsset(identifier).catch(import_nativeError.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(import_nativeError.rethrowNativeError); } function getAlbum(identifier) { return native().getAlbum(identifier).catch(import_nativeError.rethrowNativeError); } function createAlbum(title) { return native().createAlbum(title).catch(import_nativeError.rethrowNativeError); } function renameAlbum(identifier, title) { return native().renameAlbum(identifier, title).catch(import_nativeError.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(import_nativeError.rethrowNativeError); } function addAssetToAlbum(albumIdentifier, assetIdentifier) { return native().addAssetToAlbum(albumIdentifier, assetIdentifier).catch(import_nativeError.rethrowNativeError); } function removeAssetFromAlbum(albumIdentifier, assetIdentifier) { return native().removeAssetFromAlbum(albumIdentifier, assetIdentifier).catch(import_nativeError.rethrowNativeError); } function deleteAlbum(identifier) { return native().deleteAlbum(identifier).catch(import_nativeError.rethrowNativeError); } function setFavorite(identifier, favorite) { return native().setFavorite(identifier, favorite).catch(import_nativeError.rethrowNativeError); } function deleteAsset(identifier) { return native().deleteAsset(identifier).catch(import_nativeError.rethrowNativeError); } function replaceImageContent(identifier, uri) { return native().replaceImageContent(identifier, uri).catch(import_nativeError.rethrowNativeError); } function replaceVideoContent(identifier, uri) { return native().replaceVideoContent(identifier, uri).catch(import_nativeError.rethrowNativeError); } function revertAssetContent(identifier) { return native().revertAssetContent(identifier).catch(import_nativeError.rethrowNativeError); } function exportOriginalAsset(identifier) { var allowNetwork = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; return native().exportOriginalAsset(identifier, allowNetwork).catch(import_nativeError.rethrowNativeError); } function exportCurrentImage(identifier) { var allowNetwork = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; return native().exportCurrentImage(identifier, allowNetwork).catch(import_nativeError.rethrowNativeError); } function exportCurrentVideo(identifier) { var allowNetwork = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; return native().exportCurrentVideo(identifier, allowNetwork).catch(import_nativeError.rethrowNativeError); } function saveImage(uri) { return native().saveImage(uri).catch(import_nativeError.rethrowNativeError); } function saveVideo(uri) { return native().saveVideo(uri).catch(import_nativeError.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: import_unavailable.PhotoLibrary.createAlbum, renameAlbum: import_unavailable.PhotoLibrary.renameAlbum, addAssetToAlbum: import_unavailable.PhotoLibrary.addAssetToAlbum, removeAssetFromAlbum: import_unavailable.PhotoLibrary.removeAssetFromAlbum, deleteAlbum: import_unavailable.PhotoLibrary.deleteAlbum, replaceImageContent: import_unavailable.PhotoLibrary.replaceImageContent, replaceVideoContent: import_unavailable.PhotoLibrary.replaceVideoContent, revertAssetContent: import_unavailable.PhotoLibrary.revertAssetContent }); var PhotoLibrary = import_react_native.Platform.OS === "android" ? androidPhotoLibrary : nativePhotoLibrary;