incyclist-services 1.7.67 → 1.7.68
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/settings/display/ride/index.js +0 -0
- package/lib/cjs/settings/display/ride/service.js +132 -0
- package/lib/cjs/settings/display/ride/types.js +2 -0
- package/lib/cjs/workouts/base/parsers/zwo/zwo.js +2 -2
- package/lib/esm/settings/display/gear/index.js +0 -0
- package/lib/esm/settings/display/gear/service.js +127 -0
- package/lib/esm/settings/display/gear/types.js +1 -0
- package/lib/esm/settings/display/ride/index.js +0 -0
- package/lib/esm/settings/display/ride/service.js +128 -0
- package/lib/esm/settings/display/ride/types.js +1 -0
- package/lib/esm/workouts/base/parsers/zwo/zwo.js +2 -2
- package/lib/types/settings/display/gear/index.d.ts +0 -0
- package/lib/types/settings/display/gear/service.d.ts +21 -0
- package/lib/types/settings/display/gear/types.d.ts +5 -0
- package/lib/types/settings/display/ride/index.d.ts +0 -0
- package/lib/types/settings/display/ride/service.d.ts +22 -0
- package/lib/types/settings/display/ride/types.d.ts +5 -0
- package/package.json +1 -1
|
File without changes
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
3
|
+
var useValue = arguments.length > 2;
|
|
4
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
5
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
6
|
+
}
|
|
7
|
+
return useValue ? value : void 0;
|
|
8
|
+
};
|
|
9
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
10
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
11
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
12
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
13
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
14
|
+
var _, done = false;
|
|
15
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
16
|
+
var context = {};
|
|
17
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
18
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
19
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
20
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
21
|
+
if (kind === "accessor") {
|
|
22
|
+
if (result === void 0) continue;
|
|
23
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
24
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
25
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
26
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
27
|
+
}
|
|
28
|
+
else if (_ = accept(result)) {
|
|
29
|
+
if (kind === "field") initializers.unshift(_);
|
|
30
|
+
else descriptor[key] = _;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
34
|
+
done = true;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.useRideSettingsDisplay = exports.RideSettingsDisplayService = void 0;
|
|
38
|
+
const api_1 = require("../../../api");
|
|
39
|
+
const decorators_1 = require("../../../base/decorators");
|
|
40
|
+
const service_1 = require("../../../base/service");
|
|
41
|
+
const types_1 = require("../../../base/types");
|
|
42
|
+
const service_2 = require("../../service");
|
|
43
|
+
let RideSettingsDisplayService = (() => {
|
|
44
|
+
let _classDecorators = [decorators_1.Singleton];
|
|
45
|
+
let _classDescriptor;
|
|
46
|
+
let _classExtraInitializers = [];
|
|
47
|
+
let _classThis;
|
|
48
|
+
let _classSuper = service_1.IncyclistService;
|
|
49
|
+
let _instanceExtraInitializers = [];
|
|
50
|
+
let _getUserSettings_decorators;
|
|
51
|
+
let _getBindings_decorators;
|
|
52
|
+
var RideSettingsDisplayService = class extends _classSuper {
|
|
53
|
+
static { _classThis = this; }
|
|
54
|
+
static {
|
|
55
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
56
|
+
_getUserSettings_decorators = [decorators_1.Injectable];
|
|
57
|
+
_getBindings_decorators = [decorators_1.Injectable];
|
|
58
|
+
__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);
|
|
59
|
+
__esDecorate(this, null, _getBindings_decorators, { kind: "method", name: "getBindings", static: false, private: false, access: { has: obj => "getBindings" in obj, get: obj => obj.getBindings }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
60
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
61
|
+
RideSettingsDisplayService = _classThis = _classDescriptor.value;
|
|
62
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
63
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
64
|
+
}
|
|
65
|
+
observer = __runInitializers(this, _instanceExtraInitializers);
|
|
66
|
+
constructor() {
|
|
67
|
+
super('GearSettings');
|
|
68
|
+
}
|
|
69
|
+
open() {
|
|
70
|
+
if (this.observer)
|
|
71
|
+
this.close();
|
|
72
|
+
this.observer = new types_1.Observer();
|
|
73
|
+
return this.observer;
|
|
74
|
+
}
|
|
75
|
+
close() {
|
|
76
|
+
this.observer.stop();
|
|
77
|
+
delete this.observer;
|
|
78
|
+
}
|
|
79
|
+
getDisplayProps() {
|
|
80
|
+
return {
|
|
81
|
+
rideView: this.getRideView(),
|
|
82
|
+
rideViewOptions: this.getRideViewOptions()
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
setRideView(rideView) {
|
|
86
|
+
try {
|
|
87
|
+
this.getUserSettings().get('preferences.rideView', rideView);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
this.logError(err, 'setRideView');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
emitChanged() {
|
|
94
|
+
if (this.observer)
|
|
95
|
+
this.observer.emit('changed', this.getDisplayProps());
|
|
96
|
+
}
|
|
97
|
+
getRideView() {
|
|
98
|
+
if (this.isMobile() && !this.isAndroid())
|
|
99
|
+
return 'map';
|
|
100
|
+
const rideView = this.getUserSettings().get('preferences.rideView', 'sv');
|
|
101
|
+
return rideView;
|
|
102
|
+
}
|
|
103
|
+
getRideViewOptions() {
|
|
104
|
+
const map = new Map();
|
|
105
|
+
if (!this.isIOS())
|
|
106
|
+
map.set('sv', 'Street View');
|
|
107
|
+
map.set('map', 'Map');
|
|
108
|
+
if (!this.isMobile())
|
|
109
|
+
map.set('sat', 'Satellite View');
|
|
110
|
+
return map;
|
|
111
|
+
}
|
|
112
|
+
isMobile() {
|
|
113
|
+
return this.getBindings().appInfo?.getChannel() === 'mobile';
|
|
114
|
+
}
|
|
115
|
+
isAndroid() {
|
|
116
|
+
return this.getBindings().appInfo?.getOS()?.platform === 'android';
|
|
117
|
+
}
|
|
118
|
+
isIOS() {
|
|
119
|
+
return this.getBindings().appInfo?.getOS()?.platform === 'darwin';
|
|
120
|
+
}
|
|
121
|
+
getUserSettings() {
|
|
122
|
+
return (0, service_2.useUserSettings)();
|
|
123
|
+
}
|
|
124
|
+
getBindings() {
|
|
125
|
+
return (0, api_1.getBindings)();
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
return RideSettingsDisplayService = _classThis;
|
|
129
|
+
})();
|
|
130
|
+
exports.RideSettingsDisplayService = RideSettingsDisplayService;
|
|
131
|
+
const useRideSettingsDisplay = () => new RideSettingsDisplayService();
|
|
132
|
+
exports.useRideSettingsDisplay = useRideSettingsDisplay;
|
|
@@ -224,7 +224,7 @@ class ZwoParser {
|
|
|
224
224
|
}
|
|
225
225
|
try {
|
|
226
226
|
this.context = {};
|
|
227
|
-
const zwoSteps = result.workout_file.workout[0].$$ ?? [];
|
|
227
|
+
const zwoSteps = result.workout_file.workout?.[0].$$ ?? [];
|
|
228
228
|
const ftpOverride = result.workout_file.ftpOverride?.[0] ?? -1;
|
|
229
229
|
if (ftpOverride !== -1) {
|
|
230
230
|
this.context.ftpOverride = Number(ftpOverride);
|
|
@@ -244,7 +244,7 @@ class ZwoParser {
|
|
|
244
244
|
resolve(workout);
|
|
245
245
|
}
|
|
246
246
|
catch (err) {
|
|
247
|
-
this.logger.logEvent({ message: 'error', fn: 'parse()', error: err.message, tag, stack: err.stack });
|
|
247
|
+
this.logger.logEvent({ message: 'error', fn: 'parse()', error: err.message, tag, stack: err.stack, zwo: data });
|
|
248
248
|
reject(new Error(`parsing error: ${err.message}`));
|
|
249
249
|
}
|
|
250
250
|
});
|
|
File without changes
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
import { getBindings } from "../../../api";
|
|
36
|
+
import { Injectable, Singleton } from "../../../base/decorators";
|
|
37
|
+
import { IncyclistService } from "../../../base/service";
|
|
38
|
+
import { Observer } from "../../../base/types";
|
|
39
|
+
import { useUserSettings } from "../../service";
|
|
40
|
+
let GearSettingsDisplayService = (() => {
|
|
41
|
+
let _classDecorators = [Singleton];
|
|
42
|
+
let _classDescriptor;
|
|
43
|
+
let _classExtraInitializers = [];
|
|
44
|
+
let _classThis;
|
|
45
|
+
let _classSuper = IncyclistService;
|
|
46
|
+
let _instanceExtraInitializers = [];
|
|
47
|
+
let _getUserSettings_decorators;
|
|
48
|
+
let _getBindings_decorators;
|
|
49
|
+
var GearSettingsDisplayService = class extends _classSuper {
|
|
50
|
+
static { _classThis = this; }
|
|
51
|
+
static {
|
|
52
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
53
|
+
_getUserSettings_decorators = [Injectable];
|
|
54
|
+
_getBindings_decorators = [Injectable];
|
|
55
|
+
__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);
|
|
56
|
+
__esDecorate(this, null, _getBindings_decorators, { kind: "method", name: "getBindings", static: false, private: false, access: { has: obj => "getBindings" in obj, get: obj => obj.getBindings }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
57
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
58
|
+
GearSettingsDisplayService = _classThis = _classDescriptor.value;
|
|
59
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
60
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
61
|
+
}
|
|
62
|
+
observer = __runInitializers(this, _instanceExtraInitializers);
|
|
63
|
+
constructor() {
|
|
64
|
+
super('GearSettings');
|
|
65
|
+
}
|
|
66
|
+
open() {
|
|
67
|
+
if (this.observer)
|
|
68
|
+
this.close();
|
|
69
|
+
this.observer = new Observer();
|
|
70
|
+
return this.observer;
|
|
71
|
+
}
|
|
72
|
+
close() {
|
|
73
|
+
this.observer.stop();
|
|
74
|
+
delete this.observer;
|
|
75
|
+
}
|
|
76
|
+
getDisplayProps() {
|
|
77
|
+
return {
|
|
78
|
+
rideView: this.getRideView(),
|
|
79
|
+
rideViewOptions: this.getRideViewOptions()
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
setRideView(rideView) {
|
|
83
|
+
try {
|
|
84
|
+
this.getUserSettings().get('preferences.rideView', rideView);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
this.logError(err, 'setRideView');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
emitChanged() {
|
|
91
|
+
if (this.observer)
|
|
92
|
+
this.observer.emit('changed', this.getDisplayProps());
|
|
93
|
+
}
|
|
94
|
+
getRideView() {
|
|
95
|
+
if (this.isMobile() && !this.isAndroid())
|
|
96
|
+
return 'map';
|
|
97
|
+
const rideView = this.getUserSettings().get('preferences.rideView', 'sv');
|
|
98
|
+
return rideView;
|
|
99
|
+
}
|
|
100
|
+
getRideViewOptions() {
|
|
101
|
+
const map = new Map();
|
|
102
|
+
if (!this.isIOS())
|
|
103
|
+
map.set('sv', 'Street View');
|
|
104
|
+
map.set('map', 'Map');
|
|
105
|
+
if (!this.isMobile())
|
|
106
|
+
map.set('sat', 'Satellite View');
|
|
107
|
+
return map;
|
|
108
|
+
}
|
|
109
|
+
isMobile() {
|
|
110
|
+
return this.getBindings().appInfo?.getChannel() === 'mobile';
|
|
111
|
+
}
|
|
112
|
+
isAndroid() {
|
|
113
|
+
return this.getBindings().appInfo?.getOS()?.platform === 'android';
|
|
114
|
+
}
|
|
115
|
+
isIOS() {
|
|
116
|
+
return this.getBindings().appInfo?.getOS()?.platform === 'darwin';
|
|
117
|
+
}
|
|
118
|
+
getUserSettings() {
|
|
119
|
+
return useUserSettings();
|
|
120
|
+
}
|
|
121
|
+
getBindings() {
|
|
122
|
+
return getBindings();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
return GearSettingsDisplayService = _classThis;
|
|
126
|
+
})();
|
|
127
|
+
export { GearSettingsDisplayService };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
import { getBindings } from "../../../api";
|
|
36
|
+
import { Injectable, Singleton } from "../../../base/decorators";
|
|
37
|
+
import { IncyclistService } from "../../../base/service";
|
|
38
|
+
import { Observer } from "../../../base/types";
|
|
39
|
+
import { useUserSettings } from "../../service";
|
|
40
|
+
let RideSettingsDisplayService = (() => {
|
|
41
|
+
let _classDecorators = [Singleton];
|
|
42
|
+
let _classDescriptor;
|
|
43
|
+
let _classExtraInitializers = [];
|
|
44
|
+
let _classThis;
|
|
45
|
+
let _classSuper = IncyclistService;
|
|
46
|
+
let _instanceExtraInitializers = [];
|
|
47
|
+
let _getUserSettings_decorators;
|
|
48
|
+
let _getBindings_decorators;
|
|
49
|
+
var RideSettingsDisplayService = class extends _classSuper {
|
|
50
|
+
static { _classThis = this; }
|
|
51
|
+
static {
|
|
52
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
53
|
+
_getUserSettings_decorators = [Injectable];
|
|
54
|
+
_getBindings_decorators = [Injectable];
|
|
55
|
+
__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);
|
|
56
|
+
__esDecorate(this, null, _getBindings_decorators, { kind: "method", name: "getBindings", static: false, private: false, access: { has: obj => "getBindings" in obj, get: obj => obj.getBindings }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
57
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
58
|
+
RideSettingsDisplayService = _classThis = _classDescriptor.value;
|
|
59
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
60
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
61
|
+
}
|
|
62
|
+
observer = __runInitializers(this, _instanceExtraInitializers);
|
|
63
|
+
constructor() {
|
|
64
|
+
super('GearSettings');
|
|
65
|
+
}
|
|
66
|
+
open() {
|
|
67
|
+
if (this.observer)
|
|
68
|
+
this.close();
|
|
69
|
+
this.observer = new Observer();
|
|
70
|
+
return this.observer;
|
|
71
|
+
}
|
|
72
|
+
close() {
|
|
73
|
+
this.observer.stop();
|
|
74
|
+
delete this.observer;
|
|
75
|
+
}
|
|
76
|
+
getDisplayProps() {
|
|
77
|
+
return {
|
|
78
|
+
rideView: this.getRideView(),
|
|
79
|
+
rideViewOptions: this.getRideViewOptions()
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
setRideView(rideView) {
|
|
83
|
+
try {
|
|
84
|
+
this.getUserSettings().get('preferences.rideView', rideView);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
this.logError(err, 'setRideView');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
emitChanged() {
|
|
91
|
+
if (this.observer)
|
|
92
|
+
this.observer.emit('changed', this.getDisplayProps());
|
|
93
|
+
}
|
|
94
|
+
getRideView() {
|
|
95
|
+
if (this.isMobile() && !this.isAndroid())
|
|
96
|
+
return 'map';
|
|
97
|
+
const rideView = this.getUserSettings().get('preferences.rideView', 'sv');
|
|
98
|
+
return rideView;
|
|
99
|
+
}
|
|
100
|
+
getRideViewOptions() {
|
|
101
|
+
const map = new Map();
|
|
102
|
+
if (!this.isIOS())
|
|
103
|
+
map.set('sv', 'Street View');
|
|
104
|
+
map.set('map', 'Map');
|
|
105
|
+
if (!this.isMobile())
|
|
106
|
+
map.set('sat', 'Satellite View');
|
|
107
|
+
return map;
|
|
108
|
+
}
|
|
109
|
+
isMobile() {
|
|
110
|
+
return this.getBindings().appInfo?.getChannel() === 'mobile';
|
|
111
|
+
}
|
|
112
|
+
isAndroid() {
|
|
113
|
+
return this.getBindings().appInfo?.getOS()?.platform === 'android';
|
|
114
|
+
}
|
|
115
|
+
isIOS() {
|
|
116
|
+
return this.getBindings().appInfo?.getOS()?.platform === 'darwin';
|
|
117
|
+
}
|
|
118
|
+
getUserSettings() {
|
|
119
|
+
return useUserSettings();
|
|
120
|
+
}
|
|
121
|
+
getBindings() {
|
|
122
|
+
return getBindings();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
return RideSettingsDisplayService = _classThis;
|
|
126
|
+
})();
|
|
127
|
+
export { RideSettingsDisplayService };
|
|
128
|
+
export const useRideSettingsDisplay = () => new RideSettingsDisplayService();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -218,7 +218,7 @@ export class ZwoParser {
|
|
|
218
218
|
}
|
|
219
219
|
try {
|
|
220
220
|
this.context = {};
|
|
221
|
-
const zwoSteps = result.workout_file.workout[0].$$ ?? [];
|
|
221
|
+
const zwoSteps = result.workout_file.workout?.[0].$$ ?? [];
|
|
222
222
|
const ftpOverride = result.workout_file.ftpOverride?.[0] ?? -1;
|
|
223
223
|
if (ftpOverride !== -1) {
|
|
224
224
|
this.context.ftpOverride = Number(ftpOverride);
|
|
@@ -238,7 +238,7 @@ export class ZwoParser {
|
|
|
238
238
|
resolve(workout);
|
|
239
239
|
}
|
|
240
240
|
catch (err) {
|
|
241
|
-
this.logger.logEvent({ message: 'error', fn: 'parse()', error: err.message, tag, stack: err.stack });
|
|
241
|
+
this.logger.logEvent({ message: 'error', fn: 'parse()', error: err.message, tag, stack: err.stack, zwo: data });
|
|
242
242
|
reject(new Error(`parsing error: ${err.message}`));
|
|
243
243
|
}
|
|
244
244
|
});
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IncyclistService } from "../../../base/service";
|
|
2
|
+
import { Observer } from "../../../base/types";
|
|
3
|
+
import { IObserver } from "../../../types";
|
|
4
|
+
import { UserSettingsService } from "../../service";
|
|
5
|
+
import { GearSettingsDisplayProps, TRideView } from "./types";
|
|
6
|
+
export declare class GearSettingsDisplayService extends IncyclistService {
|
|
7
|
+
protected observer: Observer;
|
|
8
|
+
constructor();
|
|
9
|
+
open(): IObserver;
|
|
10
|
+
close(): void;
|
|
11
|
+
getDisplayProps(): GearSettingsDisplayProps;
|
|
12
|
+
setRideView(rideView: TRideView): void;
|
|
13
|
+
protected emitChanged(): void;
|
|
14
|
+
protected getRideView(): TRideView;
|
|
15
|
+
protected getRideViewOptions(): Map<TRideView, string>;
|
|
16
|
+
protected isMobile(): boolean;
|
|
17
|
+
protected isAndroid(): boolean;
|
|
18
|
+
protected isIOS(): boolean;
|
|
19
|
+
protected getUserSettings(): UserSettingsService;
|
|
20
|
+
protected getBindings(): import("../../../api").IncyclistBindings;
|
|
21
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IncyclistService } from "../../../base/service";
|
|
2
|
+
import { Observer } from "../../../base/types";
|
|
3
|
+
import { IObserver } from "../../../types";
|
|
4
|
+
import { UserSettingsService } from "../../service";
|
|
5
|
+
import { RideSettingsDisplayProps, TRideView } from "./types";
|
|
6
|
+
export declare class RideSettingsDisplayService extends IncyclistService {
|
|
7
|
+
protected observer: Observer;
|
|
8
|
+
constructor();
|
|
9
|
+
open(): IObserver;
|
|
10
|
+
close(): void;
|
|
11
|
+
getDisplayProps(): RideSettingsDisplayProps;
|
|
12
|
+
setRideView(rideView: TRideView): void;
|
|
13
|
+
protected emitChanged(): void;
|
|
14
|
+
protected getRideView(): TRideView;
|
|
15
|
+
protected getRideViewOptions(): Map<TRideView, string>;
|
|
16
|
+
protected isMobile(): boolean;
|
|
17
|
+
protected isAndroid(): boolean;
|
|
18
|
+
protected isIOS(): boolean;
|
|
19
|
+
protected getUserSettings(): UserSettingsService;
|
|
20
|
+
protected getBindings(): import("../../../api").IncyclistBindings;
|
|
21
|
+
}
|
|
22
|
+
export declare const useRideSettingsDisplay: () => RideSettingsDisplayService;
|