UNPKG

react-native-cloud-storage

Version:

☁️ Save to & read from iCloud and Google Drive using React Native

37 lines (36 loc) 1.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _configPlugins = require("@expo/config-plugins"); const getICloudContainerIdentifier = (config, options) => { if (options?.iCloudContainerIdentifier) return options.iCloudContainerIdentifier; if (!config?.ios?.bundleIdentifier) throw new Error('Missing iOS bundle identifier'); return `iCloud.${config.ios.bundleIdentifier}`; }; const withRNCloudStorageInfoPlist = (config, options) => (0, _configPlugins.withInfoPlist)(config, async newConfig => { const infoPlist = newConfig.modResults; infoPlist.NSUbiquitousContainers = { [getICloudContainerIdentifier(config, options)]: { NSUbiquitousContainerIsDocumentScopePublic: true, NSUbiquitousContainerSupportedFolderLevels: 'Any', NSUbiquitousContainerName: config.slug } }; return newConfig; }); const withRNCloudStorageEntitlementsPlist = (config, options) => (0, _configPlugins.withEntitlementsPlist)(config, async newConfig => { if (!config.ios?.bundleIdentifier) { throw new Error('Missing iOS bundle identifier'); } const entitlementsPlist = newConfig.modResults; entitlementsPlist['com.apple.developer.icloud-container-identifiers'] = [getICloudContainerIdentifier(config, options)]; entitlementsPlist['com.apple.developer.icloud-services'] = ['CloudDocuments']; entitlementsPlist['com.apple.developer.icloud-container-environment'] = options?.iCloudContainerEnvironment ?? 'Production'; entitlementsPlist['com.apple.developer.ubiquity-container-identifiers'] = [getICloudContainerIdentifier(config, options)]; return newConfig; }); const withRNCloudStorageIos = (config, options) => (0, _configPlugins.withPlugins)(config, [[withRNCloudStorageInfoPlist, options], [withRNCloudStorageEntitlementsPlist, options]]); var _default = exports.default = withRNCloudStorageIos; //# sourceMappingURL=ios.js.map