incyclist-services 1.9.38 → 1.9.40
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.
|
@@ -167,31 +167,26 @@ class EPMParser extends xml_1.XMLParser {
|
|
|
167
167
|
point.elevation = prevElevation + gainToPoint;
|
|
168
168
|
}
|
|
169
169
|
addVideoSpeed(route) {
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
const mappings = route.video.mappings;
|
|
171
|
+
const lastMapping = mappings.at(-1);
|
|
172
172
|
let videoIdx = 0;
|
|
173
173
|
route.points.forEach((p, idx) => {
|
|
174
174
|
if (idx === 0) {
|
|
175
|
-
p.videoSpeed =
|
|
176
|
-
p.videoTime =
|
|
177
|
-
|
|
178
|
-
prevTime = p.videoTime;
|
|
175
|
+
p.videoSpeed = mappings[0].videoSpeed;
|
|
176
|
+
p.videoTime = mappings[0].time;
|
|
177
|
+
return;
|
|
179
178
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
videoIdx++;
|
|
187
|
-
if (videoIdx < route.video.mappings.length) {
|
|
188
|
-
p.videoSpeed = route.video.mappings[videoIdx].videoSpeed;
|
|
189
|
-
const v = p.videoSpeed / 3.6;
|
|
190
|
-
p.videoTime = route.video.mappings[videoIdx].time - (route.video.mappings[videoIdx].distance - p.routeDistance) / v;
|
|
191
|
-
prevSpeed = p.videoSpeed;
|
|
192
|
-
prevTime = p.videoTime;
|
|
193
|
-
}
|
|
179
|
+
while (videoIdx < mappings.length && p.routeDistance > mappings[videoIdx].distance)
|
|
180
|
+
videoIdx++;
|
|
181
|
+
if (videoIdx >= mappings.length) {
|
|
182
|
+
p.videoSpeed = lastMapping.videoSpeed;
|
|
183
|
+
p.videoTime = lastMapping.time;
|
|
184
|
+
return;
|
|
194
185
|
}
|
|
186
|
+
const mapping = mappings[videoIdx];
|
|
187
|
+
p.videoSpeed = mapping.videoSpeed;
|
|
188
|
+
const v = p.videoSpeed / 3.6;
|
|
189
|
+
p.videoTime = mapping.time - (mapping.distance - p.routeDistance) / v;
|
|
195
190
|
});
|
|
196
191
|
}
|
|
197
192
|
parseEpp(data, route) {
|
|
@@ -40,6 +40,7 @@ const observer_1 = require("../../../base/types/observer");
|
|
|
40
40
|
const service_1 = require("../base/service");
|
|
41
41
|
const STEP_CHANGE_AUDIO_KEY = 'preferences.workouts.stepChangeAudioSignal';
|
|
42
42
|
const CREATE_OVERLAY = 'Create Workout Info';
|
|
43
|
+
const CREATE_CARD_ID = 'Create';
|
|
43
44
|
const SURFACE = 'workout-details';
|
|
44
45
|
const DISPLAY_TYPE_KEY = 'preferences.workoutListDisplayType';
|
|
45
46
|
const DEFAULT_DISPLAY_TYPE = 'tiles';
|
|
@@ -154,7 +155,7 @@ let DesktopWorkoutListPageService = (() => {
|
|
|
154
155
|
try {
|
|
155
156
|
const card = this.findSnapshotCard(id);
|
|
156
157
|
if (!card) {
|
|
157
|
-
this.
|
|
158
|
+
this.logEvent({ message: 'card not found', id, fn: 'onCardOK' });
|
|
158
159
|
return;
|
|
159
160
|
}
|
|
160
161
|
switch (card.getCardType()) {
|
|
@@ -173,12 +174,25 @@ let DesktopWorkoutListPageService = (() => {
|
|
|
173
174
|
this.logError(err, 'onCardOK');
|
|
174
175
|
}
|
|
175
176
|
}
|
|
177
|
+
onCreateWorkout() {
|
|
178
|
+
try {
|
|
179
|
+
const card = this.findWorkoutCard(CREATE_CARD_ID);
|
|
180
|
+
if (!card) {
|
|
181
|
+
this.logError(new Error('create card not found'), 'onCreateWorkout');
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
this.onCreateCardOK(card);
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
this.logError(err, 'onCreateWorkout');
|
|
188
|
+
}
|
|
189
|
+
}
|
|
176
190
|
onCreateInfoClosed(markAsSeen) {
|
|
177
191
|
try {
|
|
178
192
|
if (!this.createInfo)
|
|
179
193
|
return;
|
|
180
194
|
this.logEvent({ message: 'Overlay closed', overlay: CREATE_OVERLAY, markAsSeen });
|
|
181
|
-
const card = this.
|
|
195
|
+
const card = this.findWorkoutCard(CREATE_CARD_ID);
|
|
182
196
|
if (markAsSeen)
|
|
183
197
|
card?.markAsSeen();
|
|
184
198
|
this.createInfo = null;
|
|
@@ -164,31 +164,26 @@ export class EPMParser extends XMLParser {
|
|
|
164
164
|
point.elevation = prevElevation + gainToPoint;
|
|
165
165
|
}
|
|
166
166
|
addVideoSpeed(route) {
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
const mappings = route.video.mappings;
|
|
168
|
+
const lastMapping = mappings.at(-1);
|
|
169
169
|
let videoIdx = 0;
|
|
170
170
|
route.points.forEach((p, idx) => {
|
|
171
171
|
if (idx === 0) {
|
|
172
|
-
p.videoSpeed =
|
|
173
|
-
p.videoTime =
|
|
174
|
-
|
|
175
|
-
prevTime = p.videoTime;
|
|
172
|
+
p.videoSpeed = mappings[0].videoSpeed;
|
|
173
|
+
p.videoTime = mappings[0].time;
|
|
174
|
+
return;
|
|
176
175
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
videoIdx++;
|
|
184
|
-
if (videoIdx < route.video.mappings.length) {
|
|
185
|
-
p.videoSpeed = route.video.mappings[videoIdx].videoSpeed;
|
|
186
|
-
const v = p.videoSpeed / 3.6;
|
|
187
|
-
p.videoTime = route.video.mappings[videoIdx].time - (route.video.mappings[videoIdx].distance - p.routeDistance) / v;
|
|
188
|
-
prevSpeed = p.videoSpeed;
|
|
189
|
-
prevTime = p.videoTime;
|
|
190
|
-
}
|
|
176
|
+
while (videoIdx < mappings.length && p.routeDistance > mappings[videoIdx].distance)
|
|
177
|
+
videoIdx++;
|
|
178
|
+
if (videoIdx >= mappings.length) {
|
|
179
|
+
p.videoSpeed = lastMapping.videoSpeed;
|
|
180
|
+
p.videoTime = lastMapping.time;
|
|
181
|
+
return;
|
|
191
182
|
}
|
|
183
|
+
const mapping = mappings[videoIdx];
|
|
184
|
+
p.videoSpeed = mapping.videoSpeed;
|
|
185
|
+
const v = p.videoSpeed / 3.6;
|
|
186
|
+
p.videoTime = mapping.time - (mapping.distance - p.routeDistance) / v;
|
|
192
187
|
});
|
|
193
188
|
}
|
|
194
189
|
parseEpp(data, route) {
|
|
@@ -37,6 +37,7 @@ import { Observer } from "../../../base/types/observer";
|
|
|
37
37
|
import { IMPORT_FILE_EXTENSIONS, WorkoutListPageService } from "../base/service";
|
|
38
38
|
const STEP_CHANGE_AUDIO_KEY = 'preferences.workouts.stepChangeAudioSignal';
|
|
39
39
|
const CREATE_OVERLAY = 'Create Workout Info';
|
|
40
|
+
const CREATE_CARD_ID = 'Create';
|
|
40
41
|
const SURFACE = 'workout-details';
|
|
41
42
|
const DISPLAY_TYPE_KEY = 'preferences.workoutListDisplayType';
|
|
42
43
|
const DEFAULT_DISPLAY_TYPE = 'tiles';
|
|
@@ -151,7 +152,7 @@ let DesktopWorkoutListPageService = (() => {
|
|
|
151
152
|
try {
|
|
152
153
|
const card = this.findSnapshotCard(id);
|
|
153
154
|
if (!card) {
|
|
154
|
-
this.
|
|
155
|
+
this.logEvent({ message: 'card not found', id, fn: 'onCardOK' });
|
|
155
156
|
return;
|
|
156
157
|
}
|
|
157
158
|
switch (card.getCardType()) {
|
|
@@ -170,12 +171,25 @@ let DesktopWorkoutListPageService = (() => {
|
|
|
170
171
|
this.logError(err, 'onCardOK');
|
|
171
172
|
}
|
|
172
173
|
}
|
|
174
|
+
onCreateWorkout() {
|
|
175
|
+
try {
|
|
176
|
+
const card = this.findWorkoutCard(CREATE_CARD_ID);
|
|
177
|
+
if (!card) {
|
|
178
|
+
this.logError(new Error('create card not found'), 'onCreateWorkout');
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
this.onCreateCardOK(card);
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
this.logError(err, 'onCreateWorkout');
|
|
185
|
+
}
|
|
186
|
+
}
|
|
173
187
|
onCreateInfoClosed(markAsSeen) {
|
|
174
188
|
try {
|
|
175
189
|
if (!this.createInfo)
|
|
176
190
|
return;
|
|
177
191
|
this.logEvent({ message: 'Overlay closed', overlay: CREATE_OVERLAY, markAsSeen });
|
|
178
|
-
const card = this.
|
|
192
|
+
const card = this.findWorkoutCard(CREATE_CARD_ID);
|
|
179
193
|
if (markAsSeen)
|
|
180
194
|
card?.markAsSeen();
|
|
181
195
|
this.createInfo = null;
|
|
@@ -27,6 +27,7 @@ export declare class DesktopWorkoutListPageService extends WorkoutListPageServic
|
|
|
27
27
|
getPageDisplayProperties(): DesktopWorkoutListDisplayProps;
|
|
28
28
|
getWorkoutDetailsProps(id: string): DesktopWorkoutDetailsProps | null;
|
|
29
29
|
onCardOK(id: string): void;
|
|
30
|
+
onCreateWorkout(): void;
|
|
30
31
|
onCreateInfoClosed(markAsSeen: boolean): void;
|
|
31
32
|
onDelete(id: string): Promise<boolean>;
|
|
32
33
|
onImportFiles(files: WorkoutImportFile | WorkoutImportFile[], source: WorkoutImportSource): void;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "incyclist-services",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.40",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"gd-eventlog": "^0.1.27"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@garmin/fitsdk": "^21.222.0",
|
|
9
9
|
"axios": "^1.21.1",
|
|
10
|
-
"incyclist-devices": "^3.0.
|
|
10
|
+
"incyclist-devices": "^3.0.53",
|
|
11
11
|
"promise.any": "^2.0.6",
|
|
12
12
|
"semver": "^7.8.6",
|
|
13
13
|
"tcx-builder": "^1.1.1",
|