incyclist-services 1.7.82 → 1.7.83
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.
|
@@ -41,11 +41,13 @@ const types_1 = require("../../../base/types");
|
|
|
41
41
|
const pages_1 = require("../../../base/pages");
|
|
42
42
|
const display_1 = require("../../../ride/display");
|
|
43
43
|
const activities_1 = require("../../../activities");
|
|
44
|
+
const settings_1 = require("../../../settings");
|
|
44
45
|
const service_1 = require("../service");
|
|
45
46
|
const graph_1 = require("../../base/graph");
|
|
46
47
|
const BACKGROUND_PAUSE_TIMEOUT_MS = 300000;
|
|
47
48
|
const UPCOMING_STEPS_COUNT = 3;
|
|
48
49
|
const DEFAULT_LOAD_INCREMENT = 1;
|
|
50
|
+
const HINTS_WORKOUT_GESTURES_KEY = 'hints.workoutRideGestures';
|
|
49
51
|
let WorkoutRidePageService = (() => {
|
|
50
52
|
let _classDecorators = [types_1.Singleton];
|
|
51
53
|
let _classDescriptor;
|
|
@@ -56,6 +58,7 @@ let WorkoutRidePageService = (() => {
|
|
|
56
58
|
let _getRideDisplay_decorators;
|
|
57
59
|
let _getWorkoutRide_decorators;
|
|
58
60
|
let _getActivityRide_decorators;
|
|
61
|
+
let _getUserSettings_decorators;
|
|
59
62
|
var WorkoutRidePageService = class extends _classSuper {
|
|
60
63
|
static { _classThis = this; }
|
|
61
64
|
static {
|
|
@@ -63,9 +66,11 @@ let WorkoutRidePageService = (() => {
|
|
|
63
66
|
_getRideDisplay_decorators = [decorators_1.Injectable];
|
|
64
67
|
_getWorkoutRide_decorators = [decorators_1.Injectable];
|
|
65
68
|
_getActivityRide_decorators = [decorators_1.Injectable];
|
|
69
|
+
_getUserSettings_decorators = [decorators_1.Injectable];
|
|
66
70
|
__esDecorate(this, null, _getRideDisplay_decorators, { kind: "method", name: "getRideDisplay", static: false, private: false, access: { has: obj => "getRideDisplay" in obj, get: obj => obj.getRideDisplay }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
67
71
|
__esDecorate(this, null, _getWorkoutRide_decorators, { kind: "method", name: "getWorkoutRide", static: false, private: false, access: { has: obj => "getWorkoutRide" in obj, get: obj => obj.getWorkoutRide }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
68
72
|
__esDecorate(this, null, _getActivityRide_decorators, { kind: "method", name: "getActivityRide", static: false, private: false, access: { has: obj => "getActivityRide" in obj, get: obj => obj.getActivityRide }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
73
|
+
__esDecorate(this, null, _getUserSettings_decorators, { kind: "method", name: "getUserSettings", static: false, private: false, access: { has: obj => "getUserSettings" in obj, get: obj => obj.getUserSettings }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
69
74
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
70
75
|
WorkoutRidePageService = _classThis = _classDescriptor.value;
|
|
71
76
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -77,6 +82,7 @@ let WorkoutRidePageService = (() => {
|
|
|
77
82
|
backgroundTimer;
|
|
78
83
|
backgroundPausedByService = false;
|
|
79
84
|
menuProps = null;
|
|
85
|
+
gestureHintDismissed = false;
|
|
80
86
|
constructor() {
|
|
81
87
|
super('WorkoutRidePage');
|
|
82
88
|
this.rideEventHandler['state-update'] = this.onRideStateUpdate.bind(this);
|
|
@@ -91,6 +97,7 @@ let WorkoutRidePageService = (() => {
|
|
|
91
97
|
try {
|
|
92
98
|
this.logEvent({ message: 'page shown', page: 'WorkoutRide' });
|
|
93
99
|
gd_eventlog_1.EventLogger.setGlobalConfig('page', 'WorkoutRide');
|
|
100
|
+
this.gestureHintDismissed = false;
|
|
94
101
|
super.openPage();
|
|
95
102
|
try {
|
|
96
103
|
const service = this.getRideDisplay();
|
|
@@ -162,7 +169,8 @@ let WorkoutRidePageService = (() => {
|
|
|
162
169
|
title: wo.title ?? '',
|
|
163
170
|
graph: this.buildGraphPlan(current, wo.ftp),
|
|
164
171
|
steps: this.buildUpcomingSteps(current, wo.ftp),
|
|
165
|
-
dashboard: this.buildDashboardLine(wo)
|
|
172
|
+
dashboard: this.buildDashboardLine(wo),
|
|
173
|
+
gestureHint: this.buildGestureHint(base.startOverlayProps === null)
|
|
166
174
|
};
|
|
167
175
|
}
|
|
168
176
|
catch (err) {
|
|
@@ -278,6 +286,18 @@ let WorkoutRidePageService = (() => {
|
|
|
278
286
|
this.logError(err, 'onIgnoreStart');
|
|
279
287
|
}
|
|
280
288
|
}
|
|
289
|
+
onGestureHintDismissed({ dontShowAgain }) {
|
|
290
|
+
try {
|
|
291
|
+
this.gestureHintDismissed = true;
|
|
292
|
+
if (dontShowAgain) {
|
|
293
|
+
this.getUserSettings().set(HINTS_WORKOUT_GESTURES_KEY, true);
|
|
294
|
+
}
|
|
295
|
+
this.updatePageDisplay();
|
|
296
|
+
}
|
|
297
|
+
catch (err) {
|
|
298
|
+
this.logError(err, 'onGestureHintDismissed');
|
|
299
|
+
}
|
|
300
|
+
}
|
|
281
301
|
onCancelStart() {
|
|
282
302
|
try {
|
|
283
303
|
this.rideObserver?.stop();
|
|
@@ -357,6 +377,18 @@ let WorkoutRidePageService = (() => {
|
|
|
357
377
|
startGateProps: null
|
|
358
378
|
};
|
|
359
379
|
}
|
|
380
|
+
buildGestureHint(startOverlayCleared) {
|
|
381
|
+
if (this.gestureHintDismissed || !startOverlayCleared)
|
|
382
|
+
return null;
|
|
383
|
+
if (this.getElapsedActivityTime() !== 0 || this.getCurrentCadence() !== 0)
|
|
384
|
+
return null;
|
|
385
|
+
if (this.getUserSettings().get(HINTS_WORKOUT_GESTURES_KEY, false))
|
|
386
|
+
return null;
|
|
387
|
+
return { visible: true };
|
|
388
|
+
}
|
|
389
|
+
getCurrentCadence() {
|
|
390
|
+
return this.getActivityRide().getCurrentValues?.()?.cadence ?? 0;
|
|
391
|
+
}
|
|
360
392
|
buildGraphPlan(current, ftp) {
|
|
361
393
|
if (!current) {
|
|
362
394
|
return { bars: [], ftp: ftp ?? 0, ftpLine: ftp ?? 0, domain: { x: [0, 0], y: [0, 0] } };
|
|
@@ -451,7 +483,8 @@ let WorkoutRidePageService = (() => {
|
|
|
451
483
|
title: '',
|
|
452
484
|
graph: { bars: [], ftp: 0, ftpLine: 0, domain: { x: [0, 0], y: [0, 0] } },
|
|
453
485
|
steps: { previous: null, current: null, upcoming: [], hasMore: false },
|
|
454
|
-
dashboard: { text: '', mode: null }
|
|
486
|
+
dashboard: { text: '', mode: null },
|
|
487
|
+
gestureHint: null
|
|
455
488
|
};
|
|
456
489
|
}
|
|
457
490
|
updatePageDisplay() {
|
|
@@ -481,6 +514,9 @@ let WorkoutRidePageService = (() => {
|
|
|
481
514
|
getActivityRide() {
|
|
482
515
|
return (0, activities_1.useActivityRide)();
|
|
483
516
|
}
|
|
517
|
+
getUserSettings() {
|
|
518
|
+
return (0, settings_1.useUserSettings)();
|
|
519
|
+
}
|
|
484
520
|
};
|
|
485
521
|
return WorkoutRidePageService = _classThis;
|
|
486
522
|
})();
|
|
@@ -38,11 +38,13 @@ import { Singleton } from "../../../base/types";
|
|
|
38
38
|
import { IncyclistPageService } from "../../../base/pages";
|
|
39
39
|
import { useRideDisplay } from "../../../ride/display";
|
|
40
40
|
import { useActivityRide } from "../../../activities";
|
|
41
|
+
import { useUserSettings } from "../../../settings";
|
|
41
42
|
import { useWorkoutRide } from "../service";
|
|
42
43
|
import { getFlattenedSteps, getStepDuration, getStepTargetText, getWorkoutGraphSeries } from "../../base/graph";
|
|
43
44
|
const BACKGROUND_PAUSE_TIMEOUT_MS = 300000;
|
|
44
45
|
const UPCOMING_STEPS_COUNT = 3;
|
|
45
46
|
const DEFAULT_LOAD_INCREMENT = 1;
|
|
47
|
+
const HINTS_WORKOUT_GESTURES_KEY = 'hints.workoutRideGestures';
|
|
46
48
|
let WorkoutRidePageService = (() => {
|
|
47
49
|
let _classDecorators = [Singleton];
|
|
48
50
|
let _classDescriptor;
|
|
@@ -53,6 +55,7 @@ let WorkoutRidePageService = (() => {
|
|
|
53
55
|
let _getRideDisplay_decorators;
|
|
54
56
|
let _getWorkoutRide_decorators;
|
|
55
57
|
let _getActivityRide_decorators;
|
|
58
|
+
let _getUserSettings_decorators;
|
|
56
59
|
var WorkoutRidePageService = class extends _classSuper {
|
|
57
60
|
static { _classThis = this; }
|
|
58
61
|
static {
|
|
@@ -60,9 +63,11 @@ let WorkoutRidePageService = (() => {
|
|
|
60
63
|
_getRideDisplay_decorators = [Injectable];
|
|
61
64
|
_getWorkoutRide_decorators = [Injectable];
|
|
62
65
|
_getActivityRide_decorators = [Injectable];
|
|
66
|
+
_getUserSettings_decorators = [Injectable];
|
|
63
67
|
__esDecorate(this, null, _getRideDisplay_decorators, { kind: "method", name: "getRideDisplay", static: false, private: false, access: { has: obj => "getRideDisplay" in obj, get: obj => obj.getRideDisplay }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
64
68
|
__esDecorate(this, null, _getWorkoutRide_decorators, { kind: "method", name: "getWorkoutRide", static: false, private: false, access: { has: obj => "getWorkoutRide" in obj, get: obj => obj.getWorkoutRide }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
65
69
|
__esDecorate(this, null, _getActivityRide_decorators, { kind: "method", name: "getActivityRide", static: false, private: false, access: { has: obj => "getActivityRide" in obj, get: obj => obj.getActivityRide }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
70
|
+
__esDecorate(this, null, _getUserSettings_decorators, { kind: "method", name: "getUserSettings", static: false, private: false, access: { has: obj => "getUserSettings" in obj, get: obj => obj.getUserSettings }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
66
71
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
67
72
|
WorkoutRidePageService = _classThis = _classDescriptor.value;
|
|
68
73
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -74,6 +79,7 @@ let WorkoutRidePageService = (() => {
|
|
|
74
79
|
backgroundTimer;
|
|
75
80
|
backgroundPausedByService = false;
|
|
76
81
|
menuProps = null;
|
|
82
|
+
gestureHintDismissed = false;
|
|
77
83
|
constructor() {
|
|
78
84
|
super('WorkoutRidePage');
|
|
79
85
|
this.rideEventHandler['state-update'] = this.onRideStateUpdate.bind(this);
|
|
@@ -88,6 +94,7 @@ let WorkoutRidePageService = (() => {
|
|
|
88
94
|
try {
|
|
89
95
|
this.logEvent({ message: 'page shown', page: 'WorkoutRide' });
|
|
90
96
|
EventLogger.setGlobalConfig('page', 'WorkoutRide');
|
|
97
|
+
this.gestureHintDismissed = false;
|
|
91
98
|
super.openPage();
|
|
92
99
|
try {
|
|
93
100
|
const service = this.getRideDisplay();
|
|
@@ -159,7 +166,8 @@ let WorkoutRidePageService = (() => {
|
|
|
159
166
|
title: wo.title ?? '',
|
|
160
167
|
graph: this.buildGraphPlan(current, wo.ftp),
|
|
161
168
|
steps: this.buildUpcomingSteps(current, wo.ftp),
|
|
162
|
-
dashboard: this.buildDashboardLine(wo)
|
|
169
|
+
dashboard: this.buildDashboardLine(wo),
|
|
170
|
+
gestureHint: this.buildGestureHint(base.startOverlayProps === null)
|
|
163
171
|
};
|
|
164
172
|
}
|
|
165
173
|
catch (err) {
|
|
@@ -275,6 +283,18 @@ let WorkoutRidePageService = (() => {
|
|
|
275
283
|
this.logError(err, 'onIgnoreStart');
|
|
276
284
|
}
|
|
277
285
|
}
|
|
286
|
+
onGestureHintDismissed({ dontShowAgain }) {
|
|
287
|
+
try {
|
|
288
|
+
this.gestureHintDismissed = true;
|
|
289
|
+
if (dontShowAgain) {
|
|
290
|
+
this.getUserSettings().set(HINTS_WORKOUT_GESTURES_KEY, true);
|
|
291
|
+
}
|
|
292
|
+
this.updatePageDisplay();
|
|
293
|
+
}
|
|
294
|
+
catch (err) {
|
|
295
|
+
this.logError(err, 'onGestureHintDismissed');
|
|
296
|
+
}
|
|
297
|
+
}
|
|
278
298
|
onCancelStart() {
|
|
279
299
|
try {
|
|
280
300
|
this.rideObserver?.stop();
|
|
@@ -354,6 +374,18 @@ let WorkoutRidePageService = (() => {
|
|
|
354
374
|
startGateProps: null
|
|
355
375
|
};
|
|
356
376
|
}
|
|
377
|
+
buildGestureHint(startOverlayCleared) {
|
|
378
|
+
if (this.gestureHintDismissed || !startOverlayCleared)
|
|
379
|
+
return null;
|
|
380
|
+
if (this.getElapsedActivityTime() !== 0 || this.getCurrentCadence() !== 0)
|
|
381
|
+
return null;
|
|
382
|
+
if (this.getUserSettings().get(HINTS_WORKOUT_GESTURES_KEY, false))
|
|
383
|
+
return null;
|
|
384
|
+
return { visible: true };
|
|
385
|
+
}
|
|
386
|
+
getCurrentCadence() {
|
|
387
|
+
return this.getActivityRide().getCurrentValues?.()?.cadence ?? 0;
|
|
388
|
+
}
|
|
357
389
|
buildGraphPlan(current, ftp) {
|
|
358
390
|
if (!current) {
|
|
359
391
|
return { bars: [], ftp: ftp ?? 0, ftpLine: ftp ?? 0, domain: { x: [0, 0], y: [0, 0] } };
|
|
@@ -448,7 +480,8 @@ let WorkoutRidePageService = (() => {
|
|
|
448
480
|
title: '',
|
|
449
481
|
graph: { bars: [], ftp: 0, ftpLine: 0, domain: { x: [0, 0], y: [0, 0] } },
|
|
450
482
|
steps: { previous: null, current: null, upcoming: [], hasMore: false },
|
|
451
|
-
dashboard: { text: '', mode: null }
|
|
483
|
+
dashboard: { text: '', mode: null },
|
|
484
|
+
gestureHint: null
|
|
452
485
|
};
|
|
453
486
|
}
|
|
454
487
|
updatePageDisplay() {
|
|
@@ -478,6 +511,9 @@ let WorkoutRidePageService = (() => {
|
|
|
478
511
|
getActivityRide() {
|
|
479
512
|
return useActivityRide();
|
|
480
513
|
}
|
|
514
|
+
getUserSettings() {
|
|
515
|
+
return useUserSettings();
|
|
516
|
+
}
|
|
481
517
|
};
|
|
482
518
|
return WorkoutRidePageService = _classThis;
|
|
483
519
|
})();
|
|
@@ -4,7 +4,7 @@ import type { CurrentRideState, RideType } from "../../../types";
|
|
|
4
4
|
import type { WorkoutDisplayProperties } from "../types";
|
|
5
5
|
import type { Workout } from "../../base/model";
|
|
6
6
|
import type { StepDefinition } from "../../base/model/types";
|
|
7
|
-
import type { IWorkoutRidePageService, WorkoutDashboardLine, WorkoutGraphActuals, WorkoutGraphPlan, WorkoutRideMenuProps, WorkoutRidePageDisplayProps, WorkoutUpcomingSteps } from "./types";
|
|
7
|
+
import type { IWorkoutRidePageService, WorkoutDashboardLine, WorkoutGestureHint, WorkoutGraphActuals, WorkoutGraphPlan, WorkoutRideMenuProps, WorkoutRidePageDisplayProps, WorkoutUpcomingSteps } from "./types";
|
|
8
8
|
export declare class WorkoutRidePageService extends IncyclistPageService implements IWorkoutRidePageService {
|
|
9
9
|
protected rideEventHandler: Record<string, any>;
|
|
10
10
|
protected workoutEventHandler: Record<string, any>;
|
|
@@ -12,6 +12,7 @@ export declare class WorkoutRidePageService extends IncyclistPageService impleme
|
|
|
12
12
|
protected backgroundTimer: NodeJS.Timeout | undefined;
|
|
13
13
|
protected backgroundPausedByService: boolean;
|
|
14
14
|
protected menuProps: WorkoutRideMenuProps | null;
|
|
15
|
+
protected gestureHintDismissed: boolean;
|
|
15
16
|
constructor();
|
|
16
17
|
openPage(simulate?: boolean): IObserver;
|
|
17
18
|
closePage(): void;
|
|
@@ -31,6 +32,9 @@ export declare class WorkoutRidePageService extends IncyclistPageService impleme
|
|
|
31
32
|
onDecreaseLoad(): void;
|
|
32
33
|
onRetryStart(): void;
|
|
33
34
|
onIgnoreStart(): void;
|
|
35
|
+
onGestureHintDismissed({ dontShowAgain }: {
|
|
36
|
+
dontShowAgain: boolean;
|
|
37
|
+
}): void;
|
|
34
38
|
onCancelStart(): void;
|
|
35
39
|
adjustLoad(deltaPct: number): void;
|
|
36
40
|
protected onRideStateUpdate(state: CurrentRideState): void;
|
|
@@ -47,6 +51,8 @@ export declare class WorkoutRidePageService extends IncyclistPageService impleme
|
|
|
47
51
|
menuProps: WorkoutRideMenuProps;
|
|
48
52
|
startGateProps: any;
|
|
49
53
|
};
|
|
54
|
+
protected buildGestureHint(startOverlayCleared: boolean): WorkoutGestureHint | null;
|
|
55
|
+
protected getCurrentCadence(): number;
|
|
50
56
|
protected buildGraphPlan(current: Workout | undefined, ftp: number): WorkoutGraphPlan;
|
|
51
57
|
protected buildUpcomingSteps(current: Workout | undefined, ftp: number): WorkoutUpcomingSteps;
|
|
52
58
|
protected buildDashboardLine(wo: WorkoutDisplayProperties): WorkoutDashboardLine;
|
|
@@ -65,5 +71,6 @@ export declare class WorkoutRidePageService extends IncyclistPageService impleme
|
|
|
65
71
|
protected getRideDisplay(): import("../../../ride/display").RideDisplayService;
|
|
66
72
|
protected getWorkoutRide(): import("../service").WorkoutRide;
|
|
67
73
|
protected getActivityRide(): import("../../../activities").ActivityRideService;
|
|
74
|
+
protected getUserSettings(): import("../../../settings").UserSettingsService;
|
|
68
75
|
}
|
|
69
76
|
export declare const getWorkoutRidePageService: () => WorkoutRidePageService;
|
|
@@ -42,12 +42,16 @@ export interface WorkoutRideMenuProps {
|
|
|
42
42
|
canStepBack: boolean;
|
|
43
43
|
canStepForward: boolean;
|
|
44
44
|
}
|
|
45
|
+
export interface WorkoutGestureHint {
|
|
46
|
+
visible: boolean;
|
|
47
|
+
}
|
|
45
48
|
export interface WorkoutRidePageDisplayProps extends RidePageDisplayProps {
|
|
46
49
|
menuProps: WorkoutRideMenuProps | null;
|
|
47
50
|
graph: WorkoutGraphPlan;
|
|
48
51
|
steps: WorkoutUpcomingSteps;
|
|
49
52
|
dashboard: WorkoutDashboardLine;
|
|
50
53
|
title: string;
|
|
54
|
+
gestureHint: WorkoutGestureHint | null;
|
|
51
55
|
}
|
|
52
56
|
export interface WorkoutRidePageCallbacks {
|
|
53
57
|
onMenuOpen(): void;
|
|
@@ -62,6 +66,9 @@ export interface WorkoutRidePageCallbacks {
|
|
|
62
66
|
onRetryStart(): void;
|
|
63
67
|
onIgnoreStart(): void;
|
|
64
68
|
onCancelStart(): void;
|
|
69
|
+
onGestureHintDismissed(props: {
|
|
70
|
+
dontShowAgain: boolean;
|
|
71
|
+
}): void;
|
|
65
72
|
}
|
|
66
73
|
export interface IWorkoutRidePageService extends WorkoutRidePageCallbacks, IPageService {
|
|
67
74
|
getRideObserver(): IObserver | null;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "incyclist-services",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.83",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"gd-eventlog": "^0.1.27"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@garmin/fitsdk": "^21.200.0",
|
|
9
9
|
"axios": "^1.15.2",
|
|
10
|
-
"incyclist-devices": "^3.0.
|
|
10
|
+
"incyclist-devices": "^3.0.24",
|
|
11
11
|
"promise.any": "^2.0.6",
|
|
12
12
|
"semver": "^7.7.4",
|
|
13
13
|
"tcx-builder": "^1.1.1",
|