expo-arcgis 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin/build/index.d.ts +6 -0
- package/plugin/build/index.d.ts.map +1 -0
- package/plugin/build/index.js +24 -0
- package/plugin/build/index.js.map +1 -0
- package/plugin/build/types.d.ts +26 -0
- package/plugin/build/types.d.ts.map +1 -0
- package/plugin/build/types.js +3 -0
- package/plugin/build/types.js.map +1 -0
- package/plugin/build/withArcGISAndroid.d.ts +4 -0
- package/plugin/build/withArcGISAndroid.d.ts.map +1 -0
- package/plugin/build/withArcGISAndroid.js +101 -0
- package/plugin/build/withArcGISAndroid.js.map +1 -0
- package/plugin/build/withArcGISIos.d.ts +4 -0
- package/plugin/build/withArcGISIos.d.ts.map +1 -0
- package/plugin/build/withArcGISIos.js +117 -0
- package/plugin/build/withArcGISIos.js.map +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ConfigPlugin } from 'expo/config-plugins';
|
|
2
|
+
import { ArcGISPluginProps } from './types';
|
|
3
|
+
export type { ArcGISPluginProps } from './types';
|
|
4
|
+
declare const _default: ConfigPlugin<void | ArcGISPluginProps>;
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoC,MAAM,qBAAqB,CAAC;AAErF,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAsB5C,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;;AAEjD,wBAAuE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
4
|
+
const withArcGISAndroid_1 = require("./withArcGISAndroid");
|
|
5
|
+
const withArcGISIos_1 = require("./withArcGISIos");
|
|
6
|
+
/**
|
|
7
|
+
* Expo config plugin for `expo-arcgis`.
|
|
8
|
+
*
|
|
9
|
+
* Pulls the native ArcGIS Maps SDK into the consuming app and configures the build:
|
|
10
|
+
* - Android: Esri Maven repository, minSdk >= 28, compileSdk >= 36, optional API key + location.
|
|
11
|
+
* - iOS: deployment target >= 17.0, optional API key + location usage description.
|
|
12
|
+
*
|
|
13
|
+
* The ArcGIS SDK artifacts themselves are declared by the module's own android/build.gradle
|
|
14
|
+
* and ios/ExpoArcgis.podspec; this plugin makes the surrounding app build able to resolve them.
|
|
15
|
+
*/
|
|
16
|
+
const withArcGIS = (config, props) => {
|
|
17
|
+
const options = props || {};
|
|
18
|
+
return (0, config_plugins_1.withPlugins)(config, [
|
|
19
|
+
[withArcGISAndroid_1.withArcGISAndroid, options],
|
|
20
|
+
[withArcGISIos_1.withArcGISIos, options],
|
|
21
|
+
]);
|
|
22
|
+
};
|
|
23
|
+
exports.default = (0, config_plugins_1.createRunOncePlugin)(withArcGIS, 'expo-arcgis', '0.1.0');
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,wDAAqF;AAGrF,2DAAwD;AACxD,mDAAgD;AAEhD;;;;;;;;;GASG;AACH,MAAM,UAAU,GAA2C,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;IAC3E,MAAM,OAAO,GAAsB,KAAK,IAAI,EAAE,CAAC;IAC/C,OAAO,IAAA,4BAAW,EAAC,MAAM,EAAE;QACzB,CAAC,qCAAiB,EAAE,OAAO,CAAC;QAC5B,CAAC,6BAAa,EAAE,OAAO,CAAC;KACzB,CAAC,CAAC;AACL,CAAC,CAAC;AAIF,kBAAe,IAAA,oCAAmB,EAAC,UAAU,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type ArcGISPluginProps = {
|
|
2
|
+
/**
|
|
3
|
+
* ArcGIS API key (access token) used by the native runtime to authenticate with
|
|
4
|
+
* ArcGIS location services. Typically supplied from an environment variable in
|
|
5
|
+
* app.config.js, e.g. `apiKey: process.env.ARCGIS_API_KEY`.
|
|
6
|
+
*
|
|
7
|
+
* When provided it is written to a native resource (Android `strings.xml` →
|
|
8
|
+
* `arcgis_api_key`, iOS `Info.plist` → `ArcGISAPIKey`) for the module to read at init.
|
|
9
|
+
*/
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
/** Esri Maven repository URL (Android). Defaults to Esri's public artifactory. */
|
|
12
|
+
androidMavenUrl?: string;
|
|
13
|
+
/** Minimum Android SDK level. ArcGIS Maps SDK 300.0 requires >= 28. */
|
|
14
|
+
androidMinSdkVersion?: number;
|
|
15
|
+
/** Android compileSdk level. ArcGIS Maps SDK 300.0 requires >= 36. */
|
|
16
|
+
androidCompileSdkVersion?: number;
|
|
17
|
+
/** Minimum iOS deployment target. ArcGIS Maps SDK 300.0 requires >= 17.0. */
|
|
18
|
+
iosDeploymentTarget?: string;
|
|
19
|
+
/**
|
|
20
|
+
* When set, adds ACCESS_FINE/COARSE_LOCATION (Android) and the matching iOS usage
|
|
21
|
+
* description so the map can display the device location. Pass the iOS usage string;
|
|
22
|
+
* omit to skip location permissions entirely.
|
|
23
|
+
*/
|
|
24
|
+
locationWhenInUseUsageDescription?: string;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,kFAAkF;IAClF,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,uEAAuE;IACvE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,sEAAsE;IACtE,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC,6EAA6E;IAC7E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;OAIG;IACH,iCAAiC,CAAC,EAAE,MAAM,CAAC;CAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withArcGISAndroid.d.ts","sourceRoot":"","sources":["../src/withArcGISAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAIb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAS5C,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,iBAAiB,CAiB7D,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withArcGISAndroid = void 0;
|
|
4
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
5
|
+
/** Esri public Maven repository that serves the ArcGIS Maps SDK for Kotlin. */
|
|
6
|
+
const DEFAULT_ESRI_MAVEN_URL = 'https://esri.jfrog.io/artifactory/arcgis';
|
|
7
|
+
// ArcGIS Maps SDK for Kotlin 300.0 minimum build requirements.
|
|
8
|
+
const REQUIRED_MIN_SDK = 28;
|
|
9
|
+
const REQUIRED_COMPILE_SDK = 36;
|
|
10
|
+
const withArcGISAndroid = (config, props) => {
|
|
11
|
+
var _a;
|
|
12
|
+
config = withEsriMavenRepository(config, (_a = props.androidMavenUrl) !== null && _a !== void 0 ? _a : DEFAULT_ESRI_MAVEN_URL);
|
|
13
|
+
config = withArcGISSdkVersions(config, props);
|
|
14
|
+
config = withArcGISKotlinMetadataFix(config);
|
|
15
|
+
if (props.apiKey) {
|
|
16
|
+
config = withArcGISApiKeyResource(config, props.apiKey);
|
|
17
|
+
}
|
|
18
|
+
if (props.locationWhenInUseUsageDescription) {
|
|
19
|
+
config = config_plugins_1.AndroidConfig.Permissions.withPermissions(config, [
|
|
20
|
+
'android.permission.ACCESS_FINE_LOCATION',
|
|
21
|
+
'android.permission.ACCESS_COARSE_LOCATION',
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
return config;
|
|
25
|
+
};
|
|
26
|
+
exports.withArcGISAndroid = withArcGISAndroid;
|
|
27
|
+
/** Adds the Esri Maven repository to the app's root build.gradle (allprojects.repositories). */
|
|
28
|
+
const withEsriMavenRepository = (config, url) => (0, config_plugins_1.withProjectBuildGradle)(config, (cfg) => {
|
|
29
|
+
if (cfg.modResults.language !== 'groovy') {
|
|
30
|
+
throw new Error('expo-arcgis: cannot add the Esri Maven repository — android/build.gradle is not Groovy.');
|
|
31
|
+
}
|
|
32
|
+
cfg.modResults.contents = addMavenRepository(cfg.modResults.contents, url);
|
|
33
|
+
return cfg;
|
|
34
|
+
});
|
|
35
|
+
function addMavenRepository(buildGradle, url) {
|
|
36
|
+
if (buildGradle.includes(url)) {
|
|
37
|
+
return buildGradle; // idempotent
|
|
38
|
+
}
|
|
39
|
+
const snippet = `maven { url '${url}' }`;
|
|
40
|
+
const allprojectsRepositories = /allprojects\s*\{[\s\S]*?repositories\s*\{/;
|
|
41
|
+
if (allprojectsRepositories.test(buildGradle)) {
|
|
42
|
+
return buildGradle.replace(allprojectsRepositories, (match) => `${match}\n ${snippet}`);
|
|
43
|
+
}
|
|
44
|
+
// No allprojects block found — append a minimal one.
|
|
45
|
+
return `${buildGradle}\n\nallprojects {\n repositories {\n ${snippet}\n }\n}\n`;
|
|
46
|
+
}
|
|
47
|
+
/** Raises android.minSdkVersion / android.compileSdkVersion via gradle.properties (never lowers). */
|
|
48
|
+
const withArcGISSdkVersions = (config, props) => {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
const minSdk = (_a = props.androidMinSdkVersion) !== null && _a !== void 0 ? _a : REQUIRED_MIN_SDK;
|
|
51
|
+
const compileSdk = (_b = props.androidCompileSdkVersion) !== null && _b !== void 0 ? _b : REQUIRED_COMPILE_SDK;
|
|
52
|
+
return (0, config_plugins_1.withGradleProperties)(config, (cfg) => {
|
|
53
|
+
for (const [key, minValue] of [
|
|
54
|
+
['android.minSdkVersion', minSdk],
|
|
55
|
+
['android.compileSdkVersion', compileSdk],
|
|
56
|
+
]) {
|
|
57
|
+
const existing = cfg.modResults.find((item) => item.type === 'property' && item.key === key);
|
|
58
|
+
if (existing) {
|
|
59
|
+
const current = parseInt(existing.value, 10);
|
|
60
|
+
if (Number.isNaN(current) || current < minValue) {
|
|
61
|
+
existing.value = String(minValue);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
cfg.modResults.push({ type: 'property', key, value: String(minValue) });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return cfg;
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
/** Stores the API key in strings.xml as `arcgis_api_key` for the native runtime to read. */
|
|
72
|
+
const withArcGISApiKeyResource = (config, apiKey) => (0, config_plugins_1.withStringsXml)(config, (cfg) => {
|
|
73
|
+
cfg.modResults = config_plugins_1.AndroidConfig.Strings.setStringItem([{ _: apiKey, $: { name: 'arcgis_api_key', translatable: 'false' } }], cfg.modResults);
|
|
74
|
+
return cfg;
|
|
75
|
+
});
|
|
76
|
+
const SKIP_METADATA_FLAG = '-Xskip-metadata-version-check';
|
|
77
|
+
/**
|
|
78
|
+
* ArcGIS Maps SDK 300.0 is built with Kotlin 2.3.0; its kotlin-stdlib/reflect 2.3.0 resolve across
|
|
79
|
+
* the whole app, but Expo SDK 56 compiles with Kotlin 2.1.0. Let every module read the newer
|
|
80
|
+
* metadata so the app (expo, expo-modules-core, this module) compiles.
|
|
81
|
+
*/
|
|
82
|
+
const withArcGISKotlinMetadataFix = (config) => (0, config_plugins_1.withProjectBuildGradle)(config, (cfg) => {
|
|
83
|
+
if (cfg.modResults.language !== 'groovy') {
|
|
84
|
+
throw new Error('expo-arcgis: cannot apply the Kotlin metadata fix — android/build.gradle is not Groovy.');
|
|
85
|
+
}
|
|
86
|
+
if (!cfg.modResults.contents.includes(SKIP_METADATA_FLAG)) {
|
|
87
|
+
cfg.modResults.contents += `
|
|
88
|
+
|
|
89
|
+
// expo-arcgis: ArcGIS Maps SDK 300.0 ships Kotlin 2.3.0 metadata, newer than Expo SDK 56's compiler.
|
|
90
|
+
allprojects {
|
|
91
|
+
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
|
92
|
+
kotlinOptions {
|
|
93
|
+
freeCompilerArgs += ["${SKIP_METADATA_FLAG}"]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
}
|
|
99
|
+
return cfg;
|
|
100
|
+
});
|
|
101
|
+
//# sourceMappingURL=withArcGISAndroid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withArcGISAndroid.js","sourceRoot":"","sources":["../src/withArcGISAndroid.ts"],"names":[],"mappings":";;;AAAA,wDAM6B;AAI7B,+EAA+E;AAC/E,MAAM,sBAAsB,GAAG,0CAA0C,CAAC;AAE1E,+DAA+D;AAC/D,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEzB,MAAM,iBAAiB,GAAoC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;;IAClF,MAAM,GAAG,uBAAuB,CAAC,MAAM,EAAE,MAAA,KAAK,CAAC,eAAe,mCAAI,sBAAsB,CAAC,CAAC;IAC1F,MAAM,GAAG,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9C,MAAM,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC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AC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withArcGISIos = void 0;
|
|
4
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
5
|
+
/** ArcGIS Maps SDK for Swift 300.0 requires iOS 17.0+. */
|
|
6
|
+
const REQUIRED_IOS_DEPLOYMENT_TARGET = '17.0';
|
|
7
|
+
const withArcGISIos = (config, props) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const target = (_a = props.iosDeploymentTarget) !== null && _a !== void 0 ? _a : REQUIRED_IOS_DEPLOYMENT_TARGET;
|
|
10
|
+
// Pods read the target from Podfile.properties.json; the app target reads it from the
|
|
11
|
+
// .xcodeproj build settings. ArcGIS needs both raised to 17.0, or the app target (which
|
|
12
|
+
// imports our module via ExpoModulesProvider.swift) fails: "compiling for iOS 16.4, but
|
|
13
|
+
// module 'ExpoArcgis' has a minimum deployment target of iOS 17.0".
|
|
14
|
+
config = withArcGISPodfileDeploymentTarget(config, target);
|
|
15
|
+
config = withArcGISAppDeploymentTarget(config, target);
|
|
16
|
+
config = withArcGISEmbedFramework(config);
|
|
17
|
+
if (props.apiKey) {
|
|
18
|
+
config = withArcGISApiKeyInfoPlist(config, props.apiKey);
|
|
19
|
+
}
|
|
20
|
+
if (props.locationWhenInUseUsageDescription) {
|
|
21
|
+
config = withLocationUsageDescription(config, props.locationWhenInUseUsageDescription);
|
|
22
|
+
}
|
|
23
|
+
return config;
|
|
24
|
+
};
|
|
25
|
+
exports.withArcGISIos = withArcGISIos;
|
|
26
|
+
/** Raises the iOS deployment target in Podfile.properties.json (never lowers it). */
|
|
27
|
+
const withArcGISPodfileDeploymentTarget = (config, target) => (0, config_plugins_1.withPodfileProperties)(config, (cfg) => {
|
|
28
|
+
const current = cfg.modResults['ios.deploymentTarget'];
|
|
29
|
+
if (!current || parseFloat(current) < parseFloat(target)) {
|
|
30
|
+
cfg.modResults['ios.deploymentTarget'] = target;
|
|
31
|
+
}
|
|
32
|
+
return cfg;
|
|
33
|
+
});
|
|
34
|
+
/** Raises IPHONEOS_DEPLOYMENT_TARGET on the app project's build configurations (never lowers). */
|
|
35
|
+
const withArcGISAppDeploymentTarget = (config, target) => (0, config_plugins_1.withXcodeProject)(config, (cfg) => {
|
|
36
|
+
var _a;
|
|
37
|
+
const project = cfg.modResults;
|
|
38
|
+
const configurations = project.pbxXCBuildConfigurationSection();
|
|
39
|
+
for (const key of Object.keys(configurations)) {
|
|
40
|
+
const buildSettings = (_a = configurations[key]) === null || _a === void 0 ? void 0 : _a.buildSettings;
|
|
41
|
+
// Skip `*_comment` string entries (no buildSettings) and configs that don't pin the target.
|
|
42
|
+
const current = buildSettings === null || buildSettings === void 0 ? void 0 : buildSettings.IPHONEOS_DEPLOYMENT_TARGET;
|
|
43
|
+
if (current && parseFloat(String(current).replace(/"/g, '')) < parseFloat(target)) {
|
|
44
|
+
buildSettings.IPHONEOS_DEPLOYMENT_TARGET = target;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return cfg;
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Embeds the ArcGIS dynamic framework into the app bundle. ArcGIS is pulled in as a Swift Package
|
|
51
|
+
* product (spm_dependency) and linked into the static ExpoArcgis pod, but neither CocoaPods nor
|
|
52
|
+
* Xcode copies it into the app's Frameworks dir — so the app links fine yet crashes at launch with
|
|
53
|
+
* `Library not loaded: @rpath/ArcGIS.framework/ArcGIS`. We add an "Embed Frameworks" copy phase
|
|
54
|
+
* (CodeSignOnCopy) on the app target referencing the built product — Xcode's "Embed & Sign".
|
|
55
|
+
*/
|
|
56
|
+
const withArcGISEmbedFramework = (config) => (0, config_plugins_1.withXcodeProject)(config, (cfg) => {
|
|
57
|
+
const project = cfg.modResults;
|
|
58
|
+
const FRAMEWORK = 'ArcGIS.framework';
|
|
59
|
+
const COMMENT = `${FRAMEWORK} in Embed Frameworks`;
|
|
60
|
+
const objects = project.hash.project.objects;
|
|
61
|
+
// Idempotent: skip if already embedded (prebuild may run plugins more than once).
|
|
62
|
+
const buildFiles = objects.PBXBuildFile || {};
|
|
63
|
+
for (const key of Object.keys(buildFiles)) {
|
|
64
|
+
if (buildFiles[key] === COMMENT) {
|
|
65
|
+
return cfg;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Find the application target (fall back to the first target).
|
|
69
|
+
const nativeTargets = objects.PBXNativeTarget || {};
|
|
70
|
+
let targetUuid;
|
|
71
|
+
for (const key of Object.keys(nativeTargets)) {
|
|
72
|
+
if (key.endsWith('_comment'))
|
|
73
|
+
continue;
|
|
74
|
+
const productType = String(nativeTargets[key].productType || '').replace(/"/g, '');
|
|
75
|
+
if (productType === 'com.apple.product-type.application') {
|
|
76
|
+
targetUuid = key;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (!targetUuid) {
|
|
81
|
+
targetUuid = project.getFirstTarget().uuid;
|
|
82
|
+
}
|
|
83
|
+
// Create an "Embed Frameworks" copy-files phase (dstSubfolderSpec 10 = Frameworks).
|
|
84
|
+
const phase = project.addBuildPhase([], 'PBXCopyFilesBuildPhase', 'Embed Frameworks', targetUuid, 'frameworks');
|
|
85
|
+
// Reference the framework as a build product and embed it with code signing.
|
|
86
|
+
const fileRefUuid = project.generateUuid();
|
|
87
|
+
objects.PBXFileReference[fileRefUuid] = {
|
|
88
|
+
isa: 'PBXFileReference',
|
|
89
|
+
lastKnownFileType: 'wrapper.framework',
|
|
90
|
+
name: FRAMEWORK,
|
|
91
|
+
path: FRAMEWORK,
|
|
92
|
+
sourceTree: 'BUILT_PRODUCTS_DIR',
|
|
93
|
+
};
|
|
94
|
+
objects.PBXFileReference[`${fileRefUuid}_comment`] = FRAMEWORK;
|
|
95
|
+
const buildFileUuid = project.generateUuid();
|
|
96
|
+
objects.PBXBuildFile[buildFileUuid] = {
|
|
97
|
+
isa: 'PBXBuildFile',
|
|
98
|
+
fileRef: fileRefUuid,
|
|
99
|
+
fileRef_comment: FRAMEWORK,
|
|
100
|
+
settings: { ATTRIBUTES: ['CodeSignOnCopy', 'RemoveHeadersOnCopy'] },
|
|
101
|
+
};
|
|
102
|
+
objects.PBXBuildFile[`${buildFileUuid}_comment`] = COMMENT;
|
|
103
|
+
phase.buildPhase.files.push({ value: buildFileUuid, comment: COMMENT });
|
|
104
|
+
return cfg;
|
|
105
|
+
});
|
|
106
|
+
/** Stores the API key in Info.plist as `ArcGISAPIKey` for the native runtime to read. */
|
|
107
|
+
const withArcGISApiKeyInfoPlist = (config, apiKey) => (0, config_plugins_1.withInfoPlist)(config, (cfg) => {
|
|
108
|
+
cfg.modResults.ArcGISAPIKey = apiKey;
|
|
109
|
+
return cfg;
|
|
110
|
+
});
|
|
111
|
+
const withLocationUsageDescription = (config, description) => (0, config_plugins_1.withInfoPlist)(config, (cfg) => {
|
|
112
|
+
var _a;
|
|
113
|
+
cfg.modResults.NSLocationWhenInUseUsageDescription =
|
|
114
|
+
(_a = cfg.modResults.NSLocationWhenInUseUsageDescription) !== null && _a !== void 0 ? _a : description;
|
|
115
|
+
return cfg;
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=withArcGISIos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withArcGISIos.js","sourceRoot":"","sources":["../src/withArcGISIos.ts"],"names":[],"mappings":";;;AAAA,wDAK6B;AAI7B,0DAA0D;AAC1D,MAAM,8BAA8B,GAAG,MAAM,CAAC;AAEvC,MAAM,aAAa,GAAoC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;;IAC9E,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,mBAAmB,mCAAI,8BAA8B,CAAC;IAC3E,sFAAsF;IACtF,wFAAwF;IACxF,wFAAwF;IACxF,oEAAoE;IACpE,MAAM,GAAG,iCAAiC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3D,MAAM,GAAG,6BAA6B,CAAC,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