incyclist-services 1.7.100 → 1.7.101
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.
|
@@ -92,10 +92,12 @@ let RidePageService = (() => {
|
|
|
92
92
|
isInitialized = false;
|
|
93
93
|
startGateProps = null;
|
|
94
94
|
gestureHintDismissed = false;
|
|
95
|
+
viewTransition = false;
|
|
95
96
|
constructor() {
|
|
96
97
|
super('RidePage');
|
|
97
98
|
this.eventHandler['state-update'] = this.onDisplayStateUpdate.bind(this);
|
|
98
99
|
this.eventHandler['route-update'] = this.onRouteUpdate.bind(this);
|
|
100
|
+
this.eventHandler['view-changed'] = this.onViewChanged.bind(this);
|
|
99
101
|
this.workoutEventHandler['step-changed'] = this.onWorkoutUpdate.bind(this);
|
|
100
102
|
this.workoutEventHandler['update'] = this.onWorkoutUpdate.bind(this);
|
|
101
103
|
this.workoutEventHandler['forward'] = this.onWorkoutUpdate.bind(this);
|
|
@@ -115,6 +117,14 @@ let RidePageService = (() => {
|
|
|
115
117
|
}
|
|
116
118
|
}
|
|
117
119
|
openPage(simulate) {
|
|
120
|
+
if (this.viewTransition) {
|
|
121
|
+
this.viewTransition = false;
|
|
122
|
+
this.logEvent({ message: 'page shown', page: this.getPageLogName(), viewTransition: true });
|
|
123
|
+
gd_eventlog_1.EventLogger.setGlobalConfig('page', this.getPageLogName());
|
|
124
|
+
this.subscribeToWorkoutObserver();
|
|
125
|
+
this.updatePageDisplay();
|
|
126
|
+
return this.getPageObserver();
|
|
127
|
+
}
|
|
118
128
|
try {
|
|
119
129
|
const pageLogName = this.getPageLogName();
|
|
120
130
|
this.logEvent({ message: 'page shown', page: pageLogName });
|
|
@@ -126,6 +136,12 @@ let RidePageService = (() => {
|
|
|
126
136
|
const registerAndStart = () => {
|
|
127
137
|
this.registerHandlers(this.rideObserver, this.eventHandler);
|
|
128
138
|
this.subscribeToWorkoutObserver();
|
|
139
|
+
const state = service.getState();
|
|
140
|
+
if (state === 'Started' || state === 'Active' || state === 'Paused') {
|
|
141
|
+
this.logError(new Error(`start() requested while ride is ${state}`), 'openPage');
|
|
142
|
+
this.updatePageDisplay();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
129
145
|
service.start(simulate);
|
|
130
146
|
if (this.isRideType('Video', 'GPX')) {
|
|
131
147
|
(0, sleep_1.sleep)(5).then(() => {
|
|
@@ -156,6 +172,8 @@ let RidePageService = (() => {
|
|
|
156
172
|
return this.getPageObserver();
|
|
157
173
|
}
|
|
158
174
|
closePage() {
|
|
175
|
+
if (this.viewTransition)
|
|
176
|
+
return;
|
|
159
177
|
try {
|
|
160
178
|
gd_eventlog_1.EventLogger.setGlobalConfig('page', null);
|
|
161
179
|
this.logEvent({ message: 'page closed', page: this.getPageLogName() });
|
|
@@ -413,6 +431,18 @@ let RidePageService = (() => {
|
|
|
413
431
|
onRouteUpdate() {
|
|
414
432
|
this.updatePageDisplay();
|
|
415
433
|
}
|
|
434
|
+
onViewChanged() {
|
|
435
|
+
try {
|
|
436
|
+
const rideType = this.getRideDisplay().getRideType();
|
|
437
|
+
this.logEvent({ message: 'ride type changed', rideType });
|
|
438
|
+
this.viewTransition = true;
|
|
439
|
+
this.getPageObserver()?.emit('ride-type-update', rideType);
|
|
440
|
+
this.updatePageDisplay();
|
|
441
|
+
}
|
|
442
|
+
catch (err) {
|
|
443
|
+
this.logError(err, 'onViewChanged');
|
|
444
|
+
}
|
|
445
|
+
}
|
|
416
446
|
get rideDisplayProps() {
|
|
417
447
|
return this.getRideDisplay().getDisplayProperties();
|
|
418
448
|
}
|
|
@@ -451,6 +481,17 @@ let RidePageService = (() => {
|
|
|
451
481
|
this.logError(err, 'onStop');
|
|
452
482
|
}
|
|
453
483
|
}
|
|
484
|
+
onStopWorkout() {
|
|
485
|
+
try {
|
|
486
|
+
if (!this.isWorkoutAttached())
|
|
487
|
+
return;
|
|
488
|
+
this.getRideDisplay().stopWorkout();
|
|
489
|
+
this.updatePageDisplay();
|
|
490
|
+
}
|
|
491
|
+
catch (err) {
|
|
492
|
+
this.logError(err, 'onStopWorkout');
|
|
493
|
+
}
|
|
494
|
+
}
|
|
454
495
|
onStepBack() {
|
|
455
496
|
try {
|
|
456
497
|
if (!this.isWorkoutAttached())
|
|
@@ -532,6 +573,7 @@ let RidePageService = (() => {
|
|
|
532
573
|
return {
|
|
533
574
|
...base,
|
|
534
575
|
menuProps: base.menuProps,
|
|
576
|
+
workoutAttached: true,
|
|
535
577
|
title: wo.title ?? '',
|
|
536
578
|
graph: this.buildGraphPlan(current, wo.ftp),
|
|
537
579
|
steps: this.buildUpcomingSteps(current, wo.ftp),
|
|
@@ -89,10 +89,12 @@ let RidePageService = (() => {
|
|
|
89
89
|
isInitialized = false;
|
|
90
90
|
startGateProps = null;
|
|
91
91
|
gestureHintDismissed = false;
|
|
92
|
+
viewTransition = false;
|
|
92
93
|
constructor() {
|
|
93
94
|
super('RidePage');
|
|
94
95
|
this.eventHandler['state-update'] = this.onDisplayStateUpdate.bind(this);
|
|
95
96
|
this.eventHandler['route-update'] = this.onRouteUpdate.bind(this);
|
|
97
|
+
this.eventHandler['view-changed'] = this.onViewChanged.bind(this);
|
|
96
98
|
this.workoutEventHandler['step-changed'] = this.onWorkoutUpdate.bind(this);
|
|
97
99
|
this.workoutEventHandler['update'] = this.onWorkoutUpdate.bind(this);
|
|
98
100
|
this.workoutEventHandler['forward'] = this.onWorkoutUpdate.bind(this);
|
|
@@ -112,6 +114,14 @@ let RidePageService = (() => {
|
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
116
|
openPage(simulate) {
|
|
117
|
+
if (this.viewTransition) {
|
|
118
|
+
this.viewTransition = false;
|
|
119
|
+
this.logEvent({ message: 'page shown', page: this.getPageLogName(), viewTransition: true });
|
|
120
|
+
EventLogger.setGlobalConfig('page', this.getPageLogName());
|
|
121
|
+
this.subscribeToWorkoutObserver();
|
|
122
|
+
this.updatePageDisplay();
|
|
123
|
+
return this.getPageObserver();
|
|
124
|
+
}
|
|
115
125
|
try {
|
|
116
126
|
const pageLogName = this.getPageLogName();
|
|
117
127
|
this.logEvent({ message: 'page shown', page: pageLogName });
|
|
@@ -123,6 +133,12 @@ let RidePageService = (() => {
|
|
|
123
133
|
const registerAndStart = () => {
|
|
124
134
|
this.registerHandlers(this.rideObserver, this.eventHandler);
|
|
125
135
|
this.subscribeToWorkoutObserver();
|
|
136
|
+
const state = service.getState();
|
|
137
|
+
if (state === 'Started' || state === 'Active' || state === 'Paused') {
|
|
138
|
+
this.logError(new Error(`start() requested while ride is ${state}`), 'openPage');
|
|
139
|
+
this.updatePageDisplay();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
126
142
|
service.start(simulate);
|
|
127
143
|
if (this.isRideType('Video', 'GPX')) {
|
|
128
144
|
sleep(5).then(() => {
|
|
@@ -153,6 +169,8 @@ let RidePageService = (() => {
|
|
|
153
169
|
return this.getPageObserver();
|
|
154
170
|
}
|
|
155
171
|
closePage() {
|
|
172
|
+
if (this.viewTransition)
|
|
173
|
+
return;
|
|
156
174
|
try {
|
|
157
175
|
EventLogger.setGlobalConfig('page', null);
|
|
158
176
|
this.logEvent({ message: 'page closed', page: this.getPageLogName() });
|
|
@@ -410,6 +428,18 @@ let RidePageService = (() => {
|
|
|
410
428
|
onRouteUpdate() {
|
|
411
429
|
this.updatePageDisplay();
|
|
412
430
|
}
|
|
431
|
+
onViewChanged() {
|
|
432
|
+
try {
|
|
433
|
+
const rideType = this.getRideDisplay().getRideType();
|
|
434
|
+
this.logEvent({ message: 'ride type changed', rideType });
|
|
435
|
+
this.viewTransition = true;
|
|
436
|
+
this.getPageObserver()?.emit('ride-type-update', rideType);
|
|
437
|
+
this.updatePageDisplay();
|
|
438
|
+
}
|
|
439
|
+
catch (err) {
|
|
440
|
+
this.logError(err, 'onViewChanged');
|
|
441
|
+
}
|
|
442
|
+
}
|
|
413
443
|
get rideDisplayProps() {
|
|
414
444
|
return this.getRideDisplay().getDisplayProperties();
|
|
415
445
|
}
|
|
@@ -448,6 +478,17 @@ let RidePageService = (() => {
|
|
|
448
478
|
this.logError(err, 'onStop');
|
|
449
479
|
}
|
|
450
480
|
}
|
|
481
|
+
onStopWorkout() {
|
|
482
|
+
try {
|
|
483
|
+
if (!this.isWorkoutAttached())
|
|
484
|
+
return;
|
|
485
|
+
this.getRideDisplay().stopWorkout();
|
|
486
|
+
this.updatePageDisplay();
|
|
487
|
+
}
|
|
488
|
+
catch (err) {
|
|
489
|
+
this.logError(err, 'onStopWorkout');
|
|
490
|
+
}
|
|
491
|
+
}
|
|
451
492
|
onStepBack() {
|
|
452
493
|
try {
|
|
453
494
|
if (!this.isWorkoutAttached())
|
|
@@ -529,6 +570,7 @@ let RidePageService = (() => {
|
|
|
529
570
|
return {
|
|
530
571
|
...base,
|
|
531
572
|
menuProps: base.menuProps,
|
|
573
|
+
workoutAttached: true,
|
|
532
574
|
title: wo.title ?? '',
|
|
533
575
|
graph: this.buildGraphPlan(current, wo.ftp),
|
|
534
576
|
steps: this.buildUpcomingSteps(current, wo.ftp),
|
|
@@ -16,6 +16,7 @@ export declare class RidePageService extends IncyclistPageService implements IRi
|
|
|
16
16
|
protected isInitialized: boolean;
|
|
17
17
|
protected startGateProps: StartGateProps | null;
|
|
18
18
|
protected gestureHintDismissed: boolean;
|
|
19
|
+
protected viewTransition: boolean;
|
|
19
20
|
constructor();
|
|
20
21
|
initPage(): Promise<RideType | undefined>;
|
|
21
22
|
openPage(simulate?: boolean): IObserver;
|
|
@@ -46,10 +47,12 @@ export declare class RidePageService extends IncyclistPageService implements IRi
|
|
|
46
47
|
protected showStartGate(): void;
|
|
47
48
|
protected hideStartgate(): void;
|
|
48
49
|
protected onRouteUpdate(): void;
|
|
50
|
+
protected onViewChanged(): void;
|
|
49
51
|
protected get rideDisplayProps(): CurrentRideDisplayProps;
|
|
50
52
|
protected getSecretBinding(): ISecretBinding | undefined;
|
|
51
53
|
getGraphActuals(): WorkoutGraphActuals;
|
|
52
54
|
onStop(): void;
|
|
55
|
+
onStopWorkout(): void;
|
|
53
56
|
onStepBack(): void;
|
|
54
57
|
onStepForward(): void;
|
|
55
58
|
onIncreaseLoad(): void;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "incyclist-services",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.101",
|
|
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.32",
|
|
11
11
|
"promise.any": "^2.0.6",
|
|
12
12
|
"semver": "^7.7.4",
|
|
13
13
|
"tcx-builder": "^1.1.1",
|