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ACH;SACF;aAAM,IACL,eAAe,CAAC,oBAAoB,KAAK,oBAAoB,CAAC,WAAW;YACzE,eAAe,CAAC,oBAAoB,KAAK,oBAAoB,CAAC,UAAU,EACxE;YACA,sEAAsE;YACtE,mEAAmE;YACnE,MAAM,IAAI,UAAU,CAClB,oCAAoC,EACpC,yBAAyB,mBAAmB,sBAAsB,CACnE,CAAC;SACH;KACF;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,eAAe,SAAsB,CAAC","sourcesContent":["import { CodedError, NativeModulesProxy } from '@unimodules/core';\nimport { Platform, NativeModules } from 'react-native';\n\nimport {\n AndroidManifest,\n AppManifest,\n AppOwnership,\n Constants,\n ExecutionEnvironment,\n IOSManifest,\n Manifest,\n NativeConstants,\n PlatformManifest,\n UserInterfaceIdiom,\n WebManifest,\n} from './Constants.types';\nimport ExponentConstants from './ExponentConstants';\n\nexport {\n AndroidManifest,\n AppOwnership,\n Constants,\n ExecutionEnvironment,\n IOSManifest,\n NativeConstants,\n PlatformManifest,\n UserInterfaceIdiom,\n WebManifest,\n};\n\nif (!ExponentConstants) {\n console.warn(\n \"No native ExponentConstants module found, are you sure the expo-constants's module is linked properly?\"\n );\n}\n\nlet rawManifest: AppManifest | Manifest | null = null;\n// If expo-updates defines a non-empty manifest, prefer that one\nif (NativeModulesProxy.ExpoUpdates) {\n let updatesManifest;\n if (NativeModulesProxy.ExpoUpdates.manifest) {\n updatesManifest = NativeModulesProxy.ExpoUpdates.manifest;\n } else if (NativeModulesProxy.ExpoUpdates.manifestString) {\n updatesManifest = JSON.parse(NativeModulesProxy.ExpoUpdates.manifestString);\n }\n if (updatesManifest && Object.keys(updatesManifest).length > 0) {\n rawManifest = updatesManifest;\n }\n}\n\n// If dev-launcher defines a non-empty manifest, prefer that one\nif (NativeModules.EXDevLauncher) {\n let devLauncherManifest;\n if (NativeModules.EXDevLauncher.manifestString) {\n devLauncherManifest = JSON.parse(NativeModules.EXDevLauncher.manifestString);\n }\n\n if (devLauncherManifest && Object.keys(devLauncherManifest).length > 0) {\n rawManifest = devLauncherManifest;\n }\n}\n\n// Fall back to ExponentConstants.manifest if we don't have one from Updates\nif (!rawManifest && ExponentConstants && ExponentConstants.manifest) {\n rawManifest = ExponentConstants.manifest;\n // On Android we pass the manifest in JSON form so this step is necessary\n if (typeof rawManifest === 'string') {\n rawManifest = JSON.parse(rawManifest);\n }\n}\n\nconst { name, appOwnership, ...nativeConstants } = (ExponentConstants || {}) as any;\n\nlet warnedAboutInstallationId = false;\nlet warnedAboutDeviceId = false;\nlet warnedAboutLinkingUrl = false;\n\nconst constants = {\n ...nativeConstants,\n // Ensure this is null in bare workflow\n appOwnership: appOwnership ?? null,\n // Deprecated fields\n get installationId() {\n if (!warnedAboutInstallationId) {\n console.warn(\n `Constants.installationId has been deprecated in favor of generating and storing your own ID. Implement it using expo-application's androidId on Android and a storage API such as expo-secure-store on iOS and localStorage on the web. This API will be removed in SDK 44.`\n );\n warnedAboutInstallationId = true;\n }\n return nativeConstants.installationId;\n },\n // Legacy aliases\n get deviceId() {\n if (!warnedAboutDeviceId) {\n console.warn(\n `Constants.deviceId has been deprecated in favor of generating and storing your own ID. This API will be removed in SDK 44.`\n );\n warnedAboutDeviceId = true;\n }\n return nativeConstants.installationId;\n },\n get linkingUrl() {\n if (!warnedAboutLinkingUrl) {\n console.warn(\n `Constants.linkingUrl has been renamed to Constants.linkingUri. Consider using the Linking API directly. Constants.linkingUrl will be removed in SDK 44.`\n );\n warnedAboutLinkingUrl = true;\n }\n return nativeConstants.linkingUri;\n },\n get manifest(): AppManifest | null {\n const maybeManifest = getManifest();\n if (!maybeManifest || !isAppManifest(maybeManifest)) {\n return null;\n }\n return maybeManifest;\n },\n get manifest2(): Manifest | null {\n const maybeManifest = getManifest();\n if (!maybeManifest || !isManifest(maybeManifest)) {\n return null;\n }\n return maybeManifest;\n },\n /**\n * Use `manifest` property by default.\n * This property is only used for internal purposes.\n * It behaves similarly to the original one, but suppresses warning upon no manifest available.\n * `expo-asset` uses it to prevent users from seeing mentioned warning.\n */\n get __unsafeNoWarnManifest(): AppManifest | Manifest | null {\n return getManifest(true);\n },\n get __rawManifest_TEST(): AppManifest | Manifest | null {\n return rawManifest;\n },\n set __rawManifest_TEST(value: AppManifest | Manifest | null) {\n rawManifest = value;\n },\n} as Constants;\n\nfunction isAppManifest(manifest: AppManifest | Manifest): manifest is AppManifest {\n return !isManifest(manifest);\n}\n\nfunction isManifest(manifest: AppManifest | Manifest): manifest is Manifest {\n return 'metadata' in manifest;\n}\n\nfunction getManifest(suppressWarning = false): AppManifest | Manifest | null {\n if (!rawManifest) {\n const invalidManifestType = rawManifest === null ? 'null' : 'undefined';\n if (\n nativeConstants.executionEnvironment === ExecutionEnvironment.Bare &&\n Platform.OS !== 'web'\n ) {\n if (!suppressWarning) {\n console.warn(\n `Constants.manifest is ${invalidManifestType} because the embedded app.config could not be read. Ensure that you have installed the expo-constants build scripts if you need to read from Constants.manifest.`\n );\n }\n } else if (\n nativeConstants.executionEnvironment === ExecutionEnvironment.StoreClient ||\n nativeConstants.executionEnvironment === ExecutionEnvironment.Standalone\n ) {\n // If we somehow get here, this is a truly exceptional state to be in.\n // Constants.manifest should *always* be defined in those contexts.\n throw new CodedError(\n 'ERR_CONSTANTS_MANIFEST_UNAVAILABLE',\n `Constants.manifest is ${invalidManifestType}, must be an object.`\n );\n }\n }\n return rawManifest;\n}\n\nexport default constants as Constants;\n"]} |