@lugg/maps 1.1.0 → 1.1.2
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 +14 -1
- package/README.md +10 -0
- package/android/src/main/java/com/luggmaps/core/GoogleMapProvider.kt +5 -1
- package/ios/LuggMapView.mm +12 -1
- package/ios/core/GoogleMapProvider.mm +5 -0
- package/lib/typescript/plugin/src/index.d.ts +5 -0
- package/lib/typescript/plugin/src/index.d.ts.map +1 -1
- package/lib/typescript/plugin/src/withLuggMapsIOS.d.ts +1 -0
- package/lib/typescript/plugin/src/withLuggMapsIOS.d.ts.map +1 -1
- package/package.json +5 -5
- package/plugin/build/index.d.ts +5 -0
- package/plugin/build/index.js +5 -2
- package/plugin/build/withLuggMapsIOS.d.ts +1 -0
- package/plugin/build/withLuggMapsIOS.js +26 -4
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
|
-
|
|
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)
|
|
@@ -769,7 +769,11 @@ class GoogleMapProvider(private val context: Context) :
|
|
|
769
769
|
|
|
770
770
|
private fun processPendingMarkers() {
|
|
771
771
|
if (googleMap == null) return
|
|
772
|
-
pendingMarkerViews.forEach {
|
|
772
|
+
pendingMarkerViews.forEach {
|
|
773
|
+
// markerViewDidLayout adds it once the bitmap can be drawn
|
|
774
|
+
if (it.hasCustomView && !it.didLayout) return@forEach
|
|
775
|
+
addMarkerViewToMap(it)
|
|
776
|
+
}
|
|
773
777
|
pendingMarkerViews.clear()
|
|
774
778
|
}
|
|
775
779
|
|
package/ios/LuggMapView.mm
CHANGED
|
@@ -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 (
|
|
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
|
|
@@ -667,6 +667,11 @@ LuggInterfaceStyleFromTheme(facebook::react::LuggMapViewTheme theme) {
|
|
|
667
667
|
if (!_mapView)
|
|
668
668
|
return;
|
|
669
669
|
|
|
670
|
+
// Custom icons rasterize from layout; adding before that shows the SDK's
|
|
671
|
+
// default pin until markerViewDidLayout re-syncs.
|
|
672
|
+
if (markerView.hasCustomView && !markerView.didLayout)
|
|
673
|
+
return;
|
|
674
|
+
|
|
670
675
|
GMSAdvancedMarker *marker = [[GMSAdvancedMarker alloc] init];
|
|
671
676
|
marker.position = markerView.coordinate;
|
|
672
677
|
marker.title = markerView.title.length > 0 ? markerView.title : nil;
|
|
@@ -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;
|
|
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,
|
|
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.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Universal maps for React Native.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -78,9 +78,9 @@
|
|
|
78
78
|
"@eslint/eslintrc": "^3.3.1",
|
|
79
79
|
"@eslint/js": "^9.35.0",
|
|
80
80
|
"@expo/config-plugins": "^56.0.8",
|
|
81
|
-
"@react-native/babel-preset": "0.
|
|
82
|
-
"@react-native/eslint-config": "0.
|
|
83
|
-
"@react-native/jest-preset": "0.
|
|
81
|
+
"@react-native/babel-preset": "0.86.3",
|
|
82
|
+
"@react-native/eslint-config": "0.86.3",
|
|
83
|
+
"@react-native/jest-preset": "0.86.3",
|
|
84
84
|
"@release-it/conventional-changelog": "^10.0.1",
|
|
85
85
|
"@types/jest": "^29.5.14",
|
|
86
86
|
"@types/react": "^19.2.0",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"lefthook": "^2.0.3",
|
|
95
95
|
"prettier": "^2.8.8",
|
|
96
96
|
"react": "19.2.3",
|
|
97
|
-
"react-native": "0.
|
|
97
|
+
"react-native": "0.86.3",
|
|
98
98
|
"react-native-builder-bob": "^0.40.13",
|
|
99
99
|
"release-it": "^19.0.4",
|
|
100
100
|
"turbo": "^2.5.6",
|
package/plugin/build/index.d.ts
CHANGED
|
@@ -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;
|
package/plugin/build/index.js
CHANGED
|
@@ -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, {
|
|
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
|
};
|
|
@@ -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
|
|
6
|
-
|
|
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
|
-
|
|
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}")
|
|
43
|
+
c.modResults.contents = c.modResults.contents.replace(/(func application\([^)]+\)[^{]*\{)/, `$1\n GMSServices.provideAPIKey("${apiKey}")`);
|
|
22
44
|
}
|
|
23
45
|
return c;
|
|
24
46
|
});
|