incyclist-services 1.7.84 → 1.7.86
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/devices/page/service.js +8 -1
- package/lib/cjs/devices/pairing/service.js +7 -8
- package/lib/cjs/maps/MapArea/utils.js +4 -2
- package/lib/cjs/ride/display/service.js +1 -1
- package/lib/cjs/ride/page/service.js +16 -6
- package/lib/cjs/routes/list/service.js +2 -2
- package/lib/cjs/workouts/base/graph/series.js +2 -2
- package/lib/cjs/workouts/list/service.js +8 -4
- package/lib/cjs/workouts/page/service.js +9 -5
- package/lib/cjs/workouts/ride/page/service.js +4 -4
- package/lib/esm/devices/page/service.js +8 -1
- package/lib/esm/devices/pairing/service.js +7 -8
- package/lib/esm/maps/MapArea/utils.js +4 -2
- package/lib/esm/ride/display/service.js +1 -1
- package/lib/esm/ride/page/service.js +16 -6
- package/lib/esm/routes/list/service.js +2 -2
- package/lib/esm/workouts/base/graph/series.js +2 -2
- package/lib/esm/workouts/list/service.js +8 -4
- package/lib/esm/workouts/page/service.js +9 -5
- package/lib/esm/workouts/ride/page/service.js +4 -4
- package/lib/types/devices/page/service.d.ts +1 -0
- package/lib/types/devices/page/types.d.ts +2 -2
- package/lib/types/devices/pairing/service.d.ts +0 -1
- package/lib/types/workouts/base/graph/series.d.ts +1 -4
- package/lib/types/workouts/list/service.d.ts +3 -1
- package/lib/types/workouts/page/service.d.ts +3 -1
- package/package.json +1 -1
|
@@ -273,7 +273,8 @@ let DevicesPageService = (() => {
|
|
|
273
273
|
value: d.value,
|
|
274
274
|
interface: d.interface,
|
|
275
275
|
isSelected: d.selected,
|
|
276
|
-
onClick: (addAll) => { this.onDeviceSelected(d, addAll); }
|
|
276
|
+
onClick: (addAll) => { this.onDeviceSelected(d, addAll); },
|
|
277
|
+
onDelete: () => { this.onDeviceDelete(d); }
|
|
277
278
|
}));
|
|
278
279
|
const disabled = devices.length > 0 && !devices.some(d => d.isSelected);
|
|
279
280
|
return {
|
|
@@ -313,6 +314,12 @@ let DevicesPageService = (() => {
|
|
|
313
314
|
this.getDevicePairing().selectDevice(capability, d.udid, addAll);
|
|
314
315
|
this.updatePage();
|
|
315
316
|
}
|
|
317
|
+
onDeviceDelete(d) {
|
|
318
|
+
const capability = this.openedCapability;
|
|
319
|
+
this.logEvent({ message: 'device delete requested', capability, device: d.name });
|
|
320
|
+
this.getDevicePairing().deleteDevice(capability, d.udid);
|
|
321
|
+
this.updatePage();
|
|
322
|
+
}
|
|
316
323
|
async closeDeviceSelection(enabled) {
|
|
317
324
|
this.logEvent({ message: 'capability closed', capability: this.openedCapability });
|
|
318
325
|
if (!enabled) {
|
|
@@ -832,6 +832,12 @@ let DevicePairingService = (() => {
|
|
|
832
832
|
this.logEvent({ message: 'device could not be added', reason: 'add() failed' });
|
|
833
833
|
return;
|
|
834
834
|
}
|
|
835
|
+
const deletedCapabilities = (this.state.deleted || [])
|
|
836
|
+
.filter(e => e.udid === udid)
|
|
837
|
+
.map(e => e.capability);
|
|
838
|
+
deletedCapabilities.forEach(capability => {
|
|
839
|
+
this.getDeviceConfiguration().delete(udid, capability, true);
|
|
840
|
+
});
|
|
835
841
|
const adapter = this.getDeviceConfiguration().getAdapter(udid);
|
|
836
842
|
if (adapter) {
|
|
837
843
|
adapter.onScanStart();
|
|
@@ -1411,7 +1417,7 @@ let DevicePairingService = (() => {
|
|
|
1411
1417
|
c.value = undefined;
|
|
1412
1418
|
c.connectState = undefined;
|
|
1413
1419
|
}
|
|
1414
|
-
this.getDeviceConfiguration().delete(udid, capability,
|
|
1420
|
+
this.getDeviceConfiguration().delete(udid, capability, true);
|
|
1415
1421
|
this.addToDeletedList(capability, udid);
|
|
1416
1422
|
this.emitStateChange({ capabilities: this.state.capabilities });
|
|
1417
1423
|
}
|
|
@@ -1446,13 +1452,6 @@ let DevicePairingService = (() => {
|
|
|
1446
1452
|
const c = this.getCapability(capability);
|
|
1447
1453
|
this.state.deleted.push({ capability: c.capability, udid });
|
|
1448
1454
|
}
|
|
1449
|
-
removeFromDeletedList(capability, udid) {
|
|
1450
|
-
const c = this.getCapability(capability);
|
|
1451
|
-
const idx = this.state.deleted.findIndex(e => e.capability === c.capability && e.udid === udid);
|
|
1452
|
-
if (idx === -1)
|
|
1453
|
-
return;
|
|
1454
|
-
this.state.deleted.splice(idx, 1);
|
|
1455
|
-
}
|
|
1456
1455
|
isOnDeletedList(c, udid) {
|
|
1457
1456
|
const capability = this.getCapability(c);
|
|
1458
1457
|
return this.state.deleted.some(e => e.capability === capability.capability && e.udid === udid);
|
|
@@ -134,11 +134,13 @@ function concatPaths(path, path2, position, wayId) {
|
|
|
134
134
|
}
|
|
135
135
|
if (position === 'after') {
|
|
136
136
|
append.shift();
|
|
137
|
-
path.push(
|
|
137
|
+
append.forEach(p => path.push(p));
|
|
138
138
|
}
|
|
139
139
|
else {
|
|
140
140
|
path.shift();
|
|
141
|
-
|
|
141
|
+
const newPath = append.concat(path);
|
|
142
|
+
path.length = 0;
|
|
143
|
+
newPath.forEach(p => path.push(p));
|
|
142
144
|
}
|
|
143
145
|
}
|
|
144
146
|
function splitAtPointInfo(way, split) {
|
|
@@ -139,7 +139,7 @@ let RideDisplayService = (() => {
|
|
|
139
139
|
interface: this.getBikeInterface()
|
|
140
140
|
});
|
|
141
141
|
if (!this.getRideType()) {
|
|
142
|
-
this.observer
|
|
142
|
+
this.observer?.emit('start-error', new Error('No active ride'));
|
|
143
143
|
this.setState('Error');
|
|
144
144
|
}
|
|
145
145
|
this.startDevices();
|
|
@@ -97,14 +97,24 @@ let RidePageService = (() => {
|
|
|
97
97
|
super.openPage();
|
|
98
98
|
try {
|
|
99
99
|
const service = this.getRideDisplay();
|
|
100
|
+
const registerAndStart = () => {
|
|
101
|
+
this.registerEventHandlers();
|
|
102
|
+
service.start(simulate);
|
|
103
|
+
(0, sleep_1.sleep)(5).then(() => {
|
|
104
|
+
this.updatePageDisplay();
|
|
105
|
+
});
|
|
106
|
+
};
|
|
100
107
|
if (!this.isInitialized) {
|
|
101
|
-
service.init()
|
|
108
|
+
service.init()
|
|
109
|
+
.then(() => {
|
|
110
|
+
this.isInitialized = true;
|
|
111
|
+
registerAndStart();
|
|
112
|
+
})
|
|
113
|
+
.catch((err) => { this.logError(err, 'openPage'); });
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
registerAndStart();
|
|
102
117
|
}
|
|
103
|
-
this.registerEventHandlers();
|
|
104
|
-
service.start(simulate);
|
|
105
|
-
(0, sleep_1.sleep)(5).then(() => {
|
|
106
|
-
this.updatePageDisplay();
|
|
107
|
-
});
|
|
108
118
|
}
|
|
109
119
|
catch (err) {
|
|
110
120
|
this.logError(err, 'openPage');
|
|
@@ -637,11 +637,11 @@ let RouteListService = (() => {
|
|
|
637
637
|
unselect() {
|
|
638
638
|
this.selectedRoute = null;
|
|
639
639
|
this.startSettings = null;
|
|
640
|
-
this.observer
|
|
640
|
+
this.observer?.emit('selected', null);
|
|
641
641
|
}
|
|
642
642
|
select(route) {
|
|
643
643
|
this.selectedRoute = route;
|
|
644
|
-
this.observer
|
|
644
|
+
this.observer?.emit('selected', route);
|
|
645
645
|
}
|
|
646
646
|
selectCard(card) {
|
|
647
647
|
this.selectedRoute = card.getData();
|
|
@@ -115,8 +115,8 @@ function formatRange(low, high, unit, rangePrefix = '') {
|
|
|
115
115
|
const v = high ?? low;
|
|
116
116
|
return v === undefined ? '' : `${Math.round(v)}${unit}`;
|
|
117
117
|
}
|
|
118
|
-
function getStepTargetText(step, ftp
|
|
119
|
-
const { min: minPower, max: maxPower } =
|
|
118
|
+
function getStepTargetText(step, ftp) {
|
|
119
|
+
const { min: minPower, max: maxPower } = resolvePowerWatts(step.power, ftp);
|
|
120
120
|
const ascending = step.steady || step.cooldown === false;
|
|
121
121
|
const lowPower = ascending ? minPower : maxPower;
|
|
122
122
|
const highPower = ascending ? maxPower : minPower;
|
|
@@ -426,7 +426,7 @@ let WorkoutListService = (() => {
|
|
|
426
426
|
}
|
|
427
427
|
selectCard(card) {
|
|
428
428
|
if (this.selectedWorkout) {
|
|
429
|
-
const selectedCard = this.findCard(this.selectedWorkout)?.card;
|
|
429
|
+
const selectedCard = this.findCard(this.selectedWorkout, { includeScheduled: true })?.card;
|
|
430
430
|
if (selectedCard)
|
|
431
431
|
selectedCard.unselect();
|
|
432
432
|
}
|
|
@@ -563,7 +563,7 @@ let WorkoutListService = (() => {
|
|
|
563
563
|
}
|
|
564
564
|
return this.myWorkouts;
|
|
565
565
|
}
|
|
566
|
-
findCard(target) {
|
|
566
|
+
findCard(target, opts) {
|
|
567
567
|
let id;
|
|
568
568
|
if (typeof target === 'string') {
|
|
569
569
|
id = target;
|
|
@@ -572,9 +572,13 @@ let WorkoutListService = (() => {
|
|
|
572
572
|
const item = target;
|
|
573
573
|
id = item.id;
|
|
574
574
|
}
|
|
575
|
-
|
|
575
|
+
const includeScheduled = opts?.includeScheduled ?? false;
|
|
576
576
|
const lists = this.getLists(false) || [];
|
|
577
|
-
lists.
|
|
577
|
+
const regularLists = lists.filter(l => l.getId() !== 'scheduled');
|
|
578
|
+
const scheduledLists = includeScheduled ? lists.filter(l => l.getId() === 'scheduled') : [];
|
|
579
|
+
const orderedLists = [...regularLists, ...scheduledLists];
|
|
580
|
+
let res;
|
|
581
|
+
orderedLists.forEach(list => {
|
|
578
582
|
if (res)
|
|
579
583
|
return;
|
|
580
584
|
const card = list.getCards().find(c => c.getData()?.id === id);
|
|
@@ -146,7 +146,7 @@ let WorkoutListPageService = (() => {
|
|
|
146
146
|
}
|
|
147
147
|
getWorkoutDetailsProps(id) {
|
|
148
148
|
try {
|
|
149
|
-
const card = this.findWorkoutCard(id);
|
|
149
|
+
const card = this.findWorkoutCard(id, { includeScheduled: true });
|
|
150
150
|
if (!card)
|
|
151
151
|
return null;
|
|
152
152
|
const workout = card.getData();
|
|
@@ -266,7 +266,7 @@ let WorkoutListPageService = (() => {
|
|
|
266
266
|
}
|
|
267
267
|
onStart(id, opts) {
|
|
268
268
|
try {
|
|
269
|
-
const card = this.findWorkoutCard(id);
|
|
269
|
+
const card = this.findWorkoutCard(id, { includeScheduled: true });
|
|
270
270
|
if (!card)
|
|
271
271
|
return;
|
|
272
272
|
const service = this.getWorkoutList();
|
|
@@ -285,7 +285,7 @@ let WorkoutListPageService = (() => {
|
|
|
285
285
|
}
|
|
286
286
|
onMarkForRoute(id) {
|
|
287
287
|
try {
|
|
288
|
-
const card = this.findWorkoutCard(id);
|
|
288
|
+
const card = this.findWorkoutCard(id, { includeScheduled: true });
|
|
289
289
|
if (!card)
|
|
290
290
|
return;
|
|
291
291
|
const settings = this.getWorkoutList().getStartSettings();
|
|
@@ -425,9 +425,13 @@ let WorkoutListPageService = (() => {
|
|
|
425
425
|
});
|
|
426
426
|
return items;
|
|
427
427
|
}
|
|
428
|
-
findWorkoutCard(id) {
|
|
428
|
+
findWorkoutCard(id, opts) {
|
|
429
|
+
const includeScheduled = opts?.includeScheduled ?? false;
|
|
429
430
|
const lists = this.getWorkoutList().getLists(false) ?? [];
|
|
430
|
-
|
|
431
|
+
const regularLists = lists.filter(l => l.getId() !== 'scheduled');
|
|
432
|
+
const scheduledLists = includeScheduled ? lists.filter(l => l.getId() === 'scheduled') : [];
|
|
433
|
+
const orderedLists = [...regularLists, ...scheduledLists];
|
|
434
|
+
for (const list of orderedLists) {
|
|
431
435
|
const card = list.getCards().find(c => c.getId() === id);
|
|
432
436
|
if (card)
|
|
433
437
|
return card;
|
|
@@ -267,10 +267,10 @@ let WorkoutRidePageService = (() => {
|
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
onIncreaseLoad() {
|
|
270
|
-
this.adjustLoad(
|
|
270
|
+
this.adjustLoad(this.getLoadIncrement());
|
|
271
271
|
}
|
|
272
272
|
onDecreaseLoad() {
|
|
273
|
-
this.adjustLoad(-
|
|
273
|
+
this.adjustLoad(-this.getLoadIncrement());
|
|
274
274
|
}
|
|
275
275
|
onSetLoadIncrement(value) {
|
|
276
276
|
try {
|
|
@@ -427,7 +427,7 @@ let WorkoutRidePageService = (() => {
|
|
|
427
427
|
if (!limits)
|
|
428
428
|
return empty;
|
|
429
429
|
const currentStep = {
|
|
430
|
-
label: (0, graph_1.getStepTargetText)(limits.step ?? {}, ftp
|
|
430
|
+
label: (0, graph_1.getStepTargetText)(limits.step ?? {}, ftp),
|
|
431
431
|
targetPower: limits.targetPower ?? null,
|
|
432
432
|
duration: limits.duration,
|
|
433
433
|
remaining: limits.remaining,
|
|
@@ -456,7 +456,7 @@ let WorkoutRidePageService = (() => {
|
|
|
456
456
|
const title = wo.title ?? '';
|
|
457
457
|
if (!limits)
|
|
458
458
|
return { text: title, mode: wo.mode ?? null };
|
|
459
|
-
const target = (0, graph_1.getStepTargetText)(limits.step ?? {}, wo.ftp
|
|
459
|
+
const target = (0, graph_1.getStepTargetText)(limits.step ?? {}, wo.ftp);
|
|
460
460
|
const duration = (0, graph_1.getStepDuration)({ duration: limits.duration });
|
|
461
461
|
const text = title ? `${target} for ${duration} - ${title}` : `${target} for ${duration}`;
|
|
462
462
|
return { text, mode: wo.mode ?? null };
|
|
@@ -270,7 +270,8 @@ let DevicesPageService = (() => {
|
|
|
270
270
|
value: d.value,
|
|
271
271
|
interface: d.interface,
|
|
272
272
|
isSelected: d.selected,
|
|
273
|
-
onClick: (addAll) => { this.onDeviceSelected(d, addAll); }
|
|
273
|
+
onClick: (addAll) => { this.onDeviceSelected(d, addAll); },
|
|
274
|
+
onDelete: () => { this.onDeviceDelete(d); }
|
|
274
275
|
}));
|
|
275
276
|
const disabled = devices.length > 0 && !devices.some(d => d.isSelected);
|
|
276
277
|
return {
|
|
@@ -310,6 +311,12 @@ let DevicesPageService = (() => {
|
|
|
310
311
|
this.getDevicePairing().selectDevice(capability, d.udid, addAll);
|
|
311
312
|
this.updatePage();
|
|
312
313
|
}
|
|
314
|
+
onDeviceDelete(d) {
|
|
315
|
+
const capability = this.openedCapability;
|
|
316
|
+
this.logEvent({ message: 'device delete requested', capability, device: d.name });
|
|
317
|
+
this.getDevicePairing().deleteDevice(capability, d.udid);
|
|
318
|
+
this.updatePage();
|
|
319
|
+
}
|
|
313
320
|
async closeDeviceSelection(enabled) {
|
|
314
321
|
this.logEvent({ message: 'capability closed', capability: this.openedCapability });
|
|
315
322
|
if (!enabled) {
|
|
@@ -826,6 +826,12 @@ let DevicePairingService = (() => {
|
|
|
826
826
|
this.logEvent({ message: 'device could not be added', reason: 'add() failed' });
|
|
827
827
|
return;
|
|
828
828
|
}
|
|
829
|
+
const deletedCapabilities = (this.state.deleted || [])
|
|
830
|
+
.filter(e => e.udid === udid)
|
|
831
|
+
.map(e => e.capability);
|
|
832
|
+
deletedCapabilities.forEach(capability => {
|
|
833
|
+
this.getDeviceConfiguration().delete(udid, capability, true);
|
|
834
|
+
});
|
|
829
835
|
const adapter = this.getDeviceConfiguration().getAdapter(udid);
|
|
830
836
|
if (adapter) {
|
|
831
837
|
adapter.onScanStart();
|
|
@@ -1405,7 +1411,7 @@ let DevicePairingService = (() => {
|
|
|
1405
1411
|
c.value = undefined;
|
|
1406
1412
|
c.connectState = undefined;
|
|
1407
1413
|
}
|
|
1408
|
-
this.getDeviceConfiguration().delete(udid, capability,
|
|
1414
|
+
this.getDeviceConfiguration().delete(udid, capability, true);
|
|
1409
1415
|
this.addToDeletedList(capability, udid);
|
|
1410
1416
|
this.emitStateChange({ capabilities: this.state.capabilities });
|
|
1411
1417
|
}
|
|
@@ -1440,13 +1446,6 @@ let DevicePairingService = (() => {
|
|
|
1440
1446
|
const c = this.getCapability(capability);
|
|
1441
1447
|
this.state.deleted.push({ capability: c.capability, udid });
|
|
1442
1448
|
}
|
|
1443
|
-
removeFromDeletedList(capability, udid) {
|
|
1444
|
-
const c = this.getCapability(capability);
|
|
1445
|
-
const idx = this.state.deleted.findIndex(e => e.capability === c.capability && e.udid === udid);
|
|
1446
|
-
if (idx === -1)
|
|
1447
|
-
return;
|
|
1448
|
-
this.state.deleted.splice(idx, 1);
|
|
1449
|
-
}
|
|
1450
1449
|
isOnDeletedList(c, udid) {
|
|
1451
1450
|
const capability = this.getCapability(c);
|
|
1452
1451
|
return this.state.deleted.some(e => e.capability === capability.capability && e.udid === udid);
|
|
@@ -98,11 +98,13 @@ export function concatPaths(path, path2, position, wayId) {
|
|
|
98
98
|
}
|
|
99
99
|
if (position === 'after') {
|
|
100
100
|
append.shift();
|
|
101
|
-
path.push(
|
|
101
|
+
append.forEach(p => path.push(p));
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
104
|
path.shift();
|
|
105
|
-
|
|
105
|
+
const newPath = append.concat(path);
|
|
106
|
+
path.length = 0;
|
|
107
|
+
newPath.forEach(p => path.push(p));
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
export function splitAtPointInfo(way, split) {
|
|
@@ -136,7 +136,7 @@ let RideDisplayService = (() => {
|
|
|
136
136
|
interface: this.getBikeInterface()
|
|
137
137
|
});
|
|
138
138
|
if (!this.getRideType()) {
|
|
139
|
-
this.observer
|
|
139
|
+
this.observer?.emit('start-error', new Error('No active ride'));
|
|
140
140
|
this.setState('Error');
|
|
141
141
|
}
|
|
142
142
|
this.startDevices();
|
|
@@ -94,14 +94,24 @@ let RidePageService = (() => {
|
|
|
94
94
|
super.openPage();
|
|
95
95
|
try {
|
|
96
96
|
const service = this.getRideDisplay();
|
|
97
|
+
const registerAndStart = () => {
|
|
98
|
+
this.registerEventHandlers();
|
|
99
|
+
service.start(simulate);
|
|
100
|
+
sleep(5).then(() => {
|
|
101
|
+
this.updatePageDisplay();
|
|
102
|
+
});
|
|
103
|
+
};
|
|
97
104
|
if (!this.isInitialized) {
|
|
98
|
-
service.init()
|
|
105
|
+
service.init()
|
|
106
|
+
.then(() => {
|
|
107
|
+
this.isInitialized = true;
|
|
108
|
+
registerAndStart();
|
|
109
|
+
})
|
|
110
|
+
.catch((err) => { this.logError(err, 'openPage'); });
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
registerAndStart();
|
|
99
114
|
}
|
|
100
|
-
this.registerEventHandlers();
|
|
101
|
-
service.start(simulate);
|
|
102
|
-
sleep(5).then(() => {
|
|
103
|
-
this.updatePageDisplay();
|
|
104
|
-
});
|
|
105
115
|
}
|
|
106
116
|
catch (err) {
|
|
107
117
|
this.logError(err, 'openPage');
|
|
@@ -631,11 +631,11 @@ let RouteListService = (() => {
|
|
|
631
631
|
unselect() {
|
|
632
632
|
this.selectedRoute = null;
|
|
633
633
|
this.startSettings = null;
|
|
634
|
-
this.observer
|
|
634
|
+
this.observer?.emit('selected', null);
|
|
635
635
|
}
|
|
636
636
|
select(route) {
|
|
637
637
|
this.selectedRoute = route;
|
|
638
|
-
this.observer
|
|
638
|
+
this.observer?.emit('selected', route);
|
|
639
639
|
}
|
|
640
640
|
selectCard(card) {
|
|
641
641
|
this.selectedRoute = card.getData();
|
|
@@ -107,8 +107,8 @@ function formatRange(low, high, unit, rangePrefix = '') {
|
|
|
107
107
|
const v = high ?? low;
|
|
108
108
|
return v === undefined ? '' : `${Math.round(v)}${unit}`;
|
|
109
109
|
}
|
|
110
|
-
export function getStepTargetText(step, ftp
|
|
111
|
-
const { min: minPower, max: maxPower } =
|
|
110
|
+
export function getStepTargetText(step, ftp) {
|
|
111
|
+
const { min: minPower, max: maxPower } = resolvePowerWatts(step.power, ftp);
|
|
112
112
|
const ascending = step.steady || step.cooldown === false;
|
|
113
113
|
const lowPower = ascending ? minPower : maxPower;
|
|
114
114
|
const highPower = ascending ? maxPower : minPower;
|
|
@@ -423,7 +423,7 @@ let WorkoutListService = (() => {
|
|
|
423
423
|
}
|
|
424
424
|
selectCard(card) {
|
|
425
425
|
if (this.selectedWorkout) {
|
|
426
|
-
const selectedCard = this.findCard(this.selectedWorkout)?.card;
|
|
426
|
+
const selectedCard = this.findCard(this.selectedWorkout, { includeScheduled: true })?.card;
|
|
427
427
|
if (selectedCard)
|
|
428
428
|
selectedCard.unselect();
|
|
429
429
|
}
|
|
@@ -560,7 +560,7 @@ let WorkoutListService = (() => {
|
|
|
560
560
|
}
|
|
561
561
|
return this.myWorkouts;
|
|
562
562
|
}
|
|
563
|
-
findCard(target) {
|
|
563
|
+
findCard(target, opts) {
|
|
564
564
|
let id;
|
|
565
565
|
if (typeof target === 'string') {
|
|
566
566
|
id = target;
|
|
@@ -569,9 +569,13 @@ let WorkoutListService = (() => {
|
|
|
569
569
|
const item = target;
|
|
570
570
|
id = item.id;
|
|
571
571
|
}
|
|
572
|
-
|
|
572
|
+
const includeScheduled = opts?.includeScheduled ?? false;
|
|
573
573
|
const lists = this.getLists(false) || [];
|
|
574
|
-
lists.
|
|
574
|
+
const regularLists = lists.filter(l => l.getId() !== 'scheduled');
|
|
575
|
+
const scheduledLists = includeScheduled ? lists.filter(l => l.getId() === 'scheduled') : [];
|
|
576
|
+
const orderedLists = [...regularLists, ...scheduledLists];
|
|
577
|
+
let res;
|
|
578
|
+
orderedLists.forEach(list => {
|
|
575
579
|
if (res)
|
|
576
580
|
return;
|
|
577
581
|
const card = list.getCards().find(c => c.getData()?.id === id);
|
|
@@ -143,7 +143,7 @@ let WorkoutListPageService = (() => {
|
|
|
143
143
|
}
|
|
144
144
|
getWorkoutDetailsProps(id) {
|
|
145
145
|
try {
|
|
146
|
-
const card = this.findWorkoutCard(id);
|
|
146
|
+
const card = this.findWorkoutCard(id, { includeScheduled: true });
|
|
147
147
|
if (!card)
|
|
148
148
|
return null;
|
|
149
149
|
const workout = card.getData();
|
|
@@ -263,7 +263,7 @@ let WorkoutListPageService = (() => {
|
|
|
263
263
|
}
|
|
264
264
|
onStart(id, opts) {
|
|
265
265
|
try {
|
|
266
|
-
const card = this.findWorkoutCard(id);
|
|
266
|
+
const card = this.findWorkoutCard(id, { includeScheduled: true });
|
|
267
267
|
if (!card)
|
|
268
268
|
return;
|
|
269
269
|
const service = this.getWorkoutList();
|
|
@@ -282,7 +282,7 @@ let WorkoutListPageService = (() => {
|
|
|
282
282
|
}
|
|
283
283
|
onMarkForRoute(id) {
|
|
284
284
|
try {
|
|
285
|
-
const card = this.findWorkoutCard(id);
|
|
285
|
+
const card = this.findWorkoutCard(id, { includeScheduled: true });
|
|
286
286
|
if (!card)
|
|
287
287
|
return;
|
|
288
288
|
const settings = this.getWorkoutList().getStartSettings();
|
|
@@ -422,9 +422,13 @@ let WorkoutListPageService = (() => {
|
|
|
422
422
|
});
|
|
423
423
|
return items;
|
|
424
424
|
}
|
|
425
|
-
findWorkoutCard(id) {
|
|
425
|
+
findWorkoutCard(id, opts) {
|
|
426
|
+
const includeScheduled = opts?.includeScheduled ?? false;
|
|
426
427
|
const lists = this.getWorkoutList().getLists(false) ?? [];
|
|
427
|
-
|
|
428
|
+
const regularLists = lists.filter(l => l.getId() !== 'scheduled');
|
|
429
|
+
const scheduledLists = includeScheduled ? lists.filter(l => l.getId() === 'scheduled') : [];
|
|
430
|
+
const orderedLists = [...regularLists, ...scheduledLists];
|
|
431
|
+
for (const list of orderedLists) {
|
|
428
432
|
const card = list.getCards().find(c => c.getId() === id);
|
|
429
433
|
if (card)
|
|
430
434
|
return card;
|
|
@@ -264,10 +264,10 @@ let WorkoutRidePageService = (() => {
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
onIncreaseLoad() {
|
|
267
|
-
this.adjustLoad(
|
|
267
|
+
this.adjustLoad(this.getLoadIncrement());
|
|
268
268
|
}
|
|
269
269
|
onDecreaseLoad() {
|
|
270
|
-
this.adjustLoad(-
|
|
270
|
+
this.adjustLoad(-this.getLoadIncrement());
|
|
271
271
|
}
|
|
272
272
|
onSetLoadIncrement(value) {
|
|
273
273
|
try {
|
|
@@ -424,7 +424,7 @@ let WorkoutRidePageService = (() => {
|
|
|
424
424
|
if (!limits)
|
|
425
425
|
return empty;
|
|
426
426
|
const currentStep = {
|
|
427
|
-
label: getStepTargetText(limits.step ?? {}, ftp
|
|
427
|
+
label: getStepTargetText(limits.step ?? {}, ftp),
|
|
428
428
|
targetPower: limits.targetPower ?? null,
|
|
429
429
|
duration: limits.duration,
|
|
430
430
|
remaining: limits.remaining,
|
|
@@ -453,7 +453,7 @@ let WorkoutRidePageService = (() => {
|
|
|
453
453
|
const title = wo.title ?? '';
|
|
454
454
|
if (!limits)
|
|
455
455
|
return { text: title, mode: wo.mode ?? null };
|
|
456
|
-
const target = getStepTargetText(limits.step ?? {}, wo.ftp
|
|
456
|
+
const target = getStepTargetText(limits.step ?? {}, wo.ftp);
|
|
457
457
|
const duration = getStepDuration({ duration: limits.duration });
|
|
458
458
|
const text = title ? `${target} for ${duration} - ${title}` : `${target} for ${duration}`;
|
|
459
459
|
return { text, mode: wo.mode ?? null };
|
|
@@ -36,6 +36,7 @@ export declare class DevicesPageService extends IncyclistPageService {
|
|
|
36
36
|
protected onEnableCapability(enabled: boolean): void;
|
|
37
37
|
protected openDeviceSelection(cap: IncyclistCapability): void;
|
|
38
38
|
protected onDeviceSelected(d: DevicePairingData, addAll?: boolean): void;
|
|
39
|
+
protected onDeviceDelete(d: DevicePairingData): void;
|
|
39
40
|
protected closeDeviceSelection(enabled: boolean): Promise<void>;
|
|
40
41
|
protected getButtonsDisplayProps(): PairingButtonProps;
|
|
41
42
|
protected getTCapability(capabability: IncyclistCapability): TIncyclistCapability;
|
|
@@ -31,8 +31,8 @@ export type DeviceSelectionItemProps = {
|
|
|
31
31
|
deviceName: string;
|
|
32
32
|
value: number;
|
|
33
33
|
interface: string;
|
|
34
|
-
onClick?:
|
|
35
|
-
onDelete?:
|
|
34
|
+
onClick?: (addAll?: boolean) => void;
|
|
35
|
+
onDelete?: () => void;
|
|
36
36
|
};
|
|
37
37
|
export type CapabilityDisplayProps = {
|
|
38
38
|
title: string;
|
|
@@ -137,7 +137,6 @@ export declare class DevicePairingService extends IncyclistService {
|
|
|
137
137
|
protected _stopDeviceSelection(changed: boolean): Promise<void>;
|
|
138
138
|
private numberOfSelectedCababilities;
|
|
139
139
|
protected addToDeletedList(capability: IncyclistCapability | CapabilityData, udid: string): void;
|
|
140
|
-
protected removeFromDeletedList(capability: IncyclistCapability | CapabilityData, udid: string): void;
|
|
141
140
|
protected isOnDeletedList(c: IncyclistCapability | CapabilityData, udid: string): boolean;
|
|
142
141
|
mappedCapability(c: CapabilityInformation): CapabilityData;
|
|
143
142
|
protected mappedCapabilities(capabilities: DeviceConfigurationInfo): Array<CapabilityData>;
|
|
@@ -4,10 +4,7 @@ import { WorkoutGraphPlanBar, WorkoutGraphSeriesOptions } from "./types";
|
|
|
4
4
|
export declare const WORKOUT_ZONE_COLORS: string[];
|
|
5
5
|
export declare function getStepDuration(step: StepDefinition): string;
|
|
6
6
|
export declare function getStepPower(step: StepDefinition, ftp?: number): string;
|
|
7
|
-
export declare function getStepTargetText(step: StepDefinition, ftp?: number
|
|
8
|
-
min?: number;
|
|
9
|
-
max?: number;
|
|
10
|
-
}): string;
|
|
7
|
+
export declare function getStepTargetText(step: StepDefinition, ftp?: number): string;
|
|
11
8
|
export interface FlattenedStep {
|
|
12
9
|
step: Step;
|
|
13
10
|
start: number;
|
|
@@ -68,7 +68,9 @@ export declare class WorkoutListService extends IncyclistService implements ILis
|
|
|
68
68
|
protected addItem(item: WP): Card<WP>;
|
|
69
69
|
protected updateItem(item: WP): Promise<void>;
|
|
70
70
|
protected selectList(item: WP): CardList<WP>;
|
|
71
|
-
protected findCard(target: WP | string
|
|
71
|
+
protected findCard(target: WP | string, opts?: {
|
|
72
|
+
includeScheduled?: boolean;
|
|
73
|
+
}): {
|
|
72
74
|
card: Card<WP>;
|
|
73
75
|
list: CardList<WP>;
|
|
74
76
|
};
|
|
@@ -45,7 +45,9 @@ export declare class WorkoutListPageService extends IncyclistPageService impleme
|
|
|
45
45
|
protected getGroupFilterProps(): GroupFilterProps;
|
|
46
46
|
protected getKnownGroups(): string[];
|
|
47
47
|
protected getAllWorkoutItems(): WorkoutListItemProps[];
|
|
48
|
-
protected findWorkoutCard(id: string
|
|
48
|
+
protected findWorkoutCard(id: string, opts?: {
|
|
49
|
+
includeScheduled?: boolean;
|
|
50
|
+
}): WorkoutCard | undefined;
|
|
49
51
|
protected getLastUsedImportGroup(): string;
|
|
50
52
|
protected persistLastUsedImportGroup(group: string): void;
|
|
51
53
|
protected formatDuration(duration: number): string;
|