@situm/react-native 3.0.0-beta.0

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 +21 -0
  2. package/README.md +656 -0
  3. package/ReactNativeSitumPlugin.podspec +22 -0
  4. package/SECURITY-POLICY.md +9 -0
  5. package/android/.gradle/5.6.4/fileChanges/last-build.bin +0 -0
  6. package/android/.gradle/5.6.4/fileHashes/fileHashes.lock +0 -0
  7. package/android/.gradle/5.6.4/gc.properties +0 -0
  8. package/android/.idea/.name +1 -0
  9. package/android/.idea/codeStyles/Project.xml +116 -0
  10. package/android/.idea/encodings.xml +6 -0
  11. package/android/.idea/misc.xml +31 -0
  12. package/android/.idea/sonarlint/issuestore/index.pb +15 -0
  13. package/android/.project +34 -0
  14. package/android/build.gradle +45 -0
  15. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  16. package/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  17. package/android/gradlew +172 -0
  18. package/android/gradlew.bat +84 -0
  19. package/android/src/main/AndroidManifest.xml +6 -0
  20. package/android/src/main/java/com/situm/plugin/PluginHelper.java +989 -0
  21. package/android/src/main/java/com/situm/plugin/SitumMapper.java +1206 -0
  22. package/android/src/main/java/com/situm/plugin/SitumPackage.java +29 -0
  23. package/android/src/main/java/com/situm/plugin/SitumPlugin.java +84 -0
  24. package/android/src/main/java/com/situm/plugin/SitumPluginImpl.java +344 -0
  25. package/android/src/main/java/com/situm/plugin/utils/ReactNativeJson.java +122 -0
  26. package/android/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  27. package/android/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  28. package/android/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  29. package/android/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  30. package/android/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  31. package/android/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  32. package/android/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  33. package/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  34. package/android/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  35. package/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  36. package/android/src/main/res/values/strings.xml +3 -0
  37. package/android/src/main/res/values/styles.xml +9 -0
  38. package/ios/Constants.h +14 -0
  39. package/ios/Constants.m +14 -0
  40. package/ios/RNSitumReactNativePlugin.xcodeproj/project.pbxproj +272 -0
  41. package/ios/SitumLocationWrapper.h +112 -0
  42. package/ios/SitumLocationWrapper.m +1132 -0
  43. package/ios/SitumPlugin.h +15 -0
  44. package/ios/SitumPlugin.m +911 -0
  45. package/lib/commonjs/index.js +25 -0
  46. package/lib/commonjs/index.js.map +1 -0
  47. package/lib/commonjs/sdk/index.js +399 -0
  48. package/lib/commonjs/sdk/index.js.map +1 -0
  49. package/lib/commonjs/sdk/nativeInterface.js +20 -0
  50. package/lib/commonjs/sdk/nativeInterface.js.map +1 -0
  51. package/lib/commonjs/sdk/types/index.d.js +6 -0
  52. package/lib/commonjs/sdk/types/index.d.js.map +1 -0
  53. package/lib/commonjs/sdk/utils.js +22 -0
  54. package/lib/commonjs/sdk/utils.js.map +1 -0
  55. package/lib/commonjs/utils/requestPermission.js +73 -0
  56. package/lib/commonjs/utils/requestPermission.js.map +1 -0
  57. package/lib/commonjs/wayfinding/components/MapView.js +220 -0
  58. package/lib/commonjs/wayfinding/components/MapView.js.map +1 -0
  59. package/lib/commonjs/wayfinding/hooks/index.js +401 -0
  60. package/lib/commonjs/wayfinding/hooks/index.js.map +1 -0
  61. package/lib/commonjs/wayfinding/index.js +45 -0
  62. package/lib/commonjs/wayfinding/index.js.map +1 -0
  63. package/lib/commonjs/wayfinding/store/index.js +237 -0
  64. package/lib/commonjs/wayfinding/store/index.js.map +1 -0
  65. package/lib/commonjs/wayfinding/store/utils.js +44 -0
  66. package/lib/commonjs/wayfinding/store/utils.js.map +1 -0
  67. package/lib/commonjs/wayfinding/styles/colors.js +18 -0
  68. package/lib/commonjs/wayfinding/styles/colors.js.map +1 -0
  69. package/lib/commonjs/wayfinding/types/index.d.js +6 -0
  70. package/lib/commonjs/wayfinding/types/index.d.js.map +1 -0
  71. package/lib/commonjs/wayfinding/utils/index.js +11 -0
  72. package/lib/commonjs/wayfinding/utils/index.js.map +1 -0
  73. package/lib/commonjs/wayfinding/utils/mapper.js +106 -0
  74. package/lib/commonjs/wayfinding/utils/mapper.js.map +1 -0
  75. package/lib/module/index.js +6 -0
  76. package/lib/module/index.js.map +1 -0
  77. package/lib/module/sdk/index.js +390 -0
  78. package/lib/module/sdk/index.js.map +1 -0
  79. package/lib/module/sdk/nativeInterface.js +18 -0
  80. package/lib/module/sdk/nativeInterface.js.map +1 -0
  81. package/lib/module/sdk/types/index.d.js +2 -0
  82. package/lib/module/sdk/types/index.d.js.map +1 -0
  83. package/lib/module/sdk/utils.js +15 -0
  84. package/lib/module/sdk/utils.js.map +1 -0
  85. package/lib/module/utils/requestPermission.js +67 -0
  86. package/lib/module/utils/requestPermission.js.map +1 -0
  87. package/lib/module/wayfinding/components/MapView.js +207 -0
  88. package/lib/module/wayfinding/components/MapView.js.map +1 -0
  89. package/lib/module/wayfinding/hooks/index.js +392 -0
  90. package/lib/module/wayfinding/hooks/index.js.map +1 -0
  91. package/lib/module/wayfinding/index.js +12 -0
  92. package/lib/module/wayfinding/index.js.map +1 -0
  93. package/lib/module/wayfinding/store/index.js +202 -0
  94. package/lib/module/wayfinding/store/index.js.map +1 -0
  95. package/lib/module/wayfinding/store/utils.js +34 -0
  96. package/lib/module/wayfinding/store/utils.js.map +1 -0
  97. package/lib/module/wayfinding/styles/colors.js +11 -0
  98. package/lib/module/wayfinding/styles/colors.js.map +1 -0
  99. package/lib/module/wayfinding/types/index.d.js +2 -0
  100. package/lib/module/wayfinding/types/index.d.js.map +1 -0
  101. package/lib/module/wayfinding/utils/index.js +4 -0
  102. package/lib/module/wayfinding/utils/index.js.map +1 -0
  103. package/lib/module/wayfinding/utils/mapper.js +100 -0
  104. package/lib/module/wayfinding/utils/mapper.js.map +1 -0
  105. package/lib/typescript/src/index.d.ts +4 -0
  106. package/lib/typescript/src/index.d.ts.map +1 -0
  107. package/lib/typescript/src/sdk/index.d.ts +269 -0
  108. package/lib/typescript/src/sdk/index.d.ts.map +1 -0
  109. package/lib/typescript/src/sdk/nativeInterface.d.ts +2 -0
  110. package/lib/typescript/src/sdk/nativeInterface.d.ts.map +1 -0
  111. package/lib/typescript/src/sdk/utils.d.ts +7 -0
  112. package/lib/typescript/src/sdk/utils.d.ts.map +1 -0
  113. package/lib/typescript/src/utils/requestPermission.d.ts +3 -0
  114. package/lib/typescript/src/utils/requestPermission.d.ts.map +1 -0
  115. package/lib/typescript/src/wayfinding/components/MapView.d.ts +36 -0
  116. package/lib/typescript/src/wayfinding/components/MapView.d.ts.map +1 -0
  117. package/lib/typescript/src/wayfinding/hooks/index.d.ts +53 -0
  118. package/lib/typescript/src/wayfinding/hooks/index.d.ts.map +1 -0
  119. package/lib/typescript/src/wayfinding/index.d.ts +5 -0
  120. package/lib/typescript/src/wayfinding/index.d.ts.map +1 -0
  121. package/lib/typescript/src/wayfinding/store/index.d.ts +103 -0
  122. package/lib/typescript/src/wayfinding/store/index.d.ts.map +1 -0
  123. package/lib/typescript/src/wayfinding/store/utils.d.ts +9 -0
  124. package/lib/typescript/src/wayfinding/store/utils.d.ts.map +1 -0
  125. package/lib/typescript/src/wayfinding/styles/colors.d.ts +8 -0
  126. package/lib/typescript/src/wayfinding/styles/colors.d.ts.map +1 -0
  127. package/lib/typescript/src/wayfinding/utils/index.d.ts +3 -0
  128. package/lib/typescript/src/wayfinding/utils/index.d.ts.map +1 -0
  129. package/lib/typescript/src/wayfinding/utils/mapper.d.ts +17 -0
  130. package/lib/typescript/src/wayfinding/utils/mapper.d.ts.map +1 -0
  131. package/package.json +130 -0
  132. package/security.txt +4 -0
  133. package/src/index.ts +6 -0
  134. package/src/sdk/index.ts +656 -0
  135. package/src/sdk/nativeInterface.ts +18 -0
  136. package/src/sdk/types/index.d.ts +718 -0
  137. package/src/sdk/utils.ts +16 -0
  138. package/src/utils/requestPermission.ts +94 -0
  139. package/src/wayfinding/components/MapView.tsx +312 -0
  140. package/src/wayfinding/hooks/index.ts +539 -0
  141. package/src/wayfinding/index.tsx +11 -0
  142. package/src/wayfinding/store/index.tsx +254 -0
  143. package/src/wayfinding/store/utils.ts +40 -0
  144. package/src/wayfinding/styles/colors.tsx +6 -0
  145. package/src/wayfinding/types/index.d.ts +56 -0
  146. package/src/wayfinding/utils/index.ts +5 -0
  147. package/src/wayfinding/utils/mapper.ts +129 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Situm Technologies
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,656 @@
1
+ <p align="center"> <img width="233" src="https://situm.com/wp-content/themes/situm/img/logo-situm.svg" style="margin-bottom:1rem" /> <h1 align="center">@situm/react-native</h1> </p>
2
+
3
+ <p align="center" style="text-align:center">
4
+
5
+ Set of utilities that allow any developer to build React Native location based apps using [Situm](https://www.situm.com/)'s indoor positioning system.
6
+
7
+ </p>
8
+
9
+ <div align="center" style="text-align:center">
10
+
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
12
+ ![Latest version:](https://img.shields.io/npm/v/@situm/sdk-js/latest)
13
+ ![Node compatibility:](https://img.shields.io/node/v/@situm/sdk-js)
14
+ [![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.svg?v=101)](https://github.com/ellerbrock/typescript-badges/)
15
+ ![React Native](https://img.shields.io/badge/react--native%40lastest-0.68.2-blueviolet)
16
+
17
+ </div>
18
+
19
+ ## Introduction
20
+
21
+ Situm React Native Plugin is a set of utilities that allow any developer to build React Native location based apps using [Situm](https://www.situm.com/)'s indoor positioning system.
22
+
23
+ This plugin has two parts:
24
+
25
+ - The base SDK, the building blocks that allow you
26
+ - Obtain information related to buildings where Situm's positioning system is already configured: floorplans, points of interest, geotriggered events, etc.
27
+ - Retrieve the location of the smartphone inside these buildings (position, orientation, and floor where the smartphone is).
28
+ - Compute a route from a point A (e.g. where the smartphone is) to a point B (e.g. any point of interest within the building).
29
+ - Trigger notifications when the user enters a certain area.
30
+
31
+ - A full featured and easy to integrate React Native component that allows you to:
32
+ - show your cartography on a map
33
+ - show the user location on the map
34
+ - calculate point-to-point wayfinging routes
35
+ - explore points of interest on your buildings on the map
36
+
37
+ ![Preview of WYF module](https://raw.githubusercontent.com/situmtech/situm-react-native-plugin/feature/merge-wayfinding/docs/assets/preview.jpg)
38
+
39
+ ## Table of contents
40
+
41
+ - [Setup your account](#setup-your-account)
42
+ - [Installing pre-requisites](#installing-pre-requisites)
43
+ - [Using the Plugin](#using-the-plugin)
44
+ - [Getting Started](#getting-started)
45
+ - [Accessing plugin object](#accessing-plugin-object)
46
+ - [Methods](#methods)
47
+ - [Submitting Contributions](#submitting-contributions)
48
+ - [License](#license)
49
+ - [More information](#more-information)
50
+ - [Support information](#support-information)
51
+
52
+ ## Setup your account
53
+
54
+ In this tutorial, we will guide you step by step to set up your first React Native application using Situm React Native Plugin. Before starting to write code, we recommend you to set up an account in our Dashboard (https://dashboard.situm.es), retrieve your API KEY and configure your first building.
55
+
56
+ 1. Go to the [sign in form](http://dashboard.situm.es/accounts/register) and enter your username and password to sign in.
57
+
58
+ 2. Go to the [account section](https://dashboard.situm.es/accounts/profile) and on the bottom, click on “generate one” to generate your API KEY.
59
+
60
+ 3. Go to the [buildings section](http://dashboard.situm.es/buildings) and create your first building.
61
+
62
+ 4. Download Situm Mapping Tool in Play Store (Only Android devices) and calibrate your building. Check out our user guide for detailed information.
63
+
64
+ 5. You are ready for building your own React Native applications. Please check next steps about requirements
65
+
66
+ ## Installing pre-requisites
67
+
68
+ ### Configure React Native
69
+
70
+ Firstly you need to setup react-native development environment. To get started please follow instructions under section **React Native CLI Quickstart** on this [guide.](https://reactnative.dev/docs/environment-setup)
71
+
72
+ ## Installing the plugin
73
+
74
+ In this we assume you have already created an hybrid application with React Native. After that there are some different ways to install the plugin:
75
+
76
+ ### 1) Integrate project from Github
77
+
78
+ ```shell
79
+ yarn add https://github.com/situmtech/situm-react-native-plugin.git
80
+
81
+ #OR
82
+
83
+ npm install --save https://github.com/situmtech/situm-react-native-plugin.git
84
+ ```
85
+
86
+ Make sure to delete `node_modulles/` at `project/node_modules/@situm/react-native/node_modules`.
87
+
88
+ Note: As of now the SDK is available only on Github. When updating the SDK, make sure to delete the existing one from `node_modules/@situm/react-native`.
89
+
90
+ ### 2) Integrate plugin into project from npm
91
+
92
+ ```shell
93
+ yarn add @situm/react-native
94
+
95
+ #OR
96
+
97
+ npm install --save @situm/react-native
98
+ ```
99
+
100
+ ### Android
101
+
102
+ You'll need to add the follow repository in your project gradle file
103
+
104
+ ```groovy
105
+ allprojects {
106
+ repositories {
107
+ maven {
108
+ url "https://repo.situm.es/artifactory/libs-release-local"
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ ### iOS
115
+
116
+ You'll need to add depedency in `PodFile`
117
+
118
+ ```js
119
+ target 'YourApp' do
120
+
121
+ pod 'ReactNativeSitumPlugin', :path => '../node_modules/@situm/react-native/ReactNativeSitumPlugin.podspec'
122
+
123
+ end
124
+ ```
125
+
126
+ You may need to add a Header Search Path: ([screenshot](https://reactnative.dev/docs/linking-libraries-ios.html#step-3))
127
+
128
+ ```bash
129
+ $(SRCROOT)/../node_modules/@situm/react-native/lib/ios
130
+ ```
131
+
132
+ ## Using the Plugin
133
+
134
+ ### Getting Started
135
+
136
+ Before start using our plugin in your own project, you can try out our [Getting Started sample app](./example/README.md) in your device.
137
+
138
+ ### Accessing plugin object
139
+
140
+ In order to use the plugin in a React Native component all you need is the following:
141
+
142
+ ```js
143
+ import SitumPlugin from "@situm/react-native";
144
+
145
+ SitumPlugin.fetchFloorsFromBuilding(building,
146
+ (floors) => {...},
147
+ (error) => {...},
148
+ );
149
+ ```
150
+
151
+ ### Methods
152
+
153
+ NOTE: This plugin is currently under development. There may be method not implemented yet. Also there may be some API changes as development progresses.
154
+
155
+ ### - initSitumSDK
156
+
157
+ Method that initialize the SDK. This method needs to be called once before using the rest of the methods.
158
+
159
+ ```js
160
+ SitumPlugin.initSitumSDK();
161
+ ```
162
+
163
+ #### - setDashboardURL
164
+
165
+ Set the environment that will be used to retrieve the data of your account. Return true if `url` was set successfully, otherwise false. The default environment is "https://dashboard.situm.com".
166
+
167
+ - **NOTE**: You must set the environment with this method before authenticating with `setUserPass()` or `setApiKey()`. In case you are authenticating with the `AndroidManifest.xml` fields, make sure the credentials specified there belong to the enviroment specified with this method.
168
+
169
+ ```js
170
+ SitumPlugin.setDashboardURL("https://dashboard.situm.com", (success: any) => {});
171
+ ```
172
+
173
+ #### - setApiKey
174
+
175
+ Log in into your Situm Account. This key is generated in Situm Dashboard. Return true if apiKey was set successfully, otherwise false.
176
+
177
+ ```js
178
+ SitumPlugin.setApiKey("SITUM_EMAIL","SITUM_API_KEY")
179
+ ```
180
+
181
+ #### - setUserPass
182
+
183
+ Provides user's email and password.
184
+
185
+ ```js
186
+ SitumPlugin.setUserPass("SITUM_EMAIL","SITUM_USER_PASSWORD")
187
+ ```
188
+
189
+ #### - setUseRemoteConfig
190
+
191
+ Set the remote configuration state which allows to use the configuration (location request) stored on the web to find the location of the user.
192
+
193
+ ```js
194
+ SitumPlugin.setUseRemoteConfig("true", (success: any) => {});
195
+ ```
196
+
197
+ #### - setCacheMaxAge
198
+
199
+ Sets the maximum age of a cached response in seconds.
200
+
201
+ ```js
202
+ SitumPlugin.setCacheMaxAge(1*60*60) // 1 hour
203
+ ```
204
+
205
+ #### - startPositioning
206
+
207
+ Starts the positioning system.
208
+
209
+ ```js
210
+ const locationOptions = {
211
+ buildingIdentifier: building.buildingIdentifier,
212
+ };
213
+
214
+ SitumPlugin.startPositioning(
215
+ (location) => {
216
+ // returns location object
217
+ console.log(JSON.stringy(location))
218
+ },
219
+ (status) => {
220
+ // returns positioning status
221
+ console.log(JSON.stringy(status))
222
+ },
223
+ (error: string) => {
224
+ // returns an error string
225
+ console.log(error)
226
+ },
227
+ locationOptions
228
+ )
229
+ ```
230
+
231
+ #### - stopPositioning
232
+
233
+ Stop the positioning system on current active listener.
234
+
235
+ ```js
236
+ SitumPlugin.stopPositioning((success: any) => {});
237
+ ```
238
+
239
+ #### - fetchBuildings
240
+
241
+ Download all the buildings for the current user.
242
+
243
+ ```js
244
+ const getBuildings = () => {
245
+ SitumPlugin.fetchBuildings(
246
+ (buildings) => {
247
+ // returns list of buildings
248
+ if (!buildings || buildings.length == 0)
249
+ alert(
250
+ 'No buildings, add a few buildings first by going to:\nhttps://dashboard.situm.es/buildings',
251
+ );
252
+ },
253
+ (error) => {
254
+ // returns an error string
255
+ },
256
+ );
257
+ };
258
+ ```
259
+
260
+ ### - fetchBuildingInfo
261
+
262
+ Download the information (floors, pois, ...) of a building.
263
+
264
+ ```js
265
+ const getBuildingInfo = () => {
266
+ SitumPlugin.fetchBuildingInfo(
267
+ building,
268
+ (buildingInfo) => {
269
+ // returns a building info object
270
+ },
271
+ (error) => {
272
+ // returns an error string
273
+ },
274
+ );
275
+ };
276
+ ```
277
+
278
+ #### - fetchFloorsFromBuilding
279
+
280
+ Download all the floors of a building.
281
+
282
+ ```js
283
+ const getFloorsFromBuilding = () => {
284
+ SitumPlugin.fetchFloorsFromBuilding(
285
+ building,
286
+ (floors) => {
287
+ // returns list of floors
288
+ },
289
+ (error) => {
290
+ // returns an error string
291
+ },
292
+ );
293
+ };
294
+ ```
295
+
296
+ #### - fetchIndoorPOIsFromBuilding
297
+
298
+ Download the indoor POIs of a building.
299
+
300
+ ```js
301
+ const getPOIsFromBuilding = () => {
302
+ SitumPlugin.fetchIndoorPOIsFromBuilding(
303
+ building,
304
+ (pois) => {
305
+ // returns list of POIs
306
+ },
307
+ (error) => {
308
+ //returns error string
309
+ }
310
+ );
311
+ };
312
+ ```
313
+
314
+ #### - fetchOutdoorPOIsFromBuilding
315
+
316
+ Download the outdoor POIs of a building.
317
+
318
+ ```js
319
+ const getPOIsFromBuilding = () => {
320
+ SitumPlugin.fetchOutdoorPOIsFromBuilding(
321
+ building,
322
+ (pois) => {
323
+ // returns list of POIs
324
+ },
325
+ (error) => {
326
+ // returns error string
327
+ }
328
+ );
329
+ };
330
+ ```
331
+
332
+ #### - fetchEventsFromBuilding
333
+
334
+ Download the events of a building.
335
+
336
+ ```js
337
+ const getEventsFromBuilding = () => {
338
+ SitumPlugin.fetchEventsFromBuilding(
339
+ building,
340
+ (events: any) => {
341
+ // returns list of events
342
+ },
343
+ (error) => {
344
+ //returns error string
345
+ }
346
+ );
347
+ };
348
+ ```
349
+
350
+ #### - fetchPoiCategories
351
+
352
+ Get all POI categories, download and cache their icons asynchronously.
353
+
354
+ ```js
355
+ const getPoiCategories = () => {
356
+ SitumPlugin.fetchPoiCategories(
357
+ (categories) => {
358
+ // returns list of categories
359
+ },
360
+ (error) => {
361
+ // returns error string
362
+ }
363
+ );
364
+ };
365
+ ```
366
+
367
+ #### - fetchMapFromFloor
368
+
369
+ Download the map image of a floor.
370
+
371
+ ```js
372
+ const getMapFromFloor = (floor) => {
373
+ SitumPlugin.fetchMapFromFloor(
374
+ floor,
375
+ (map) => {
376
+ // map image in Base64 format
377
+ },
378
+ (error) => {
379
+ // returns error string
380
+ },
381
+ );
382
+ };
383
+ ```
384
+
385
+ #### - fetchPoiCategoryIconNormal
386
+
387
+ Get the normal category icon for a POICategory.
388
+
389
+ ```js
390
+ const getPoiCategoryIconNormal = (category) => {
391
+ SitumPlugin.fetchPoiCategoryIconNormal(
392
+ category,
393
+ (icon) => {
394
+ // returns base64 icon
395
+ },
396
+ (error) => {
397
+ //returns error string
398
+ }
399
+ );
400
+ };
401
+ ```
402
+
403
+ #### - fetchPoiCategoryIconSelected
404
+
405
+ Get the selected category icon for a POICategory.
406
+
407
+ ```js
408
+ const getPoiCategoryIconSelected = (category) => {
409
+ SitumPlugin.fetchPoiCategoryIconSelected(
410
+ category,
411
+ (icon) => {
412
+ // returns base64 icon
413
+ },
414
+ (error) => {
415
+ // returns error string
416
+ }
417
+ );
418
+ };
419
+ ```
420
+
421
+ #### - invalidateCache
422
+
423
+ Invalidate all the resources in the cache.
424
+
425
+ ```js
426
+ SitumPlugin.invalidateCache();
427
+ ```
428
+
429
+ #### - requestDirections
430
+
431
+ Calculates a route between two points. Note that you can also specify the [accessibility mode](https://situm.com/docs/wayfinding/#route-types). The values allowed for this parameter are: `'CHOOSE_SHORTEST', 'ONLY_ACCESSIBLE'` or `'ONLY_NOT_ACCESSIBLE_FLOOR_CHANGES'`.
432
+
433
+ ```js
434
+
435
+ // Set the accessibility mode used on route computation
436
+ const directionOptions = {
437
+ accessibilityMode: 'CHOOSE_SHORTEST'
438
+ };
439
+
440
+ const points = [
441
+ {
442
+ floorIdentifier: floor.floorIdentifier,
443
+ buildingIdentifier: building.buildingIdentifier,
444
+ coordinate: {latitude:41.37968, longitude:2.1460623},
445
+ },
446
+ {
447
+ floorIdentifier: floor.floorIdentifier,
448
+ buildingIdentifier: building.buildingIdentifier,
449
+ coordinate: {latitude:41.375566, longitude:2.1467063},
450
+ }
451
+ ];
452
+
453
+ SitumPlugin.requestDirections(
454
+ [building, ...points, {...directionOptions}],
455
+ (route) => {
456
+ // returns route object
457
+ let latlngs = [];
458
+ for (let segment of route.segments) {
459
+ for (let point of segment.points) {
460
+ latlngs.push({
461
+ latitude: point.coordinate.latitude,
462
+ longitude: point.coordinate.longitude,
463
+ });
464
+ }
465
+ }
466
+ setPolylineLatlng(latlngs);
467
+ },
468
+ (error) => {
469
+ // returns error string
470
+ console.log(error);
471
+ }
472
+ );
473
+ ```
474
+
475
+ #### - requestNavigationUpdates
476
+
477
+ Necessary step to request progress. Alone this method does not provide progress object. You must feed navigation API with location, as indicated on updateNavigationWithLocation section.
478
+
479
+ ```js
480
+ const requestNavigationUpdates = () => {
481
+ SitumPlugin.requestNavigationUpdates(
482
+ (navigation) => {
483
+ //returns navigation object
484
+ },
485
+ (error) => {
486
+ //returns error string
487
+ },
488
+ {
489
+ distanceToGoalThreshold: 3,
490
+ outsideRouteThreshold: 50
491
+ }
492
+ );
493
+ };
494
+ ```
495
+
496
+ #### - updateNavigationWithLocation
497
+
498
+ Usually, position variable should be one of the locations provided by the system on the [startPositioning](#--startpositioning) function.
499
+
500
+ ```js
501
+ SitumPlugin.updateNavigationWithLocation(currentLocation)
502
+ ```
503
+
504
+ #### - removeNavigationUpdates
505
+
506
+ When you are no longer interested on Navigation Updates you should call this method to remove internal allocated resources.
507
+
508
+ ```js
509
+ SitumPlugin.removeNavigationUpdates();
510
+ ```
511
+
512
+ #### - requestRealTimeUpdates
513
+
514
+ Emits the real time location of devices
515
+
516
+ ```js
517
+ const requestRealtime = () => {
518
+ SitumPlugin.requestRealTimeUpdates(
519
+ (locations) => {
520
+ // returns list of locations
521
+ },
522
+ (error) => {
523
+ // returns error string
524
+ },
525
+ { building: building, pollTime: 3000 }
526
+ );
527
+ };
528
+ ```
529
+
530
+ #### - removeRealTimeUpdates
531
+
532
+ When you are no longer interested on realtime location Updates you should call this method to remove internal allocated resources.
533
+
534
+ ```js
535
+ SitumPlugin.removeRealTimeUpdates();
536
+ ```
537
+
538
+ #### - checkIfPointInsideGeofence
539
+
540
+ Checks if a point on the map is inside a geofence
541
+
542
+ ```js
543
+ SitumPlugin.checkIfPointInsideGeofence(
544
+ { coordinate: coordinate },
545
+ (response) => {
546
+ // returns geofence name and id if point is inside a geofence
547
+ }
548
+ );
549
+ ```
550
+
551
+ #### - requestAuthorization
552
+
553
+ Request location permissions on Android & iOS.
554
+
555
+ ```js
556
+ SitumPlugin.requestAuthorization()
557
+ ```
558
+
559
+ #### - sdkVersions
560
+
561
+ Returns iOS, Android and react native SDK versions depending on the platform the app is running on.
562
+
563
+ ```js
564
+ SitumPlugin.sdkVersions(response => {
565
+ // e.g. {ios: "2.45.0", android: "1.60@aar", react_native:"0.0.3"}
566
+ });
567
+ ```
568
+
569
+ #### - getDeviceId
570
+
571
+ Returns user's device Id generated by SitumSDK
572
+
573
+ ```js
574
+ SitumPlugin.getDeviceId(response => {
575
+ // e.g. {deviceId: 12345678}
576
+ });
577
+ ```
578
+
579
+ #### - onEnterGeofences
580
+
581
+ Get notified about entering geofences. Take into account:
582
+
583
+ - This method must be called **before** the positioning is started.
584
+ - Positioning geofences (with `trainer_metadata` custom field) won't be notified.
585
+ - This callback only work with indoor locations. Any outdoor location will produce a call to [onExitedGeofences](#--onExitedGeofences) with the last positioned geofences as argument.
586
+
587
+ ```js
588
+ SitumPlugin.onEnterGeofences((geofences) => {
589
+ // e.g. [
590
+ // {"polygonPoints": [], "customFields": {}, "updatedAt": "Thu Jan 01 01:00:00 +0100 1970", "buildingIdentifier": "1234", "floorIdentifier": "123456", "code": "", "createdAt": "Thu Jan 01 01:00:00 +0100 1970", "infoHtml": "", "name": "My Geofence", "identifier": "12345678-aaaa-bbbb-cccc-12345678abcd"}
591
+ // ]
592
+ });
593
+ ```
594
+
595
+ #### - onExitGeofences
596
+
597
+ Get notified about exiting geofences. Take into account the considerations described at [onEnterGeofences](#--onEnterGeofences).
598
+
599
+ ## Development
600
+
601
+ ### Run the tests
602
+
603
+ ```bash
604
+ yarn test
605
+ ```
606
+
607
+ Situm-React-Native-Plugin is licensed under [MIT License](https://opensource.org/licenses/MIT)
608
+
609
+ ### Build the library
610
+
611
+
612
+ ```bash
613
+ yarn run prepare
614
+ ```
615
+
616
+ More info is available at our [Developers Page](http://developers.situm.com/pages/mobile/react-native/).
617
+
618
+ ### Release version
619
+
620
+ ```bash
621
+ yarn run prepare
622
+ npm pack
623
+ npm publish
624
+ ```
625
+
626
+ or for beta channel
627
+
628
+ ```bash
629
+ npm publish --tag beta
630
+ ```
631
+
632
+ ## Support information
633
+
634
+ For any question or bug report, please send an email to [support@situm.com](mailto:support@situm.com)
635
+
636
+ ## Versioning
637
+
638
+ Please refer to [CHANGELOG.md](./CHANGELOG.md) for a list of notable changes for each version of the plugin.
639
+
640
+ You can also see the [tags on this repository](https://github.com/situmtech/situm-react-native-wayfinding/tags).
641
+
642
+ ## Submitting contributions
643
+
644
+ You will need to sign a Contributor License Agreement (CLA) before making a submission. [Learn more here](https://situm.com/contributions/).
645
+
646
+ ## License
647
+
648
+ This project is licensed under the MIT - see the [LICENSE](./LICENSE) file for further details.
649
+
650
+ ## More information
651
+
652
+ More info is available at our [Developers Page](https://situm.com/docs/01-introduction/).
653
+
654
+ ## Support information
655
+
656
+ For any question or bug report, please send an email to [support@situm.es](mailto:support@situm.es)
@@ -0,0 +1,22 @@
1
+ require "json"
2
+ package = JSON.parse(File.read('package.json'))
3
+
4
+ Pod::Spec.new do |s|
5
+ s.name = "ReactNativeSitumPlugin"
6
+ s.version = package['version']
7
+ s.summary = "Situm react native plugin"
8
+ s.homepage = "https://github.com/author/situm-react-native-plugin.git"
9
+ s.license = "../LICENSE"
10
+ s.author = { "Situm Technologies S.L." => "situm@situm.com" }
11
+ s.platform = :ios, "8.0"
12
+ s.source = { :http => 'file:' + __dir__ + '/' }
13
+ s.source_files = "ios/*.{h,m}"
14
+ s.requires_arc = true
15
+
16
+
17
+ s.dependency "React"
18
+ s.dependency "SitumSDK", package['sdkVersions']["ios"]
19
+
20
+ end
21
+
22
+
@@ -0,0 +1,9 @@
1
+ Please read [security.txt](https://github.com/situmtech/situm-react-native-plugin/blob/master/security.txt)
2
+ to report any security vulnerabilities. We will acknowledge receipt of your
3
+ vulnerability report and strive to send you regular updates about our
4
+ progress. If you're curious about the status of your disclosure please
5
+ feel free to email us again.
6
+
7
+ Please refrain from requesting compensation for reporting vulnerabilities.
8
+ If you want we will publicly acknowledge your responsible disclosure,
9
+ once the issue is fixed.
File without changes