incyclist-services 1.7.83 → 1.7.85
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/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/index.js +4 -0
- package/lib/cjs/workouts/list/service.js +8 -4
- package/lib/cjs/workouts/page/service.js +18 -7
- package/lib/cjs/workouts/ride/page/service.js +19 -4
- package/lib/esm/devices/page/service.js +8 -1
- 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/index.js +1 -0
- package/lib/esm/workouts/list/service.js +8 -4
- package/lib/esm/workouts/page/service.js +18 -7
- package/lib/esm/workouts/ride/page/service.js +19 -4
- package/lib/types/devices/page/service.d.ts +1 -0
- package/lib/types/devices/page/types.d.ts +2 -2
- package/lib/types/workouts/index.d.ts +1 -0
- package/lib/types/workouts/list/service.d.ts +3 -1
- package/lib/types/workouts/page/service.d.ts +4 -1
- package/lib/types/workouts/ride/page/service.d.ts +2 -0
- package/lib/types/workouts/ride/page/types.d.ts +2 -0
- 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) {
|
|
@@ -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();
|
|
@@ -14,8 +14,12 @@ 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
|
+
exports.useWorkoutCalendar = exports.WorkoutCalendarService = void 0;
|
|
17
18
|
__exportStar(require("./list"), exports);
|
|
18
19
|
__exportStar(require("./ride"), exports);
|
|
19
20
|
__exportStar(require("./base/model"), exports);
|
|
20
21
|
__exportStar(require("./base/graph"), exports);
|
|
21
22
|
__exportStar(require("./page"), exports);
|
|
23
|
+
var calendar_1 = require("./calendar");
|
|
24
|
+
Object.defineProperty(exports, "WorkoutCalendarService", { enumerable: true, get: function () { return calendar_1.WorkoutCalendarService; } });
|
|
25
|
+
Object.defineProperty(exports, "useWorkoutCalendar", { enumerable: true, get: function () { return calendar_1.useWorkoutCalendar; } });
|
|
@@ -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);
|
|
@@ -83,6 +83,7 @@ let WorkoutListPageService = (() => {
|
|
|
83
83
|
importingFileName;
|
|
84
84
|
importResult;
|
|
85
85
|
importError;
|
|
86
|
+
importGeneration = 0;
|
|
86
87
|
listObserver;
|
|
87
88
|
listUpdateHandler = this.emitPageUpdate.bind(this);
|
|
88
89
|
calendarUpdateHandler = this.emitPageUpdate.bind(this);
|
|
@@ -145,7 +146,7 @@ let WorkoutListPageService = (() => {
|
|
|
145
146
|
}
|
|
146
147
|
getWorkoutDetailsProps(id) {
|
|
147
148
|
try {
|
|
148
|
-
const card = this.findWorkoutCard(id);
|
|
149
|
+
const card = this.findWorkoutCard(id, { includeScheduled: true });
|
|
149
150
|
if (!card)
|
|
150
151
|
return null;
|
|
151
152
|
const workout = card.getData();
|
|
@@ -265,7 +266,7 @@ let WorkoutListPageService = (() => {
|
|
|
265
266
|
}
|
|
266
267
|
onStart(id, opts) {
|
|
267
268
|
try {
|
|
268
|
-
const card = this.findWorkoutCard(id);
|
|
269
|
+
const card = this.findWorkoutCard(id, { includeScheduled: true });
|
|
269
270
|
if (!card)
|
|
270
271
|
return;
|
|
271
272
|
const service = this.getWorkoutList();
|
|
@@ -284,7 +285,7 @@ let WorkoutListPageService = (() => {
|
|
|
284
285
|
}
|
|
285
286
|
onMarkForRoute(id) {
|
|
286
287
|
try {
|
|
287
|
-
const card = this.findWorkoutCard(id);
|
|
288
|
+
const card = this.findWorkoutCard(id, { includeScheduled: true });
|
|
288
289
|
if (!card)
|
|
289
290
|
return;
|
|
290
291
|
const settings = this.getWorkoutList().getStartSettings();
|
|
@@ -317,6 +318,7 @@ let WorkoutListPageService = (() => {
|
|
|
317
318
|
}
|
|
318
319
|
onImportFile(file) {
|
|
319
320
|
const observer = new observer_1.Observer();
|
|
321
|
+
const generation = this.importGeneration = Date.now();
|
|
320
322
|
try {
|
|
321
323
|
this.importPhase = 'importing';
|
|
322
324
|
this.importingFileName = file?.name;
|
|
@@ -324,17 +326,21 @@ let WorkoutListPageService = (() => {
|
|
|
324
326
|
this.getWorkoutList().import(file, { showImportCards: false })
|
|
325
327
|
.then(([card]) => {
|
|
326
328
|
const group = this.getLastUsedImportGroup();
|
|
329
|
+
observer.emit('success');
|
|
330
|
+
if (generation !== this.importGeneration)
|
|
331
|
+
return;
|
|
327
332
|
if (group !== DEFAULT_IMPORT_GROUP)
|
|
328
333
|
card.move(group);
|
|
329
334
|
this.importPhase = 'result';
|
|
330
335
|
this.importResult = { id: card.getId(), workoutName: card.getTitle(), group };
|
|
331
|
-
observer.emit('success');
|
|
332
336
|
this.emitImportUpdate();
|
|
333
337
|
})
|
|
334
338
|
.catch((err) => {
|
|
339
|
+
observer.emit('error', err);
|
|
340
|
+
if (generation !== this.importGeneration)
|
|
341
|
+
return;
|
|
335
342
|
this.importPhase = 'error';
|
|
336
343
|
this.importError = err?.message;
|
|
337
|
-
observer.emit('error', err);
|
|
338
344
|
this.emitImportUpdate();
|
|
339
345
|
});
|
|
340
346
|
}
|
|
@@ -358,6 +364,7 @@ let WorkoutListPageService = (() => {
|
|
|
358
364
|
}
|
|
359
365
|
onImportClose() {
|
|
360
366
|
try {
|
|
367
|
+
this.importGeneration = Date.now();
|
|
361
368
|
delete this.importPhase;
|
|
362
369
|
delete this.importingFileName;
|
|
363
370
|
delete this.importResult;
|
|
@@ -418,9 +425,13 @@ let WorkoutListPageService = (() => {
|
|
|
418
425
|
});
|
|
419
426
|
return items;
|
|
420
427
|
}
|
|
421
|
-
findWorkoutCard(id) {
|
|
428
|
+
findWorkoutCard(id, opts) {
|
|
429
|
+
const includeScheduled = opts?.includeScheduled ?? false;
|
|
422
430
|
const lists = this.getWorkoutList().getLists(false) ?? [];
|
|
423
|
-
|
|
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) {
|
|
424
435
|
const card = list.getCards().find(c => c.getId() === id);
|
|
425
436
|
if (card)
|
|
426
437
|
return card;
|
|
@@ -48,6 +48,7 @@ const BACKGROUND_PAUSE_TIMEOUT_MS = 300000;
|
|
|
48
48
|
const UPCOMING_STEPS_COUNT = 3;
|
|
49
49
|
const DEFAULT_LOAD_INCREMENT = 1;
|
|
50
50
|
const HINTS_WORKOUT_GESTURES_KEY = 'hints.workoutRideGestures';
|
|
51
|
+
const LOAD_INCREMENT_SETTING_KEY = 'preferences.workouts.loadIncrement';
|
|
51
52
|
let WorkoutRidePageService = (() => {
|
|
52
53
|
let _classDecorators = [types_1.Singleton];
|
|
53
54
|
let _classDescriptor;
|
|
@@ -170,7 +171,8 @@ let WorkoutRidePageService = (() => {
|
|
|
170
171
|
graph: this.buildGraphPlan(current, wo.ftp),
|
|
171
172
|
steps: this.buildUpcomingSteps(current, wo.ftp),
|
|
172
173
|
dashboard: this.buildDashboardLine(wo),
|
|
173
|
-
gestureHint: this.buildGestureHint(base.startOverlayProps === null)
|
|
174
|
+
gestureHint: this.buildGestureHint(base.startOverlayProps === null),
|
|
175
|
+
loadIncrement: this.getLoadIncrement()
|
|
174
176
|
};
|
|
175
177
|
}
|
|
176
178
|
catch (err) {
|
|
@@ -265,10 +267,19 @@ let WorkoutRidePageService = (() => {
|
|
|
265
267
|
}
|
|
266
268
|
}
|
|
267
269
|
onIncreaseLoad() {
|
|
268
|
-
this.adjustLoad(
|
|
270
|
+
this.adjustLoad(this.getLoadIncrement());
|
|
269
271
|
}
|
|
270
272
|
onDecreaseLoad() {
|
|
271
|
-
this.adjustLoad(-
|
|
273
|
+
this.adjustLoad(-this.getLoadIncrement());
|
|
274
|
+
}
|
|
275
|
+
onSetLoadIncrement(value) {
|
|
276
|
+
try {
|
|
277
|
+
this.getUserSettings().set(LOAD_INCREMENT_SETTING_KEY, value);
|
|
278
|
+
this.updatePageDisplay();
|
|
279
|
+
}
|
|
280
|
+
catch (err) {
|
|
281
|
+
this.logError(err, 'onSetLoadIncrement');
|
|
282
|
+
}
|
|
272
283
|
}
|
|
273
284
|
onRetryStart() {
|
|
274
285
|
try {
|
|
@@ -389,6 +400,9 @@ let WorkoutRidePageService = (() => {
|
|
|
389
400
|
getCurrentCadence() {
|
|
390
401
|
return this.getActivityRide().getCurrentValues?.()?.cadence ?? 0;
|
|
391
402
|
}
|
|
403
|
+
getLoadIncrement() {
|
|
404
|
+
return this.getUserSettings().get(LOAD_INCREMENT_SETTING_KEY, DEFAULT_LOAD_INCREMENT);
|
|
405
|
+
}
|
|
392
406
|
buildGraphPlan(current, ftp) {
|
|
393
407
|
if (!current) {
|
|
394
408
|
return { bars: [], ftp: ftp ?? 0, ftpLine: ftp ?? 0, domain: { x: [0, 0], y: [0, 0] } };
|
|
@@ -484,7 +498,8 @@ let WorkoutRidePageService = (() => {
|
|
|
484
498
|
graph: { bars: [], ftp: 0, ftpLine: 0, domain: { x: [0, 0], y: [0, 0] } },
|
|
485
499
|
steps: { previous: null, current: null, upcoming: [], hasMore: false },
|
|
486
500
|
dashboard: { text: '', mode: null },
|
|
487
|
-
gestureHint: null
|
|
501
|
+
gestureHint: null,
|
|
502
|
+
loadIncrement: DEFAULT_LOAD_INCREMENT
|
|
488
503
|
};
|
|
489
504
|
}
|
|
490
505
|
updatePageDisplay() {
|
|
@@ -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) {
|
|
@@ -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();
|
|
@@ -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);
|
|
@@ -80,6 +80,7 @@ let WorkoutListPageService = (() => {
|
|
|
80
80
|
importingFileName;
|
|
81
81
|
importResult;
|
|
82
82
|
importError;
|
|
83
|
+
importGeneration = 0;
|
|
83
84
|
listObserver;
|
|
84
85
|
listUpdateHandler = this.emitPageUpdate.bind(this);
|
|
85
86
|
calendarUpdateHandler = this.emitPageUpdate.bind(this);
|
|
@@ -142,7 +143,7 @@ let WorkoutListPageService = (() => {
|
|
|
142
143
|
}
|
|
143
144
|
getWorkoutDetailsProps(id) {
|
|
144
145
|
try {
|
|
145
|
-
const card = this.findWorkoutCard(id);
|
|
146
|
+
const card = this.findWorkoutCard(id, { includeScheduled: true });
|
|
146
147
|
if (!card)
|
|
147
148
|
return null;
|
|
148
149
|
const workout = card.getData();
|
|
@@ -262,7 +263,7 @@ let WorkoutListPageService = (() => {
|
|
|
262
263
|
}
|
|
263
264
|
onStart(id, opts) {
|
|
264
265
|
try {
|
|
265
|
-
const card = this.findWorkoutCard(id);
|
|
266
|
+
const card = this.findWorkoutCard(id, { includeScheduled: true });
|
|
266
267
|
if (!card)
|
|
267
268
|
return;
|
|
268
269
|
const service = this.getWorkoutList();
|
|
@@ -281,7 +282,7 @@ let WorkoutListPageService = (() => {
|
|
|
281
282
|
}
|
|
282
283
|
onMarkForRoute(id) {
|
|
283
284
|
try {
|
|
284
|
-
const card = this.findWorkoutCard(id);
|
|
285
|
+
const card = this.findWorkoutCard(id, { includeScheduled: true });
|
|
285
286
|
if (!card)
|
|
286
287
|
return;
|
|
287
288
|
const settings = this.getWorkoutList().getStartSettings();
|
|
@@ -314,6 +315,7 @@ let WorkoutListPageService = (() => {
|
|
|
314
315
|
}
|
|
315
316
|
onImportFile(file) {
|
|
316
317
|
const observer = new Observer();
|
|
318
|
+
const generation = this.importGeneration = Date.now();
|
|
317
319
|
try {
|
|
318
320
|
this.importPhase = 'importing';
|
|
319
321
|
this.importingFileName = file?.name;
|
|
@@ -321,17 +323,21 @@ let WorkoutListPageService = (() => {
|
|
|
321
323
|
this.getWorkoutList().import(file, { showImportCards: false })
|
|
322
324
|
.then(([card]) => {
|
|
323
325
|
const group = this.getLastUsedImportGroup();
|
|
326
|
+
observer.emit('success');
|
|
327
|
+
if (generation !== this.importGeneration)
|
|
328
|
+
return;
|
|
324
329
|
if (group !== DEFAULT_IMPORT_GROUP)
|
|
325
330
|
card.move(group);
|
|
326
331
|
this.importPhase = 'result';
|
|
327
332
|
this.importResult = { id: card.getId(), workoutName: card.getTitle(), group };
|
|
328
|
-
observer.emit('success');
|
|
329
333
|
this.emitImportUpdate();
|
|
330
334
|
})
|
|
331
335
|
.catch((err) => {
|
|
336
|
+
observer.emit('error', err);
|
|
337
|
+
if (generation !== this.importGeneration)
|
|
338
|
+
return;
|
|
332
339
|
this.importPhase = 'error';
|
|
333
340
|
this.importError = err?.message;
|
|
334
|
-
observer.emit('error', err);
|
|
335
341
|
this.emitImportUpdate();
|
|
336
342
|
});
|
|
337
343
|
}
|
|
@@ -355,6 +361,7 @@ let WorkoutListPageService = (() => {
|
|
|
355
361
|
}
|
|
356
362
|
onImportClose() {
|
|
357
363
|
try {
|
|
364
|
+
this.importGeneration = Date.now();
|
|
358
365
|
delete this.importPhase;
|
|
359
366
|
delete this.importingFileName;
|
|
360
367
|
delete this.importResult;
|
|
@@ -415,9 +422,13 @@ let WorkoutListPageService = (() => {
|
|
|
415
422
|
});
|
|
416
423
|
return items;
|
|
417
424
|
}
|
|
418
|
-
findWorkoutCard(id) {
|
|
425
|
+
findWorkoutCard(id, opts) {
|
|
426
|
+
const includeScheduled = opts?.includeScheduled ?? false;
|
|
419
427
|
const lists = this.getWorkoutList().getLists(false) ?? [];
|
|
420
|
-
|
|
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) {
|
|
421
432
|
const card = list.getCards().find(c => c.getId() === id);
|
|
422
433
|
if (card)
|
|
423
434
|
return card;
|
|
@@ -45,6 +45,7 @@ const BACKGROUND_PAUSE_TIMEOUT_MS = 300000;
|
|
|
45
45
|
const UPCOMING_STEPS_COUNT = 3;
|
|
46
46
|
const DEFAULT_LOAD_INCREMENT = 1;
|
|
47
47
|
const HINTS_WORKOUT_GESTURES_KEY = 'hints.workoutRideGestures';
|
|
48
|
+
const LOAD_INCREMENT_SETTING_KEY = 'preferences.workouts.loadIncrement';
|
|
48
49
|
let WorkoutRidePageService = (() => {
|
|
49
50
|
let _classDecorators = [Singleton];
|
|
50
51
|
let _classDescriptor;
|
|
@@ -167,7 +168,8 @@ let WorkoutRidePageService = (() => {
|
|
|
167
168
|
graph: this.buildGraphPlan(current, wo.ftp),
|
|
168
169
|
steps: this.buildUpcomingSteps(current, wo.ftp),
|
|
169
170
|
dashboard: this.buildDashboardLine(wo),
|
|
170
|
-
gestureHint: this.buildGestureHint(base.startOverlayProps === null)
|
|
171
|
+
gestureHint: this.buildGestureHint(base.startOverlayProps === null),
|
|
172
|
+
loadIncrement: this.getLoadIncrement()
|
|
171
173
|
};
|
|
172
174
|
}
|
|
173
175
|
catch (err) {
|
|
@@ -262,10 +264,19 @@ let WorkoutRidePageService = (() => {
|
|
|
262
264
|
}
|
|
263
265
|
}
|
|
264
266
|
onIncreaseLoad() {
|
|
265
|
-
this.adjustLoad(
|
|
267
|
+
this.adjustLoad(this.getLoadIncrement());
|
|
266
268
|
}
|
|
267
269
|
onDecreaseLoad() {
|
|
268
|
-
this.adjustLoad(-
|
|
270
|
+
this.adjustLoad(-this.getLoadIncrement());
|
|
271
|
+
}
|
|
272
|
+
onSetLoadIncrement(value) {
|
|
273
|
+
try {
|
|
274
|
+
this.getUserSettings().set(LOAD_INCREMENT_SETTING_KEY, value);
|
|
275
|
+
this.updatePageDisplay();
|
|
276
|
+
}
|
|
277
|
+
catch (err) {
|
|
278
|
+
this.logError(err, 'onSetLoadIncrement');
|
|
279
|
+
}
|
|
269
280
|
}
|
|
270
281
|
onRetryStart() {
|
|
271
282
|
try {
|
|
@@ -386,6 +397,9 @@ let WorkoutRidePageService = (() => {
|
|
|
386
397
|
getCurrentCadence() {
|
|
387
398
|
return this.getActivityRide().getCurrentValues?.()?.cadence ?? 0;
|
|
388
399
|
}
|
|
400
|
+
getLoadIncrement() {
|
|
401
|
+
return this.getUserSettings().get(LOAD_INCREMENT_SETTING_KEY, DEFAULT_LOAD_INCREMENT);
|
|
402
|
+
}
|
|
389
403
|
buildGraphPlan(current, ftp) {
|
|
390
404
|
if (!current) {
|
|
391
405
|
return { bars: [], ftp: ftp ?? 0, ftpLine: ftp ?? 0, domain: { x: [0, 0], y: [0, 0] } };
|
|
@@ -481,7 +495,8 @@ let WorkoutRidePageService = (() => {
|
|
|
481
495
|
graph: { bars: [], ftp: 0, ftpLine: 0, domain: { x: [0, 0], y: [0, 0] } },
|
|
482
496
|
steps: { previous: null, current: null, upcoming: [], hasMore: false },
|
|
483
497
|
dashboard: { text: '', mode: null },
|
|
484
|
-
gestureHint: null
|
|
498
|
+
gestureHint: null,
|
|
499
|
+
loadIncrement: DEFAULT_LOAD_INCREMENT
|
|
485
500
|
};
|
|
486
501
|
}
|
|
487
502
|
updatePageDisplay() {
|
|
@@ -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;
|
|
@@ -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
|
};
|
|
@@ -15,6 +15,7 @@ export declare class WorkoutListPageService extends IncyclistPageService impleme
|
|
|
15
15
|
group: string;
|
|
16
16
|
};
|
|
17
17
|
protected importError: string;
|
|
18
|
+
protected importGeneration: number;
|
|
18
19
|
protected listObserver: IObserver;
|
|
19
20
|
protected listUpdateHandler: any;
|
|
20
21
|
protected calendarUpdateHandler: any;
|
|
@@ -44,7 +45,9 @@ export declare class WorkoutListPageService extends IncyclistPageService impleme
|
|
|
44
45
|
protected getGroupFilterProps(): GroupFilterProps;
|
|
45
46
|
protected getKnownGroups(): string[];
|
|
46
47
|
protected getAllWorkoutItems(): WorkoutListItemProps[];
|
|
47
|
-
protected findWorkoutCard(id: string
|
|
48
|
+
protected findWorkoutCard(id: string, opts?: {
|
|
49
|
+
includeScheduled?: boolean;
|
|
50
|
+
}): WorkoutCard | undefined;
|
|
48
51
|
protected getLastUsedImportGroup(): string;
|
|
49
52
|
protected persistLastUsedImportGroup(group: string): void;
|
|
50
53
|
protected formatDuration(duration: number): string;
|
|
@@ -30,6 +30,7 @@ export declare class WorkoutRidePageService extends IncyclistPageService impleme
|
|
|
30
30
|
onStepForward(): void;
|
|
31
31
|
onIncreaseLoad(): void;
|
|
32
32
|
onDecreaseLoad(): void;
|
|
33
|
+
onSetLoadIncrement(value: number): void;
|
|
33
34
|
onRetryStart(): void;
|
|
34
35
|
onIgnoreStart(): void;
|
|
35
36
|
onGestureHintDismissed({ dontShowAgain }: {
|
|
@@ -53,6 +54,7 @@ export declare class WorkoutRidePageService extends IncyclistPageService impleme
|
|
|
53
54
|
};
|
|
54
55
|
protected buildGestureHint(startOverlayCleared: boolean): WorkoutGestureHint | null;
|
|
55
56
|
protected getCurrentCadence(): number;
|
|
57
|
+
protected getLoadIncrement(): number;
|
|
56
58
|
protected buildGraphPlan(current: Workout | undefined, ftp: number): WorkoutGraphPlan;
|
|
57
59
|
protected buildUpcomingSteps(current: Workout | undefined, ftp: number): WorkoutUpcomingSteps;
|
|
58
60
|
protected buildDashboardLine(wo: WorkoutDisplayProperties): WorkoutDashboardLine;
|
|
@@ -52,6 +52,7 @@ export interface WorkoutRidePageDisplayProps extends RidePageDisplayProps {
|
|
|
52
52
|
dashboard: WorkoutDashboardLine;
|
|
53
53
|
title: string;
|
|
54
54
|
gestureHint: WorkoutGestureHint | null;
|
|
55
|
+
loadIncrement: number;
|
|
55
56
|
}
|
|
56
57
|
export interface WorkoutRidePageCallbacks {
|
|
57
58
|
onMenuOpen(): void;
|
|
@@ -63,6 +64,7 @@ export interface WorkoutRidePageCallbacks {
|
|
|
63
64
|
onStepForward(): void;
|
|
64
65
|
onIncreaseLoad(): void;
|
|
65
66
|
onDecreaseLoad(): void;
|
|
67
|
+
onSetLoadIncrement(value: number): void;
|
|
66
68
|
onRetryStart(): void;
|
|
67
69
|
onIgnoreStart(): void;
|
|
68
70
|
onCancelStart(): void;
|