react-native-google-maps-plus 1.8.8-dev.1 → 1.10.0-dev.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.
Files changed (57) hide show
  1. package/README.md +0 -2
  2. package/android/build.gradle +0 -21
  3. package/android/gradle.properties +1 -1
  4. package/android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt +64 -80
  5. package/android/src/main/java/com/rngooglemapsplus/MapLifecycleEventObserver.kt +78 -0
  6. package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +6 -13
  7. package/android/src/main/java/com/rngooglemapsplus/extensions/RNLatLngBoundsExtension.kt +0 -1
  8. package/android/src/main/java/com/rngooglemapsplus/extensions/ThrowableExtension.kt +2 -0
  9. package/expoConfig/build/index.js +2 -2
  10. package/ios/GoogleMapViewImpl.swift +27 -14
  11. package/ios/LocationHandler.swift +32 -20
  12. package/ios/RNGoogleMapsPlusView.swift +8 -16
  13. package/ios/extensions/CLLocation+Extension.swift +1 -1
  14. package/ios/extensions/RNIOSLocationActivityType+Extensions.swift +18 -0
  15. package/ios/extensions/RNLineCapType+Extension.swift +0 -1
  16. package/ios/extensions/RNLineJoinType+Extension.swift +0 -2
  17. package/ios/extensions/String+Extensions.swift +6 -6
  18. package/lib/module/GoogleMapsPlus.js.map +1 -1
  19. package/lib/module/index.js.map +1 -1
  20. package/lib/module/types.js +8 -0
  21. package/lib/module/types.js.map +1 -1
  22. package/lib/typescript/src/GoogleMapsPlus.d.ts +1 -1
  23. package/lib/typescript/src/GoogleMapsPlus.d.ts.map +1 -1
  24. package/lib/typescript/src/RNGoogleMapsPlusModule.nitro.d.ts.map +1 -1
  25. package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts +1 -1
  26. package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts.map +1 -1
  27. package/lib/typescript/src/index.d.ts +1 -1
  28. package/lib/typescript/src/index.d.ts.map +1 -1
  29. package/lib/typescript/src/types.d.ts +10 -2
  30. package/lib/typescript/src/types.d.ts.map +1 -1
  31. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.cpp +20 -8
  32. package/nitrogen/generated/android/c++/JRNHeatmap.hpp +2 -1
  33. package/nitrogen/generated/android/c++/JRNHeatmapGradient.hpp +2 -1
  34. package/nitrogen/generated/android/c++/JRNIOSLocationActivityType.hpp +68 -0
  35. package/nitrogen/generated/android/c++/JRNIOSLocationConfig.hpp +9 -3
  36. package/nitrogen/generated/android/c++/JRNIndoorBuilding.hpp +2 -1
  37. package/nitrogen/generated/android/c++/JRNLocationConfig.hpp +2 -0
  38. package/nitrogen/generated/android/c++/JRNPolygon.hpp +4 -2
  39. package/nitrogen/generated/android/c++/JRNPolygonHole.hpp +2 -1
  40. package/nitrogen/generated/android/c++/JRNPolyline.hpp +2 -1
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNIOSLocationActivityType.kt +24 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNIOSLocationConfig.kt +6 -3
  43. package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Bridge.hpp +18 -0
  44. package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Umbrella.hpp +3 -0
  45. package/nitrogen/generated/ios/c++/HybridRNGoogleMapsPlusViewSpecSwift.hpp +3 -0
  46. package/nitrogen/generated/ios/swift/RNIOSLocationActivityType.swift +52 -0
  47. package/nitrogen/generated/ios/swift/RNIOSLocationConfig.swift +24 -1
  48. package/nitrogen/generated/shared/c++/RNIOSLocationActivityType.hpp +65 -0
  49. package/nitrogen/generated/shared/c++/RNIOSLocationConfig.hpp +9 -2
  50. package/package.json +19 -69
  51. package/src/GoogleMapsPlus.tsx +1 -2
  52. package/src/RNGoogleMapsPlusModule.nitro.ts +1 -0
  53. package/src/RNGoogleMapsPlusView.nitro.ts +5 -5
  54. package/src/index.tsx +2 -1
  55. package/src/types.ts +11 -2
  56. package/scripts/create-dev-tag.sh +0 -8
  57. package/scripts/nitrogen-patch.js +0 -191
@@ -1,191 +0,0 @@
1
- /**
2
- * Recursively patches all generated Nitro files (Android & iOS):
3
- *
4
- * ANDROID
5
- * - Replaces 'com.margelo.nitro.rngooglemapsplus' -> 'com.rngooglemapsplus'
6
- * - Replaces 'com/margelo/nitro/rngooglemapsplus' -> 'com/rngooglemapsplus'
7
- * - Removes 'margelo/nitro/' in RNGoogleMapsPlusOnLoad.cpp
8
- * - Inserts `prepareToRecycleView()`
9
- * nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/views/HybridRNGoogleMapsPlusViewManager.kt
10
- *
11
- * iOS
12
- * - Inserts `+ (BOOL)shouldBeRecycled`
13
- * nitrogen/generated/ios/c++/views/HybridRNGoogleMapsPlusViewComponent.mm
14
- */
15
- import { fileURLToPath } from 'url';
16
- import { basename } from 'path';
17
- import path from 'node:path';
18
- import { readdir, readFile, writeFile } from 'node:fs/promises';
19
- import { mkdir, copyFile } from 'node:fs/promises';
20
-
21
- const ROOT_ANDROID = path.join(
22
- process.cwd(),
23
- 'nitrogen',
24
- 'generated',
25
- 'android'
26
- );
27
- const ROOT_IOS = path.join(process.cwd(), 'nitrogen', 'generated', 'ios');
28
- const SRC_JSON_DIR = path.join(
29
- process.cwd(),
30
- 'nitrogen',
31
- 'generated',
32
- 'shared',
33
- 'json'
34
- );
35
- const DEST_JSON_DIR = path.join(
36
- process.cwd(),
37
- 'lib',
38
- 'nitrogen',
39
- 'generated',
40
- 'shared',
41
- 'json'
42
- );
43
-
44
- const ANDROID_ONLOAD_FILE = path.join(
45
- ROOT_ANDROID,
46
- 'RNGoogleMapsPlusOnLoad.cpp'
47
- );
48
-
49
- const HYBRID_VIEW_MANAGER = path.join(
50
- ROOT_ANDROID,
51
- 'kotlin/com/margelo/nitro/rngooglemapsplus/views/HybridRNGoogleMapsPlusViewManager.kt'
52
- );
53
-
54
- const HYBRID_VIEW_COMPONENT_IOS = path.join(
55
- ROOT_IOS,
56
- 'c++/views/HybridRNGoogleMapsPlusViewComponent.mm'
57
- );
58
-
59
- const REPLACEMENTS = [
60
- {
61
- regex: /com\.margelo\.nitro\.rngooglemapsplus/g,
62
- replacement: 'com.rngooglemapsplus',
63
- },
64
- {
65
- regex: /com\/margelo\/nitro\/rngooglemapsplus/g,
66
- replacement: 'com/rngooglemapsplus',
67
- },
68
- ];
69
-
70
- const __filename = fileURLToPath(import.meta.url);
71
- const filename = basename(__filename);
72
-
73
- const ANDROID_VIEW_MANAGER_METHODS =
74
- /override fun onDropViewInstance\(view: View\)\s*\{\s*super\.onDropViewInstance\(view\)\s*views\.remove\(view\)\s*\}/m;
75
-
76
- const ANDROID_VIEW_MANAGER_METHODS_NEW = `
77
- override fun onDropViewInstance(view: View) {
78
- super.onDropViewInstance(view)
79
- views.remove(view)
80
- /// added by ${filename}
81
- if (view is GoogleMapsViewImpl) {
82
- view.destroyInternal()
83
- }
84
- }
85
-
86
- /// added by ${filename}
87
- override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? {
88
- return null
89
- }
90
- `;
91
-
92
- const RECYCLE_METHOD_IOS = `
93
- /// added by ${filename}
94
- + (BOOL)shouldBeRecycled
95
- {
96
- return NO;
97
- }
98
-
99
- /// added by ${filename}
100
- - (void)dealloc {
101
- if (_hybridView) {
102
- RNGoogleMapsPlus::HybridRNGoogleMapsPlusViewSpec_cxx& swiftPart = _hybridView->getSwiftPart();
103
- swiftPart.dispose();
104
- _hybridView.reset();
105
- }
106
- }`;
107
-
108
- async function processFile(filePath) {
109
- let content = await readFile(filePath, 'utf8');
110
- let updated = content;
111
-
112
- for (const { regex, replacement } of REPLACEMENTS) {
113
- updated = updated.replace(regex, replacement);
114
- }
115
-
116
- if (path.resolve(filePath) === path.resolve(ANDROID_ONLOAD_FILE)) {
117
- updated = updated.replace(/margelo\/nitro\//g, '');
118
- }
119
-
120
- if (path.resolve(filePath) === path.resolve(HYBRID_VIEW_MANAGER)) {
121
- if (ANDROID_VIEW_MANAGER_METHODS.test(updated)) {
122
- updated = updated.replace(
123
- ANDROID_VIEW_MANAGER_METHODS,
124
- ANDROID_VIEW_MANAGER_METHODS_NEW
125
- );
126
- } else {
127
- throw new Error(
128
- `Pattern for HybridRNGoogleMapsPlusViewManager not found in ${filePath}`
129
- );
130
- }
131
- }
132
-
133
- if (path.resolve(filePath) === path.resolve(HYBRID_VIEW_COMPONENT_IOS)) {
134
- if (!/\+\s*\(BOOL\)\s*shouldBeRecycled/.test(updated)) {
135
- const pattern =
136
- /(- \(instancetype\)\s*init\s*\{(?:[^{}]|\{[^{}]*\})*\})/m;
137
-
138
- if (pattern.test(updated)) {
139
- updated = updated.replace(pattern, `$1\n${RECYCLE_METHOD_IOS}`);
140
- } else {
141
- throw new Error(`Pattern for "init" not found in ${filePath}`);
142
- }
143
- }
144
- }
145
-
146
- if (updated !== content) {
147
- await writeFile(filePath, updated, 'utf8');
148
- console.log(`Updated: ${filePath}`);
149
- }
150
- }
151
-
152
- async function start(dir) {
153
- const entries = await readdir(dir, { withFileTypes: true });
154
- for (const entry of entries) {
155
- const fullPath = path.join(dir, entry.name);
156
- if (entry.isDirectory()) {
157
- await start(fullPath);
158
- } else if (entry.isFile()) {
159
- await processFile(fullPath);
160
- }
161
- }
162
- }
163
-
164
- async function copyJsonFiles() {
165
- try {
166
- await mkdir(DEST_JSON_DIR, { recursive: true });
167
- const files = await readdir(SRC_JSON_DIR);
168
- for (const file of files) {
169
- if (file.endsWith('.json')) {
170
- const src = path.join(SRC_JSON_DIR, file);
171
- const dest = path.join(DEST_JSON_DIR, file);
172
- await copyFile(src, dest);
173
- console.log(`Copied JSON: ${file}`);
174
- }
175
- }
176
- } catch (err) {
177
- console.warn('Failed to copy JSON view configs:', err.message);
178
- }
179
- }
180
-
181
- (async () => {
182
- try {
183
- await copyJsonFiles();
184
- await start(ROOT_ANDROID);
185
- await start(ROOT_IOS);
186
- console.log('All Nitrogen files patched successfully.');
187
- } catch (err) {
188
- console.error('Error while processing files:', err);
189
- process.exit(1);
190
- }
191
- })();