incyclist-services 1.7.7 → 1.7.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/lib/cjs/activities/active-rides/service.js +2 -2
- package/lib/cjs/activities/list/utils.js +1 -1
- package/lib/cjs/devices/ride/service.js +1 -1
- package/lib/cjs/ride/display/service.js +9 -12
- package/lib/esm/activities/active-rides/service.js +2 -2
- package/lib/esm/activities/list/utils.js +1 -1
- package/lib/esm/devices/ride/service.js +1 -1
- package/lib/esm/ride/display/service.js +9 -12
- package/package.json +2 -2
|
@@ -190,11 +190,11 @@ let ActiveRidesService = (() => {
|
|
|
190
190
|
const isOnline = this.getOnlineStatusMonitoring().onlineStatus;
|
|
191
191
|
if (!isOnline)
|
|
192
192
|
return;
|
|
193
|
-
const activeRides = await this.getApi().getAll();
|
|
193
|
+
const activeRides = (await this.getApi().getAll()).filter(ar => ar.ride !== undefined && ar.ride !== null);
|
|
194
194
|
const routes = this.getRouteList().getAllRoutes();
|
|
195
195
|
const counts = [];
|
|
196
196
|
routes.forEach(route => {
|
|
197
|
-
const routeRides = activeRides.filter(ar => ar.ride.routeHash === route.description
|
|
197
|
+
const routeRides = activeRides.filter(ar => ar.ride?.routeHash && ar.ride?.routeHash === route.description?.routeHash) ?? [];
|
|
198
198
|
const count = routeRides.length;
|
|
199
199
|
counts.push({
|
|
200
200
|
count,
|
|
@@ -27,7 +27,7 @@ exports.createUIActivitySummary = createUIActivitySummary;
|
|
|
27
27
|
const createUIActivityDetails = (details) => {
|
|
28
28
|
if (!details)
|
|
29
29
|
return details;
|
|
30
|
-
const ui =
|
|
30
|
+
const ui = structuredClone(details);
|
|
31
31
|
const [C, U] = (0, i18n_1.getUnitConversionShortcuts)();
|
|
32
32
|
ui.distance = { value: C(details.distance, 'distance', { digits: 1 }), unit: U('distance') };
|
|
33
33
|
if (ui.distance.value > 100)
|
|
@@ -735,7 +735,7 @@ let DeviceRideService = (() => {
|
|
|
735
735
|
const adapters = this.rideAdapters?.filter(ai => ai.adapter.getInterface() === ifName);
|
|
736
736
|
const stillHealthy = adapters.filter(ai => ai.isHealthy === undefined || ai.isHealthy);
|
|
737
737
|
this.logEvent({ message: 'reconnect confirmed', device: unhealthy.adapter.getUniqueName(), udid: unhealthy.udid, noDataSince: (Date.now() - unhealthy.tsLastData), tsLastData: unhealthy.tsLastData, stillHealthy: stillHealthy?.length, onSameInterface: adapters.length });
|
|
738
|
-
if (!stillHealthy?.length && adapters.length > 1) {
|
|
738
|
+
if (!stillHealthy?.length && adapters.length > 1 && ifName !== 'ble') {
|
|
739
739
|
await this.reconnectInterface(ifName, adapters);
|
|
740
740
|
}
|
|
741
741
|
else {
|
|
@@ -259,7 +259,6 @@ let RideDisplayService = (() => {
|
|
|
259
259
|
await this.stopRide({ exit, noStateUpdates: true });
|
|
260
260
|
this.getActivityRide().cleanup();
|
|
261
261
|
this.getCoaches().stopRide();
|
|
262
|
-
delete this.type;
|
|
263
262
|
}
|
|
264
263
|
toggleCyclingMode() {
|
|
265
264
|
try {
|
|
@@ -387,14 +386,12 @@ let RideDisplayService = (() => {
|
|
|
387
386
|
if (overwrite) {
|
|
388
387
|
delete this.type;
|
|
389
388
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
this.type = prev;
|
|
397
|
-
}
|
|
389
|
+
try {
|
|
390
|
+
this.type = this.type ?? this.detectRideType();
|
|
391
|
+
}
|
|
392
|
+
catch (err) {
|
|
393
|
+
this.logError(err, 'getRideType');
|
|
394
|
+
this.type = prev;
|
|
398
395
|
}
|
|
399
396
|
return this.type;
|
|
400
397
|
}
|
|
@@ -454,7 +451,6 @@ let RideDisplayService = (() => {
|
|
|
454
451
|
catch (err) {
|
|
455
452
|
this.logError(err, 'stopRide');
|
|
456
453
|
}
|
|
457
|
-
delete this.type;
|
|
458
454
|
delete this.displayService;
|
|
459
455
|
}
|
|
460
456
|
async closePrevRide() {
|
|
@@ -777,6 +773,7 @@ let RideDisplayService = (() => {
|
|
|
777
773
|
this.logEvent({ message: 'Start activity', activityId: this.activity?.id, ...logProps, interface: this.getBikeInterface() });
|
|
778
774
|
}
|
|
779
775
|
startRide(retry) {
|
|
776
|
+
this.getRideType(true);
|
|
780
777
|
this.displayService.start(retry);
|
|
781
778
|
this.displayService.on('state-update', this.stateUpdateHandler)
|
|
782
779
|
.on('route-updated', this.onRouteUpdated.bind(this));
|
|
@@ -1014,9 +1011,9 @@ let RideDisplayService = (() => {
|
|
|
1014
1011
|
getStartOverlayProps = () => {
|
|
1015
1012
|
const mode = this.getRideType();
|
|
1016
1013
|
const readyToStart = this.isStartDeviceReadyToStart() && this.getRideModeService().isStartRideCompleted();
|
|
1017
|
-
const
|
|
1014
|
+
const devicesState = this.deviceInfo ?? [];
|
|
1018
1015
|
const displayOverlayProps = this.getRideModeService().getStartOverlayProps() ?? {};
|
|
1019
|
-
return { mode, rideState: this.state,
|
|
1016
|
+
return { mode, rideState: this.state, devicesState, readyToStart, ...displayOverlayProps };
|
|
1020
1017
|
};
|
|
1021
1018
|
getDeviceStartSettings() {
|
|
1022
1019
|
let forceErgMode = false;
|
|
@@ -187,11 +187,11 @@ let ActiveRidesService = (() => {
|
|
|
187
187
|
const isOnline = this.getOnlineStatusMonitoring().onlineStatus;
|
|
188
188
|
if (!isOnline)
|
|
189
189
|
return;
|
|
190
|
-
const activeRides = await this.getApi().getAll();
|
|
190
|
+
const activeRides = (await this.getApi().getAll()).filter(ar => ar.ride !== undefined && ar.ride !== null);
|
|
191
191
|
const routes = this.getRouteList().getAllRoutes();
|
|
192
192
|
const counts = [];
|
|
193
193
|
routes.forEach(route => {
|
|
194
|
-
const routeRides = activeRides.filter(ar => ar.ride.routeHash === route.description
|
|
194
|
+
const routeRides = activeRides.filter(ar => ar.ride?.routeHash && ar.ride?.routeHash === route.description?.routeHash) ?? [];
|
|
195
195
|
const count = routeRides.length;
|
|
196
196
|
counts.push({
|
|
197
197
|
count,
|
|
@@ -22,7 +22,7 @@ export const createUIActivitySummary = (summary) => {
|
|
|
22
22
|
export const createUIActivityDetails = (details) => {
|
|
23
23
|
if (!details)
|
|
24
24
|
return details;
|
|
25
|
-
const ui =
|
|
25
|
+
const ui = structuredClone(details);
|
|
26
26
|
const [C, U] = getUnitConversionShortcuts();
|
|
27
27
|
ui.distance = { value: C(details.distance, 'distance', { digits: 1 }), unit: U('distance') };
|
|
28
28
|
if (ui.distance.value > 100)
|
|
@@ -729,7 +729,7 @@ let DeviceRideService = (() => {
|
|
|
729
729
|
const adapters = this.rideAdapters?.filter(ai => ai.adapter.getInterface() === ifName);
|
|
730
730
|
const stillHealthy = adapters.filter(ai => ai.isHealthy === undefined || ai.isHealthy);
|
|
731
731
|
this.logEvent({ message: 'reconnect confirmed', device: unhealthy.adapter.getUniqueName(), udid: unhealthy.udid, noDataSince: (Date.now() - unhealthy.tsLastData), tsLastData: unhealthy.tsLastData, stillHealthy: stillHealthy?.length, onSameInterface: adapters.length });
|
|
732
|
-
if (!stillHealthy?.length && adapters.length > 1) {
|
|
732
|
+
if (!stillHealthy?.length && adapters.length > 1 && ifName !== 'ble') {
|
|
733
733
|
await this.reconnectInterface(ifName, adapters);
|
|
734
734
|
}
|
|
735
735
|
else {
|
|
@@ -256,7 +256,6 @@ let RideDisplayService = (() => {
|
|
|
256
256
|
await this.stopRide({ exit, noStateUpdates: true });
|
|
257
257
|
this.getActivityRide().cleanup();
|
|
258
258
|
this.getCoaches().stopRide();
|
|
259
|
-
delete this.type;
|
|
260
259
|
}
|
|
261
260
|
toggleCyclingMode() {
|
|
262
261
|
try {
|
|
@@ -384,14 +383,12 @@ let RideDisplayService = (() => {
|
|
|
384
383
|
if (overwrite) {
|
|
385
384
|
delete this.type;
|
|
386
385
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
this.type = prev;
|
|
394
|
-
}
|
|
386
|
+
try {
|
|
387
|
+
this.type = this.type ?? this.detectRideType();
|
|
388
|
+
}
|
|
389
|
+
catch (err) {
|
|
390
|
+
this.logError(err, 'getRideType');
|
|
391
|
+
this.type = prev;
|
|
395
392
|
}
|
|
396
393
|
return this.type;
|
|
397
394
|
}
|
|
@@ -451,7 +448,6 @@ let RideDisplayService = (() => {
|
|
|
451
448
|
catch (err) {
|
|
452
449
|
this.logError(err, 'stopRide');
|
|
453
450
|
}
|
|
454
|
-
delete this.type;
|
|
455
451
|
delete this.displayService;
|
|
456
452
|
}
|
|
457
453
|
async closePrevRide() {
|
|
@@ -774,6 +770,7 @@ let RideDisplayService = (() => {
|
|
|
774
770
|
this.logEvent({ message: 'Start activity', activityId: this.activity?.id, ...logProps, interface: this.getBikeInterface() });
|
|
775
771
|
}
|
|
776
772
|
startRide(retry) {
|
|
773
|
+
this.getRideType(true);
|
|
777
774
|
this.displayService.start(retry);
|
|
778
775
|
this.displayService.on('state-update', this.stateUpdateHandler)
|
|
779
776
|
.on('route-updated', this.onRouteUpdated.bind(this));
|
|
@@ -1011,9 +1008,9 @@ let RideDisplayService = (() => {
|
|
|
1011
1008
|
getStartOverlayProps = () => {
|
|
1012
1009
|
const mode = this.getRideType();
|
|
1013
1010
|
const readyToStart = this.isStartDeviceReadyToStart() && this.getRideModeService().isStartRideCompleted();
|
|
1014
|
-
const
|
|
1011
|
+
const devicesState = this.deviceInfo ?? [];
|
|
1015
1012
|
const displayOverlayProps = this.getRideModeService().getStartOverlayProps() ?? {};
|
|
1016
|
-
return { mode, rideState: this.state,
|
|
1013
|
+
return { mode, rideState: this.state, devicesState, readyToStart, ...displayOverlayProps };
|
|
1017
1014
|
};
|
|
1018
1015
|
getDeviceStartSettings() {
|
|
1019
1016
|
let forceErgMode = false;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "incyclist-services",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.9",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"gd-eventlog": "^0.1.27"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"axios": "^1.13.4",
|
|
9
|
-
"incyclist-devices": "^3.0.
|
|
9
|
+
"incyclist-devices": "^3.0.6",
|
|
10
10
|
"promise.any": "^2.0.6",
|
|
11
11
|
"semver": "^7.7.3",
|
|
12
12
|
"tcx-builder": "^1.1.1",
|