@lugg/maps 1.1.0 → 1.1.1

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/LuggMaps.podspec CHANGED
@@ -16,7 +16,20 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
17
17
  s.private_header_files = "ios/**/*.h"
18
18
 
19
- s.dependency "GoogleMaps"
19
+ # `$LuggMapsGoogleEnabled = false` in the Podfile drops the Google Maps SDK (Apple Maps only)
20
+ google_enabled = defined?($LuggMapsGoogleEnabled) ? $LuggMapsGoogleEnabled : true
21
+ s.pod_target_xcconfig = {
22
+ "GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) LUGG_GOOGLE_MAPS_ENABLED=#{google_enabled ? 1 : 0}"
23
+ }
24
+ if google_enabled
25
+ s.dependency "GoogleMaps"
26
+ else
27
+ unless defined?($LuggMapsGoogleDisabledLogged)
28
+ Pod::UI.puts "[LuggMaps] Google Maps SDK is disabled, Apple Maps only.".yellow
29
+ $LuggMapsGoogleDisabledLogged = true
30
+ end
31
+ s.exclude_files = "ios/core/Google*", "ios/core/GMS*"
32
+ end
20
33
  s.frameworks = "MapKit"
21
34
 
22
35
  install_modules_dependencies(s)
package/README.md CHANGED
@@ -40,6 +40,16 @@ import { MapView, Marker } from '@lugg/maps';
40
40
 
41
41
  Google Maps needs an API key on every platform. See [Installation](https://maps.lodev09.com/installation) for Expo, iOS, Android, and web setup.
42
42
 
43
+ ## AI Skills
44
+
45
+ Skills give your AI coding agent working knowledge of `@lugg/maps` - setup, camera control, markers and callouts, static maps, advanced patterns, and platform limitations - so it generates correct code without you explaining the library each time.
46
+
47
+ ```sh
48
+ npx skills add lugg/maps
49
+ ```
50
+
51
+ This installs the **Maps Usage** skill into your project. The source lives in [`skills/maps-usage`](skills/maps-usage).
52
+
43
53
  ## Contributing
44
54
 
45
55
  - [Development workflow](CONTRIBUTING.md#development-workflow)
@@ -8,8 +8,10 @@
8
8
  #import "LuggTileOverlayView.h"
9
9
  #import "core/AppleMapProvider.h"
10
10
  #import "core/AppleStaticMapProvider.h"
11
+ #if LUGG_GOOGLE_MAPS_ENABLED
11
12
  #import "core/GoogleMapProvider.h"
12
13
  #import "core/GoogleStaticMapProvider.h"
14
+ #endif
13
15
  #import "core/MapProviderDelegate.h"
14
16
  #import "events/CameraIdleEvent.h"
15
17
  #import "events/CameraMoveEvent.h"
@@ -329,6 +331,7 @@ static NSCache<NSString *, UIImage *> *StaticSnapshotCache(void) {
329
331
  if (_providerType == LuggMapViewProvider::Apple) {
330
332
  _provider = _staticMode ? [[AppleStaticMapProvider alloc] init]
331
333
  : [[AppleMapProvider alloc] init];
334
+ #if LUGG_GOOGLE_MAPS_ENABLED
332
335
  } else if (_staticMode) {
333
336
  GoogleStaticMapProvider *google = [[GoogleStaticMapProvider alloc] init];
334
337
  google.mapId = _mapId;
@@ -338,6 +341,14 @@ static NSCache<NSString *, UIImage *> *StaticSnapshotCache(void) {
338
341
  google.mapId = _mapId;
339
342
  _provider = google;
340
343
  }
344
+ #else
345
+ } else {
346
+ NSLog(@"[LuggMaps] provider=\"google\" requested but the Google Maps SDK "
347
+ @"is excluded ($LuggMapsGoogleEnabled = false); using Apple Maps");
348
+ _provider = _staticMode ? [[AppleStaticMapProvider alloc] init]
349
+ : [[AppleMapProvider alloc] init];
350
+ }
351
+ #endif
341
352
 
342
353
  _provider.delegate = self;
343
354
  _provider.staticMode = _staticMode;
@@ -617,7 +628,7 @@ static NSCache<NSString *, UIImage *> *StaticSnapshotCache(void) {
617
628
  _provider = nil;
618
629
  _initialized = NO;
619
630
  [self initializeProviderWithCoordinate:coordinate zoom:zoom];
620
- if (_providerType == LuggMapViewProvider::Apple) {
631
+ if ([_provider isKindOfClass:[AppleMapProvider class]]) {
621
632
  // The captured camera already includes the previous inset offset.
622
633
  [_provider moveCamera:coordinate.latitude
623
634
  longitude:coordinate.longitude
@@ -10,6 +10,11 @@ export interface MapsPluginProps {
10
10
  * Required for Android as it only supports Google Maps.
11
11
  */
12
12
  androidGoogleMapsApiKey?: string;
13
+ /**
14
+ * Whether to link the Google Maps SDK on iOS. Set to `false` when only
15
+ * Apple Maps is used to drop the SDK from the app. Defaults to `true`.
16
+ */
17
+ iosGoogleMapsEnabled?: boolean;
13
18
  }
14
19
  declare const _default: ConfigPlugin<void | MapsPluginProps>;
15
20
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,sBAAsB,CAAC;AAO9E,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;;AAWD,wBAAoE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,sBAAsB,CAAC;AAO9E,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAEjC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;;AAkBD,wBAAoE"}
@@ -1,6 +1,7 @@
1
1
  import { type ConfigPlugin } from '@expo/config-plugins';
2
2
  export interface MapsIOSPluginProps {
3
3
  apiKey?: string;
4
+ googleEnabled?: boolean;
4
5
  }
5
6
  export declare const withLuggMapsIOS: ConfigPlugin<MapsIOSPluginProps>;
6
7
  //# sourceMappingURL=withLuggMapsIOS.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withLuggMapsIOS.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withLuggMapsIOS.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,kBAAkB,CAoC5D,CAAC"}
1
+ {"version":3,"file":"withLuggMapsIOS.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withLuggMapsIOS.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAIlB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAID,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,kBAAkB,CA8D5D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lugg/maps",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Universal maps for React Native.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -10,6 +10,11 @@ export interface MapsPluginProps {
10
10
  * Required for Android as it only supports Google Maps.
11
11
  */
12
12
  androidGoogleMapsApiKey?: string;
13
+ /**
14
+ * Whether to link the Google Maps SDK on iOS. Set to `false` when only
15
+ * Apple Maps is used to drop the SDK from the app. Defaults to `true`.
16
+ */
17
+ iosGoogleMapsEnabled?: boolean;
13
18
  }
14
19
  declare const _default: ConfigPlugin<void | MapsPluginProps>;
15
20
  export default _default;
@@ -5,8 +5,11 @@ const withLuggMapsAndroid_1 = require("./withLuggMapsAndroid");
5
5
  const withLuggMapsIOS_1 = require("./withLuggMapsIOS");
6
6
  const pkg = require('../../package.json');
7
7
  const withMaps = (config, props = {}) => {
8
- const { iosGoogleMapsApiKey, androidGoogleMapsApiKey } = props ?? {};
9
- config = (0, withLuggMapsIOS_1.withLuggMapsIOS)(config, { apiKey: iosGoogleMapsApiKey });
8
+ const { iosGoogleMapsApiKey, androidGoogleMapsApiKey, iosGoogleMapsEnabled = true, } = props ?? {};
9
+ config = (0, withLuggMapsIOS_1.withLuggMapsIOS)(config, {
10
+ apiKey: iosGoogleMapsApiKey,
11
+ googleEnabled: iosGoogleMapsEnabled,
12
+ });
10
13
  config = (0, withLuggMapsAndroid_1.withLuggMapsAndroid)(config, { apiKey: androidGoogleMapsApiKey });
11
14
  return config;
12
15
  };
@@ -1,5 +1,6 @@
1
1
  import { type ConfigPlugin } from '@expo/config-plugins';
2
2
  export interface MapsIOSPluginProps {
3
3
  apiKey?: string;
4
+ googleEnabled?: boolean;
4
5
  }
5
6
  export declare const withLuggMapsIOS: ConfigPlugin<MapsIOSPluginProps>;
@@ -2,15 +2,37 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withLuggMapsIOS = void 0;
4
4
  const config_plugins_1 = require("@expo/config-plugins");
5
- const withLuggMapsIOS = (config, { apiKey }) => {
6
- if (!apiKey) {
5
+ const GMS_EXCLUSION_PODFILE_FLAG = '$LuggMapsGoogleEnabled = false';
6
+ const withLuggMapsIOS = (config, { apiKey, googleEnabled = true }) => {
7
+ config = (0, config_plugins_1.withPodfile)(config, (c) => {
8
+ if (!googleEnabled) {
9
+ console.log('[LuggMaps] Google Maps SDK is disabled, Apple Maps only.');
10
+ }
11
+ const contents = c.modResults.contents.replace(/^\$LuggMapsGoogleEnabled = false\r?\n/gm, '');
12
+ c.modResults.contents = googleEnabled
13
+ ? contents
14
+ : `${GMS_EXCLUSION_PODFILE_FLAG}\n${contents}`;
15
+ return c;
16
+ });
17
+ if (googleEnabled && !apiKey) {
7
18
  return config;
8
19
  }
9
20
  config = (0, config_plugins_1.withInfoPlist)(config, (c) => {
10
- c.modResults.GMSApiKey = apiKey;
21
+ if (googleEnabled) {
22
+ c.modResults.GMSApiKey = apiKey;
23
+ }
24
+ else {
25
+ delete c.modResults.GMSApiKey;
26
+ }
11
27
  return c;
12
28
  });
13
29
  config = (0, config_plugins_1.withAppDelegate)(config, (c) => {
30
+ if (!googleEnabled) {
31
+ c.modResults.contents = c.modResults.contents
32
+ .replace(/^[ \t]*import GoogleMaps\r?\n/gm, '')
33
+ .replace(/^[ \t]*GMSServices\.provideAPIKey\("[^"\r\n]*"\)\r?\n/gm, '');
34
+ return c;
35
+ }
14
36
  const contents = c.modResults.contents;
15
37
  // Add import for GoogleMaps
16
38
  if (!contents.includes('import GoogleMaps')) {
@@ -18,7 +40,7 @@ const withLuggMapsIOS = (config, { apiKey }) => {
18
40
  }
19
41
  // Add GMSServices.provideAPIKey call
20
42
  if (!c.modResults.contents.includes('GMSServices.provideAPIKey')) {
21
- c.modResults.contents = c.modResults.contents.replace(/(func application\([^)]+\)[^{]*\{)/, `$1\n GMSServices.provideAPIKey("${apiKey}")\n`);
43
+ c.modResults.contents = c.modResults.contents.replace(/(func application\([^)]+\)[^{]*\{)/, `$1\n GMSServices.provideAPIKey("${apiKey}")`);
22
44
  }
23
45
  return c;
24
46
  });