incyclist-services 1.5.70 → 1.5.71
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.
|
@@ -125,7 +125,7 @@ let DeviceRideService = (() => {
|
|
|
125
125
|
return this.data;
|
|
126
126
|
}
|
|
127
127
|
getRideAdapters() {
|
|
128
|
-
var _a, _b;
|
|
128
|
+
var _a, _b, _c, _d, _e;
|
|
129
129
|
if ((_a = this.rideAdapters) === null || _a === void 0 ? void 0 : _a.length)
|
|
130
130
|
return this.rideAdapters;
|
|
131
131
|
try {
|
|
@@ -150,11 +150,24 @@ let DeviceRideService = (() => {
|
|
|
150
150
|
if (this.simulatorEnforced) {
|
|
151
151
|
this.setRequestedCapabilties(this.rideAdapters);
|
|
152
152
|
}
|
|
153
|
+
if (this.rideAdapters.length === 0) {
|
|
154
|
+
const devices = this.getDeviceConfiguration();
|
|
155
|
+
const adapter = (_c = (_b = devices.getSelected(incyclist_devices_1.IncyclistCapability.Control)) !== null && _b !== void 0 ? _b : devices.getSelected(incyclist_devices_1.IncyclistCapability.Power)) !== null && _c !== void 0 ? _c : devices.getSelected(incyclist_devices_1.IncyclistCapability.Speed);
|
|
156
|
+
if (adapter) {
|
|
157
|
+
const adapters = (_d = this.getConfiguredAdapters(true)) !== null && _d !== void 0 ? _d : [];
|
|
158
|
+
this.logEvent({ message: 'error',
|
|
159
|
+
error: 'incorrect device configuration',
|
|
160
|
+
adapters: adapters.map(ai => `${ai.udid}, ${ai.isControl ? '(C)' : ''}`).join('|'),
|
|
161
|
+
configuredControlDevice: configuredControlDevice === null || configuredControlDevice === void 0 ? void 0 : configuredControlDevice.udid,
|
|
162
|
+
controlDevice: controlDevice === null || controlDevice === void 0 ? void 0 : controlDevice.udid,
|
|
163
|
+
simulatorEnforced: this.simulatorEnforced });
|
|
164
|
+
}
|
|
165
|
+
}
|
|
153
166
|
return this.rideAdapters;
|
|
154
167
|
}
|
|
155
168
|
catch (err) {
|
|
156
169
|
this.logError(err, 'getRideAdapters');
|
|
157
|
-
return (
|
|
170
|
+
return (_e = this.rideAdapters) !== null && _e !== void 0 ? _e : [];
|
|
158
171
|
}
|
|
159
172
|
}
|
|
160
173
|
getAllAdapters() {
|
|
@@ -547,6 +560,7 @@ let DeviceRideService = (() => {
|
|
|
547
560
|
logProps.bikeType = (_b = bike.getCyclingMode()) === null || _b === void 0 ? void 0 : _b.getSetting('bikeType');
|
|
548
561
|
}
|
|
549
562
|
startProps.capabilities = ai.capabilities;
|
|
563
|
+
ai.isStarted = false;
|
|
550
564
|
this.logEvent(Object.assign({ message: `${startType} ${sType} request` }, logProps));
|
|
551
565
|
return ai.adapter.start(startProps)
|
|
552
566
|
.then((success) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -901,8 +915,8 @@ let DeviceRideService = (() => {
|
|
|
901
915
|
return __awaiter(this, void 0, void 0, function* () {
|
|
902
916
|
yield this.lazyInit();
|
|
903
917
|
this.cleanInternalCache();
|
|
904
|
-
delete this.rideAdapters;
|
|
905
918
|
const adapters = this.getRideAdapters();
|
|
919
|
+
this.logEvent({ message: 'sending start request', retry: false, deviceInfo: adapters === null || adapters === void 0 ? void 0 : adapters.map(this.getAdapterStateInfo.bind(this)) });
|
|
906
920
|
this.emit('start-request', adapters === null || adapters === void 0 ? void 0 : adapters.map(this.getAdapterStateInfo.bind(this)));
|
|
907
921
|
const goodToGo = yield this.waitForPreviousStartToFinish();
|
|
908
922
|
if (!goodToGo)
|
|
@@ -915,7 +929,8 @@ let DeviceRideService = (() => {
|
|
|
915
929
|
return __awaiter(this, void 0, void 0, function* () {
|
|
916
930
|
yield this.lazyInit();
|
|
917
931
|
const selected = this.getRideAdapters();
|
|
918
|
-
this.
|
|
932
|
+
this.logEvent({ message: 'sending start request', retry: true, deviceInfo: selected === null || selected === void 0 ? void 0 : selected.map(this.getAdapterStateInfo.bind(this)) });
|
|
933
|
+
this.emit('start-request', selected === null || selected === void 0 ? void 0 : selected.map(this.getAdapterStateInfo.bind(this)));
|
|
919
934
|
const adapters = selected.filter(ai => !ai.adapter.isStarted());
|
|
920
935
|
const goodToGo = yield this.waitForPreviousStartToFinish();
|
|
921
936
|
if (!goodToGo)
|
|
@@ -795,7 +795,6 @@ let RideDisplayService = (() => {
|
|
|
795
795
|
.on('route-updated', this.onRouteUpdated.bind(this));
|
|
796
796
|
}
|
|
797
797
|
onStateUpdate() {
|
|
798
|
-
console.log('# state update', this.state);
|
|
799
798
|
this.checkStartStatus();
|
|
800
799
|
this.updateStartOverlay();
|
|
801
800
|
}
|
|
@@ -1016,6 +1015,9 @@ let RideDisplayService = (() => {
|
|
|
1016
1015
|
isStartDeviceReadyToStart() {
|
|
1017
1016
|
var _a, _b;
|
|
1018
1017
|
const devices = (_a = this.deviceInfo) !== null && _a !== void 0 ? _a : [];
|
|
1018
|
+
if (devices.length === 0) {
|
|
1019
|
+
return false;
|
|
1020
|
+
}
|
|
1019
1021
|
const mandatory = (_b = devices === null || devices === void 0 ? void 0 : devices.filter(d => d.isControl)) !== null && _b !== void 0 ? _b : [];
|
|
1020
1022
|
return !(mandatory === null || mandatory === void 0 ? void 0 : mandatory.length) || mandatory.filter(d => d.status === 'Started').length == mandatory.length;
|
|
1021
1023
|
}
|
|
@@ -189,11 +189,11 @@ let RLVDisplayService = (() => {
|
|
|
189
189
|
return this.infotext;
|
|
190
190
|
}
|
|
191
191
|
checkFinishOptions(position) {
|
|
192
|
-
var _b, _c;
|
|
193
|
-
if (this.videos
|
|
192
|
+
var _b, _c, _d, _e;
|
|
193
|
+
if (!((_b = this.videos) === null || _b === void 0 ? void 0 : _b.length) || !((_c = this.currentVideo) === null || _c === void 0 ? void 0 : _c.loaded)) {
|
|
194
194
|
return super.checkFinishOptions(position);
|
|
195
195
|
}
|
|
196
|
-
if (!((
|
|
196
|
+
if (!((_d = this.currentVideo) === null || _d === void 0 ? void 0 : _d.next) || ((_e = this.videos) === null || _e === void 0 ? void 0 : _e.length) === 1) {
|
|
197
197
|
return super.checkFinishOptions(position);
|
|
198
198
|
}
|
|
199
199
|
const finished = this.checkIsRouteFinished(position);
|
|
@@ -347,8 +347,12 @@ let RLVDisplayService = (() => {
|
|
|
347
347
|
video.loaded = false;
|
|
348
348
|
video.error = this.buildVideoError(error);
|
|
349
349
|
if (!video.isInitial) {
|
|
350
|
-
this.logEvent({ message: 'could not load next video',
|
|
351
|
-
|
|
350
|
+
this.logEvent({ message: 'could not load next video', video: this.getVideoUrl(video), error: error.message, errorCode: error.code });
|
|
351
|
+
const errIdx = this.videos.indexOf(video);
|
|
352
|
+
if (errIdx !== -1) {
|
|
353
|
+
this.videos.splice(errIdx);
|
|
354
|
+
this.logEvent({ message: 'changed video config', videos: this.videos.map(v => this.getVideoUrl(v)).join('|') });
|
|
355
|
+
}
|
|
352
356
|
}
|
|
353
357
|
this.emit('state-update');
|
|
354
358
|
}
|