@wemap/positioning 2.3.7 → 2.3.9

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/package.json CHANGED
@@ -81,5 +81,5 @@
81
81
  "lint": "eslint --ext .js,.jsx --quiet src",
82
82
  "test": "mocha -r esm \"src/**/*.spec.js\""
83
83
  },
84
- "version": "2.3.7"
84
+ "version": "2.3.9"
85
85
  }
@@ -16,6 +16,8 @@ import Availability from './events/Availability';
16
16
  */
17
17
  class PositioningHandler {
18
18
 
19
+ static CameraUsedNatively = 'camera_used_natively';
20
+
19
21
  providerInstances = [];
20
22
 
21
23
  /**
@@ -44,7 +46,17 @@ class PositioningHandler {
44
46
  this.providerInstances[provider.id] = provider;
45
47
  provider.start();
46
48
 
47
- return provider.id;
49
+ const messages = [];
50
+
51
+ if (provider.useCameraNatively) {
52
+ messages.push(PositioningHandler.CameraUsedNatively);
53
+ }
54
+
55
+ return {
56
+ id: provider.id,
57
+ name: provider.name,
58
+ messages
59
+ };
48
60
  } catch (e) {
49
61
  onError(e);
50
62
  return null;
@@ -191,9 +203,9 @@ class PositioningHandler {
191
203
  }
192
204
  if (!provider.getItineraryInfo) {
193
205
  Logger.warn('Cannot getItineraryInfo from ' + provider.constructor.name);
194
- return;
206
+ return null;
195
207
  }
196
- provider.getItineraryInfo();
208
+ return provider.getItineraryInfo();
197
209
  }
198
210
 
199
211
  }
@@ -25,7 +25,7 @@ class PositioningInclinationComponent extends React.Component {
25
25
  [EventType.Inclination],
26
26
  this.onEvents,
27
27
  this.onError
28
- );
28
+ ).id;
29
29
  }
30
30
 
31
31
 
@@ -36,7 +36,7 @@ class PositioningPoseComponent extends React.Component {
36
36
 
37
37
 
38
38
  start() {
39
- this.id = this.props.positioningHandler.start(
39
+ const output = this.props.positioningHandler.start(
40
40
  [EventType.AbsolutePosition, EventType.AbsoluteAttitude],
41
41
  this.onEvents,
42
42
  this.onError,
@@ -46,10 +46,12 @@ class PositioningPoseComponent extends React.Component {
46
46
  }
47
47
  );
48
48
 
49
- if (!this.id) {
49
+ if (!output) {
50
50
  return;
51
51
  }
52
52
 
53
+ this.id = output.id;
54
+
53
55
  this.props.positioningHandler.setItinerary(this.id, ITINERARY);
54
56
  this.props.positioningHandler.setNetwork(this.id, ITINERARY);
55
57
  this.props.positioningHandler.setPosition(this.id, INITIAL_POSITION);
@@ -88,7 +90,7 @@ class PositioningPoseComponent extends React.Component {
88
90
  this.setState({
89
91
  position: error,
90
92
  attitude: error,
91
- errored: false
93
+ errored: true
92
94
  });
93
95
  }
94
96
 
@@ -225,6 +225,14 @@ class Provider {
225
225
  static get nativeInterface() {
226
226
  return global.WemapProvidersAndroid;
227
227
  }
228
+
229
+ static get useCameraNatively() {
230
+ return false;
231
+ }
232
+
233
+ get useCameraNatively() {
234
+ return this.constructor.useCameraNatively;
235
+ }
228
236
  }
229
237
 
230
238
  export default Provider;
@@ -155,6 +155,13 @@ class ArCoreAbsoluteProvider extends Provider {
155
155
  this.position.provider = this.constructor.name;
156
156
  this.notify(this.createEvent(EventType.AbsolutePosition, this.position));
157
157
  }
158
+
159
+ /**
160
+ * @override
161
+ */
162
+ static get useCameraNatively() {
163
+ return true;
164
+ }
158
165
  }
159
166
 
160
167
  export default ArCoreAbsoluteProvider;
@@ -113,6 +113,13 @@ class ArCoreProvider extends Provider {
113
113
 
114
114
  return Availability.yes();
115
115
  }
116
+
117
+ /**
118
+ * @override
119
+ */
120
+ static get useCameraNatively() {
121
+ return true;
122
+ }
116
123
  }
117
124
 
118
125
  export default ArCoreProvider;