incyclist-services 1.7.94 → 1.7.96
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/upload/index.js +0 -1
- package/lib/cjs/apps/index.js +0 -1
- package/lib/cjs/apps/service.js +1 -3
- package/lib/cjs/devices/page/service.js +9 -3
- package/lib/cjs/devices/page/statemachine.js +14 -4
- package/lib/cjs/devices/ride/cyclingMode.js +29 -0
- package/lib/cjs/devices/ride/index.js +1 -0
- package/lib/cjs/ride/display/service.js +7 -13
- package/lib/cjs/ride/page/index.js +1 -0
- package/lib/cjs/ride/page/service.js +458 -124
- package/lib/cjs/ride/workout/WorkoutDisplayService.js +6 -2
- package/lib/cjs/workouts/ride/index.js +0 -1
- package/lib/cjs/workouts/ride/service.js +80 -11
- package/lib/esm/activities/upload/index.js +0 -1
- package/lib/esm/apps/index.js +0 -1
- package/lib/esm/apps/service.js +1 -3
- package/lib/esm/devices/page/service.js +9 -3
- package/lib/esm/devices/page/statemachine.js +14 -4
- package/lib/esm/devices/ride/cyclingMode.js +25 -0
- package/lib/esm/devices/ride/index.js +1 -0
- package/lib/esm/ride/display/service.js +8 -14
- package/lib/esm/ride/page/index.js +1 -0
- package/lib/esm/ride/page/service.js +458 -124
- package/lib/esm/ride/workout/WorkoutDisplayService.js +6 -2
- package/lib/esm/workouts/ride/index.js +0 -1
- package/lib/esm/workouts/ride/page/service.js +13 -2
- package/lib/esm/workouts/ride/service.js +81 -12
- package/lib/types/activities/ride/service.d.ts +1 -1
- package/lib/types/activities/ride/types.d.ts +1 -1
- package/lib/types/activities/upload/index.d.ts +0 -1
- package/lib/types/apps/index.d.ts +0 -1
- package/lib/types/appstate/types.d.ts +1 -1
- package/lib/types/devices/page/statemachine.d.ts +2 -0
- package/lib/types/devices/ride/cyclingMode.d.ts +4 -0
- package/lib/types/devices/ride/index.d.ts +1 -0
- package/lib/types/ride/page/index.d.ts +1 -0
- package/lib/types/ride/page/service.d.ts +69 -17
- package/lib/types/ride/page/types.d.ts +84 -8
- package/lib/types/workouts/ride/index.d.ts +0 -1
- package/lib/types/workouts/ride/page/service.d.ts +2 -1
- package/lib/types/workouts/ride/page/types.d.ts +3 -0
- package/lib/types/workouts/ride/service.d.ts +10 -1
- package/lib/types/workouts/ride/types.d.ts +10 -1
- package/lib/types/workouts/types.d.ts +0 -1
- package/package.json +1 -1
- package/lib/cjs/activities/upload/velohero.js +0 -136
- package/lib/cjs/apps/velohero/VeloHeroAppConnection.js +0 -232
- package/lib/cjs/apps/velohero/index.js +0 -18
- package/lib/cjs/apps/velohero/types.js +0 -2
- package/lib/cjs/workouts/list/pageService.js +0 -455
- package/lib/cjs/workouts/ride/page/index.js +0 -18
- package/lib/cjs/workouts/ride/page/service.js +0 -553
- package/lib/cjs/workouts/ride/page/types.js +0 -2
- package/lib/esm/activities/upload/trainingpeaks.js +0 -123
- package/lib/esm/activities/upload/velohero.js +0 -133
- package/lib/esm/apps/base/api/trainingpeaks/api.js +0 -143
- package/lib/esm/apps/base/api/trainingpeaks/index.js +0 -1
- package/lib/esm/apps/base/api/trainingpeaks/types.js +0 -1
- package/lib/esm/apps/trainingpeaks/TrainingPeaksAppConnection.js +0 -189
- package/lib/esm/apps/trainingpeaks/types.js +0 -1
- package/lib/esm/apps/velohero/VeloHeroAppConnection.js +0 -229
- package/lib/esm/apps/velohero/index.js +0 -2
- package/lib/esm/apps/velohero/types.js +0 -1
- package/lib/esm/workouts/calendar/sync/trainingpeaks/provider.js +0 -201
- package/lib/esm/workouts/list/pageService.js +0 -451
- package/lib/types/activities/upload/trainingpeaks.d.ts +0 -16
- package/lib/types/activities/upload/velohero.d.ts +0 -18
- package/lib/types/apps/base/api/trainingpeaks/api.d.ts +0 -30
- package/lib/types/apps/base/api/trainingpeaks/index.d.ts +0 -2
- package/lib/types/apps/base/api/trainingpeaks/types.d.ts +0 -55
- package/lib/types/apps/trainingpeaks/TrainingPeaksAppConnection.d.ts +0 -22
- package/lib/types/apps/trainingpeaks/types.d.ts +0 -6
- package/lib/types/apps/velohero/VeloHeroAppConnection.d.ts +0 -24
- package/lib/types/apps/velohero/index.d.ts +0 -2
- package/lib/types/apps/velohero/types.d.ts +0 -9
- package/lib/types/workouts/calendar/sync/trainingpeaks/provider.d.ts +0 -22
- package/lib/types/workouts/list/pageService.d.ts +0 -150
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./velohero"), exports);
|
|
18
17
|
__exportStar(require("./strava"), exports);
|
|
19
18
|
__exportStar(require("./intervals"), exports);
|
|
20
19
|
__exportStar(require("./types"), exports);
|
package/lib/cjs/apps/index.js
CHANGED
package/lib/cjs/apps/service.js
CHANGED
|
@@ -43,7 +43,6 @@ const settings_1 = require("../settings");
|
|
|
43
43
|
const base_1 = require("./base");
|
|
44
44
|
const IntervalsAppConnection_1 = require("./intervals/IntervalsAppConnection");
|
|
45
45
|
const komoot_1 = require("./komoot");
|
|
46
|
-
const VeloHeroAppConnection_1 = require("./velohero/VeloHeroAppConnection");
|
|
47
46
|
let AppsService = (() => {
|
|
48
47
|
let _classDecorators = [types_1.Singleton];
|
|
49
48
|
let _classDescriptor;
|
|
@@ -67,7 +66,7 @@ let AppsService = (() => {
|
|
|
67
66
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
68
67
|
}
|
|
69
68
|
services = (__runInitializers(this, _instanceExtraInitializers), {
|
|
70
|
-
ActivityUpload: ['strava', '
|
|
69
|
+
ActivityUpload: ['strava', 'intervals'],
|
|
71
70
|
WorkoutUpload: [],
|
|
72
71
|
WorkoutDownload: ['intervals'],
|
|
73
72
|
ActivityDownload: [],
|
|
@@ -75,7 +74,6 @@ let AppsService = (() => {
|
|
|
75
74
|
});
|
|
76
75
|
serviceMap = [
|
|
77
76
|
{ name: 'Strava', key: 'strava', iconUrl: 'https://static.cdnlogo.com/logos/s/42/strava-wordmark.svg', connection: new base_1.StravaAppConnection() },
|
|
78
|
-
{ name: 'VeloHero', key: 'velohero', iconUrl: 'images/velo-white.png', connection: new VeloHeroAppConnection_1.VeloHeroAppConnection() },
|
|
79
77
|
{ name: 'Komoot', key: 'komoot', iconUrl: 'https://www.komoot.com/assets/4d8ae313eec53e6e.svg', connection: new komoot_1.KomootAppConnection() },
|
|
80
78
|
{ name: 'Intervals.icu', key: 'intervals', iconUrl: 'images/intervals.png', connection: new IntervalsAppConnection_1.IntervalsAppConnection() },
|
|
81
79
|
];
|
|
@@ -95,9 +95,15 @@ let DevicesPageService = (() => {
|
|
|
95
95
|
if (this.promiseOpen !== undefined) {
|
|
96
96
|
return this.getPageObserver();
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
const onStateMachineUpdate = () => {
|
|
99
99
|
this.getPageObserver().emit('page-update');
|
|
100
|
-
}
|
|
100
|
+
};
|
|
101
|
+
this.stateMachine.start(onStateMachineUpdate);
|
|
102
|
+
if (this.stateMachine.state !== 'Idle') {
|
|
103
|
+
this.logEvent({ message: 'state machine was not in expected state on open, resetting', page: 'Pairing', state: this.stateMachine.state });
|
|
104
|
+
this.stateMachine.stop();
|
|
105
|
+
this.stateMachine.start(onStateMachineUpdate);
|
|
106
|
+
}
|
|
101
107
|
this.promiseOpen = new Promise((done) => {
|
|
102
108
|
this.start()
|
|
103
109
|
.catch((err) => { this.logError(err, 'openPage'); })
|
|
@@ -321,7 +327,7 @@ let DevicesPageService = (() => {
|
|
|
321
327
|
this.updatePage();
|
|
322
328
|
}
|
|
323
329
|
async closeDeviceSelection(enabled) {
|
|
324
|
-
this.logEvent({ message: 'capability closed', capability: this.openedCapability });
|
|
330
|
+
this.logEvent({ message: 'capability closed', capability: this.openedCapability, enabled, caller: new Error().stack });
|
|
325
331
|
if (!enabled) {
|
|
326
332
|
const all = this.state.capabilities ?? [];
|
|
327
333
|
const requested = all.find(c => c.capability === this.openedCapability);
|
|
@@ -68,6 +68,8 @@ let PairingPageStateMachine = (() => {
|
|
|
68
68
|
selectStateChangeCallback;
|
|
69
69
|
retryTimeout;
|
|
70
70
|
selectionTimeout;
|
|
71
|
+
pairingPromise;
|
|
72
|
+
scanningPromise;
|
|
71
73
|
constructor() {
|
|
72
74
|
this.logger = new gd_eventlog_1.EventLogger('PairingPageState');
|
|
73
75
|
}
|
|
@@ -99,6 +101,8 @@ let PairingPageStateMachine = (() => {
|
|
|
99
101
|
this.unregisterServiceEventHandlers();
|
|
100
102
|
delete this.stateChangeCallback;
|
|
101
103
|
this.resetTimeouts();
|
|
104
|
+
delete this.pairingPromise;
|
|
105
|
+
delete this.scanningPromise;
|
|
102
106
|
this.setState('Closed');
|
|
103
107
|
this.logIncomingEvent('stop', prev, 'Closed');
|
|
104
108
|
}
|
|
@@ -199,14 +203,20 @@ let PairingPageStateMachine = (() => {
|
|
|
199
203
|
this.resetTimeouts();
|
|
200
204
|
this.setState('Done');
|
|
201
205
|
}
|
|
202
|
-
else {
|
|
206
|
+
else if (!this.pairingPromise) {
|
|
203
207
|
this.setState('Pairing');
|
|
204
|
-
service.startPairing(adapters, {})
|
|
208
|
+
this.pairingPromise = Promise.resolve(service.startPairing(adapters, {}))
|
|
209
|
+
.catch(err => { this.logError(err, 'startPairing'); })
|
|
210
|
+
.finally(() => { delete this.pairingPromise; });
|
|
205
211
|
}
|
|
206
212
|
}
|
|
207
213
|
else if (this.selectState === 'Closed' || this.selectState === 'Active') {
|
|
208
|
-
this.
|
|
209
|
-
|
|
214
|
+
if (!this.scanningPromise) {
|
|
215
|
+
this.setState('Scanning');
|
|
216
|
+
this.scanningPromise = Promise.resolve(service.startScanning(adapters, {}))
|
|
217
|
+
.catch(err => { this.logError(err, 'startScanning'); })
|
|
218
|
+
.finally(() => { delete this.scanningPromise; });
|
|
219
|
+
}
|
|
210
220
|
}
|
|
211
221
|
if (this.state !== oldState)
|
|
212
222
|
this.logger.logEvent({ message: 'state changed', stateTransition: { from: oldState, to: this.state } });
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isVirtualShiftingEnabled = isVirtualShiftingEnabled;
|
|
4
|
+
exports.getLoadButtonMode = getLoadButtonMode;
|
|
5
|
+
function isVirtualShiftingEnabled(mode) {
|
|
6
|
+
try {
|
|
7
|
+
if (!mode)
|
|
8
|
+
return false;
|
|
9
|
+
if (mode.isSIM()) {
|
|
10
|
+
const virtshiftMode = mode.getSetting('virtshift');
|
|
11
|
+
return (virtshiftMode === 'Mixed' || virtshiftMode === 'Incyclist' || virtshiftMode === 'SmartTrainer' || virtshiftMode === 'Enabled');
|
|
12
|
+
}
|
|
13
|
+
if (mode.isResistance()) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function getLoadButtonMode(mode) {
|
|
23
|
+
if (!mode)
|
|
24
|
+
return 'power';
|
|
25
|
+
if (mode.isSIM() || mode.isResistance()) {
|
|
26
|
+
return isVirtualShiftingEnabled(mode) ? 'gear' : 'hidden';
|
|
27
|
+
}
|
|
28
|
+
return 'power';
|
|
29
|
+
}
|
|
@@ -432,8 +432,11 @@ let RideDisplayService = (() => {
|
|
|
432
432
|
this.observer?.stop({ immediately: props.noStateUpdates });
|
|
433
433
|
if (props.noStateUpdates)
|
|
434
434
|
delete this.observer;
|
|
435
|
-
else
|
|
436
|
-
|
|
435
|
+
else {
|
|
436
|
+
const observerToClear = this.observer;
|
|
437
|
+
(0, utils_1.waitNextTick)().then(() => { if (this.observer === observerToClear)
|
|
438
|
+
delete this.observer; });
|
|
439
|
+
}
|
|
437
440
|
if (prevState === 'Finished' || prevState === 'Idle' || prevState === 'Closing') {
|
|
438
441
|
this.state = 'Idle';
|
|
439
442
|
return;
|
|
@@ -553,7 +556,7 @@ let RideDisplayService = (() => {
|
|
|
553
556
|
const { time, speed, routeDistance, distance } = currentValues;
|
|
554
557
|
const data = { time, speed, routeDistance, distance };
|
|
555
558
|
this.getRideModeService().onActivityUpdate(data, currentValues);
|
|
556
|
-
this.observer
|
|
559
|
+
this.observer?.emit('data-update', data, currentValues);
|
|
557
560
|
}
|
|
558
561
|
}
|
|
559
562
|
onWorkoutStopped() {
|
|
@@ -1085,16 +1088,7 @@ let RideDisplayService = (() => {
|
|
|
1085
1088
|
isVirtualShiftingEnabled() {
|
|
1086
1089
|
try {
|
|
1087
1090
|
const mode = this.getDeviceRide().getCyclingMode();
|
|
1088
|
-
|
|
1089
|
-
return false;
|
|
1090
|
-
if (mode.isSIM()) {
|
|
1091
|
-
const virtshiftMode = mode.getSetting('virtshift');
|
|
1092
|
-
return (virtshiftMode === 'Mixed' || virtshiftMode === 'Incyclist' || virtshiftMode === 'SmartTrainer' || virtshiftMode === 'Enabled');
|
|
1093
|
-
}
|
|
1094
|
-
if (mode.isResistance()) {
|
|
1095
|
-
return true;
|
|
1096
|
-
}
|
|
1097
|
-
return false;
|
|
1091
|
+
return (0, devices_1.isVirtualShiftingEnabled)(mode);
|
|
1098
1092
|
}
|
|
1099
1093
|
catch (err) {
|
|
1100
1094
|
this.logError(err, 'isVirtualShiftingEnabled');
|