"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const resolve_from_1 = __importDefault(require("resolve-from")); const GoogleMapsApiKey_1 = require("../../android/GoogleMapsApiKey"); const Permissions_1 = require("../../android/Permissions"); const Maps_1 = require("../../ios/Maps"); const core_plugins_1 = require("../core-plugins"); const static_plugins_1 = require("../static-plugins"); const packageName = 'react-native-maps'; const LOCATION_USAGE = 'Allow $(PRODUCT_NAME) to access your location'; // Copied from expo-location package, this gets used when the // user has react-native-maps installed but not expo-location. const withDefaultLocationPermissions = config => { if (!config.ios) config.ios = {}; if (!config.ios.infoPlist) config.ios.infoPlist = {}; config.ios.infoPlist.NSLocationWhenInUseUsageDescription = config.ios.infoPlist.NSLocationWhenInUseUsageDescription || LOCATION_USAGE; return Permissions_1.withPermissions(config, [ 'android.permission.ACCESS_COARSE_LOCATION', 'android.permission.ACCESS_FINE_LOCATION', ]); }; exports.withMaps = config => { return static_plugins_1.withStaticPlugin(config, { _isLegacyPlugin: true, plugin: packageName, // If the static plugin isn't found, use the unversioned one. fallback: withUnversionedMaps, }); }; const withUnversionedMaps = core_plugins_1.createRunOncePlugin(config => { var _a, _b; config = GoogleMapsApiKey_1.withGoogleMapsApiKey(config); config = Maps_1.withMaps(config); // Only add location permissions if react-native-maps is installed. if (((_a = config._internal) === null || _a === void 0 ? void 0 : _a.projectRoot) && resolve_from_1.default.silent((_b = config._internal) === null || _b === void 0 ? void 0 : _b.projectRoot, 'react-native-maps')) { config = withDefaultLocationPermissions(config); } return config; }, packageName); exports.default = exports.withMaps; //# sourceMappingURL=react-native-maps.js.map