incyclist-services 1.9.4 → 1.9.6
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 +7 -7
- package/lib/cjs/activities/base/convert/fit/local-fit.js +4 -4
- package/lib/cjs/activities/base/repo/db.js +5 -5
- package/lib/cjs/activities/base/utils/activity.js +1 -1
- package/lib/cjs/activities/list/service.js +8 -7
- package/lib/cjs/activities/page/service.js +2 -2
- package/lib/cjs/activities/ride/service.js +12 -11
- package/lib/cjs/api/repository/json/index.js +1 -1
- package/lib/cjs/base/types/observer.js +1 -1
- package/lib/cjs/coaches/service.js +48 -29
- package/lib/cjs/devices/access/service.js +2 -2
- package/lib/cjs/devices/configuration/service.js +2 -2
- package/lib/cjs/devices/page/base/service.js +10 -7
- package/lib/cjs/devices/pairing/service.js +36 -27
- package/lib/cjs/devices/ride/service.js +4 -4
- package/lib/cjs/ride/base/base.js +4 -4
- package/lib/cjs/ride/display/service.js +12 -11
- package/lib/cjs/ride/page/service.js +4 -4
- package/lib/cjs/ride/route/FreeRideDisplayService.js +7 -6
- package/lib/cjs/ride/route/GpxDisplayService.js +10 -2
- package/lib/cjs/ride/route/RLVDisplayService.js +34 -4
- package/lib/cjs/ride/route/RouteDisplayService.js +1 -1
- package/lib/cjs/routes/base/parsers/gpx.js +2 -2
- package/lib/cjs/routes/download/service.js +2 -2
- package/lib/cjs/routes/free-ride/service.js +2 -2
- package/lib/cjs/routes/list/cards/RouteCard.js +12 -12
- package/lib/cjs/routes/list/loaders/DBLoader.js +1 -1
- package/lib/cjs/routes/list/loaders/StravaActivityLoader.js +1 -1
- package/lib/cjs/routes/list/loaders/api.js +5 -5
- package/lib/cjs/routes/list/loaders/db.js +11 -8
- package/lib/cjs/routes/list/loaders/types.js +1 -1
- package/lib/cjs/routes/list/service.js +27 -23
- package/lib/cjs/routes/page/service.js +2 -2
- package/lib/cjs/routes/sync/factory.js +2 -2
- package/lib/cjs/routes/sync/komoot/provider.js +3 -3
- package/lib/cjs/settings/service/service.js +3 -3
- package/lib/cjs/ui/service.js +6 -6
- package/lib/cjs/video/VideoConversion.js +13 -4
- package/lib/cjs/video/audio.js +14 -0
- package/lib/cjs/video/index.js +1 -0
- package/lib/cjs/workouts/calendar/service.js +3 -3
- package/lib/cjs/workouts/calendar/sync/factory.js +2 -2
- package/lib/cjs/workouts/calendar/sync/intervals/provider.js +2 -2
- package/lib/cjs/workouts/list/cards/ActiveImportCard.js +1 -1
- package/lib/cjs/workouts/list/cards/WorkoutCard.js +3 -3
- package/lib/cjs/workouts/list/loaders/api.js +3 -3
- package/lib/cjs/workouts/list/loaders/db.js +4 -4
- package/lib/cjs/workouts/list/service.js +2 -2
- package/lib/cjs/workouts/ride/service.js +14 -13
- package/lib/esm/activities/active-rides/service.js +7 -7
- package/lib/esm/activities/base/convert/fit/local-fit.js +4 -4
- package/lib/esm/activities/base/repo/db.js +5 -5
- package/lib/esm/activities/base/utils/activity.js +1 -1
- package/lib/esm/activities/list/service.js +8 -7
- package/lib/esm/activities/page/service.js +2 -2
- package/lib/esm/activities/ride/service.js +12 -11
- package/lib/esm/api/repository/json/index.js +1 -1
- package/lib/esm/base/types/observer.js +1 -1
- package/lib/esm/coaches/service.js +48 -29
- package/lib/esm/devices/access/service.js +2 -2
- package/lib/esm/devices/configuration/service.js +2 -2
- package/lib/esm/devices/page/base/service.js +10 -7
- package/lib/esm/devices/pairing/service.js +36 -27
- package/lib/esm/devices/ride/service.js +4 -4
- package/lib/esm/ride/base/base.js +4 -4
- package/lib/esm/ride/display/service.js +12 -11
- package/lib/esm/ride/page/service.js +4 -4
- package/lib/esm/ride/route/FreeRideDisplayService.js +7 -6
- package/lib/esm/ride/route/GpxDisplayService.js +10 -2
- package/lib/esm/ride/route/RLVDisplayService.js +35 -5
- package/lib/esm/ride/route/RouteDisplayService.js +1 -1
- package/lib/esm/routes/base/parsers/gpx.js +2 -2
- package/lib/esm/routes/download/service.js +2 -2
- package/lib/esm/routes/free-ride/service.js +2 -2
- package/lib/esm/routes/list/cards/RouteCard.js +12 -12
- package/lib/esm/routes/list/loaders/DBLoader.js +1 -1
- package/lib/esm/routes/list/loaders/StravaActivityLoader.js +1 -1
- package/lib/esm/routes/list/loaders/api.js +5 -5
- package/lib/esm/routes/list/loaders/db.js +11 -8
- package/lib/esm/routes/list/loaders/types.js +1 -1
- package/lib/esm/routes/list/service.js +27 -23
- package/lib/esm/routes/page/service.js +2 -2
- package/lib/esm/routes/sync/factory.js +2 -2
- package/lib/esm/routes/sync/komoot/provider.js +3 -3
- package/lib/esm/settings/service/service.js +3 -3
- package/lib/esm/ui/service.js +6 -6
- package/lib/esm/video/VideoConversion.js +13 -4
- package/lib/esm/video/audio.js +10 -0
- package/lib/esm/video/index.js +1 -0
- package/lib/esm/workouts/calendar/service.js +3 -3
- package/lib/esm/workouts/calendar/sync/factory.js +2 -2
- package/lib/esm/workouts/calendar/sync/intervals/provider.js +2 -2
- package/lib/esm/workouts/list/cards/ActiveImportCard.js +1 -1
- package/lib/esm/workouts/list/cards/WorkoutCard.js +3 -3
- package/lib/esm/workouts/list/loaders/api.js +3 -3
- package/lib/esm/workouts/list/loaders/db.js +4 -4
- package/lib/esm/workouts/list/service.js +2 -2
- package/lib/esm/workouts/ride/service.js +14 -13
- package/lib/types/api/video/index.d.ts +1 -0
- package/lib/types/coaches/service.d.ts +4 -2
- package/lib/types/devices/pairing/service.d.ts +2 -1
- package/lib/types/devices/types.d.ts +1 -0
- package/lib/types/ride/route/GpxDisplayService.d.ts +1 -0
- package/lib/types/ride/route/RLVDisplayService.d.ts +5 -0
- package/lib/types/video/VideoConversion.d.ts +3 -2
- package/lib/types/video/audio.d.ts +4 -0
- package/lib/types/video/index.d.ts +1 -0
- package/lib/types/video/types.d.ts +3 -0
- package/package.json +2 -2
|
@@ -152,7 +152,7 @@ let DevicePairingService = (() => {
|
|
|
152
152
|
this.emit('page-ready');
|
|
153
153
|
}
|
|
154
154
|
else {
|
|
155
|
-
this.run();
|
|
155
|
+
this.run().catch(err => { this.logError(err, 'start'); });
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
catch (err) {
|
|
@@ -242,7 +242,7 @@ let DevicePairingService = (() => {
|
|
|
242
242
|
const startScan = async () => {
|
|
243
243
|
if (devices.length > 0)
|
|
244
244
|
await this.stopAdaptersWithCapability(capability);
|
|
245
|
-
this.stopPairing();
|
|
245
|
+
this.stopPairing().catch(err => { this.logError(err, 'startDeviceSelection'); });
|
|
246
246
|
this.emitStateChange({ capabilities: this.state.capabilities });
|
|
247
247
|
if (devices.length > 0)
|
|
248
248
|
await this.stopAdaptersWithCapability(capability);
|
|
@@ -250,14 +250,15 @@ let DevicePairingService = (() => {
|
|
|
250
250
|
};
|
|
251
251
|
this.deviceSelectState = { capability, devices: available };
|
|
252
252
|
if (devices.length === 0) {
|
|
253
|
-
startScan();
|
|
253
|
+
startScan().catch(err => { this.logError(err, 'startDeviceSelection'); });
|
|
254
254
|
}
|
|
255
255
|
else {
|
|
256
256
|
this.pauseScanDelay()
|
|
257
257
|
.then(() => {
|
|
258
258
|
if (this.deviceSelectState)
|
|
259
|
-
startScan();
|
|
260
|
-
})
|
|
259
|
+
return startScan();
|
|
260
|
+
})
|
|
261
|
+
.catch(err => { this.logError(err, 'startDeviceSelection'); });
|
|
261
262
|
}
|
|
262
263
|
return this.deviceSelectState;
|
|
263
264
|
}
|
|
@@ -331,7 +332,7 @@ let DevicePairingService = (() => {
|
|
|
331
332
|
const adapater = this.getDeviceConfiguration().getSelected(capability);
|
|
332
333
|
this.getDeviceConfiguration().disableCapability(capability, true);
|
|
333
334
|
if (adapater?.isStarted()) {
|
|
334
|
-
this.restart();
|
|
335
|
+
this.restart().catch(err => { this.logError(err, 'unselectDevices'); });
|
|
335
336
|
}
|
|
336
337
|
}
|
|
337
338
|
catch (err) {
|
|
@@ -371,7 +372,7 @@ let DevicePairingService = (() => {
|
|
|
371
372
|
if (this.state.check?.to)
|
|
372
373
|
clearTimeout(this.state.check?.to);
|
|
373
374
|
delete this.state.check;
|
|
374
|
-
this.run();
|
|
375
|
+
this.run().catch(err => { this.logError(err, 'restartPair'); });
|
|
375
376
|
}
|
|
376
377
|
async restart() {
|
|
377
378
|
const wasActive = this.isPairing() || this.isScanning();
|
|
@@ -397,11 +398,11 @@ let DevicePairingService = (() => {
|
|
|
397
398
|
if (wasActive) {
|
|
398
399
|
await this.rideService.stop();
|
|
399
400
|
await (0, sleep_1.sleep)(500);
|
|
400
|
-
this.run();
|
|
401
|
+
this.run().catch(err => { this.logError(err, 'restart'); });
|
|
401
402
|
}
|
|
402
403
|
if (this.state.waiting) {
|
|
403
404
|
this.state.waiting = false;
|
|
404
|
-
this.run();
|
|
405
|
+
this.run().catch(err => { this.logError(err, 'restart'); });
|
|
405
406
|
}
|
|
406
407
|
}
|
|
407
408
|
async _stop() {
|
|
@@ -459,10 +460,10 @@ let DevicePairingService = (() => {
|
|
|
459
460
|
}
|
|
460
461
|
else {
|
|
461
462
|
this.getDeviceConfiguration().once('initialized', (capabilitiesLoaded, interfacesLoaded) => {
|
|
462
|
-
this.onConfigLoaded(capabilitiesLoaded, interfacesLoaded);
|
|
463
|
+
this.onConfigLoaded(capabilitiesLoaded, interfacesLoaded).catch(err => { this.logError(err, 'waitForInit'); });
|
|
463
464
|
done();
|
|
464
465
|
});
|
|
465
|
-
this.getDeviceConfiguration().init();
|
|
466
|
+
this.getDeviceConfiguration().init().catch(err => { this.logError(err, 'waitForInit'); });
|
|
466
467
|
}
|
|
467
468
|
});
|
|
468
469
|
}
|
|
@@ -552,11 +553,13 @@ let DevicePairingService = (() => {
|
|
|
552
553
|
const current = getInterfaceSettings(ifName, prev);
|
|
553
554
|
if (settings.enabled && !current.enabled) {
|
|
554
555
|
const { port, protocol } = settings;
|
|
555
|
-
this.access.enableInterface(ifName, undefined, { port: Number(port), protocol, autoConnect: true })
|
|
556
|
+
this.access.enableInterface(ifName, undefined, { port: Number(port), protocol, autoConnect: true })
|
|
557
|
+
.catch(err => { this.logError(err, 'onInterfaceConfigChanged()'); });
|
|
556
558
|
this.selectFromInterface(ifName);
|
|
557
559
|
}
|
|
558
560
|
else if (!settings.enabled && current.enabled) {
|
|
559
|
-
this.access.disableInterface(ifName)
|
|
561
|
+
this.access.disableInterface(ifName)
|
|
562
|
+
.catch(err => { this.logError(err, 'onInterfaceConfigChanged()'); });
|
|
560
563
|
this.unselectOnInterface(ifName);
|
|
561
564
|
this.unselectDisabledInterfaces();
|
|
562
565
|
this.stopAdaptersOnInterface(ifName).catch(err => {
|
|
@@ -570,7 +573,7 @@ let DevicePairingService = (() => {
|
|
|
570
573
|
current.port = settings.port;
|
|
571
574
|
current.protocol = settings.protocol;
|
|
572
575
|
this.emitStateChange();
|
|
573
|
-
this.restart();
|
|
576
|
+
this.restart().catch(err => { this.logError(err, 'onInterfaceConfigChanged()'); });
|
|
574
577
|
}
|
|
575
578
|
catch (err) {
|
|
576
579
|
this.logError(err, 'onInterfaceConfigChanged()');
|
|
@@ -632,10 +635,10 @@ let DevicePairingService = (() => {
|
|
|
632
635
|
prev[changedIdx].state = ifDetails.state;
|
|
633
636
|
}
|
|
634
637
|
if (restartScan) {
|
|
635
|
-
this.restart();
|
|
638
|
+
this.restart().catch(err => { this.logError(err, 'onInterfaceStateChanged()'); });
|
|
636
639
|
}
|
|
637
640
|
if (restartPair && this.isInterfaceInUse(ifName)) {
|
|
638
|
-
this.restartPair();
|
|
641
|
+
this.restartPair().catch(err => { this.logError(err, 'onInterfaceStateChanged()'); });
|
|
639
642
|
}
|
|
640
643
|
this.emitStateChange({ interfaces: this.state.interfaces });
|
|
641
644
|
}
|
|
@@ -664,7 +667,7 @@ let DevicePairingService = (() => {
|
|
|
664
667
|
if (pairing.includes(ifName)) {
|
|
665
668
|
current.state = 'disconnected';
|
|
666
669
|
this.emitStateChange({ interfaces: this.state.interfaces });
|
|
667
|
-
this.reconnectInterface(ifName, 1000);
|
|
670
|
+
this.reconnectInterface(ifName, 1000).catch(err => { this.logError(err, 'reconnectInterface'); });
|
|
668
671
|
}
|
|
669
672
|
}
|
|
670
673
|
}
|
|
@@ -728,6 +731,8 @@ let DevicePairingService = (() => {
|
|
|
728
731
|
rideService.off('data', this.onDeviceDataHandler);
|
|
729
732
|
}
|
|
730
733
|
initScanningCallbacks() {
|
|
734
|
+
this.access.off('device', this.onDeviceDetectedHandler);
|
|
735
|
+
this.access.off('data', this.onDeviceDataHandler);
|
|
731
736
|
this.access.on('device', this.onDeviceDetectedHandler);
|
|
732
737
|
this.access.on('data', this.onDeviceDataHandler);
|
|
733
738
|
}
|
|
@@ -736,11 +741,11 @@ let DevicePairingService = (() => {
|
|
|
736
741
|
this.access?.off('data', this.onDeviceDataHandler);
|
|
737
742
|
this.deregisterScanningDataHandlers();
|
|
738
743
|
}
|
|
739
|
-
onPairingStatusUpdate(udid, connectState, notify = true) {
|
|
744
|
+
onPairingStatusUpdate(udid, connectState, notify = true, keepConnectAttempts = false) {
|
|
740
745
|
const capabilities = this.state.capabilities;
|
|
741
746
|
let changed = false;
|
|
742
747
|
capabilities.forEach(c => {
|
|
743
|
-
if (c.selected === udid) {
|
|
748
|
+
if (c.selected === udid && !(keepConnectAttempts && this.isConnectAttemptState(c.connectState))) {
|
|
744
749
|
if (c.connectState !== connectState) {
|
|
745
750
|
c.connectState = connectState;
|
|
746
751
|
changed = true;
|
|
@@ -751,7 +756,7 @@ let DevicePairingService = (() => {
|
|
|
751
756
|
}
|
|
752
757
|
}
|
|
753
758
|
const device = this.getCapabilityDevice(c);
|
|
754
|
-
if (device && device.
|
|
759
|
+
if (device?.udid === udid && !(keepConnectAttempts && this.isConnectAttemptState(device.connectState))) {
|
|
755
760
|
device.connectState = connectState;
|
|
756
761
|
}
|
|
757
762
|
});
|
|
@@ -908,7 +913,7 @@ let DevicePairingService = (() => {
|
|
|
908
913
|
else {
|
|
909
914
|
this.logEvent({ message: 'Could not get adapter', deviceSettings });
|
|
910
915
|
}
|
|
911
|
-
this.
|
|
916
|
+
this.onPairingStatusUpdate(udid, 'connected', true, true);
|
|
912
917
|
}
|
|
913
918
|
catch (err) {
|
|
914
919
|
this.logError(err, 'onDeviceDetected');
|
|
@@ -926,17 +931,21 @@ let DevicePairingService = (() => {
|
|
|
926
931
|
}
|
|
927
932
|
let device = this.getCapabilityDevice(c, udid);
|
|
928
933
|
if (device) {
|
|
929
|
-
device.connectState
|
|
934
|
+
if (!this.isConnectAttemptState(device.connectState))
|
|
935
|
+
device.connectState = 'connected';
|
|
930
936
|
}
|
|
931
937
|
else {
|
|
932
938
|
device = { udid, connectState: 'connected', selected: false, name: adapter.getUniqueName(), interface: adapter.getInterface() };
|
|
933
939
|
info.devices.push(device);
|
|
934
940
|
}
|
|
935
|
-
if (info.selected === udid) {
|
|
941
|
+
if (info.selected === udid && !this.isConnectAttemptState(info.connectState)) {
|
|
936
942
|
info.connectState = 'connected';
|
|
937
943
|
}
|
|
938
944
|
});
|
|
939
945
|
}
|
|
946
|
+
isConnectAttemptState(connectState) {
|
|
947
|
+
return connectState === 'connecting' || connectState === 'failed';
|
|
948
|
+
}
|
|
940
949
|
disconnectInterface(name) {
|
|
941
950
|
this.access.disableInterface(name)
|
|
942
951
|
.catch((err) => { this.logError(err, 'disableInterface'); });
|
|
@@ -1121,7 +1130,7 @@ let DevicePairingService = (() => {
|
|
|
1121
1130
|
return;
|
|
1122
1131
|
await (0, sleep_1.sleep)(this.getPairingRetryDelay());
|
|
1123
1132
|
if (!this.state.scan)
|
|
1124
|
-
this.run();
|
|
1133
|
+
this.run().catch(err => { this.logError(err, 'startPairing'); });
|
|
1125
1134
|
}
|
|
1126
1135
|
}
|
|
1127
1136
|
setRequestedCapabilties(selectedAdapters) {
|
|
@@ -1195,7 +1204,7 @@ let DevicePairingService = (() => {
|
|
|
1195
1204
|
}
|
|
1196
1205
|
if (!this.isPairing() && (!this.isScanning() || this.state.scan.preparing === preparing)) {
|
|
1197
1206
|
delete this.state.scan;
|
|
1198
|
-
this.run();
|
|
1207
|
+
this.run().catch(err => { this.logError(err, 'startScanning'); });
|
|
1199
1208
|
}
|
|
1200
1209
|
}, 1000);
|
|
1201
1210
|
return;
|
|
@@ -1234,7 +1243,7 @@ let DevicePairingService = (() => {
|
|
|
1234
1243
|
if (!props.enforcedScan) {
|
|
1235
1244
|
this.cleanupScan();
|
|
1236
1245
|
await (0, sleep_1.sleep)(500);
|
|
1237
|
-
this.run();
|
|
1246
|
+
this.run().catch(err => { this.logError(err, 'startScanning'); });
|
|
1238
1247
|
}
|
|
1239
1248
|
}
|
|
1240
1249
|
deregisterScanningDataHandlers() {
|
|
@@ -1496,7 +1505,7 @@ let DevicePairingService = (() => {
|
|
|
1496
1505
|
if (stop) {
|
|
1497
1506
|
if (wasScanning)
|
|
1498
1507
|
await this.stopAdaptersWithCapability(this.settings.capabilityForScan);
|
|
1499
|
-
this.run();
|
|
1508
|
+
this.run().catch(err => { this.logError(err, '_stopDeviceSelection'); });
|
|
1500
1509
|
}
|
|
1501
1510
|
}
|
|
1502
1511
|
numberOfSelectedCababilities(udid) {
|
|
@@ -107,7 +107,7 @@ let DeviceRideService = (() => {
|
|
|
107
107
|
if (config.isInitialized())
|
|
108
108
|
return done();
|
|
109
109
|
config.once('initialized', done);
|
|
110
|
-
config.init();
|
|
110
|
+
config.init().catch(err => { this.logError(err, 'waitForInit'); });
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
async lazyInit() {
|
|
@@ -254,7 +254,7 @@ let DeviceRideService = (() => {
|
|
|
254
254
|
if (eppPreferences.programId > 32767)
|
|
255
255
|
eppPreferences.programId = 1;
|
|
256
256
|
}
|
|
257
|
-
userSettings.update({ eppPreferences });
|
|
257
|
+
userSettings.update({ eppPreferences }).catch(err => { this.logError(err, 'incrementEppProgramId'); });
|
|
258
258
|
return eppPreferences;
|
|
259
259
|
}
|
|
260
260
|
parseEppData(routeData, startPos, isLap, eppPreferences, rideMode, realityFactor) {
|
|
@@ -705,7 +705,7 @@ let DeviceRideService = (() => {
|
|
|
705
705
|
if (ai.isHealthy && (isAmber || isRed)) {
|
|
706
706
|
ai.isHealthy = false;
|
|
707
707
|
this.logEvent({ message: 'device unhealthy', device: ai.adapter.getUniqueName(), udid: ai.udid, noDataSince: (tsNow - tsLastData), tsLastData: new Date(tsLastData).toISOString() });
|
|
708
|
-
this.prepareReconnect(ai);
|
|
708
|
+
this.prepareReconnect(ai).catch(err => { this.logError(err, 'startHealthCheck'); });
|
|
709
709
|
}
|
|
710
710
|
else if (!ai.isHealthy && !isAmber && !isRed) {
|
|
711
711
|
ai.isHealthy = true;
|
|
@@ -1238,7 +1238,7 @@ let DeviceRideService = (() => {
|
|
|
1238
1238
|
if (currentMode.isERG()) {
|
|
1239
1239
|
const slope = adapter.getData().slope;
|
|
1240
1240
|
adapter.setCyclingMode(targetMode);
|
|
1241
|
-
this.resetCyclingMode(false);
|
|
1241
|
+
this.resetCyclingMode(false).catch(err => { this.logError(err, 'toggleCyclingMode'); });
|
|
1242
1242
|
const newMode = adapter.getCyclingMode();
|
|
1243
1243
|
if (newMode.isSIM()) {
|
|
1244
1244
|
request = { slope };
|
|
@@ -97,7 +97,7 @@ let RideModeService = (() => {
|
|
|
97
97
|
onActivityUpdate(activityPos, data) {
|
|
98
98
|
const limits = this.getWorkoutLimits();
|
|
99
99
|
const request = this.buildRequest({ limits });
|
|
100
|
-
this.sendUpdate(request);
|
|
100
|
+
this.sendUpdate(request).catch(err => { this.logError(err, 'onActivityUpdate'); });
|
|
101
101
|
this.prevLimits = limits;
|
|
102
102
|
}
|
|
103
103
|
onDeviceData(data, udid) {
|
|
@@ -139,7 +139,7 @@ let RideModeService = (() => {
|
|
|
139
139
|
if (!update || Object.keys(update).length === 0) {
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
|
-
this.getDeviceRide().sendUpdate(update);
|
|
142
|
+
this.getDeviceRide().sendUpdate(update).catch(err => { this.logError(err, 'sendUpdate'); });
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
processPowerDeltaRequest(request) {
|
|
@@ -154,7 +154,7 @@ let RideModeService = (() => {
|
|
|
154
154
|
this.processing.shift();
|
|
155
155
|
if (this.queued.length > 0) {
|
|
156
156
|
const request = this.queued.shift();
|
|
157
|
-
send(request);
|
|
157
|
+
send(request).catch(err => { this.logError(err, 'processPowerDeltaRequest'); });
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
160
|
if (this.processing.length > 0) {
|
|
@@ -168,7 +168,7 @@ let RideModeService = (() => {
|
|
|
168
168
|
}
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
|
-
send(request);
|
|
171
|
+
send(request).catch(err => { this.logError(err, 'processPowerDeltaRequest'); });
|
|
172
172
|
}
|
|
173
173
|
isForcedERG() {
|
|
174
174
|
let forceErgMode = false;
|
|
@@ -155,7 +155,7 @@ let RideDisplayService = (() => {
|
|
|
155
155
|
}
|
|
156
156
|
this.startDevices();
|
|
157
157
|
this.startRide();
|
|
158
|
-
this.getCoaches().startRide(this.route);
|
|
158
|
+
this.getCoaches().startRide(this.route).catch(err => { this.logError(err, 'start'); });
|
|
159
159
|
this.setState('Starting');
|
|
160
160
|
this.logEvent({ message: 'overlay shown', overlay: 'start overlay' });
|
|
161
161
|
}
|
|
@@ -292,8 +292,8 @@ let RideDisplayService = (() => {
|
|
|
292
292
|
this.logError(err, 'stop');
|
|
293
293
|
}
|
|
294
294
|
await this.stopRide({ exit, noStateUpdates: true });
|
|
295
|
-
this.getActivityRide().cleanup();
|
|
296
|
-
this.getCoaches().stopRide();
|
|
295
|
+
this.getActivityRide().cleanup().catch(err => { this.logError(err, 'stop'); });
|
|
296
|
+
this.getCoaches().stopRide().catch(err => { this.logError(err, 'stop'); });
|
|
297
297
|
}
|
|
298
298
|
toggleCyclingMode() {
|
|
299
299
|
try {
|
|
@@ -301,7 +301,7 @@ let RideDisplayService = (() => {
|
|
|
301
301
|
this.getWorkoutRide().toggleCyclingMode();
|
|
302
302
|
}
|
|
303
303
|
else {
|
|
304
|
-
this.getDeviceRide().toggleCyclingMode();
|
|
304
|
+
this.getDeviceRide().toggleCyclingMode().catch(err => { this.logError(err, 'toggleCyclingMode'); });
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
307
|
catch (err) {
|
|
@@ -487,15 +487,16 @@ let RideDisplayService = (() => {
|
|
|
487
487
|
else {
|
|
488
488
|
const observerToClear = this.observer;
|
|
489
489
|
(0, utils_1.waitNextTick)().then(() => { if (this.observer === observerToClear)
|
|
490
|
-
delete this.observer; })
|
|
490
|
+
delete this.observer; })
|
|
491
|
+
.catch(err => { this.logError(err, 'stopRide'); });
|
|
491
492
|
}
|
|
492
493
|
if (isRedundantCall) {
|
|
493
494
|
this.state = 'Idle';
|
|
494
495
|
return;
|
|
495
496
|
}
|
|
496
497
|
this.stopDevices(props.exit);
|
|
497
|
-
this.displayService.stop();
|
|
498
|
-
this.getActivityRide().stop();
|
|
498
|
+
this.displayService.stop().catch(err => { this.logError(err, 'stopRide'); });
|
|
499
|
+
this.getActivityRide().stop().catch(err => { this.logError(err, 'stopRide'); });
|
|
499
500
|
this.observer?.emit('state-update', this.state);
|
|
500
501
|
const workoutService = this.getWorkoutRide();
|
|
501
502
|
workoutService.stop({ clearFromList: true, completed: true });
|
|
@@ -642,7 +643,7 @@ let RideDisplayService = (() => {
|
|
|
642
643
|
if (this.state !== 'Active' && this.state !== 'Paused')
|
|
643
644
|
return;
|
|
644
645
|
if (this.getRideType() === 'Workout') {
|
|
645
|
-
this.stopRide();
|
|
646
|
+
this.stopRide().catch(err => { this.logError(err, 'onWorkoutCompleted'); });
|
|
646
647
|
}
|
|
647
648
|
this.checkCyclingModeToggle();
|
|
648
649
|
}
|
|
@@ -652,7 +653,7 @@ let RideDisplayService = (() => {
|
|
|
652
653
|
if (res?.changed) {
|
|
653
654
|
this.getRideModeService().sendUpdate();
|
|
654
655
|
}
|
|
655
|
-
});
|
|
656
|
+
}).catch(err => { this.logError(err, 'checkCyclingModeToggle'); });
|
|
656
657
|
}
|
|
657
658
|
}
|
|
658
659
|
onLapCompleted(oldLap, newLap) {
|
|
@@ -671,7 +672,7 @@ let RideDisplayService = (() => {
|
|
|
671
672
|
this.observer?.emit('view-changed');
|
|
672
673
|
return;
|
|
673
674
|
}
|
|
674
|
-
this.stopRide();
|
|
675
|
+
this.stopRide().catch(err => { this.logError(err, 'onRouteCompleted'); });
|
|
675
676
|
}
|
|
676
677
|
onForward(workoutTime, remaining) {
|
|
677
678
|
const time = Math.round(this.activity.time);
|
|
@@ -876,7 +877,7 @@ let RideDisplayService = (() => {
|
|
|
876
877
|
this.getDeviceRide().off('data', this.startDeviceHandlers?.deviceDataHandler);
|
|
877
878
|
this.resetDeviceHandlers();
|
|
878
879
|
if (exit)
|
|
879
|
-
this.getDeviceRide().stop();
|
|
880
|
+
this.getDeviceRide().stop().catch(err => { this.logError(err, 'stopDevices'); });
|
|
880
881
|
else
|
|
881
882
|
this.getDeviceRide().pause();
|
|
882
883
|
}
|
|
@@ -181,7 +181,7 @@ let RidePageService = (() => {
|
|
|
181
181
|
if (this.isRideType('Video', 'GPX')) {
|
|
182
182
|
(0, sleep_1.sleep)(5).then(() => {
|
|
183
183
|
this.updatePageDisplay();
|
|
184
|
-
});
|
|
184
|
+
}).catch(err => { this.logError(err, 'openPage'); });
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
187
|
if (this.requiresOwnInit() && !this.isInitialized) {
|
|
@@ -213,7 +213,7 @@ let RidePageService = (() => {
|
|
|
213
213
|
gd_eventlog_1.EventLogger.setGlobalConfig('page', null);
|
|
214
214
|
this.logEvent({ message: 'page closed', page: this.getPageLogName() });
|
|
215
215
|
this.handleVideoVisitExit();
|
|
216
|
-
this.getRideDisplay().stop();
|
|
216
|
+
this.getRideDisplay().stop().catch(err => { this.logError(err, 'closePage'); });
|
|
217
217
|
this.unregisterHandlers(this.rideObserver, this.eventHandler);
|
|
218
218
|
this.unsubscribeFromWorkoutObserver();
|
|
219
219
|
this.getDeviceConfiguration().off('mode-changed', this.onDeviceModeChangedBound);
|
|
@@ -384,7 +384,7 @@ let RidePageService = (() => {
|
|
|
384
384
|
}
|
|
385
385
|
onEndRide() {
|
|
386
386
|
try {
|
|
387
|
-
this.getRideDisplay().stop();
|
|
387
|
+
this.getRideDisplay().stop().catch(err => { this.logError(err, 'onEndRide'); });
|
|
388
388
|
this.moveToPreviousPage();
|
|
389
389
|
this.closePage();
|
|
390
390
|
}
|
|
@@ -801,7 +801,7 @@ let RidePageService = (() => {
|
|
|
801
801
|
}
|
|
802
802
|
}
|
|
803
803
|
finishRide() {
|
|
804
|
-
this.getRideDisplay().stop(true);
|
|
804
|
+
this.getRideDisplay().stop(true).catch(err => { this.logError(err, 'finishRide'); });
|
|
805
805
|
this.menuProps = this.buildFinishedMenuProps();
|
|
806
806
|
this.updatePageDisplay();
|
|
807
807
|
}
|
|
@@ -94,7 +94,7 @@ let FreeRideDisplayService = (() => {
|
|
|
94
94
|
this.getFreeRideService().applyStartOption(startSettings.option);
|
|
95
95
|
this.tsLastOptionChange = Date.now();
|
|
96
96
|
delete this.viewportPreview;
|
|
97
|
-
this.getNextOptions(true);
|
|
97
|
+
this.getNextOptions(true).catch(err => { this.logError(err, 'start'); });
|
|
98
98
|
}
|
|
99
99
|
catch (err) {
|
|
100
100
|
this.logError(err, 'start');
|
|
@@ -119,7 +119,7 @@ let FreeRideDisplayService = (() => {
|
|
|
119
119
|
const freeRide = this.getFreeRideService();
|
|
120
120
|
const selectedOption = freeRide.getSelectedOption();
|
|
121
121
|
if (!selectedOption?.path?.length) {
|
|
122
|
-
this.onTurn();
|
|
122
|
+
this.onTurn().catch(err => { this.logError(err, 'continueWithSelectedOption'); });
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
125
|
const finished = this.updateRouteWithSelectedOption();
|
|
@@ -133,7 +133,7 @@ let FreeRideDisplayService = (() => {
|
|
|
133
133
|
if (turnEnabled) {
|
|
134
134
|
setTimeout(() => { this.isTurnEnabled = turnEnabled; }, DEFAULT_OPTIONS_DELAY);
|
|
135
135
|
}
|
|
136
|
-
});
|
|
136
|
+
}).catch(err => { this.logError(err, 'continueWithSelectedOption'); });
|
|
137
137
|
}
|
|
138
138
|
return finished;
|
|
139
139
|
}
|
|
@@ -385,7 +385,7 @@ let FreeRideDisplayService = (() => {
|
|
|
385
385
|
const route = new route_1.Route(description, details);
|
|
386
386
|
(0, routes_1.validateRoute)(route);
|
|
387
387
|
route.description.distance = route.details.distance = (0, routes_1.getTotalDistance)(details);
|
|
388
|
-
route.updateCountryFromPoints();
|
|
388
|
+
route.updateCountryFromPoints().catch(err => { this.logError(err, 'createRoute'); });
|
|
389
389
|
return route;
|
|
390
390
|
}
|
|
391
391
|
catch (err) {
|
|
@@ -438,7 +438,8 @@ let FreeRideDisplayService = (() => {
|
|
|
438
438
|
else {
|
|
439
439
|
this.emitRouteUpdate();
|
|
440
440
|
}
|
|
441
|
-
})
|
|
441
|
+
})
|
|
442
|
+
.catch(err => { this.logError(err, 'getNextOptions'); });
|
|
442
443
|
});
|
|
443
444
|
}
|
|
444
445
|
saveViewport(viewport) {
|
|
@@ -473,7 +474,7 @@ let FreeRideDisplayService = (() => {
|
|
|
473
474
|
];
|
|
474
475
|
}
|
|
475
476
|
getMapCenter() {
|
|
476
|
-
if (!this.optionsVisible || !this.currentOptions)
|
|
477
|
+
if (!this.optionsVisible || !this.currentOptions?.length)
|
|
477
478
|
return;
|
|
478
479
|
const { lat, lng } = this.currentOptions[0].path[0];
|
|
479
480
|
return { lat, lng };
|
|
@@ -187,6 +187,7 @@ let GpxDisplayService = (() => {
|
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
189
|
getStartOverlayProps() {
|
|
190
|
+
const rideView = this.getRideView();
|
|
190
191
|
if (this.svFlowActive) {
|
|
191
192
|
const resolved = this.svViewState === 'loaded' || this.svViewState === 'unavailable';
|
|
192
193
|
return {
|
|
@@ -196,7 +197,6 @@ let GpxDisplayService = (() => {
|
|
|
196
197
|
viewFallbackCause: this.svViewState === 'unavailable' ? this.svFallbackCause : undefined
|
|
197
198
|
};
|
|
198
199
|
}
|
|
199
|
-
const rideView = this.getRideView();
|
|
200
200
|
if (rideView === 'map' || (this.isMobile() && !this.waitsForStreetView() && !this.waitsForSatelliteView())) {
|
|
201
201
|
return {
|
|
202
202
|
mapType: this.getRideViewName(),
|
|
@@ -210,10 +210,10 @@ let GpxDisplayService = (() => {
|
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
212
|
isStartRideCompleted() {
|
|
213
|
+
const rideView = this.getRideView();
|
|
213
214
|
if (this.svFlowActive) {
|
|
214
215
|
return this.mapLoaded;
|
|
215
216
|
}
|
|
216
|
-
const rideView = this.getRideView();
|
|
217
217
|
if (rideView === 'map' || (this.isMobile() && !this.waitsForStreetView() && !this.waitsForSatelliteView())) {
|
|
218
218
|
this.mapLoaded = true;
|
|
219
219
|
return true;
|
|
@@ -251,9 +251,17 @@ let GpxDisplayService = (() => {
|
|
|
251
251
|
getRideView() {
|
|
252
252
|
if (this.service?.isSimulated() && !this.getGoogleMaps().hasPersonalApiKey()) {
|
|
253
253
|
this.rideViewOverride = 'map';
|
|
254
|
+
this.abandonStreetViewFlow();
|
|
254
255
|
}
|
|
255
256
|
return this.rideViewOverride ?? this.getRideSettingsDisplay().getRideView();
|
|
256
257
|
}
|
|
258
|
+
abandonStreetViewFlow() {
|
|
259
|
+
if (!this.svFlowActive || this.svViewState === 'loaded' || this.svViewState === 'unavailable')
|
|
260
|
+
return;
|
|
261
|
+
this.clearStreetViewPhaseTimers();
|
|
262
|
+
this.svFlowActive = false;
|
|
263
|
+
this.emit('state-update');
|
|
264
|
+
}
|
|
257
265
|
onRideSettingsChanged(settings = {}) {
|
|
258
266
|
super.onRideSettingsChanged(settings);
|
|
259
267
|
if (this.rideViewOverride && settings?.rideView) {
|
|
@@ -69,6 +69,7 @@ let RLVDisplayService = (() => {
|
|
|
69
69
|
videos;
|
|
70
70
|
offset;
|
|
71
71
|
isInitialized;
|
|
72
|
+
audibleRate = true;
|
|
72
73
|
infotext;
|
|
73
74
|
videosInitialized = false;
|
|
74
75
|
startTime;
|
|
@@ -80,11 +81,12 @@ let RLVDisplayService = (() => {
|
|
|
80
81
|
initView() {
|
|
81
82
|
this.currentVideo = undefined;
|
|
82
83
|
this.videos = [];
|
|
84
|
+
this.audibleRate = true;
|
|
83
85
|
delete this.startTime;
|
|
84
86
|
this.addVideo(this.getRouteList().getRideRoute(), true).then(() => {
|
|
85
87
|
this.videosInitialized = true;
|
|
86
88
|
this.emit('state-update');
|
|
87
|
-
});
|
|
89
|
+
}).catch(err => { this.logError(err, 'initView'); });
|
|
88
90
|
this.isInitialized = true;
|
|
89
91
|
this.offset = 0;
|
|
90
92
|
}
|
|
@@ -165,7 +167,7 @@ let RLVDisplayService = (() => {
|
|
|
165
167
|
startTime,
|
|
166
168
|
autoConvert,
|
|
167
169
|
info: this.getInfotextDisplayProps(),
|
|
168
|
-
muted:
|
|
170
|
+
muted: !this.isVideoAudible(this.currentVideo),
|
|
169
171
|
loop: this.isLoopEnabled() ? true : undefined,
|
|
170
172
|
playback: this.currentVideo?.playback,
|
|
171
173
|
observer: this.currentVideo?.observer,
|
|
@@ -193,7 +195,7 @@ let RLVDisplayService = (() => {
|
|
|
193
195
|
autoConvert,
|
|
194
196
|
hidden: !video.isCurrent,
|
|
195
197
|
info: video.isCurrent ? this.getInfotextDisplayProps() : undefined,
|
|
196
|
-
muted:
|
|
198
|
+
muted: !(video.isCurrent && this.isVideoAudible(video)),
|
|
197
199
|
playback: video.playback,
|
|
198
200
|
observer: video.observer,
|
|
199
201
|
onLoaded: (bufferedTime) => { this.onVideoLoaded(bufferedTime, video); },
|
|
@@ -446,6 +448,16 @@ let RLVDisplayService = (() => {
|
|
|
446
448
|
onVideoPlayBackUpdate(time, rate, e, video = this.currentVideo) {
|
|
447
449
|
video.syncHelper.onVideoPlaybackUpdate(time, rate, e);
|
|
448
450
|
this.checkInfotextDisplayProps(time);
|
|
451
|
+
if (video === this.currentVideo)
|
|
452
|
+
this.checkAudibleRate(rate);
|
|
453
|
+
}
|
|
454
|
+
checkAudibleRate(rate) {
|
|
455
|
+
const audible = (0, video_1.isAudibleRate)(rate, this.audibleRate);
|
|
456
|
+
if (audible === this.audibleRate)
|
|
457
|
+
return;
|
|
458
|
+
this.audibleRate = audible;
|
|
459
|
+
if (this.isVideoSoundEnabled())
|
|
460
|
+
this.emit('state-update');
|
|
449
461
|
}
|
|
450
462
|
onVideoEnded(video = this.currentVideo) {
|
|
451
463
|
video.syncHelper.onVideoEnded();
|
|
@@ -526,6 +538,24 @@ let RLVDisplayService = (() => {
|
|
|
526
538
|
cleanupUrl(url) {
|
|
527
539
|
return (0, video_1.resolvePlaybackUrl)(url);
|
|
528
540
|
}
|
|
541
|
+
isVideoAudible(video) {
|
|
542
|
+
if (!this.isVideoSoundEnabled() || !this.audibleRate)
|
|
543
|
+
return false;
|
|
544
|
+
if (video?.playback === 'converted')
|
|
545
|
+
return this.isConvertedAudioSupported();
|
|
546
|
+
return true;
|
|
547
|
+
}
|
|
548
|
+
isConvertedAudioSupported() {
|
|
549
|
+
try {
|
|
550
|
+
return this.getBindings()?.video?.isConvertAudioSupported?.() ?? false;
|
|
551
|
+
}
|
|
552
|
+
catch {
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
isVideoSoundEnabled() {
|
|
557
|
+
return this.getUserSettings().get('preferences.video.sound', false) === true;
|
|
558
|
+
}
|
|
529
559
|
isLoopEnabled() {
|
|
530
560
|
return this.isLoop() && !this.startSettings?.loopOverwrite;
|
|
531
561
|
}
|
|
@@ -565,7 +595,7 @@ let RLVDisplayService = (() => {
|
|
|
565
595
|
if (!nextRoute) {
|
|
566
596
|
return false;
|
|
567
597
|
}
|
|
568
|
-
this.addVideo(nextRoute, false, current);
|
|
598
|
+
this.addVideo(nextRoute, false, current).catch(err => { this.logError(err, 'checkForAdditionalVideos'); });
|
|
569
599
|
return true;
|
|
570
600
|
}
|
|
571
601
|
isMobile() {
|
|
@@ -145,7 +145,7 @@ let RouteDisplayService = (() => {
|
|
|
145
145
|
onStarted() {
|
|
146
146
|
try {
|
|
147
147
|
this.prepareActiveRides();
|
|
148
|
-
this.sendUpdate(this.buildRequest());
|
|
148
|
+
this.sendUpdate(this.buildRequest()).catch(err => { this.logError(err, 'onStarted'); });
|
|
149
149
|
}
|
|
150
150
|
catch (err) {
|
|
151
151
|
this.logError(err, 'onStarted');
|
|
@@ -163,7 +163,7 @@ class GPXParser extends xml_2.XMLParser {
|
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
165
|
if (useAverageSpeed) {
|
|
166
|
-
this.adjustTimes(context);
|
|
166
|
+
this.adjustTimes(context).catch(() => { });
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
caclulateDistance(point, prev) {
|
|
@@ -227,7 +227,7 @@ class GPXParser extends xml_2.XMLParser {
|
|
|
227
227
|
isLoop,
|
|
228
228
|
previewUrl: undefined
|
|
229
229
|
};
|
|
230
|
-
this.addHeadings(route.points, isLoop);
|
|
230
|
+
this.addHeadings(route.points, isLoop).catch(() => { });
|
|
231
231
|
return info;
|
|
232
232
|
}
|
|
233
233
|
}
|
|
@@ -130,9 +130,9 @@ let RouteDownloadService = (() => {
|
|
|
130
130
|
const videoDir = await this.waitForVideoDir(observer);
|
|
131
131
|
if (videoDir) {
|
|
132
132
|
observer.once('stopped', () => {
|
|
133
|
-
this.deleteIncompleteFile(route, videoDir);
|
|
133
|
+
this.deleteIncompleteFile(route, videoDir).catch(err => { this.logError(err, '_download'); });
|
|
134
134
|
});
|
|
135
|
-
this.downloadRoute(route, videoDir, observer);
|
|
135
|
+
this.downloadRoute(route, videoDir, observer).catch(err => { this.logError(err, '_download'); });
|
|
136
136
|
}
|
|
137
137
|
else {
|
|
138
138
|
this.logEvent({ message: 'could not start download', reason: 'video dir not specified' });
|
|
@@ -105,7 +105,7 @@ let FreeRideService = (() => {
|
|
|
105
105
|
this.options = this.evaluateOptions(from.options, from);
|
|
106
106
|
if (this.options?.length) {
|
|
107
107
|
prepared = true;
|
|
108
|
-
this.getNextLevelOptions(from.options);
|
|
108
|
+
this.getNextLevelOptions(from.options).catch(err => { this.logError(err, 'getNextLevelOptions'); });
|
|
109
109
|
}
|
|
110
110
|
else {
|
|
111
111
|
loadAsync = true;
|
|
@@ -149,7 +149,7 @@ let FreeRideService = (() => {
|
|
|
149
149
|
await this.getNextLevelOptions(opts);
|
|
150
150
|
else {
|
|
151
151
|
from.options = from.options ?? opts;
|
|
152
|
-
this.getNextLevelOptions(from.options);
|
|
152
|
+
this.getNextLevelOptions(from.options).catch(err => { this.logError(err, 'loadNextOptions'); });
|
|
153
153
|
}
|
|
154
154
|
return opts;
|
|
155
155
|
}
|