@mapsindoors/react-native-maps-indoors-mapbox 0.0.5-beta

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 (147) hide show
  1. package/LICENSE +11 -0
  2. package/README.md +178 -0
  3. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  4. package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
  5. package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
  6. package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
  7. package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
  8. package/android/.gradle/7.4/executionHistory/executionHistory.bin +0 -0
  9. package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
  10. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  11. package/android/.gradle/7.4/fileHashes/fileHashes.bin +0 -0
  12. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  13. package/android/.gradle/7.4/fileHashes/resourceHashesCache.bin +0 -0
  14. package/android/.gradle/7.4/gc.properties +0 -0
  15. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  16. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  17. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  18. package/android/.gradle/file-system.probe +0 -0
  19. package/android/.gradle/vcs-1/gc.properties +0 -0
  20. package/android/.idea/compiler.xml +6 -0
  21. package/android/.idea/gradle.xml +19 -0
  22. package/android/.idea/jarRepositories.xml +45 -0
  23. package/android/.idea/misc.xml +10 -0
  24. package/android/.idea/vcs.xml +6 -0
  25. package/android/README.md +14 -0
  26. package/android/build.gradle +169 -0
  27. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  28. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  29. package/android/gradle.properties +17 -0
  30. package/android/gradlew +234 -0
  31. package/android/gradlew.bat +89 -0
  32. package/android/local.properties +8 -0
  33. package/android/src/main/AndroidManifest.xml +6 -0
  34. package/android/src/main/java/com/reactlibrary/DirectionsRendererModule.java +207 -0
  35. package/android/src/main/java/com/reactlibrary/DirectionsServiceModule.java +130 -0
  36. package/android/src/main/java/com/reactlibrary/MPDisplayRuleModule.java +816 -0
  37. package/android/src/main/java/com/reactlibrary/MapControlModule.java +661 -0
  38. package/android/src/main/java/com/reactlibrary/MapsIndoorsModule.java +327 -0
  39. package/android/src/main/java/com/reactlibrary/MapsIndoorsPackage.java +46 -0
  40. package/android/src/main/java/com/reactlibrary/MapsIndoorsViewManager.java +119 -0
  41. package/android/src/main/java/com/reactlibrary/UtilsModule.java +165 -0
  42. package/android/src/main/java/com/reactlibrary/models/Bounds.java +19 -0
  43. package/android/src/main/java/com/reactlibrary/models/Filter.java +77 -0
  44. package/android/src/main/java/com/reactlibrary/models/Location.java +17 -0
  45. package/android/src/main/java/com/reactlibrary/models/MPCameraPosition.java +29 -0
  46. package/android/src/main/java/com/reactlibrary/models/MPCameraUpdate.java +92 -0
  47. package/android/src/main/java/com/reactlibrary/models/MPError.java +38 -0
  48. package/android/src/main/java/com/reactlibrary/models/PositionProvider.java +46 -0
  49. package/android/src/main/java/com/reactlibrary/models/PositionResult.java +117 -0
  50. package/android/src/main/java/com/reactlibrary/models/Query.java +30 -0
  51. package/android/src/main/res/values/google_maps_api_key.xml +4 -0
  52. package/android/src/main/res/values/mapbox_api_key.xml +5 -0
  53. package/index.ts +184 -0
  54. package/ios/DirectionsRendererBridge.m +53 -0
  55. package/ios/DirectionsRendererModule.swift +187 -0
  56. package/ios/DirectionsServiceBridge.m +46 -0
  57. package/ios/DirectionsServiceModule.swift +149 -0
  58. package/ios/MPDisplayRuleBridge.m +410 -0
  59. package/ios/MPDisplayRuleModule.swift +845 -0
  60. package/ios/MapControlBridge.m +178 -0
  61. package/ios/MapControlModule.swift +602 -0
  62. package/ios/MapsIndoors.xcodeproj/project.pbxproj +318 -0
  63. package/ios/MapsIndoors.xcworkspace/contents.xcworkspacedata +7 -0
  64. package/ios/MapsIndoors.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  65. package/ios/MapsIndoorsBridge.m +98 -0
  66. package/ios/MapsIndoorsData.swift +203 -0
  67. package/ios/MapsIndoorsModule.swift +247 -0
  68. package/ios/MapsIndoorsViewManager.swift +30 -0
  69. package/ios/MapsIndoorsViewManagerBridge.m +9 -0
  70. package/ios/ReactPositionProvider.swift +25 -0
  71. package/ios/UtilsBridge.m +63 -0
  72. package/ios/UtilsModule.swift +146 -0
  73. package/ios/helpers.swift +57 -0
  74. package/ios/react-native-maps-indoors-Bridging-Header.h +6 -0
  75. package/package.json +52 -0
  76. package/react-native-maps-indoors-mapbox.podspec +30 -0
  77. package/src/EventNames.ts +21 -0
  78. package/src/MPBounds.ts +137 -0
  79. package/src/MPBuilding.ts +334 -0
  80. package/src/MPBuildingCollection.ts +57 -0
  81. package/src/MPBuildingInfo.ts +63 -0
  82. package/src/MPCameraEvent.ts +17 -0
  83. package/src/MPCameraEventListener.ts +17 -0
  84. package/src/MPCameraPosition.ts +83 -0
  85. package/src/MPCameraUpdate.ts +174 -0
  86. package/src/MPCameraViewFitMode.ts +21 -0
  87. package/src/MPCategory.ts +76 -0
  88. package/src/MPCategoryCollection.ts +62 -0
  89. package/src/MPCollection.ts +59 -0
  90. package/src/MPCollisionHandling.ts +12 -0
  91. package/src/MPDataField.ts +69 -0
  92. package/src/MPDirectionsRenderer.ts +194 -0
  93. package/src/MPDirectionsService.ts +119 -0
  94. package/src/MPDisplayRule.ts +1027 -0
  95. package/src/MPEntity.ts +60 -0
  96. package/src/MPEntityInfo.ts +28 -0
  97. package/src/MPError.ts +122 -0
  98. package/src/MPFilter.ts +168 -0
  99. package/src/MPFilterBehavior.ts +95 -0
  100. package/src/MPFloor.ts +170 -0
  101. package/src/MPFloorSelectorInterface.ts +63 -0
  102. package/src/MPGeometry.ts +91 -0
  103. package/src/MPHighway.ts +14 -0
  104. package/src/MPIconSize.ts +39 -0
  105. package/src/MPLocation.ts +386 -0
  106. package/src/MPLocationPropertyNames.ts +30 -0
  107. package/src/MPLocationType.ts +16 -0
  108. package/src/MPMapConfig.ts +211 -0
  109. package/src/MPMapStyle.ts +57 -0
  110. package/src/MPMultiPolygon.ts +205 -0
  111. package/src/MPPoint.ts +165 -0
  112. package/src/MPPolygon.ts +206 -0
  113. package/src/MPPositionProviderInterface.ts +45 -0
  114. package/src/MPPositionResultInterface.ts +42 -0
  115. package/src/MPPropertyData.ts +215 -0
  116. package/src/MPQuery.ts +69 -0
  117. package/src/MPRoute.ts +95 -0
  118. package/src/MPRouteCoordinate.ts +95 -0
  119. package/src/MPRouteLeg.ts +128 -0
  120. package/src/MPRouteProperty.ts +83 -0
  121. package/src/MPRouteStep.ts +176 -0
  122. package/src/MPSelectionBehavior.ts +93 -0
  123. package/src/MPSettings3D.ts +107 -0
  124. package/src/MPSize.ts +21 -0
  125. package/src/MPSolution.ts +180 -0
  126. package/src/MPSolutionConfig.ts +127 -0
  127. package/src/MPSolutionDisplayRule.ts +13 -0
  128. package/src/MPUserRole.ts +60 -0
  129. package/src/MPUserRoleCollection.ts +37 -0
  130. package/src/MPUtils.ts +157 -0
  131. package/src/MPVenue.ts +294 -0
  132. package/src/MPVenueCollection.ts +58 -0
  133. package/src/MPVenueInfo.ts +62 -0
  134. package/src/MapControl.ts +861 -0
  135. package/src/MapView.tsx +34 -0
  136. package/src/MapsIndoors.ts +530 -0
  137. package/src/OnBuildingFoundAtCameraTargetListener.ts +17 -0
  138. package/src/OnFloorSelectionChangedListener.ts +17 -0
  139. package/src/OnFloorUpdateListener.ts +16 -0
  140. package/src/OnLegSelectedListener.ts +17 -0
  141. package/src/OnLiveLocationUpdateListener.ts +17 -0
  142. package/src/OnLocationSelectedListener.ts +17 -0
  143. package/src/OnMapClickListener.ts +20 -0
  144. package/src/OnMarkerClickListener.ts +17 -0
  145. package/src/OnMarkerInfoWindowClickListener.ts +17 -0
  146. package/src/OnPositionUpdateListener.ts +17 -0
  147. package/src/OnVenueFoundAtCameraTargetListener.ts +17 -0
package/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ Copyright 2023 Mapspeople
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,178 @@
1
+ # react-native-maps-indoors
2
+
3
+ ## Getting started
4
+
5
+ `$ npm install react-native-maps-indoors-mapbox`
6
+
7
+ ### iOS
8
+
9
+ The MapsIndoors SDK requires iOS 13, so make sure that your podfile is configured for iOS 13
10
+
11
+ ```pod
12
+ platform :ios, '13.0
13
+ ```
14
+
15
+ #### Providing API key
16
+
17
+ 1. Navigate to your application settings and add your Mapbox public access token to info with the key `MBXAccessToken`
18
+ 2. Setup your secret access token for downloading the sdk. Read how to do this here: [Configure credentials](https://docs.mapbox.com/ios/maps/guides/install/#configure-credentials)
19
+
20
+ ### Android
21
+
22
+ #### Android Gooogle Maps Setup
23
+
24
+ ​
25
+ To get the underlying Google Map to function, you need to perform the following steps:
26
+ ​
27
+
28
+ 1. Navigate to `android/app/src/main/res/value`.
29
+ 2. Create a file in this folder called `mapbox_api_key.xml`.
30
+ 3. Copy and paste the below code snippet and replace `YOUR_KEY_HERE` with your Mapbox api key.
31
+ ​
32
+
33
+ ```xml
34
+ <?xml version="1.0" encoding="utf-8"?>
35
+ <resources>
36
+ <string name="mapbox_api_key" translatable="false">YOUR_KEY_HERE</string>
37
+ </resources>
38
+ ```
39
+
40
+ #### MapsIndoors Gradle Setup
41
+
42
+ ​
43
+ The plugin Gradle project has trouble resolving the MapsIndoors dependency, so to ensure that it is resolved correctly, do the following:
44
+
45
+ 1. Navigate to the app `gradle.properties` and add the value MAPBOX_DOWNLOADS_TOKEN with your Mapbox download access token.
46
+ 2. Navigate to the app's project level `build.gradle`.
47
+ 3. add `maven { url 'https://maven.mapsindoors.com/' }` to `allprojects`/`repositories` as well as the Mapbox maven
48
+ ​
49
+
50
+ ```groovy
51
+ allprojects {
52
+ repositories {
53
+ google()
54
+ mavenCentral()
55
+ maven { url 'https://maven.mapsindoors.com/' }
56
+ maven {
57
+ url 'https://api.mapbox.com/downloads/v2/releases/maven'
58
+ authentication {
59
+ basic(BasicAuthentication)
60
+ }
61
+ credentials {
62
+ // Do not change the username below.
63
+ // This should always be `mapbox` (not your username).
64
+ username = "mapbox"
65
+ // Use the secret token you stored in gradle.properties as the password
66
+ password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
67
+ }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ## Usage
74
+
75
+ ### Showing your map
76
+
77
+ This snippet shows you how to set up MapsIndoors in a React Native application.
78
+
79
+ ```javascript
80
+ import MapsIndoors, { MapControl, MapView } from 'react-native-maps-indoors';
81
+ ...
82
+ //Function to initialize mapsindoors and mapcontrol. To load a solution and show data onto the map.
83
+ const loadMapsIndoors = () => {
84
+ //Load solution data with your api key
85
+ MapsIndoors.load('API_KEY').then(async () => {
86
+ //Create the MapControl. Which will be using the MapView of the component.
87
+ const mc = await MapControl.create(new MPMapConfig({useDefaultMapsIndoorsStyle: true}), NativeEventEmitter);
88
+ //Get a venue and move the camera to it.
89
+ let venue: MPVenue = (await MapsIndoors.getVenues()).getAll()[0];
90
+ mapControl.goTo(venue);
91
+ }
92
+ }
93
+
94
+ ...
95
+ render() {
96
+ return (
97
+ <MapView
98
+ style={{
99
+ width: Dimensions.get('window').width,
100
+ height: Dimensions.get('window').height,
101
+ }}
102
+ />
103
+ );
104
+ }
105
+ ...
106
+ ```
107
+
108
+ ### Showing a route
109
+
110
+ ```javascript
111
+ const showRoute = async () => {
112
+ let point = new MPPoint(57.0580431, 9.9505475);
113
+ let point2 = new MPPoint(57.0581638, 9.9507732, 10);
114
+ var directionsService = await MPDirectionsService.create();
115
+
116
+ //Optional query parameters for the route.
117
+ directionsService.setIsDeparture(true);
118
+ directionsService.setTime(Date.now());
119
+ directionsService.setTravelMode('bicycling');
120
+
121
+ var route = await directionsService.getRoute(point, point2);
122
+ directionsRenderer = new MPDirectionsRenderer(NativeEventEmitter);
123
+ directionsRenderer.setRoute(route);
124
+ };
125
+ ```
126
+
127
+ ### Searching locations
128
+
129
+ This code snippet shows a function called `searchForParking` that takes a single argument of type `MPPoint`. The function uses `MapsIndoors` to search for locations matching the query string `"parking"` near the point specified, and uses the filter to only get the first 10 matches.
130
+ ​
131
+ It mathces in the locations' descriptions, names, and external IDs to the query string. Once the search is complete, it is possible to update/get information from the locations (not specified in the code snippet).
132
+
133
+ ```javascript
134
+ const searchForParking = async (point: MPPoint) => {
135
+ let query = MPQuery.create({query: "parking",
136
+ near: point,
137
+ queryProperties: [MPLocationPropertyNames.description, MPLocationPropertyNames.name, MPLocationPropertyNames.externalId]});
138
+ let filter = MPFilter.create({take: 10});
139
+ let parkingLotsNearPoint = await MapsIndoors.getLocationsAsync(query, filter);
140
+ }
141
+ ```
142
+
143
+ ### Changing the look with DisplayRules
144
+
145
+ ​
146
+ This code snippet shows three ways to manipulate display rules in the MapsIndoors SDK.
147
+ ​
148
+ The `hideLocationsByDefault` method hides all markers that are not explicitly visible by setting the main display rule to not visible.
149
+ ​
150
+ The `showLocationsByDefault` method ensures all markers are shown by setting the main display rule to visible.
151
+ ​
152
+ The `changeTypePolygonColor(String type, String color)` method changes the fill color for all polygons belonging to a specific type. It gets the display rule for the specified type using `getDisplayRuleByName`, and sets the fill color using `setPolygonFillColor`.
153
+ ​
154
+ These methods can all be used to customize the display of markers and polygons on the map.
155
+ ​
156
+
157
+ ```javascript
158
+ // This method changes the main display rule to hide all markers,
159
+ // This will cause all locations/types that are not explicitly visible to be hidden.
160
+ const hideLocationsByDefault = async () => {
161
+ let mainDisplayRule = await MapsIndoors.getMainDisplayRule();
162
+ mainDisplayRule?.setVisible(false);
163
+ }
164
+ ​
165
+ // This method changes the main display rule to show all markers,
166
+ // This will cause all locations/types that are not explicitly visible to be shown.
167
+ const showLocationsByDefault = async () => {
168
+ let mainDisplayRule = await MapsIndoors.getMainDisplayRule();
169
+ mainDisplayRule?.setVisible(true);
170
+ }
171
+ ​
172
+ // This method changes the fill color for all polygons belonging to a specific [type]
173
+ // the color MUST be a valid hex color string.
174
+ const changeTypePolygonColor = async (type: string, color: string) => {
175
+ let typeDisplayRule = await MapsIndoors.getDisplayRuleByName(type);
176
+ typeDisplayRule?.setPolygonFillColor(color);
177
+ }
178
+ ```
File without changes
@@ -0,0 +1,2 @@
1
+ #Thu Feb 02 14:40:19 CET 2023
2
+ gradle.version=7.4
File without changes
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="CompilerConfiguration">
4
+ <bytecodeTargetLevel target="11" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="GradleMigrationSettings" migrationVersion="1" />
4
+ <component name="GradleSettings">
5
+ <option name="linkedExternalProjectsSettings">
6
+ <GradleProjectSettings>
7
+ <option name="testRunner" value="GRADLE" />
8
+ <option name="distributionType" value="DEFAULT_WRAPPED" />
9
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
10
+ <option name="gradleJvm" value="11" />
11
+ <option name="modules">
12
+ <set>
13
+ <option value="$PROJECT_DIR$" />
14
+ </set>
15
+ </option>
16
+ </GradleProjectSettings>
17
+ </option>
18
+ </component>
19
+ </project>
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="RemoteRepositoriesConfiguration">
4
+ <remote-repository>
5
+ <option name="id" value="central" />
6
+ <option name="name" value="Maven Central repository" />
7
+ <option name="url" value="https://repo1.maven.org/maven2" />
8
+ </remote-repository>
9
+ <remote-repository>
10
+ <option name="id" value="jboss.community" />
11
+ <option name="name" value="JBoss Community repository" />
12
+ <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
13
+ </remote-repository>
14
+ <remote-repository>
15
+ <option name="id" value="MavenLocal" />
16
+ <option name="name" value="MavenLocal" />
17
+ <option name="url" value="file:$USER_HOME$/.m2/repository/" />
18
+ </remote-repository>
19
+ <remote-repository>
20
+ <option name="id" value="MavenRepo" />
21
+ <option name="name" value="MavenRepo" />
22
+ <option name="url" value="https://repo.maven.apache.org/maven2/" />
23
+ </remote-repository>
24
+ <remote-repository>
25
+ <option name="id" value="maven2" />
26
+ <option name="name" value="maven2" />
27
+ <option name="url" value="file:$PROJECT_DIR$/../node_modules/jsc-android/dist/" />
28
+ </remote-repository>
29
+ <remote-repository>
30
+ <option name="id" value="maven" />
31
+ <option name="name" value="maven" />
32
+ <option name="url" value="file:$PROJECT_DIR$/../node_modules/react-native/android/" />
33
+ </remote-repository>
34
+ <remote-repository>
35
+ <option name="id" value="Google" />
36
+ <option name="name" value="Google" />
37
+ <option name="url" value="https://dl.google.com/dl/android/maven2/" />
38
+ </remote-repository>
39
+ <remote-repository>
40
+ <option name="id" value="maven" />
41
+ <option name="name" value="maven" />
42
+ <option name="url" value="https://maven.mapsindoors.com/" />
43
+ </remote-repository>
44
+ </component>
45
+ </project>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ExternalStorageConfigurationManager" enabled="true" />
4
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="1.8" project-jdk-type="JavaSDK">
5
+ <output url="file://$PROJECT_DIR$/build/classes" />
6
+ </component>
7
+ <component name="ProjectType">
8
+ <option name="id" value="Android" />
9
+ </component>
10
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,14 @@
1
+ README
2
+ ======
3
+
4
+ If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm:
5
+
6
+ 1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed
7
+ 2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK
8
+ ```
9
+ ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle
10
+ sdk.dir=/Users/{username}/Library/Android/sdk
11
+ ```
12
+ 3. Delete the `maven` folder
13
+ 4. Run `./gradlew installArchives`
14
+ 5. Verify that latest set of generated files is in the maven folder with the correct version number
@@ -0,0 +1,169 @@
1
+ // android/build.gradle
2
+
3
+ // based on:
4
+ //
5
+ // * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle
6
+ // previous location:
7
+ // - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle
8
+ //
9
+ // * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle
10
+ // previous location:
11
+ // - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
12
+
13
+ // These defaults should reflect the SDK versions used by
14
+ // the minimum React Native version supported.
15
+ def DEFAULT_COMPILE_SDK_VERSION = 33
16
+ def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
17
+ def DEFAULT_MIN_SDK_VERSION = 21
18
+ def DEFAULT_TARGET_SDK_VERSION = 33
19
+
20
+ def safeExtGet(prop, fallback) {
21
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
22
+ }
23
+
24
+ apply plugin: 'com.android.library'
25
+
26
+ buildscript {
27
+ // The Android Gradle plugin is only required when opening the android folder stand-alone.
28
+ // This avoids unnecessary downloads and potential conflicts when the library is included as a
29
+ // module dependency in an application project.
30
+ // ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
31
+ if (project == rootProject) {
32
+
33
+
34
+ repositories {
35
+ google()
36
+ mavenCentral()
37
+ maven {
38
+ url "https://plugins.gradle.org/m2/"
39
+ }
40
+ }
41
+ dependencies {
42
+ // This should reflect the Gradle plugin version used by
43
+ // the minimum React Native version supported.
44
+ classpath 'com.android.tools.build:gradle:7.1.3'
45
+ }
46
+ }
47
+ }
48
+
49
+ android {
50
+ compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
51
+ defaultConfig {
52
+ minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
53
+ targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
54
+ versionCode 1
55
+ versionName "1.0"
56
+ }
57
+ lintOptions {
58
+ abortOnError false
59
+ }
60
+ }
61
+
62
+ repositories {
63
+ // ref: https://www.baeldung.com/maven-local-repository
64
+ maven { url 'https://maven.mapsindoors.com/' }
65
+ mavenLocal()
66
+ maven {
67
+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
68
+ url "$rootDir/../node_modules/react-native/android"
69
+ }
70
+ maven {
71
+ // Android JSC is installed from npm
72
+ url "$rootDir/../node_modules/jsc-android/dist"
73
+ }
74
+ google()
75
+ mavenCentral()
76
+ }
77
+
78
+ dependencies {
79
+ repositories {
80
+ maven {
81
+ url 'https://api.mapbox.com/downloads/v2/releases/maven'
82
+ authentication {
83
+ basic(BasicAuthentication)
84
+ }
85
+ credentials {
86
+ // Do not change the username below.
87
+ // This should always be `mapbox` (not your username).
88
+ username = "mapbox"
89
+ // Use the secret token you stored in gradle.properties as the password
90
+ password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
91
+ }
92
+ }
93
+ }
94
+
95
+ implementation 'com.mapbox.maps:android:10.13.0'
96
+
97
+
98
+
99
+ implementation 'com.mapspeople.mapsindoors:mapbox:4.1.6'
100
+ implementation 'com.facebook.react:react-native:+' // From node_modules
101
+ implementation 'androidx.core:core-ktx:1.3.2'
102
+ }
103
+
104
+ def configureReactNativePom(def pom) {
105
+ def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)
106
+
107
+ pom.project {
108
+ name packageJson.title
109
+ artifactId packageJson.name
110
+ version = packageJson.version
111
+ group = "com.reactlibrary"
112
+ description packageJson.description
113
+ url packageJson.repository.baseUrl
114
+
115
+ licenses {
116
+ license {
117
+ name packageJson.license
118
+ url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
119
+ distribution 'repo'
120
+ }
121
+ }
122
+
123
+ developers {
124
+ developer {
125
+ id packageJson.author.username
126
+ name packageJson.author.name
127
+ }
128
+ }
129
+ }
130
+ }
131
+
132
+ afterEvaluate { project ->
133
+ // some Gradle build hooks ref:
134
+ // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
135
+ task androidJavadoc(type: Javadoc) {
136
+ source = android.sourceSets.main.java.srcDirs
137
+ classpath += files(android.bootClasspath)
138
+ include '**/*.java'
139
+ }
140
+
141
+ task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
142
+ classifier = 'javadoc'
143
+ from androidJavadoc.destinationDir
144
+ }
145
+
146
+ task androidSourcesJar(type: Jar) {
147
+ classifier = 'sources'
148
+ from android.sourceSets.main.java.srcDirs
149
+ include '**/*.java'
150
+ }
151
+
152
+ android.libraryVariants.all { variant ->
153
+ def name = variant.name.capitalize()
154
+ def javaCompileTask = variant.javaCompileProvider.get()
155
+
156
+ task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
157
+ from javaCompileTask.destinationDir
158
+ }
159
+ }
160
+
161
+ artifacts {
162
+ archives androidSourcesJar
163
+ archives androidJavadocJar
164
+ }
165
+
166
+ task installArchives(type: Upload) {
167
+ configuration = configurations.archives
168
+ }
169
+ }
@@ -0,0 +1,5 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
4
+ zipStoreBase=GRADLE_USER_HOME
5
+ zipStorePath=wrapper/dists
@@ -0,0 +1,17 @@
1
+ ## For more details on how to configure your build environment visit
2
+ # http://www.gradle.org/docs/current/userguide/build_environment.html
3
+ #
4
+ # Specifies the JVM arguments used for the daemon process.
5
+ # The setting is particularly useful for tweaking memory settings.
6
+ # Default value: -Xmx1024m -XX:MaxPermSize=256m
7
+ # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
8
+ #
9
+ # When configured, Gradle will run in incubating parallel mode.
10
+ # This option should only be used with decoupled projects. More details, visit
11
+ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
12
+ # org.gradle.parallel=true
13
+ #Thu Feb 02 15:52:14 CET 2023
14
+ android.useAndroidX=true
15
+ android.enableJetifier=true
16
+
17
+ org.gradle.jvmargs=-Xmx4096M