@situm/react-native 3.15.0 → 3.15.1-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.
- package/README.md +187 -0
- package/lib/commonjs/sdk/index.js +9 -9
- package/lib/commonjs/sdk/types/index.js +99 -342
- package/lib/commonjs/sdk/types/index.js.map +1 -1
- package/lib/module/sdk/index.js +9 -9
- package/lib/module/sdk/types/index.js +90 -333
- package/lib/module/sdk/types/index.js.map +1 -1
- package/lib/typescript/sdk/index.d.ts +9 -9
- package/lib/typescript/sdk/types/index.d.ts +224 -289
- package/lib/typescript/sdk/types/index.d.ts.map +1 -1
- package/lib/typescript/wayfinding/components/MapView.d.ts +2 -2
- package/package.json +3 -3
- package/src/sdk/index.ts +9 -9
- package/src/sdk/types/index.ts +224 -295
- package/src/wayfinding/components/MapView.tsx +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
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
|
+
[Situm Wayfinding](https://situm.com/wayfinding) for React Native. Integrate plug&play navigation experience with indoor maps, routes and turn-by-turn directions in no time. With the power of [Situm](https://www.situm.com/).
|
|
6
|
+
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<div align="center" style="text-align:center">
|
|
10
|
+
|
|
11
|
+
[](https://opensource.org/licenses/MIT)
|
|
12
|
+

|
|
13
|
+

|
|
14
|
+
[](https://github.com/ellerbrock/typescript-badges/)
|
|
15
|
+

|
|
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 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
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
<!-- ## Table of contents
|
|
41
|
+
|
|
42
|
+
- [Setup your account](#setup-your-account)
|
|
43
|
+
- [Installing pre-requisites](#installing-pre-requisites)
|
|
44
|
+
- [Using the Plugin](#using-the-plugin)
|
|
45
|
+
- [Getting Started](#getting-started)
|
|
46
|
+
- [Accessing plugin object](#accessing-plugin-object)
|
|
47
|
+
- [Methods](#methods)
|
|
48
|
+
- [Submitting Contributions](#submitting-contributions)
|
|
49
|
+
- [License](#license)
|
|
50
|
+
- [More information](#more-information)
|
|
51
|
+
- [Support information](#support-information) -->
|
|
52
|
+
|
|
53
|
+
## Getting started
|
|
54
|
+
|
|
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/).
|
|
56
|
+
|
|
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.
|
|
58
|
+
|
|
59
|
+
## Running the example
|
|
60
|
+
|
|
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.
|
|
62
|
+
|
|
63
|
+
### Configure the plugin on your React Native project
|
|
64
|
+
|
|
65
|
+
#### Install the plugin
|
|
66
|
+
|
|
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)
|
|
68
|
+
|
|
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:
|
|
70
|
+
|
|
71
|
+
```shell
|
|
72
|
+
yarn add @situm/react-native react-native-webview
|
|
73
|
+
|
|
74
|
+
#OR
|
|
75
|
+
|
|
76
|
+
npm install --save @situm/react-native react-native-webview
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Set up your Situm credentials
|
|
80
|
+
|
|
81
|
+
Follow the [Wayfinding guide](https://situm.com/docs/first-steps-for-wayfinding/) if you haven't set up a Situm account.
|
|
82
|
+
After that, authenticate your app by calling the `setApiKey()` method.
|
|
83
|
+
|
|
84
|
+
```TypeScript
|
|
85
|
+
SitumPlugin.init();
|
|
86
|
+
SitumPlugin.setApiKey("YOUR_SITUM_API_KEY");
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
#### Android
|
|
90
|
+
|
|
91
|
+
1. 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()>):
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
3. Set the `minSdkVersion` to 21 or later on your app's `build.gradle` file.
|
|
98
|
+
|
|
99
|
+
#### iOS
|
|
100
|
+
|
|
101
|
+
1. Add depedency in `PodFile`
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
target 'YourApp' do
|
|
105
|
+
|
|
106
|
+
pod 'ReactNativeSitumPlugin', :path => '../node_modules/@situm/react-native/ReactNativeSitumPlugin.podspec'
|
|
107
|
+
|
|
108
|
+
end
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
You may need to add a Header Search Path: ([screenshot](https://reactnative.dev/docs/linking-libraries-ios.html#step-3))
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
$(SRCROOT)/../node_modules/@situm/react-native/lib/ios
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
2. Declare the following permissions in your app's `Info.plist` file to successfully start positioning:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
<key>NSLocationWhenInUseUsageDescription</key>
|
|
121
|
+
<string>Location is required to find out where you are</string>
|
|
122
|
+
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
|
123
|
+
<string>Location is required to find out where you are</string>
|
|
124
|
+
<key>NSMotionUsageDescription</key>
|
|
125
|
+
<string>We use your phone sensors (giroscope, accelerometer and altimeter) to improve location quality</string>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
3. For offline support you will have to add the underlying web application's domain inside the entry `WKAppBoundDomains` on `Info.plist` as follows:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
<key>WKAppBoundDomains</key>
|
|
132
|
+
<array>
|
|
133
|
+
<string>maps.situm.com</string>
|
|
134
|
+
</array>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Migrate from the old Situm React Native Wayfinding plugin
|
|
138
|
+
|
|
139
|
+
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).
|
|
140
|
+
|
|
141
|
+
## Development
|
|
142
|
+
|
|
143
|
+
### Prepare for development
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
yarn
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Run the tests
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
yarn test
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Situm-React-Native-Plugin is licensed under [MIT License](https://opensource.org/licenses/MIT)
|
|
156
|
+
|
|
157
|
+
This will also generate the docs (see next section). More info is available at our [Developers Page](http://developers.situm.com/pages/mobile/react-native/).
|
|
158
|
+
|
|
159
|
+
### Build the documentation
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
yarn run doc
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Docs will be available in the _docs/_ folder.
|
|
166
|
+
|
|
167
|
+
## Versioning
|
|
168
|
+
|
|
169
|
+
Please refer to [CHANGELOG.md](./CHANGELOG.md) for a list of notable changes for each version of the plugin.
|
|
170
|
+
|
|
171
|
+
You can also see the [tags on this repository](https://github.com/situmtech/situm-react-native/tags).
|
|
172
|
+
|
|
173
|
+
## Submitting contributions
|
|
174
|
+
|
|
175
|
+
You will need to sign a Contributor License Agreement (CLA) before making a submission. [Learn more here](https://situm.com/contributions/).
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
This project is licensed under the MIT - see the [LICENSE](./LICENSE) file for further details.
|
|
180
|
+
|
|
181
|
+
## More information
|
|
182
|
+
|
|
183
|
+
More info is available at our [Developers Page](https://situm.com/docs/01-introduction/).
|
|
184
|
+
|
|
185
|
+
## Support information
|
|
186
|
+
|
|
187
|
+
For any question or bug report, please send an email to [support@situm.es](mailto:support@situm.es)
|
|
@@ -199,7 +199,7 @@ class SitumPlugin {
|
|
|
199
199
|
* if it is not already initialised.
|
|
200
200
|
*
|
|
201
201
|
* @returns void
|
|
202
|
-
* @
|
|
202
|
+
* @throws Exception
|
|
203
203
|
*/
|
|
204
204
|
static init = () => {
|
|
205
205
|
_registerCallbacks();
|
|
@@ -217,7 +217,7 @@ class SitumPlugin {
|
|
|
217
217
|
* @param apiKey user's apikey.
|
|
218
218
|
*
|
|
219
219
|
* @returns void
|
|
220
|
-
* @
|
|
220
|
+
* @throws Exception
|
|
221
221
|
*/
|
|
222
222
|
static setApiKey = apiKey => {
|
|
223
223
|
return (0, _utils.exceptionWrapper)(({
|
|
@@ -239,7 +239,7 @@ class SitumPlugin {
|
|
|
239
239
|
* @param password user's password.
|
|
240
240
|
*
|
|
241
241
|
* @returns void
|
|
242
|
-
* @
|
|
242
|
+
* @throws Exception
|
|
243
243
|
*/
|
|
244
244
|
static setUserPass = (email, password) => {
|
|
245
245
|
return (0, _utils.exceptionWrapper)(({
|
|
@@ -257,7 +257,7 @@ class SitumPlugin {
|
|
|
257
257
|
* @param url user's email.
|
|
258
258
|
*
|
|
259
259
|
* @returns void
|
|
260
|
-
* @
|
|
260
|
+
* @throws Exception
|
|
261
261
|
*/
|
|
262
262
|
|
|
263
263
|
static setDashboardURL = url => {
|
|
@@ -278,7 +278,7 @@ class SitumPlugin {
|
|
|
278
278
|
* @param useRemoteConfig
|
|
279
279
|
*
|
|
280
280
|
* @returns void
|
|
281
|
-
* @
|
|
281
|
+
* @throws Exception
|
|
282
282
|
*/
|
|
283
283
|
static setUseRemoteConfig = useRemoteConfig => {
|
|
284
284
|
return (0, _utils.exceptionWrapper)(({
|
|
@@ -294,7 +294,7 @@ class SitumPlugin {
|
|
|
294
294
|
* Sets the max seconds the cache is valid
|
|
295
295
|
*
|
|
296
296
|
* @returns void
|
|
297
|
-
* @
|
|
297
|
+
* @throws Exception
|
|
298
298
|
*/
|
|
299
299
|
static setMaxCacheAge = cacheAge => {
|
|
300
300
|
return (0, _utils.exceptionWrapper)(({
|
|
@@ -312,7 +312,7 @@ class SitumPlugin {
|
|
|
312
312
|
* @param options {@link ConfigurationOptions}
|
|
313
313
|
*
|
|
314
314
|
* @returns void
|
|
315
|
-
* @
|
|
315
|
+
* @throws Exception
|
|
316
316
|
*/
|
|
317
317
|
static setConfiguration = options => {
|
|
318
318
|
return (0, _utils.exceptionWrapper)(() => {
|
|
@@ -331,7 +331,7 @@ class SitumPlugin {
|
|
|
331
331
|
* Invalidate all the resources in the cache
|
|
332
332
|
*
|
|
333
333
|
* @returns void
|
|
334
|
-
* @
|
|
334
|
+
* @throws Exception
|
|
335
335
|
*/
|
|
336
336
|
static invalidateCache = () => {
|
|
337
337
|
return (0, _utils.exceptionWrapper)(() => {
|
|
@@ -346,7 +346,7 @@ class SitumPlugin {
|
|
|
346
346
|
* Gets the list of versions for the current plugin and environment
|
|
347
347
|
*
|
|
348
348
|
* @returns void
|
|
349
|
-
* @
|
|
349
|
+
* @throws Exception
|
|
350
350
|
*/
|
|
351
351
|
static sdkVersion = () => {
|
|
352
352
|
return (0, _utils.exceptionWrapper)(({
|