incyclist-services 1.1.82 → 1.1.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.
|
@@ -382,8 +382,8 @@ class DeviceRideService extends events_1.default {
|
|
|
382
382
|
if ((_a = ai.adapter) === null || _a === void 0 ? void 0 : _a.isControllable()) {
|
|
383
383
|
bike = ai.adapter;
|
|
384
384
|
const modeInfo = this.configurationService.getModeSettings(ai.udid);
|
|
385
|
-
mode = modeInfo.mode;
|
|
386
|
-
settings = modeInfo.settings;
|
|
385
|
+
mode = modeInfo === null || modeInfo === void 0 ? void 0 : modeInfo.mode;
|
|
386
|
+
settings = (modeInfo === null || modeInfo === void 0 ? void 0 : modeInfo.settings) || {};
|
|
387
387
|
if (!this.simulatorEnforced && forceErgMode) {
|
|
388
388
|
const modes = bike.getSupportedCyclingModes().filter(C => C.supportsERGMode());
|
|
389
389
|
if (modes.length > 0) {
|
|
@@ -4,6 +4,7 @@ exports.FreeRideCard = void 0;
|
|
|
4
4
|
const observer_1 = require("../../../base/types/observer");
|
|
5
5
|
const settings_1 = require("../../../settings");
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
|
+
const valid_1 = require("../../../utils/valid");
|
|
7
8
|
const route_1 = require("../../base/model/route");
|
|
8
9
|
const service_1 = require("../service");
|
|
9
10
|
const base_1 = require("./base");
|
|
@@ -75,6 +76,8 @@ class FreeRideCard extends base_1.BaseCard {
|
|
|
75
76
|
else {
|
|
76
77
|
this.position = this.getUserSetting(`position`, null);
|
|
77
78
|
}
|
|
79
|
+
if (!(0, valid_1.valid)(this.position.lat) || !(0, valid_1.valid)(this.position.lng))
|
|
80
|
+
this.position = undefined;
|
|
78
81
|
}
|
|
79
82
|
saveSettings() {
|
|
80
83
|
if (!this.position)
|
|
@@ -90,7 +90,7 @@ export declare class RouteCard extends BaseCard implements Card<Route> {
|
|
|
90
90
|
}): Promise<void>;
|
|
91
91
|
protected emitUpdate(): void;
|
|
92
92
|
updateRoute(route: Route): void;
|
|
93
|
-
protected buildSettingsKey(): string;
|
|
93
|
+
protected buildSettingsKey(legacy?: boolean): string;
|
|
94
94
|
protected createPreview(): Promise<void>;
|
|
95
95
|
protected deleteRouteUserSettings(): void;
|
|
96
96
|
protected deleteFromUIList(): void;
|
|
@@ -111,9 +111,22 @@ class RouteCard extends base_1.BaseCard {
|
|
|
111
111
|
return this.deleteable;
|
|
112
112
|
}
|
|
113
113
|
openSettings() {
|
|
114
|
-
|
|
114
|
+
this.startSettings = { startPos: 0, realityFactor: 100, type: this.getCardType() };
|
|
115
|
+
let migrate = false;
|
|
116
|
+
const legacy = this.buildSettingsKey(true);
|
|
117
|
+
const legacySettings = (0, settings_1.useUserSettings)().get(legacy, null);
|
|
118
|
+
if (legacySettings) {
|
|
119
|
+
this.startSettings = legacySettings;
|
|
120
|
+
migrate = true;
|
|
121
|
+
}
|
|
115
122
|
const key = this.buildSettingsKey();
|
|
116
|
-
|
|
123
|
+
const startSettings = (0, settings_1.useUserSettings)().get(key, null);
|
|
124
|
+
if (startSettings) {
|
|
125
|
+
this.startSettings = startSettings;
|
|
126
|
+
}
|
|
127
|
+
if (migrate) {
|
|
128
|
+
(0, settings_1.useUserSettings)().set(key, this.startSettings);
|
|
129
|
+
}
|
|
117
130
|
return this.startSettings;
|
|
118
131
|
}
|
|
119
132
|
changeSettings(props) {
|
|
@@ -316,9 +329,9 @@ class RouteCard extends base_1.BaseCard {
|
|
|
316
329
|
this.save();
|
|
317
330
|
this.emitUpdate();
|
|
318
331
|
}
|
|
319
|
-
buildSettingsKey() {
|
|
332
|
+
buildSettingsKey(legacy = false) {
|
|
320
333
|
const type = this.route.description.hasVideo ? 'video' : 'followRoute';
|
|
321
|
-
const id = this.route.description.id;
|
|
334
|
+
const id = legacy ? this.route.description.legacyId : this.route.description.id;
|
|
322
335
|
const key = `routeSelection.${type}.prevSetting.${id}`;
|
|
323
336
|
return key;
|
|
324
337
|
}
|