@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
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {};
7
+ exports.default = void 0;
8
+ var _sdk = _interopRequireDefault(require("./sdk"));
9
+ var _index = require("./sdk/types/index.d");
10
+ Object.keys(_index).forEach(function (key) {
11
+ if (key === "default" || key === "__esModule") return;
12
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
13
+ if (key in exports && exports[key] === _index[key]) return;
14
+ Object.defineProperty(exports, key, {
15
+ enumerable: true,
16
+ get: function () {
17
+ return _index[key];
18
+ }
19
+ });
20
+ });
21
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
+ // Definitions
23
+ var _default = _sdk.default;
24
+ exports.default = _default;
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_sdk","_interopRequireDefault","require","_index","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","obj","__esModule","default","_default","SitumPlugin"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,MAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAAoC,SAAAN,uBAAAe,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AADpC;AAAA,IAAAG,QAAA,GAGeC,YAAW;AAAAR,OAAA,CAAAM,OAAA,GAAAC,QAAA"}
@@ -0,0 +1,399 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _invariant = _interopRequireDefault(require("invariant"));
8
+ var _reactNative = require("react-native");
9
+ var _package = _interopRequireDefault(require("../../package.json"));
10
+ var _utils = require("./utils");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ /* eslint-disable @typescript-eslint/no-explicit-any */
13
+ /* eslint-disable @typescript-eslint/ban-types */
14
+
15
+ const LINKING_ERROR = `The package 'situm-react-native-plugin' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
16
+ ios: "- You have run 'pod install'\n",
17
+ default: ""
18
+ }) + "- You rebuilt the app after installing the package\n" + "- You are not using Expo managed workflow\n";
19
+ const RNCSitumPlugin = _reactNative.NativeModules.RNCSitumPlugin ? _reactNative.NativeModules.RNCSitumPlugin : new Proxy({}, {
20
+ get() {
21
+ throw new Error(LINKING_ERROR);
22
+ }
23
+ });
24
+ const SitumPluginEventEmitter = new _reactNative.NativeEventEmitter(RNCSitumPlugin);
25
+ let positioningSubscriptions = [];
26
+ let navigationSubscriptions = [];
27
+ let realtimeSubscriptions = [];
28
+ var _default = {
29
+ /**
30
+ * Initializes SDK.
31
+ *
32
+ * You have to call this function prior any call to other method.
33
+ * This method can be safely called many times as it will only initialise the SDK
34
+ * if it is not already initialised.
35
+ */
36
+ initSitumSDK: function () {
37
+ RNCSitumPlugin.initSitumSDK();
38
+ },
39
+ /**
40
+ * Provides your API key to the Situm SDK.
41
+ *
42
+ * This key is generated for your application in the Dashboard.
43
+ * Old credentials will be removed.
44
+ *
45
+ * @param email user's email.
46
+ * @param apiKey user's apikey.
47
+ * @param onSuccess callback to use when the function returns successfully
48
+ */
49
+ setApiKey: function (email, apiKey, onSuccess) {
50
+ RNCSitumPlugin.setApiKey(email, apiKey, onSuccess);
51
+ },
52
+ /**
53
+ * Provides user's email and password. This credentials will be used to obtain a
54
+ * valid user token to authenticate the server request, when necessary. Token
55
+ * obtaining is not necessary done when this method is executed. Old credentials
56
+ * will be removed.
57
+ *
58
+ * @param email user's email.
59
+ * @param password user's password.
60
+ * @param onSuccess callback to use when the function returns successfully
61
+ */
62
+ setUserPass: function (email, password, onSuccess) {
63
+ RNCSitumPlugin.setUserPass(email, password, onSuccess);
64
+ },
65
+ setDashboardURL: function (url, success) {
66
+ RNCSitumPlugin.setDashboardURL(url, success);
67
+ },
68
+ /**
69
+ * Set to true if you want the SDK to download the configuration from the Situm API
70
+ * and use it by default. Right now it only affects the LocationRequest.
71
+ * Default value is true from SDK version 2.83.5
72
+ *
73
+ * @param useRemoteConfig boolean
74
+ * @param success function called on sucess
75
+ */
76
+ setUseRemoteConfig(useRemoteConfig, onSuccess) {
77
+ RNCSitumPlugin.setUseRemoteConfig(useRemoteConfig, onSuccess);
78
+ },
79
+ /**
80
+ * Sets the maximum age of a cached response. If the cache response's age exceeds
81
+ * maxAge, it will not be used and a network request will be made.
82
+ *
83
+ * @param cacheAge a non-negative integer
84
+ * @param success function called on success
85
+ */
86
+ setCacheMaxAge: function (cacheAge, success) {
87
+ RNCSitumPlugin.setCacheMaxAge(cacheAge, success);
88
+ },
89
+ /**
90
+ * Invalidate all the resources in the cache
91
+ */
92
+ invalidateCache: function () {
93
+ RNCSitumPlugin.invalidateCache();
94
+ },
95
+ /**
96
+ * Gets the list of versions for the current plugin and environment
97
+ *
98
+ * @param callback callback to use on success
99
+ */
100
+ sdkVersions: function (callback) {
101
+ const versions = {
102
+ react_native: _package.default.version
103
+ };
104
+ if (_reactNative.Platform.OS === "ios") {
105
+ versions.ios = _package.default.sdkVersions.ios;
106
+ } else {
107
+ versions.android = _package.default.sdkVersions.android;
108
+ }
109
+ callback(versions);
110
+ },
111
+ /**
112
+ * Returns the device identifier that has generated the location
113
+ *
114
+ * @param callback function called on sucess, returns the id of the current device
115
+ */
116
+ getDeviceId: function (callback) {
117
+ RNCSitumPlugin.getDeviceId(callback);
118
+ },
119
+ /**
120
+ * Request authorization for the provided authentication
121
+ * and stores it internally for subsequent requests
122
+ */
123
+ requestAuthorization: function () {
124
+ RNCSitumPlugin.requestAuthorization();
125
+ },
126
+ /**
127
+ * Download all the buildings for the current user
128
+ *
129
+ * @param success function called on sucess, returns a list of Building objects
130
+ * @param error function called on failure, returns an error string
131
+ */
132
+ fetchBuildings: function (success, error) {
133
+ (0, _invariant.default)(typeof success === "function", "Must provide a valid success callback.");
134
+ RNCSitumPlugin.fetchBuildings(success, error || _utils.logError);
135
+ },
136
+ /**
137
+ * Download all the building data for the selected building. This info includes
138
+ * floors, indoor and outdoor POIs, events and paths. Also it download floor
139
+ * maps and POI category icons to local storage.
140
+ *
141
+ * @param building
142
+ * @param success function called on sucess, returns a list of Building objects
143
+ * @param error function called on failure, returns an error string
144
+ */
145
+ fetchBuildingInfo: function (building, success, error) {
146
+ (0, _invariant.default)(typeof success === "function", "Must provide a valid success callback.");
147
+ RNCSitumPlugin.fetchBuildingInfo(building, success, error || _utils.logError);
148
+ },
149
+ fetchTilesFromBuilding: function (building, success, error) {
150
+ (0, _invariant.default)(typeof success === "function", "Must provide a valid success callback.");
151
+ RNCSitumPlugin.fetchTilesFromBuilding(building, success, error || _utils.logError);
152
+ },
153
+ /**
154
+ * Download all the floors of a building
155
+ *
156
+ * @param building
157
+ * @param success function called on sucess, returns a list of Floor objects
158
+ * @param error function called on failure, returns an error string
159
+ */
160
+ fetchFloorsFromBuilding: function (building, success, error) {
161
+ (0, _invariant.default)(typeof success === "function", "Must provide a valid success callback.");
162
+ RNCSitumPlugin.fetchFloorsFromBuilding(building, success, error || _utils.logError);
163
+ },
164
+ /**
165
+ * Download the map image of a floor
166
+ *
167
+ * @param floor the floor object. Not null.
168
+ * @param success function called on sucess, returns a list of Map url objects
169
+ * @param error function called on failure, returns an error string
170
+ */
171
+ fetchMapFromFloor: function (floor, success, error) {
172
+ (0, _invariant.default)(typeof success === "function", "Must provide a valid success callback.");
173
+ RNCSitumPlugin.fetchMapFromFloor(floor, success, error || _utils.logError);
174
+ },
175
+ /**
176
+ * Get the geofences of a building
177
+ *
178
+ * @param building
179
+ * @param success function called on sucess, returns a list of Building objects
180
+ * @param error function called on failure, returns an error string
181
+ */
182
+ fetchGeofencesFromBuilding: function (building, success, error) {
183
+ (0, _invariant.default)(typeof success === "function", "Must provide a valid success callback.");
184
+ RNCSitumPlugin.fetchGeofencesFromBuilding(building, success, error || _utils.logError);
185
+ },
186
+ /**
187
+ * Get all POI categories, download and cache their icons asynchronously.
188
+ *
189
+ * @param success function called on sucess, returns a list of POI categories
190
+ * @param error function called on failure, returns an error string
191
+ */
192
+ fetchPoiCategories: function (success, error) {
193
+ (0, _invariant.default)(typeof success === "function", "Must provide a valid success callback.");
194
+ RNCSitumPlugin.fetchPoiCategories(success, error || _utils.logError);
195
+ },
196
+ /**
197
+ * Get the normal category icon for a category
198
+ *
199
+ * @param category the category. Not null.
200
+ * @param success function called on sucess, returns the icon in normal state.
201
+ * @param error function called on failure, returns an error string
202
+ */
203
+ fetchPoiCategoryIconNormal: function (category, success, error) {
204
+ (0, _invariant.default)(typeof success === "function", "Must provide a valid success callback.");
205
+ RNCSitumPlugin.fetchPoiCategoryIconNormal(category, success, error || _utils.logError);
206
+ },
207
+ /**
208
+ * Get the selected category icon for a category
209
+ *
210
+ * @param category the category. Not null.
211
+ * @param success function called on sucess, returns the icon in selected state.
212
+ * @param error function called on failure, returns an error string
213
+ */
214
+ fetchPoiCategoryIconSelected: function (category, success, error) {
215
+ (0, _invariant.default)(typeof success === "function", "Must provide a valid success callback.");
216
+ RNCSitumPlugin.fetchPoiCategoryIconSelected(category, success, error || _utils.logError);
217
+ },
218
+ /**
219
+ * Download the indoor POIs of a building
220
+ *
221
+ * @param building
222
+ * @param success function called on sucess, returns a list of POI objects
223
+ * @param error function called on failure, returns an error string
224
+ */
225
+ fetchIndoorPOIsFromBuilding: function (building, success, error) {
226
+ (0, _invariant.default)(typeof success === "function", "Must provide a valid success callback.");
227
+ RNCSitumPlugin.fetchIndoorPOIsFromBuilding(building, success, error || _utils.logError);
228
+ },
229
+ /**
230
+ * Download the outdoor POIs of a building
231
+ *
232
+ * @param building
233
+ * @param success function called on sucess, returns a list of POI objects
234
+ * @param error function called on failure, returns an error string
235
+ */
236
+ fetchOutdoorPOIsFromBuilding: function (building, success, error) {
237
+ (0, _invariant.default)(typeof success === "function", "Must provide a valid success callback.");
238
+ RNCSitumPlugin.fetchOutdoorPOIsFromBuilding(building, success, error || _utils.logError);
239
+ },
240
+ /**
241
+ * Download the events of a building
242
+ *
243
+ * @param building
244
+ * @param success Callback to asynchronously receive the events of a building. Not null.
245
+ * @param error function called on failure, returns an error string
246
+ */
247
+ fetchEventsFromBuilding: function (building, success, error) {
248
+ (0, _invariant.default)(typeof success === "function", "Must provide a valid success callback.");
249
+ RNCSitumPlugin.fetchEventsFromBuilding(building, success, error || _utils.logError);
250
+ },
251
+ /**
252
+ * Starts positioning with the configuration specified by the LocationRequest;
253
+ * computed geolocations, status codes and errors will be received through the LocationListener callbacks.
254
+ * You may call this method more than once, with the following effect:
255
+ *
256
+ * - If you provide a new LocationRequest instance, positioning will be re-started
257
+ * with the new positioning options specified by this new instance.
258
+ * - If you provide a new LocationListener, the former LocationListener will be
259
+ * replaced, therefore geolocations will be communicated to the new one.
260
+ * - If neither LocationRequest nor LocationListener change, nothing will happen.
261
+ * You may stop positioning at any time by calling the LocationManager.removeUpdates() method.
262
+ *
263
+ * @param location callback to use when location is udpated
264
+ * @param status callback to use when the positioning status changes
265
+ * @param error callback to use when error is raised
266
+ * @param locationOptions hashmap with options
267
+ *
268
+ * @returns the id of the subscription
269
+ */
270
+ startPositioning: function (location, status, error, options) {
271
+ this.requestAuthorization();
272
+ return this.startPositioningUpdates(location, status, error || _utils.logError, options || {});
273
+ },
274
+ startPositioningUpdates: function (location, status, error, options) {
275
+ // Remove old positioning subscriptions:
276
+ positioningSubscriptions.forEach(subscription => subscription === null || subscription === void 0 ? void 0 : subscription.remove());
277
+ positioningSubscriptions = [];
278
+ positioningSubscriptions.push(SitumPluginEventEmitter.addListener("locationChanged", location), SitumPluginEventEmitter.addListener("statusChanged", status), error ? SitumPluginEventEmitter.addListener("locationError", error || _utils.logError) : null);
279
+ // Call native:
280
+ RNCSitumPlugin.startPositioning(options || {});
281
+ },
282
+ /**
283
+ * Stops positioning, removing all location updates
284
+ *
285
+ * @param callback the callback to use when the function successfully ends
286
+ * @returns
287
+ */
288
+ stopPositioning: function (callback) {
289
+ RNCSitumPlugin.stopPositioning(callback || _utils.logError);
290
+ },
291
+ /**
292
+ * Calculates a route between two points. The result is provided
293
+ * asynchronously using the callback.
294
+ *
295
+ * @param directionParams
296
+ * @param success function called on sucess, returns a Route object
297
+ * @param error function called on failure, returns an error string
298
+ */
299
+ requestDirections: function (directionParams, success, error) {
300
+ (0, _invariant.default)(typeof success === "function", "Must provide a valid success callback.");
301
+ RNCSitumPlugin.requestDirections(directionParams, success, error || _utils.logError);
302
+ },
303
+ /**
304
+ * Set the navigation params, and the listener that receives the updated
305
+ * navigation progress.
306
+ *
307
+ * Can only exist one navigation with one listener at a time. If this method was
308
+ * previously invoked, but removeUpdates() wasn't, removeUpdates() is called internally.
309
+ *
310
+ * @param navigationUpdates
311
+ * @param error function called on failure, returns an error string
312
+ * @param options
313
+ */
314
+ requestNavigationUpdates: function (navigationUpdates, error, options) {
315
+ RNCSitumPlugin.requestNavigationUpdates(options || {});
316
+ navigationSubscriptions.push(SitumPluginEventEmitter.addListener("navigationUpdated", navigationUpdates));
317
+ navigationSubscriptions.push(error ? SitumPluginEventEmitter.addListener("navigationError", error || _utils.logError) : null);
318
+ },
319
+ /**
320
+ * Informs NavigationManager object the change of the user's location
321
+ *
322
+ * @param location new Location of the user. If null, nothing is done
323
+ * @param success callback to use when the navigation updates
324
+ * @param error callback to use when an error on navigation udpates raises
325
+ */
326
+ updateNavigationWithLocation: function (location, success, error) {
327
+ if (navigationSubscriptions.length === 0) {
328
+ error("No active navigation!!");
329
+ return;
330
+ }
331
+ RNCSitumPlugin.updateNavigationWithLocation(location, success, error || _utils.logError);
332
+ },
333
+ /**
334
+ * Removes all location updates. This removes the internal state of the manager,
335
+ * including the listener provided in requestNavigationUpdates(NavigationRequest,
336
+ * NavigationListener), so it won't receive more progress updates.
337
+ *
338
+ * @param callback
339
+ */
340
+ removeNavigationUpdates: function (callback) {
341
+ for (let i = 0; i < navigationSubscriptions.length; i++) {
342
+ navigationSubscriptions[i].remove();
343
+ }
344
+ navigationSubscriptions = [];
345
+ RNCSitumPlugin.removeNavigationUpdates(callback || _utils.logError);
346
+ },
347
+ requestRealTimeUpdates: function (navigationUpdates, error, options) {
348
+ RNCSitumPlugin.requestRealTimeUpdates(options || {});
349
+ realtimeSubscriptions.push([SitumPluginEventEmitter.addListener("realtimeUpdated", navigationUpdates), error ? SitumPluginEventEmitter.addListener("realtimeError", error || _utils.logError) : null]);
350
+ },
351
+ /**
352
+ * Requests a real time devices positions
353
+ *
354
+ * @param realtimeUpdates callback to use when new device positions are updated
355
+ * @param error callback to use when an error on navigation udpates raises
356
+ * @param options Represents the configuration for getting realtime devices positions in
357
+ */
358
+ removeRealTimeUpdates: function (_callback) {
359
+ realtimeSubscriptions = [];
360
+ RNCSitumPlugin.removeRealTimeUpdates();
361
+ },
362
+ checkIfPointInsideGeofence: function (request, callback) {
363
+ (0, _invariant.default)(typeof callback === "function", "Must provide a valid success callback.");
364
+ RNCSitumPlugin.checkIfPointInsideGeofence(request, callback);
365
+ },
366
+ /**
367
+ * Callback that notifies when the user enters a geofence.
368
+ *
369
+ * In order to use correctly these callbacks you must know the following:
370
+ * - Positioning geofences (with trainer_metadata custom field) won't be notified.
371
+ * - These callbacks only work with indoor locations. Any outdoor location will
372
+ * produce a call to onExitedGeofences with the last positioned geofences as argument.
373
+ *
374
+ * @param callback the function called when the user enters a geofence
375
+ */
376
+ onEnterGeofences: function (callback) {
377
+ RNCSitumPlugin.onEnterGeofences();
378
+ // Adopts SDK behavior (setter):
379
+ SitumPluginEventEmitter.removeAllListeners("onEnterGeofences");
380
+ SitumPluginEventEmitter.addListener("onEnterGeofences", callback);
381
+ },
382
+ /**
383
+ * Callback that notifies when the user exits a geofence.
384
+ *
385
+ * In order to use correctly these callbacks you must know the following:
386
+ * - Positioning geofences (with trainer_metadata custom field) won't be notified.
387
+ * - These callbacks only work with indoor locations. Any outdoor location will
388
+ * produce a call to onExitedGeofences with the last positioned geofences as argument.
389
+ *
390
+ * @param callback the function called when the user exits a geofence
391
+ */
392
+ onExitGeofences: function (callback) {
393
+ RNCSitumPlugin.onExitGeofences();
394
+ SitumPluginEventEmitter.removeAllListeners("onExitGeofences");
395
+ SitumPluginEventEmitter.addListener("onExitGeofences", callback);
396
+ }
397
+ };
398
+ exports.default = _default;
399
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_invariant","_interopRequireDefault","require","_reactNative","_package","_utils","obj","__esModule","default","LINKING_ERROR","Platform","select","ios","RNCSitumPlugin","NativeModules","Proxy","get","Error","SitumPluginEventEmitter","NativeEventEmitter","positioningSubscriptions","navigationSubscriptions","realtimeSubscriptions","_default","initSitumSDK","setApiKey","email","apiKey","onSuccess","setUserPass","password","setDashboardURL","url","success","setUseRemoteConfig","useRemoteConfig","setCacheMaxAge","cacheAge","invalidateCache","sdkVersions","callback","versions","react_native","packageJson","version","OS","android","getDeviceId","requestAuthorization","fetchBuildings","error","invariant","logError","fetchBuildingInfo","building","fetchTilesFromBuilding","fetchFloorsFromBuilding","fetchMapFromFloor","floor","fetchGeofencesFromBuilding","fetchPoiCategories","fetchPoiCategoryIconNormal","category","fetchPoiCategoryIconSelected","fetchIndoorPOIsFromBuilding","fetchOutdoorPOIsFromBuilding","fetchEventsFromBuilding","startPositioning","location","status","options","startPositioningUpdates","forEach","subscription","remove","push","addListener","stopPositioning","requestDirections","directionParams","requestNavigationUpdates","navigationUpdates","updateNavigationWithLocation","length","removeNavigationUpdates","i","requestRealTimeUpdates","removeRealTimeUpdates","_callback","checkIfPointInsideGeofence","request","onEnterGeofences","removeAllListeners","onExitGeofences","exports"],"sourceRoot":"../../../src","sources":["sdk/index.ts"],"mappings":";;;;;;AAEA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AAQA,IAAAG,MAAA,GAAAH,OAAA;AAAmC,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAbnC;AACA;;AAcA,MAAMG,aAAa,GAChB,oFAAmF,GACpFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEJ,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAE/C,MAAMK,cAAc,GAAGC,0BAAa,CAACD,cAAc,GAC/CC,0BAAa,CAAC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OAAO,EAAElD,QAAQ,CAAC;EAC9D,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEmD,gBAAgB,EAAE,SAAAA,CAAUnD,QAA8B,EAAE;IAC1D3B,cAAc,CAAC8E,gBAAgB,CAAC,CAAC;IACjC;IACAzE,uBAAuB,CAAC0E,kBAAkB,CAAC,kBAAkB,CAAC;IAC9D1E,uBAAuB,CAAC0D,WAAW,CAAC,kBAAkB,EAAEpC,QAAQ,CAAC;EACnE,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEqD,eAAe,EAAE,SAAAA,CAAUrD,QAA8B,EAAE;IACzD3B,cAAc,CAACgF,eAAe,CAAC,CAAC;IAChC3E,uBAAuB,CAAC0E,kBAAkB,CAAC,iBAAiB,CAAC;IAC7D1E,uBAAuB,CAAC0D,WAAW,CAAC,iBAAiB,EAAEpC,QAAQ,CAAC;EAClE;AACF,CAAC;AAAAsD,OAAA,CAAAtF,OAAA,GAAAe,QAAA"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ var _reactNative = require("react-native");
4
+ const {
5
+ RNCSitumPlugin
6
+ } = _reactNative.NativeModules;
7
+ if (!RNCSitumPlugin) {
8
+ throw new Error("react-native-situm-plugin: NativeModule is null");
9
+ }
10
+ let nativeEventEmitter = null;
11
+ module.exports = {
12
+ RNCSitumPlugin,
13
+ get SitumPluginEventEmitter() {
14
+ if (!nativeEventEmitter) {
15
+ nativeEventEmitter = new _reactNative.NativeEventEmitter(RNCSitumPlugin);
16
+ }
17
+ return nativeEventEmitter;
18
+ }
19
+ };
20
+ //# sourceMappingURL=nativeInterface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","RNCSitumPlugin","NativeModules","Error","nativeEventEmitter","module","exports","SitumPluginEventEmitter","NativeEventEmitter"],"sourceRoot":"../../../src","sources":["sdk/nativeInterface.ts"],"mappings":";;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAM;EAAEC;AAAe,CAAC,GAAGC,0BAAa;AAExC,IAAI,CAACD,cAAc,EAAE;EACnB,MAAM,IAAIE,KAAK,CAAC,iDAAiD,CAAC;AACpE;AAEA,IAAIC,kBAAkB,GAAG,IAAI;AAC7BC,MAAM,CAACC,OAAO,GAAG;EACfL,cAAc;EACd,IAAIM,uBAAuBA,CAAA,EAAG;IAC5B,IAAI,CAACH,kBAAkB,EAAE;MACvBA,kBAAkB,GAAG,IAAII,+BAAkB,CAACP,cAAc,CAAC;IAC7D;IACA,OAAOG,kBAAkB;EAC3B;AACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=index.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["sdk/types/index.d.ts"],"mappings":""}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.logError = void 0;
7
+ /**
8
+ * Small utility that can be used as an error handler. You cannot just pass
9
+ * `console.error` as a failure callback - it's not properly bound. If passes an
10
+ * `Error` object, it will print the message and stack.
11
+ */
12
+ const logError = __DEV__ ? function (response) {
13
+ if (response instanceof String) {
14
+ console.log(response);
15
+ } else {
16
+ console.log(JSON.stringify(response));
17
+ }
18
+ } : function (_response) {
19
+ // do nothing
20
+ };
21
+ exports.logError = logError;
22
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["logError","__DEV__","response","String","console","log","JSON","stringify","_response","exports"],"sourceRoot":"../../../src","sources":["sdk/utils.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACO,MAAMA,QAAQ,GAAGC,OAAO,GAC3B,UAAUC,QAAiB,EAAE;EAC3B,IAAIA,QAAQ,YAAYC,MAAM,EAAE;IAC9BC,OAAO,CAACC,GAAG,CAACH,QAAQ,CAAC;EACvB,CAAC,MAAM;IACLE,OAAO,CAACC,GAAG,CAACC,IAAI,CAACC,SAAS,CAACL,QAAQ,CAAC,CAAC;EACvC;AACF,CAAC,GACD,UAAUM,SAAS,EAAE;EACnB;AAAA,CACD;AAACC,OAAA,CAAAT,QAAA,GAAAA,QAAA"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _reactNativePermissions = require("react-native-permissions");
9
+ // TODO: can requestMultiple be used ?
10
+ const checkIOSPermissions = async () => {
11
+ let granted = await (0, _reactNativePermissions.request)(_reactNativePermissions.PERMISSIONS.IOS.LOCATION_WHEN_IN_USE);
12
+ if (granted === _reactNativePermissions.RESULTS.GRANTED) {
13
+ console.info("LOCATION_WHEN_IN_USE permission granted");
14
+
15
+ //@ts-ignore
16
+ if (parseInt(_reactNative.Platform.Version, 10) > 12) {
17
+ granted = await (0, _reactNativePermissions.request)(_reactNativePermissions.PERMISSIONS.IOS.BLUETOOTH_PERIPHERAL);
18
+ if (granted === _reactNativePermissions.RESULTS.GRANTED) {
19
+ console.info("BLUETOOTH_PERIPHERAL permission granted");
20
+ return true;
21
+ } else {
22
+ throw "BLUETOOTH_PERIPHERAL permission not granted";
23
+ }
24
+ } else {
25
+ console.warn("BLUETOOTH_PERIPHERAL permissions not required");
26
+ return true;
27
+ }
28
+ } else {
29
+ throw "ACCESS_FINE_LOCATION denied";
30
+ }
31
+ };
32
+ const checkAndroidPermissions = async () => {
33
+ let granted;
34
+ //@ts-ignore
35
+ if (_reactNative.Platform.Version > 30) {
36
+ console.log("ANDROID VERSION > 30");
37
+ granted = await (0, _reactNativePermissions.requestMultiple)([_reactNativePermissions.PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION, _reactNativePermissions.PERMISSIONS.ANDROID.BLUETOOTH_CONNECT, _reactNativePermissions.PERMISSIONS.ANDROID.BLUETOOTH_SCAN]);
38
+ if (granted["android.permission.ACCESS_FINE_LOCATION"] === _reactNativePermissions.RESULTS.GRANTED && granted["android.permission.BLUETOOTH_CONNECT"] === _reactNativePermissions.RESULTS.GRANTED && granted["android.permission.BLUETOOTH_SCAN"] === _reactNativePermissions.RESULTS.GRANTED) {
39
+ console.info("ACCESS_FINE_LOCATION, BLUETOOTH_CONNECT and ACCESS_FINE_LOCATION permissions granted");
40
+ return true;
41
+ }
42
+ throw "ACCESS_FINE_LOCATION, BLUETOOTH_CONNECT and ACCESS_FINE_LOCATION permissions not granted";
43
+ } else {
44
+ console.info("ANDROID VERSION < 30");
45
+ granted = await (0, _reactNativePermissions.request)(_reactNativePermissions.PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION);
46
+ if (granted === _reactNativePermissions.RESULTS.GRANTED) {
47
+ console.info("ACCESS_FINE_LOCATION granted");
48
+ return true;
49
+ } else {
50
+ throw "ACCESS_FINE_LOCATION permission not granted";
51
+ }
52
+ }
53
+ };
54
+ const requestPermission = () =>
55
+ // eslint-disable-next-line no-async-promise-executor
56
+ new Promise(async (resolve, reject) => {
57
+ console.log("Retrieving permissions for platform " + _reactNative.Platform.OS);
58
+ if (_reactNative.Platform.OS === "ios") {
59
+ await checkIOSPermissions().then(() => resolve()).catch(e => {
60
+ console.warn(e);
61
+ reject(e);
62
+ });
63
+ } else if (_reactNative.Platform.OS === "android") {
64
+ await checkAndroidPermissions().then(() => resolve()).catch(e => {
65
+ console.warn(e);
66
+ reject(e);
67
+ });
68
+ }
69
+ reject(`Platform ${_reactNative.Platform.OS} not supported`);
70
+ });
71
+ var _default = requestPermission;
72
+ exports.default = _default;
73
+ //# sourceMappingURL=requestPermission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_reactNativePermissions","checkIOSPermissions","granted","request","PERMISSIONS","IOS","LOCATION_WHEN_IN_USE","RESULTS","GRANTED","console","info","parseInt","Platform","Version","BLUETOOTH_PERIPHERAL","warn","checkAndroidPermissions","log","requestMultiple","ANDROID","ACCESS_FINE_LOCATION","BLUETOOTH_CONNECT","BLUETOOTH_SCAN","requestPermission","Promise","resolve","reject","OS","then","catch","e","_default","exports","default"],"sourceRoot":"../../../src","sources":["utils/requestPermission.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAOA;AACA,MAAME,mBAAmB,GAAG,MAAAA,CAAA,KAAY;EACtC,IAAIC,OAAO,GAAG,MAAM,IAAAC,+BAAO,EAACC,mCAAW,CAACC,GAAG,CAACC,oBAAoB,CAAC;EAEjE,IAAIJ,OAAO,KAAKK,+BAAO,CAACC,OAAO,EAAE;IAC/BC,OAAO,CAACC,IAAI,CAAC,yCAAyC,CAAC;;IAEvD;IACA,IAAIC,QAAQ,CAACC,qBAAQ,CAACC,OAAO,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;MACvCX,OAAO,GAAG,MAAM,IAAAC,+BAAO,EAACC,mCAAW,CAACC,GAAG,CAACS,oBAAoB,CAAC;MAE7D,IAAIZ,OAAO,KAAKK,+BAAO,CAACC,OAAO,EAAE;QAC/BC,OAAO,CAACC,IAAI,CAAC,yCAAyC,CAAC;QACvD,OAAO,IAAI;MACb,CAAC,MAAM;QACL,MAAM,6CAA6C;MACrD;IACF,CAAC,MAAM;MACLD,OAAO,CAACM,IAAI,CAAC,+CAA+C,CAAC;MAC7D,OAAO,IAAI;IACb;EACF,CAAC,MAAM;IACL,MAAM,6BAA6B;EACrC;AACF,CAAC;AAED,MAAMC,uBAAuB,GAAG,MAAAA,CAAA,KAAY;EAC1C,IAAId,OAAO;EACX;EACA,IAAIU,qBAAQ,CAACC,OAAO,GAAG,EAAE,EAAE;IACzBJ,OAAO,CAACQ,GAAG,CAAC,sBAAsB,CAAC;IACnCf,OAAO,GAAG,MAAM,IAAAgB,uCAAe,EAAC,CAC9Bd,mCAAW,CAACe,OAAO,CAACC,oBAAoB,EACxChB,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