@situm/react-native 3.0.0-beta.0 → 3.0.0-beta.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/README.md +60 -506
- package/android/.gradle/5.6.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/android.iml +9 -0
- package/android/.idea/gradle.xml +13 -0
- package/android/.idea/modules.xml +8 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/.idea/workspace.xml +63 -0
- package/android/local.properties +8 -0
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/sdk/types/index.d.js +349 -0
- package/lib/commonjs/sdk/types/index.d.js.map +1 -1
- package/lib/commonjs/utils/requestPermission.js +2 -2
- package/lib/commonjs/utils/requestPermission.js.map +1 -1
- package/lib/commonjs/wayfinding/components/MapView.js +97 -12
- package/lib/commonjs/wayfinding/components/MapView.js.map +1 -1
- package/lib/commonjs/wayfinding/hooks/index.js +40 -80
- package/lib/commonjs/wayfinding/hooks/index.js.map +1 -1
- package/lib/commonjs/wayfinding/store/index.js +8 -28
- package/lib/commonjs/wayfinding/store/index.js.map +1 -1
- package/lib/commonjs/wayfinding/utils/mapper.js +6 -4
- package/lib/commonjs/wayfinding/utils/mapper.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/sdk/types/index.d.js +373 -1
- package/lib/module/sdk/types/index.d.js.map +1 -1
- package/lib/module/utils/requestPermission.js +2 -2
- package/lib/module/utils/requestPermission.js.map +1 -1
- package/lib/module/wayfinding/components/MapView.js +97 -11
- package/lib/module/wayfinding/components/MapView.js.map +1 -1
- package/lib/module/wayfinding/hooks/index.js +8 -49
- package/lib/module/wayfinding/hooks/index.js.map +1 -1
- package/lib/module/wayfinding/store/index.js +3 -24
- package/lib/module/wayfinding/store/index.js.map +1 -1
- package/lib/module/wayfinding/utils/mapper.js +6 -4
- package/lib/module/wayfinding/utils/mapper.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/wayfinding/components/MapView.d.ts +5 -2
- package/lib/typescript/src/wayfinding/components/MapView.d.ts.map +1 -1
- package/lib/typescript/src/wayfinding/hooks/index.d.ts +3 -12
- package/lib/typescript/src/wayfinding/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/wayfinding/store/index.d.ts +3 -62
- package/lib/typescript/src/wayfinding/store/index.d.ts.map +1 -1
- package/lib/typescript/src/wayfinding/utils/mapper.d.ts +3 -2
- package/lib/typescript/src/wayfinding/utils/mapper.d.ts.map +1 -1
- package/package.json +12 -9
- package/src/index.ts +1 -0
- package/src/sdk/types/index.d.ts +80 -0
- package/src/utils/requestPermission.ts +2 -2
- package/src/wayfinding/components/MapView.tsx +329 -217
- package/src/wayfinding/hooks/index.ts +17 -78
- package/src/wayfinding/store/index.tsx +13 -80
- package/src/wayfinding/types/index.d.ts +10 -11
- package/src/wayfinding/utils/mapper.ts +16 -13
package/README.md
CHANGED
|
@@ -22,21 +22,22 @@ Situm React Native Plugin is a set of utilities that allow any developer to buil
|
|
|
22
22
|
|
|
23
23
|
This plugin has two parts:
|
|
24
24
|
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
- The base SDK, the building blocks that allow you to:
|
|
26
|
+
|
|
27
|
+
- obtain information related to buildings where Situm's positioning system is already configured: floorplans, points of interest, geotriggered events, etc.
|
|
28
|
+
- retrieve the location of the smartphone inside these buildings (position, orientation, and floor where the smartphone is).
|
|
29
|
+
- 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).
|
|
30
|
+
- trigger notifications when the user enters a certain area.
|
|
31
|
+
|
|
32
|
+
- A full featured and easy to integrate React Native component that allows you to:
|
|
33
|
+
- show your cartography on a map
|
|
34
|
+
- show the user location on the map
|
|
35
|
+
- calculate point-to-point wayfinging routes
|
|
36
|
+
- explore points of interest on your buildings on the map
|
|
36
37
|
|
|
37
38
|

|
|
38
39
|
|
|
39
|
-
## Table of contents
|
|
40
|
+
<!-- ## Table of contents
|
|
40
41
|
|
|
41
42
|
- [Setup your account](#setup-your-account)
|
|
42
43
|
- [Installing pre-requisites](#installing-pre-requisites)
|
|
@@ -47,59 +48,44 @@ This plugin has two parts:
|
|
|
47
48
|
- [Submitting Contributions](#submitting-contributions)
|
|
48
49
|
- [License](#license)
|
|
49
50
|
- [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.
|
|
51
|
+
- [Support information](#support-information) -->
|
|
55
52
|
|
|
56
|
-
|
|
53
|
+
## Getting started
|
|
57
54
|
|
|
58
|
-
|
|
55
|
+
There is a comprehensive tutorial on how to set-up a new application using this plugin on the Situm [documentation page](https://situm.com/docs/a-basic-react-native-app/).
|
|
59
56
|
|
|
60
|
-
|
|
57
|
+
Below you will find the basic steps to install and configure the plugin on your React Native project. These steps have already been done for you in the example application of this repository, but they are required for other projects.
|
|
61
58
|
|
|
62
|
-
|
|
59
|
+
## Running the example
|
|
63
60
|
|
|
64
|
-
|
|
61
|
+
Check the [example/README](./example/README.md) file of this repository to create your first React Native application using Situm React Native. In this example app you will find example screens for each method the plugin exposes.
|
|
65
62
|
|
|
66
|
-
|
|
63
|
+
### Configure the plugin on your React Native project
|
|
67
64
|
|
|
68
|
-
###
|
|
65
|
+
### Install the plugin
|
|
69
66
|
|
|
70
67
|
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
68
|
|
|
72
|
-
|
|
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
|
|
69
|
+
To add the Situm dependency to your React Native project, you can use the `yarn` or `npm` command. To add this dependency to your project, you can use the following command in your terminal:
|
|
77
70
|
|
|
78
71
|
```shell
|
|
79
|
-
yarn add
|
|
72
|
+
yarn add @situm/react-native react-native-webview react-native-permissions
|
|
80
73
|
|
|
81
74
|
#OR
|
|
82
75
|
|
|
83
|
-
npm install --save
|
|
76
|
+
npm install --save @situm/react-native react-native-webview react-native-permissions
|
|
84
77
|
```
|
|
85
78
|
|
|
86
|
-
|
|
79
|
+
### Set up your Situm credentials
|
|
87
80
|
|
|
88
|
-
|
|
81
|
+
Create a new `situm.tsx` file with your Situm credentials. You can use the contents of [example/src/situm.tsx](./example/src/situm.tsx) as example.
|
|
89
82
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
```shell
|
|
93
|
-
yarn add @situm/react-native
|
|
94
|
-
|
|
95
|
-
#OR
|
|
96
|
-
|
|
97
|
-
npm install --save @situm/react-native
|
|
98
|
-
```
|
|
83
|
+
Follow the [Wayfinding guide](https://situm.com/docs/first-steps-for-wayfinding/) if you haven't set
|
|
84
|
+
up a Situm account.
|
|
99
85
|
|
|
100
86
|
### Android
|
|
101
87
|
|
|
102
|
-
|
|
88
|
+
1. Include the Situm repository in your project level `build.gradle`:
|
|
103
89
|
|
|
104
90
|
```groovy
|
|
105
91
|
allprojects {
|
|
@@ -111,11 +97,19 @@ allprojects {
|
|
|
111
97
|
}
|
|
112
98
|
```
|
|
113
99
|
|
|
100
|
+
2. Add the `ACCESS_FINE_LOCATION` permission to your `AndroidManifest.xml` file if you have configured Situm SDK to [use GPS](<https://developers.situm.com/sdk_documentation/android/javadoc/latest/es/situm/sdk/location/locationrequest#useGps()>):
|
|
101
|
+
|
|
102
|
+
```xml
|
|
103
|
+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
3. Set the `minSdkVersion` to 21 or later on your app's `build.gradle` file.
|
|
107
|
+
|
|
114
108
|
### iOS
|
|
115
109
|
|
|
116
|
-
|
|
110
|
+
1. Add depedency in `PodFile`
|
|
117
111
|
|
|
118
|
-
```
|
|
112
|
+
```ruby
|
|
119
113
|
target 'YourApp' do
|
|
120
114
|
|
|
121
115
|
pod 'ReactNativeSitumPlugin', :path => '../node_modules/@situm/react-native/ReactNativeSitumPlugin.podspec'
|
|
@@ -129,472 +123,33 @@ You may need to add a Header Search Path: ([screenshot](https://reactnative.dev/
|
|
|
129
123
|
$(SRCROOT)/../node_modules/@situm/react-native/lib/ios
|
|
130
124
|
```
|
|
131
125
|
|
|
132
|
-
|
|
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
|
|
126
|
+
2. Declare the following permissions in your app's `Info.plist` file to successfully start positioning:
|
|
497
127
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
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
|
-
);
|
|
128
|
+
```xml
|
|
129
|
+
<key>NSLocationWhenInUseUsageDescription</key>
|
|
130
|
+
<string>Location is required to find out where you are</string>
|
|
131
|
+
<key>NSBluetoothPeripheralUsageDescription</key>
|
|
132
|
+
<string>Bluetooth is required to find out where you are</string>
|
|
133
|
+
<key>NSLocationAlwaysUsageDescription</key>
|
|
134
|
+
<string>Location is required to find out where you are</string>
|
|
135
|
+
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
|
136
|
+
<string>Location is required to find out where you are</string>
|
|
137
|
+
<key>NSBluetoothAlwaysUsageDescription</key>
|
|
138
|
+
<string>Bluetooth is required to find out where you are</string>
|
|
549
139
|
```
|
|
550
140
|
|
|
551
|
-
|
|
141
|
+
3. For offline support you will have to add the underlying web application's domain inside the entry `WKAppBoundDomains` on `Info.plist` as follows:
|
|
552
142
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
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
|
-
});
|
|
143
|
+
```xml
|
|
144
|
+
<key>WKAppBoundDomains</key>
|
|
145
|
+
<array>
|
|
146
|
+
<string>map-viewer.situm.com</string>
|
|
147
|
+
</array>
|
|
567
148
|
```
|
|
568
149
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
Returns user's device Id generated by SitumSDK
|
|
572
|
-
|
|
573
|
-
```js
|
|
574
|
-
SitumPlugin.getDeviceId(response => {
|
|
575
|
-
// e.g. {deviceId: 12345678}
|
|
576
|
-
});
|
|
577
|
-
```
|
|
150
|
+
## Migrate from the old Situm React Native Wayfinding plugin
|
|
578
151
|
|
|
579
|
-
|
|
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).
|
|
152
|
+
The new [Situm React Native](https://www.npmjs.com/package/@situm/react-native) package breaks compatibility with the previous Situm React Native Wayfinding plugin. Integrating the new version is simpler and more straightforward. If you want to migrate your application, follow the steps described in the [Situm documentation](https://situm.com/docs/react-native-wayfinding-migration-guide).
|
|
598
153
|
|
|
599
154
|
## Development
|
|
600
155
|
|
|
@@ -608,7 +163,6 @@ Situm-React-Native-Plugin is licensed under [MIT License](https://opensource.org
|
|
|
608
163
|
|
|
609
164
|
### Build the library
|
|
610
165
|
|
|
611
|
-
|
|
612
166
|
```bash
|
|
613
167
|
yarn run prepare
|
|
614
168
|
```
|
|
@@ -637,7 +191,7 @@ For any question or bug report, please send an email to [support@situm.com](mail
|
|
|
637
191
|
|
|
638
192
|
Please refer to [CHANGELOG.md](./CHANGELOG.md) for a list of notable changes for each version of the plugin.
|
|
639
193
|
|
|
640
|
-
You can also see the [tags on this repository](https://github.com/situmtech/situm-react-native
|
|
194
|
+
You can also see the [tags on this repository](https://github.com/situmtech/situm-react-native/tags).
|
|
641
195
|
|
|
642
196
|
## Submitting contributions
|
|
643
197
|
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
|
6
|
+
<orderEntry type="inheritedJdk" />
|
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
+
</component>
|
|
9
|
+
</module>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="GradleSettings">
|
|
4
|
+
<option name="linkedExternalProjectsSettings">
|
|
5
|
+
<GradleProjectSettings>
|
|
6
|
+
<option name="testRunner" value="GRADLE" />
|
|
7
|
+
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
8
|
+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
9
|
+
<option name="gradleJvm" value="11" />
|
|
10
|
+
</GradleProjectSettings>
|
|
11
|
+
</option>
|
|
12
|
+
</component>
|
|
13
|
+
</project>
|