incyclist-services 1.9.0 → 1.9.2
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/activities/types.js +1 -0
- package/lib/cjs/apps/service.js +2 -2
- package/lib/cjs/base/pages/service.js +6 -8
- package/lib/cjs/devices/configuration/service.js +4 -0
- package/lib/cjs/devices/page/base/logobserver.js +19 -0
- package/lib/cjs/devices/page/base/orchestrator.js +2 -0
- package/lib/cjs/devices/page/base/service.js +383 -0
- package/lib/cjs/devices/page/base/types.js +2 -0
- package/lib/cjs/devices/page/base/visit-log-factory.js +41 -0
- package/lib/cjs/devices/page/base/visit-log.js +143 -0
- package/lib/cjs/devices/page/desktop/matrix.js +26 -0
- package/lib/cjs/devices/page/desktop/orchestrator.js +21 -0
- package/lib/cjs/devices/page/desktop/service.js +253 -0
- package/lib/cjs/devices/page/desktop/types.js +2 -0
- package/lib/cjs/devices/page/index.js +17 -18
- package/lib/cjs/devices/page/mobile/orchestrator.js +6 -0
- package/lib/cjs/devices/page/mobile/service.js +197 -0
- package/lib/cjs/devices/page/mobile/statemachine.js +348 -0
- package/lib/cjs/devices/pairing/guidance.js +9 -5
- package/lib/cjs/devices/pairing/service.js +54 -1
- package/lib/cjs/devices/ride/service.js +1 -22
- package/lib/cjs/ride/display/service.js +21 -11
- package/lib/cjs/ride/route/GpxDisplayService.js +3 -0
- package/lib/cjs/ui/service.js +20 -17
- package/lib/cjs/workouts/ride/service.js +8 -8
- package/lib/esm/activities/types.js +1 -0
- package/lib/esm/apps/service.js +1 -1
- package/lib/esm/base/pages/service.js +6 -8
- package/lib/esm/devices/configuration/service.js +4 -0
- package/lib/esm/devices/page/index.js +2 -0
- package/lib/esm/devices/page/service.js +6 -70
- package/lib/esm/devices/pairing/guidance.js +9 -5
- package/lib/esm/devices/ride/service.js +1 -22
- package/lib/esm/ride/display/service.js +13 -3
- package/lib/esm/ride/route/GpxDisplayService.js +3 -0
- package/lib/esm/workouts/ride/service.js +1 -1
- package/lib/types/activities/ride/service.d.ts +1 -1
- package/lib/types/activities/types.d.ts +1 -0
- package/lib/types/api/ui/index.d.ts +1 -1
- package/lib/types/apps/service.d.ts +1 -1
- package/lib/types/appstate/types.d.ts +1 -1
- package/lib/types/base/pages/service.d.ts +1 -1
- package/lib/types/devices/page/index.d.ts +5 -1
- package/lib/types/devices/page/service.d.ts +1 -9
- package/lib/types/devices/page/types.d.ts +2 -129
- package/lib/types/devices/ride/service.d.ts +0 -1
- package/lib/types/ride/base/base.d.ts +1 -2
- package/lib/types/ride/base/types.d.ts +1 -0
- package/lib/types/ride/display/service.d.ts +9 -7
- package/lib/types/routes/list/cards/RouteCard.d.ts +1 -1
- package/lib/types/workouts/ride/service.d.ts +1 -1
- package/package.json +1 -1
|
@@ -249,6 +249,9 @@ let GpxDisplayService = (() => {
|
|
|
249
249
|
};
|
|
250
250
|
}
|
|
251
251
|
getRideView() {
|
|
252
|
+
if (this.service?.isSimulated() && !this.getGoogleMaps().hasPersonalApiKey()) {
|
|
253
|
+
this.rideViewOverride = 'map';
|
|
254
|
+
}
|
|
252
255
|
return this.rideViewOverride ?? this.getRideSettingsDisplay().getRideView();
|
|
253
256
|
}
|
|
254
257
|
onRideSettingsChanged(settings = {}) {
|
package/lib/cjs/ui/service.js
CHANGED
|
@@ -42,7 +42,10 @@ const service_1 = require("../base/service");
|
|
|
42
42
|
const settings_1 = require("../settings");
|
|
43
43
|
const uuid_1 = require("uuid");
|
|
44
44
|
const incyclist_devices_1 = require("incyclist-devices");
|
|
45
|
-
const
|
|
45
|
+
const access_1 = require("../devices/access");
|
|
46
|
+
const configuration_1 = require("../devices/configuration");
|
|
47
|
+
const pairing_1 = require("../devices/pairing");
|
|
48
|
+
const visit_log_factory_1 = require("../devices/page/base/visit-log-factory");
|
|
46
49
|
const routes_1 = require("../routes");
|
|
47
50
|
const workouts_1 = require("../workouts");
|
|
48
51
|
const activities_1 = require("../activities");
|
|
@@ -152,8 +155,8 @@ let UserInterfaceServcie = (() => {
|
|
|
152
155
|
pages_1.IncyclistPageService.closePage();
|
|
153
156
|
const cleanup = async () => {
|
|
154
157
|
await (0, utils_1.waitNextTick)();
|
|
155
|
-
await (0,
|
|
156
|
-
await (0,
|
|
158
|
+
await (0, pairing_1.useDevicePairing)().exit();
|
|
159
|
+
await (0, access_1.useDeviceAccess)().terminate();
|
|
157
160
|
};
|
|
158
161
|
await Promise.race([cleanup(), (0, sleep_1.sleep)(APP_EXIT_TIMEOUT_MS)]);
|
|
159
162
|
this.appState = 'Stopped';
|
|
@@ -176,7 +179,7 @@ let UserInterfaceServcie = (() => {
|
|
|
176
179
|
this.logEvent({ message: 'onAppPause called' });
|
|
177
180
|
this.stopHeartbeatWorker();
|
|
178
181
|
this.onPairingVisitBackground();
|
|
179
|
-
(0,
|
|
182
|
+
(0, access_1.useDeviceAccess)().pauseBackgroundActivity()
|
|
180
183
|
.catch((err) => { this.logError(err, 'onAppPause:pauseBackgroundActivity'); });
|
|
181
184
|
this.backgroundTimer = setTimeout(() => {
|
|
182
185
|
this.backgroundPausedByService = true;
|
|
@@ -206,7 +209,7 @@ let UserInterfaceServcie = (() => {
|
|
|
206
209
|
this.startHeartbeatWorker();
|
|
207
210
|
this.backgroundPausedByService = false;
|
|
208
211
|
this.appState = 'Active';
|
|
209
|
-
(0,
|
|
212
|
+
(0, access_1.useDeviceAccess)().resumeBackgroundActivity()
|
|
210
213
|
.catch((err) => { this.logError(err, 'onAppResume:resumeBackgroundActivity'); });
|
|
211
214
|
if (resumeRequired) {
|
|
212
215
|
this.resume().catch((err) => { this.logError(err, 'onAppResume:resume'); });
|
|
@@ -255,7 +258,7 @@ let UserInterfaceServcie = (() => {
|
|
|
255
258
|
this.logError(err, 'pause:pausePage');
|
|
256
259
|
}
|
|
257
260
|
try {
|
|
258
|
-
await (0,
|
|
261
|
+
await (0, access_1.useDeviceAccess)().disconnect();
|
|
259
262
|
}
|
|
260
263
|
catch (err) {
|
|
261
264
|
this.logError(err, 'pause:disconnect');
|
|
@@ -279,7 +282,7 @@ let UserInterfaceServcie = (() => {
|
|
|
279
282
|
this.logError(err, 'resume:mqConnect');
|
|
280
283
|
}
|
|
281
284
|
try {
|
|
282
|
-
await (0,
|
|
285
|
+
await (0, access_1.useDeviceAccess)().connect();
|
|
283
286
|
}
|
|
284
287
|
catch (err) {
|
|
285
288
|
this.logError(err, 'resume:connect');
|
|
@@ -432,8 +435,8 @@ let UserInterfaceServcie = (() => {
|
|
|
432
435
|
}
|
|
433
436
|
async initDeviceServices() {
|
|
434
437
|
try {
|
|
435
|
-
const deviceConfiguration = (0,
|
|
436
|
-
const deviceAccess = (0,
|
|
438
|
+
const deviceConfiguration = (0, configuration_1.useDeviceConfiguration)();
|
|
439
|
+
const deviceAccess = (0, access_1.useDeviceAccess)();
|
|
437
440
|
const { serial: serialFactory, ant, ble, wifi } = this.getBindings();
|
|
438
441
|
let serial, tcpip;
|
|
439
442
|
if (this.isSupported('serial')) {
|
|
@@ -490,8 +493,8 @@ let UserInterfaceServcie = (() => {
|
|
|
490
493
|
}
|
|
491
494
|
}
|
|
492
495
|
configureInterface(ifName, binding) {
|
|
493
|
-
const deviceAccess = (0,
|
|
494
|
-
const deviceConfiguration = (0,
|
|
496
|
+
const deviceAccess = (0, access_1.useDeviceAccess)();
|
|
497
|
+
const deviceConfiguration = (0, configuration_1.useDeviceConfiguration)();
|
|
495
498
|
if (!binding) {
|
|
496
499
|
deviceAccess.disableInterface(ifName);
|
|
497
500
|
return;
|
|
@@ -543,7 +546,7 @@ let UserInterfaceServcie = (() => {
|
|
|
543
546
|
initPairingVisits() {
|
|
544
547
|
try {
|
|
545
548
|
const isNewUser = this.getUserSettings().isNewUser() ?? false;
|
|
546
|
-
(0,
|
|
549
|
+
(0, visit_log_factory_1.initPairingVisitTracker)(this.platform).onAppLaunch(isNewUser);
|
|
547
550
|
}
|
|
548
551
|
catch (err) {
|
|
549
552
|
this.logError(err, 'initPairingVisits');
|
|
@@ -551,8 +554,8 @@ let UserInterfaceServcie = (() => {
|
|
|
551
554
|
}
|
|
552
555
|
closePairingVisitOnExit() {
|
|
553
556
|
try {
|
|
554
|
-
const canStartRide = (0,
|
|
555
|
-
(0,
|
|
557
|
+
const canStartRide = (0, pairing_1.useDevicePairing)().getState()?.canStartRide ?? false;
|
|
558
|
+
(0, visit_log_factory_1.usePairingVisitTracker)().onAppExit(canStartRide);
|
|
556
559
|
}
|
|
557
560
|
catch (err) {
|
|
558
561
|
this.logError(err, 'closePairingVisitOnExit');
|
|
@@ -560,8 +563,8 @@ let UserInterfaceServcie = (() => {
|
|
|
560
563
|
}
|
|
561
564
|
onPairingVisitBackground() {
|
|
562
565
|
try {
|
|
563
|
-
const canStartRide = (0,
|
|
564
|
-
(0,
|
|
566
|
+
const canStartRide = (0, pairing_1.useDevicePairing)().getState()?.canStartRide;
|
|
567
|
+
(0, visit_log_factory_1.usePairingVisitTracker)().onBackground({ canStartRide });
|
|
565
568
|
}
|
|
566
569
|
catch (err) {
|
|
567
570
|
this.logError(err, 'onPairingVisitBackground');
|
|
@@ -569,7 +572,7 @@ let UserInterfaceServcie = (() => {
|
|
|
569
572
|
}
|
|
570
573
|
onPairingVisitForeground() {
|
|
571
574
|
try {
|
|
572
|
-
(0,
|
|
575
|
+
(0, visit_log_factory_1.usePairingVisitTracker)().onForeground();
|
|
573
576
|
}
|
|
574
577
|
catch (err) {
|
|
575
578
|
this.logError(err, 'onPairingVisitForeground');
|
|
@@ -39,7 +39,7 @@ const api_1 = require("../../api");
|
|
|
39
39
|
const service_1 = require("../../base/service");
|
|
40
40
|
const types_1 = require("../../base/types");
|
|
41
41
|
const observer_1 = require("../../base/types/observer");
|
|
42
|
-
const
|
|
42
|
+
const ride_1 = require("../../devices/ride");
|
|
43
43
|
const settings_1 = require("../../settings");
|
|
44
44
|
const utils_1 = require("../../utils");
|
|
45
45
|
const valid_1 = require("../../utils/valid");
|
|
@@ -329,7 +329,7 @@ let WorkoutRide = (() => {
|
|
|
329
329
|
getLoadButtonMode() {
|
|
330
330
|
try {
|
|
331
331
|
const mode = this.getDeviceRide().getCyclingMode();
|
|
332
|
-
return (0,
|
|
332
|
+
return (0, ride_1.getLoadButtonMode)(mode);
|
|
333
333
|
}
|
|
334
334
|
catch (err) {
|
|
335
335
|
this.logError(err, 'getLoadButtonMode');
|
|
@@ -442,7 +442,7 @@ let WorkoutRide = (() => {
|
|
|
442
442
|
this.getDeviceRide().sendUpdate({ gearDelta });
|
|
443
443
|
}
|
|
444
444
|
toggleCyclingMode() {
|
|
445
|
-
const deviceRide = (0,
|
|
445
|
+
const deviceRide = (0, ride_1.useDeviceRide)();
|
|
446
446
|
deviceRide.toggleCyclingMode();
|
|
447
447
|
this.emit('update', this.getDashboardDisplayProperties());
|
|
448
448
|
}
|
|
@@ -593,18 +593,18 @@ let WorkoutRide = (() => {
|
|
|
593
593
|
}
|
|
594
594
|
async startFreeRide() {
|
|
595
595
|
if (this.settings.useErgMode) {
|
|
596
|
-
(0,
|
|
596
|
+
(0, ride_1.useDeviceRide)().resetCyclingMode(false);
|
|
597
597
|
}
|
|
598
598
|
this.resetLimits();
|
|
599
599
|
}
|
|
600
600
|
async stopFreeRide() {
|
|
601
601
|
if (this.settings.useErgMode) {
|
|
602
|
-
(0,
|
|
602
|
+
(0, ride_1.useDeviceRide)().enforceERG();
|
|
603
603
|
}
|
|
604
604
|
this.resetLimits();
|
|
605
605
|
}
|
|
606
606
|
async resetLimits() {
|
|
607
|
-
const rideService = (0,
|
|
607
|
+
const rideService = (0, ride_1.useDeviceRide)();
|
|
608
608
|
const mode = rideService.getCyclingMode();
|
|
609
609
|
const isERG = mode ? mode.constructor.supportsERGMode() : false;
|
|
610
610
|
if (!this.currentLimits || !mode)
|
|
@@ -766,7 +766,7 @@ let WorkoutRide = (() => {
|
|
|
766
766
|
this.clearCountdownTimers();
|
|
767
767
|
}
|
|
768
768
|
getCyclingModeText() {
|
|
769
|
-
const deviceRide = (0,
|
|
769
|
+
const deviceRide = (0, ride_1.useDeviceRide)();
|
|
770
770
|
const mode = deviceRide.getCyclingMode();
|
|
771
771
|
const enabled = deviceRide.isToggleEnabled();
|
|
772
772
|
if (!mode || !enabled)
|
|
@@ -783,7 +783,7 @@ let WorkoutRide = (() => {
|
|
|
783
783
|
return (0, list_1.useWorkoutList)();
|
|
784
784
|
}
|
|
785
785
|
getDeviceRide() {
|
|
786
|
-
return (0,
|
|
786
|
+
return (0, ride_1.useDeviceRide)();
|
|
787
787
|
}
|
|
788
788
|
getRideDisplay() {
|
|
789
789
|
return (0, service_2.useRideDisplay)();
|
package/lib/esm/apps/service.js
CHANGED
|
@@ -32,7 +32,7 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
32
32
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
33
|
done = true;
|
|
34
34
|
};
|
|
35
|
-
import { ActivityUploadFactory } from "../activities";
|
|
35
|
+
import { ActivityUploadFactory } from "../activities/upload";
|
|
36
36
|
import { Injectable } from "../base/decorators";
|
|
37
37
|
import { IncyclistService } from "../base/service";
|
|
38
38
|
import { Singleton } from "../base/types";
|
|
@@ -98,14 +98,12 @@ let IncyclistPageService = (() => {
|
|
|
98
98
|
const contentPage = this.getAppState().getPersistedState('page');
|
|
99
99
|
return contentPage ?? 'routes';
|
|
100
100
|
}
|
|
101
|
-
moveTo(route, close = true) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.getUIBinding().openPage(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
this.getUIBinding().openPage(route);
|
|
108
|
-
}
|
|
101
|
+
moveTo(route, close = true, state) {
|
|
102
|
+
const target = route === '$contentPage' ? this.getPrevContentPage() : route;
|
|
103
|
+
if (state !== undefined)
|
|
104
|
+
this.getUIBinding().openPage(target, state);
|
|
105
|
+
else
|
|
106
|
+
this.getUIBinding().openPage(target);
|
|
109
107
|
if (close) {
|
|
110
108
|
this.closePage();
|
|
111
109
|
}
|
|
@@ -166,7 +166,11 @@ let DeviceConfigurationService = (() => {
|
|
|
166
166
|
return { capabilities, interfaces };
|
|
167
167
|
}
|
|
168
168
|
disableCapability(cability, disabled = true) {
|
|
169
|
+
if (!this.settings?.capabilities)
|
|
170
|
+
return;
|
|
169
171
|
const cabilitySettings = this.settings.capabilities.find(c => c.capability === cability);
|
|
172
|
+
if (!cabilitySettings)
|
|
173
|
+
return;
|
|
170
174
|
cabilitySettings.disabled = disabled;
|
|
171
175
|
this.updateUserSettings();
|
|
172
176
|
this.emitCapabiltyChanged();
|
|
@@ -3,6 +3,8 @@ import { MobilePairingPageService } from './mobile/service';
|
|
|
3
3
|
import { DesktopPairingPageService } from './desktop/service';
|
|
4
4
|
export { PairingVisitTracker } from './base/visit-log';
|
|
5
5
|
export { usePairingVisitTracker, initPairingVisitTracker } from './base/visit-log-factory';
|
|
6
|
+
export { MobilePairingPageService } from './mobile/service';
|
|
7
|
+
export { DesktopPairingPageService } from './desktop/service';
|
|
6
8
|
export const getDevicesPageService = () => {
|
|
7
9
|
const channel = getBindings().appInfo.getChannel();
|
|
8
10
|
if (channel === 'desktop' || channel === 'web')
|
|
@@ -35,16 +35,14 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
35
35
|
import { EventLogger } from 'gd-eventlog';
|
|
36
36
|
import { Injectable, Singleton } from '../../base/decorators';
|
|
37
37
|
import { IncyclistPageService } from '../../base/pages';
|
|
38
|
-
import { useDevicePairing
|
|
38
|
+
import { useDevicePairing } from '../pairing';
|
|
39
39
|
import { PairingPageStateMachine } from './statemachine';
|
|
40
40
|
import { PageLogObserver } from './logobserver';
|
|
41
41
|
import { useDeviceAccess } from '../access';
|
|
42
|
-
import { IncyclistCapability } from 'incyclist-devices';
|
|
43
42
|
import { useDeviceConfiguration } from '../configuration';
|
|
44
43
|
import { useIncyclist } from '../../ui';
|
|
45
44
|
import { Observer } from '../../base/types';
|
|
46
45
|
import { useDeviceRide } from '../ride';
|
|
47
|
-
import { usePairingVisitTracker } from './visit-log-factory';
|
|
48
46
|
let DevicesPageService = (() => {
|
|
49
47
|
let _classDecorators = [Singleton];
|
|
50
48
|
let _classDescriptor;
|
|
@@ -56,7 +54,6 @@ let DevicesPageService = (() => {
|
|
|
56
54
|
let _getDeviceRide_decorators;
|
|
57
55
|
let _getDeviceConfiguration_decorators;
|
|
58
56
|
let _getIncyclist_decorators;
|
|
59
|
-
let _getPairingVisitTracker_decorators;
|
|
60
57
|
var DevicesPageService = class extends _classSuper {
|
|
61
58
|
static { _classThis = this; }
|
|
62
59
|
static {
|
|
@@ -65,12 +62,10 @@ let DevicesPageService = (() => {
|
|
|
65
62
|
_getDeviceRide_decorators = [Injectable];
|
|
66
63
|
_getDeviceConfiguration_decorators = [Injectable];
|
|
67
64
|
_getIncyclist_decorators = [Injectable];
|
|
68
|
-
_getPairingVisitTracker_decorators = [Injectable];
|
|
69
65
|
__esDecorate(this, null, _getDevicePairing_decorators, { kind: "method", name: "getDevicePairing", static: false, private: false, access: { has: obj => "getDevicePairing" in obj, get: obj => obj.getDevicePairing }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
70
66
|
__esDecorate(this, null, _getDeviceRide_decorators, { kind: "method", name: "getDeviceRide", static: false, private: false, access: { has: obj => "getDeviceRide" in obj, get: obj => obj.getDeviceRide }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
71
67
|
__esDecorate(this, null, _getDeviceConfiguration_decorators, { kind: "method", name: "getDeviceConfiguration", static: false, private: false, access: { has: obj => "getDeviceConfiguration" in obj, get: obj => obj.getDeviceConfiguration }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
72
68
|
__esDecorate(this, null, _getIncyclist_decorators, { kind: "method", name: "getIncyclist", static: false, private: false, access: { has: obj => "getIncyclist" in obj, get: obj => obj.getIncyclist }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
73
|
-
__esDecorate(this, null, _getPairingVisitTracker_decorators, { kind: "method", name: "getPairingVisitTracker", static: false, private: false, access: { has: obj => "getPairingVisitTracker" in obj, get: obj => obj.getPairingVisitTracker }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
74
69
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
75
70
|
DevicesPageService = _classThis = _classDescriptor.value;
|
|
76
71
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -83,7 +78,6 @@ let DevicesPageService = (() => {
|
|
|
83
78
|
openedInterfaceSettings;
|
|
84
79
|
interfaceSettingsObserver;
|
|
85
80
|
isPairingForRide = false;
|
|
86
|
-
isVisitOpen = false;
|
|
87
81
|
constructor() {
|
|
88
82
|
super('pairing');
|
|
89
83
|
this.stateMachine = new PairingPageStateMachine();
|
|
@@ -93,7 +87,6 @@ let DevicesPageService = (() => {
|
|
|
93
87
|
try {
|
|
94
88
|
this.logEvent({ message: 'page shown', page: 'Pairing', forRide });
|
|
95
89
|
this.isPairingForRide = forRide ?? false;
|
|
96
|
-
this.openVisit();
|
|
97
90
|
EventLogger.setGlobalConfig('page', 'Pairing');
|
|
98
91
|
super.openPage();
|
|
99
92
|
if (this.promiseOpen !== undefined) {
|
|
@@ -123,7 +116,6 @@ let DevicesPageService = (() => {
|
|
|
123
116
|
closePage() {
|
|
124
117
|
try {
|
|
125
118
|
this.logEvent({ message: 'page closed', page: 'Pairing' });
|
|
126
|
-
this.isVisitOpen = false;
|
|
127
119
|
EventLogger.setGlobalConfig('page', null);
|
|
128
120
|
this.isPairingForRide = false;
|
|
129
121
|
super.closePage();
|
|
@@ -136,7 +128,6 @@ let DevicesPageService = (() => {
|
|
|
136
128
|
}
|
|
137
129
|
async pausePage() {
|
|
138
130
|
try {
|
|
139
|
-
this.trackVisit(t => t.onBackground({ canStartRide: this.canStartRide() }), 'onBackground');
|
|
140
131
|
await this.stateMachine.pause();
|
|
141
132
|
this.logEvent({ message: 'page paused', page: 'Pairing' });
|
|
142
133
|
}
|
|
@@ -146,7 +137,6 @@ let DevicesPageService = (() => {
|
|
|
146
137
|
}
|
|
147
138
|
async resumePage() {
|
|
148
139
|
try {
|
|
149
|
-
this.trackVisit(t => t.onForeground(), 'onForeground');
|
|
150
140
|
this.stateMachine.resume();
|
|
151
141
|
if (this.promiseOpen !== undefined)
|
|
152
142
|
return;
|
|
@@ -183,38 +173,23 @@ let DevicesPageService = (() => {
|
|
|
183
173
|
const ifs = this.state.interfaces ?? [];
|
|
184
174
|
useDeviceAccess().enrichWithAccessState(ifs);
|
|
185
175
|
const interfaces = ifs.map(i => { return this.getInterfaceDisplayProps(i); });
|
|
176
|
+
const capProps = caps.map(c => this.getCapabilityDisplayProps(c));
|
|
186
177
|
const loading = this.promiseOpen != undefined;
|
|
187
|
-
const status = getPairingStatusDisplay({
|
|
188
|
-
platform: 'mobile',
|
|
189
|
-
interfaces: toPairingInterfaceStates(ifs),
|
|
190
|
-
capabilities: caps,
|
|
191
|
-
canStartRide: this.canStartRide(),
|
|
192
|
-
loading,
|
|
193
|
-
rideMode: this.isPairingForRide,
|
|
194
|
-
});
|
|
195
|
-
const capProps = caps.map(c => this.getCapabilityDisplayProps(c, status.id === 'S1'));
|
|
196
178
|
const CP = (cap) => capProps.find(c => c.capability === cap);
|
|
197
179
|
const top = [
|
|
198
180
|
CP('control'),
|
|
199
181
|
CP('power'),
|
|
200
|
-
CP('
|
|
182
|
+
CP('heartrate')
|
|
201
183
|
].filter(c => c !== null && c !== undefined);
|
|
202
184
|
const bottom = [
|
|
203
|
-
CP('heartrate'),
|
|
204
185
|
CP('cadence'),
|
|
186
|
+
CP('speed'),
|
|
205
187
|
CP('app_control')
|
|
206
188
|
].filter(c => c !== null && c !== undefined);
|
|
207
|
-
const trainerSelected = Boolean(caps.find(c => c.capability === IncyclistCapability.Control)?.selected);
|
|
208
|
-
const rowLabels = {
|
|
209
|
-
top: getPairingGuidanceText(getPairingRowLabelId(trainerSelected)),
|
|
210
|
-
bottom: getPairingGuidanceText('row-optional'),
|
|
211
|
-
};
|
|
212
189
|
const buttons = this.getButtonsDisplayProps();
|
|
213
190
|
return {
|
|
214
191
|
title,
|
|
215
|
-
|
|
216
|
-
status,
|
|
217
|
-
capabilities: { top, bottom, rowLabels },
|
|
192
|
+
capabilities: { top, bottom },
|
|
218
193
|
interfaces,
|
|
219
194
|
deviceSelection: this.getDeviceListDisplayProps(),
|
|
220
195
|
showInterfaceSettings: this.openedInterfaceSettings,
|
|
@@ -257,7 +232,7 @@ let DevicesPageService = (() => {
|
|
|
257
232
|
this.interfaceSettingsObserver?.stop();
|
|
258
233
|
this.updatePage();
|
|
259
234
|
}
|
|
260
|
-
getCapabilityDisplayProps(data
|
|
235
|
+
getCapabilityDisplayProps(data) {
|
|
261
236
|
const { capability: cap, deviceName, connectState, value, unit, disabled } = data;
|
|
262
237
|
const capability = this.getTCapability(cap);
|
|
263
238
|
const adapaters = this.state.adapters ?? [];
|
|
@@ -265,19 +240,8 @@ let DevicesPageService = (() => {
|
|
|
265
240
|
const ifName = adapter?.adapter?.getInterface();
|
|
266
241
|
const title = this.getDisplayCapability(cap);
|
|
267
242
|
const onClick = () => { this.openDeviceSelection(cap); };
|
|
268
|
-
const role = PAIRING_CAPABILITY_ROLES.find(r => r.capability === cap)?.role;
|
|
269
|
-
const helpText = {
|
|
270
|
-
full: getCapabilityHelpText(capability, 'full') ?? '',
|
|
271
|
-
short: getCapabilityHelpText(capability, 'short') ?? '',
|
|
272
|
-
};
|
|
273
|
-
let emptyFooter = undefined;
|
|
274
|
-
if (noSearch)
|
|
275
|
-
emptyFooter = 'Not searching';
|
|
276
|
-
else if (role)
|
|
277
|
-
emptyFooter = getEmptyTileFooterText(role);
|
|
278
243
|
return {
|
|
279
244
|
title, capability, deviceName: !disabled ? deviceName : undefined, disabled, connectState, value: value?.toString(), unit, interface: ifName,
|
|
280
|
-
role, helpText, emptyFooter,
|
|
281
245
|
onClick
|
|
282
246
|
};
|
|
283
247
|
}
|
|
@@ -407,34 +371,11 @@ let DevicesPageService = (() => {
|
|
|
407
371
|
};
|
|
408
372
|
return mapping[capabability];
|
|
409
373
|
}
|
|
410
|
-
trackVisit(fn, name) {
|
|
411
|
-
try {
|
|
412
|
-
fn(this.getPairingVisitTracker());
|
|
413
|
-
}
|
|
414
|
-
catch (err) {
|
|
415
|
-
this.logError(err, name);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
openVisit() {
|
|
419
|
-
if (this.isVisitOpen)
|
|
420
|
-
return;
|
|
421
|
-
this.trackVisit(t => t.openVisit({ forRide: this.isPairingForRide }), 'openVisit');
|
|
422
|
-
this.isVisitOpen = true;
|
|
423
|
-
}
|
|
424
|
-
closeVisit(via) {
|
|
425
|
-
this.trackVisit(t => t.closeVisit(via, { canStartRide: this.canStartRide() }), 'closeVisit');
|
|
426
|
-
this.isVisitOpen = false;
|
|
427
|
-
}
|
|
428
|
-
canStartRide() {
|
|
429
|
-
return this.state?.canStartRide ?? false;
|
|
430
|
-
}
|
|
431
374
|
onSkip() {
|
|
432
|
-
this.closeVisit('skip');
|
|
433
375
|
const nextPage = this.getAppState().getPersistedState('page') ?? 'routes';
|
|
434
376
|
this.moveTo(`/${nextPage}`);
|
|
435
377
|
}
|
|
436
378
|
onOK() {
|
|
437
|
-
this.closeVisit('ok');
|
|
438
379
|
this.getDevicePairing().prepareStart();
|
|
439
380
|
this.getDevicePairing().setReadyToStart();
|
|
440
381
|
this.getAppState().setState('paired', true);
|
|
@@ -451,7 +392,6 @@ let DevicesPageService = (() => {
|
|
|
451
392
|
}
|
|
452
393
|
}
|
|
453
394
|
onSimulate() {
|
|
454
|
-
this.closeVisit('simulate');
|
|
455
395
|
const simulator = this.getDeviceConfiguration().getSimulatorAdapterId();
|
|
456
396
|
this.getDevicePairing().prepareStart([simulator]);
|
|
457
397
|
const prevContentPage = this.getPrevContentPage();
|
|
@@ -461,7 +401,6 @@ let DevicesPageService = (() => {
|
|
|
461
401
|
this.moveTo(prevContentPage);
|
|
462
402
|
}
|
|
463
403
|
onCancel() {
|
|
464
|
-
this.closeVisit('cancel');
|
|
465
404
|
const nextPage = this.getAppState().getState('prevPage');
|
|
466
405
|
this.moveTo(`/${nextPage}`);
|
|
467
406
|
}
|
|
@@ -489,9 +428,6 @@ let DevicesPageService = (() => {
|
|
|
489
428
|
getIncyclist() {
|
|
490
429
|
return useIncyclist();
|
|
491
430
|
}
|
|
492
|
-
getPairingVisitTracker() {
|
|
493
|
-
return usePairingVisitTracker();
|
|
494
|
-
}
|
|
495
431
|
};
|
|
496
432
|
return DevicesPageService = _classThis;
|
|
497
433
|
})();
|
|
@@ -14,12 +14,16 @@ const INTERFACE_LABELS = {
|
|
|
14
14
|
tcpip: 'TCP/IP',
|
|
15
15
|
wifi: 'Wi-Fi',
|
|
16
16
|
};
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
17
|
+
const DESKTOP_SCAN_INTERFACES = new Set(['ble', 'ant', 'wifi']);
|
|
18
|
+
const DESKTOP_NAMED_INTERFACES = new Set(['ble', 'ant']);
|
|
19
|
+
const scanInterfaces = (interfaces, platform) => platform === 'desktop'
|
|
20
|
+
? interfaces.filter(i => DESKTOP_SCAN_INTERFACES.has(i.id))
|
|
20
21
|
: interfaces;
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
const namedInterfaces = (interfaces, platform) => platform === 'desktop'
|
|
23
|
+
? interfaces.filter(i => DESKTOP_NAMED_INTERFACES.has(i.id))
|
|
24
|
+
: interfaces;
|
|
25
|
+
export const canScanWithInterfaces = (interfaces, platform) => scanInterfaces(interfaces, platform).some(i => i.enabled && i.available);
|
|
26
|
+
export const getUnavailableInterfaces = (interfaces, platform) => namedInterfaces(interfaces, platform).filter(i => i.enabled && !i.available).map(i => i.id);
|
|
23
27
|
const isBrokenInterface = (interfaces, id) => interfaces.find(i => i.id === id && i.enabled && !i.available);
|
|
24
28
|
export const getPairingHint = (input) => {
|
|
25
29
|
if (input.anyDeviceSelected)
|
|
@@ -39,12 +39,10 @@ import clone from "../../utils/clone";
|
|
|
39
39
|
import { useUserSettings } from "../../settings";
|
|
40
40
|
import { getLegacyInterface } from "../../utils/logging";
|
|
41
41
|
import { AdapterFactory, IncyclistCapability, InterfaceFactory } from "incyclist-devices";
|
|
42
|
-
import { getRouteList } from "../../routes";
|
|
43
42
|
import { IncyclistService } from "../../base/service";
|
|
44
43
|
import { Singleton } from "../../base/types";
|
|
45
44
|
import { Injectable } from "../../base/decorators/Injection";
|
|
46
45
|
import { useGoogleMaps } from "../../apps";
|
|
47
|
-
import { useWorkoutList } from "../../workouts";
|
|
48
46
|
const NO_DATA_THRESHOLD = 10000;
|
|
49
47
|
const UNHEALTHY_THRESHOLD = 60000;
|
|
50
48
|
let DeviceRideService = (() => {
|
|
@@ -58,7 +56,6 @@ let DeviceRideService = (() => {
|
|
|
58
56
|
let _getUserSettings_decorators;
|
|
59
57
|
let _getDeviceAccess_decorators;
|
|
60
58
|
let _getGoogleMaps_decorators;
|
|
61
|
-
let _getWorkoutList_decorators;
|
|
62
59
|
var DeviceRideService = class extends _classSuper {
|
|
63
60
|
static { _classThis = this; }
|
|
64
61
|
static {
|
|
@@ -67,12 +64,10 @@ let DeviceRideService = (() => {
|
|
|
67
64
|
_getUserSettings_decorators = [Injectable];
|
|
68
65
|
_getDeviceAccess_decorators = [Injectable];
|
|
69
66
|
_getGoogleMaps_decorators = [Injectable];
|
|
70
|
-
_getWorkoutList_decorators = [Injectable];
|
|
71
67
|
__esDecorate(this, null, _getDeviceConfiguration_decorators, { kind: "method", name: "getDeviceConfiguration", static: false, private: false, access: { has: obj => "getDeviceConfiguration" in obj, get: obj => obj.getDeviceConfiguration }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
72
68
|
__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);
|
|
73
69
|
__esDecorate(this, null, _getDeviceAccess_decorators, { kind: "method", name: "getDeviceAccess", static: false, private: false, access: { has: obj => "getDeviceAccess" in obj, get: obj => obj.getDeviceAccess }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
74
70
|
__esDecorate(this, null, _getGoogleMaps_decorators, { kind: "method", name: "getGoogleMaps", static: false, private: false, access: { has: obj => "getGoogleMaps" in obj, get: obj => obj.getGoogleMaps }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
75
|
-
__esDecorate(this, null, _getWorkoutList_decorators, { kind: "method", name: "getWorkoutList", static: false, private: false, access: { has: obj => "getWorkoutList" in obj, get: obj => obj.getWorkoutList }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
76
71
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
77
72
|
DeviceRideService = _classThis = _classDescriptor.value;
|
|
78
73
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -1358,20 +1353,7 @@ let DeviceRideService = (() => {
|
|
|
1358
1353
|
delete this.rideAdapters;
|
|
1359
1354
|
}
|
|
1360
1355
|
canEnforceSimulator() {
|
|
1361
|
-
|
|
1362
|
-
if (this.getWorkoutList().getSelected() && !selected)
|
|
1363
|
-
return true;
|
|
1364
|
-
const personalApiKey = this.getGoogleMaps().hasPersonalApiKey();
|
|
1365
|
-
if (!selected?.description)
|
|
1366
|
-
return false;
|
|
1367
|
-
if (selected?.description?.hasVideo || personalApiKey)
|
|
1368
|
-
return true;
|
|
1369
|
-
if (!selected.description.hasVideo) {
|
|
1370
|
-
const rideView = useUserSettings().getValue('preferences.rideView', null);
|
|
1371
|
-
if (rideView === 'map')
|
|
1372
|
-
return true;
|
|
1373
|
-
}
|
|
1374
|
-
return useUserSettings().isNewUser();
|
|
1356
|
+
return true;
|
|
1375
1357
|
}
|
|
1376
1358
|
logEvent(event) {
|
|
1377
1359
|
if (this.logPaused)
|
|
@@ -1416,9 +1398,6 @@ let DeviceRideService = (() => {
|
|
|
1416
1398
|
getGoogleMaps() {
|
|
1417
1399
|
return useGoogleMaps();
|
|
1418
1400
|
}
|
|
1419
|
-
getWorkoutList() {
|
|
1420
|
-
return useWorkoutList();
|
|
1421
|
-
}
|
|
1422
1401
|
};
|
|
1423
1402
|
return DeviceRideService = _classThis;
|
|
1424
1403
|
})();
|
|
@@ -32,13 +32,15 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
32
32
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
33
|
done = true;
|
|
34
34
|
};
|
|
35
|
-
import { useActivityRide } from "../../activities";
|
|
35
|
+
import { useActivityRide } from "../../activities/ride/service";
|
|
36
36
|
import { IncyclistService } from "../../base/service";
|
|
37
37
|
import { Observer, Singleton } from "../../base/types";
|
|
38
38
|
import { Injectable } from "../../base/decorators";
|
|
39
39
|
import { Step, useWorkoutList, useWorkoutRide, Workout } from "../../workouts";
|
|
40
40
|
import { useRouteList } from "../../routes";
|
|
41
|
-
import { isVirtualShiftingEnabled as checkVirtualShiftingEnabled,
|
|
41
|
+
import { isVirtualShiftingEnabled as checkVirtualShiftingEnabled, useDeviceRide } from "../../devices/ride";
|
|
42
|
+
import { useDeviceConfiguration } from "../../devices/configuration";
|
|
43
|
+
import { usePairingVisitTracker } from "../../devices/page/base/visit-log-factory";
|
|
42
44
|
import { useUserSettings } from "../../settings";
|
|
43
45
|
import { IncyclistCapability } from "incyclist-devices";
|
|
44
46
|
import { formatDateTime, getLegacyInterface, waitNextTick } from "../../utils";
|
|
@@ -105,6 +107,7 @@ let RideDisplayService = (() => {
|
|
|
105
107
|
deviceData;
|
|
106
108
|
actualWorkout;
|
|
107
109
|
hideAll = false;
|
|
110
|
+
simulated = false;
|
|
108
111
|
onChangeState = this.setState.bind(this);
|
|
109
112
|
startDeviceHandlers;
|
|
110
113
|
isResuming;
|
|
@@ -116,6 +119,7 @@ let RideDisplayService = (() => {
|
|
|
116
119
|
}
|
|
117
120
|
async init() {
|
|
118
121
|
await this.closePrevRide();
|
|
122
|
+
this.simulated = false;
|
|
119
123
|
this.observer = new Observer();
|
|
120
124
|
this.controlDevicesReadyNotified = false;
|
|
121
125
|
try {
|
|
@@ -133,8 +137,9 @@ let RideDisplayService = (() => {
|
|
|
133
137
|
}
|
|
134
138
|
start(simulate) {
|
|
135
139
|
try {
|
|
136
|
-
if (simulate)
|
|
140
|
+
if (simulate) {
|
|
137
141
|
this.enforceSimulator();
|
|
142
|
+
}
|
|
138
143
|
this.notifyPairingVisitRideStarted(simulate);
|
|
139
144
|
const rideProps = this.getRideModeService().getLogProps();
|
|
140
145
|
this.logEvent({ message: 'Start ride', ...rideProps,
|
|
@@ -155,6 +160,9 @@ let RideDisplayService = (() => {
|
|
|
155
160
|
this.logError(err, 'start');
|
|
156
161
|
}
|
|
157
162
|
}
|
|
163
|
+
isSimulated() {
|
|
164
|
+
return this.simulated;
|
|
165
|
+
}
|
|
158
166
|
notifyPairingVisitRideStarted(simulate) {
|
|
159
167
|
try {
|
|
160
168
|
this.getPairingVisitTracker().onRideStarted({ simulate: simulate === true });
|
|
@@ -493,6 +501,7 @@ let RideDisplayService = (() => {
|
|
|
493
501
|
}
|
|
494
502
|
if (prevState !== 'Starting')
|
|
495
503
|
this.enableScreensaver();
|
|
504
|
+
this.simulated = false;
|
|
496
505
|
}
|
|
497
506
|
catch (err) {
|
|
498
507
|
this.logError(err, 'stopRide');
|
|
@@ -971,6 +980,7 @@ let RideDisplayService = (() => {
|
|
|
971
980
|
this.checkStartStatus();
|
|
972
981
|
}
|
|
973
982
|
enforceSimulator() {
|
|
983
|
+
this.simulated = true;
|
|
974
984
|
this.getDeviceRide().enforceSimulator();
|
|
975
985
|
}
|
|
976
986
|
getScreenshotName() {
|
|
@@ -246,6 +246,9 @@ let GpxDisplayService = (() => {
|
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
248
|
getRideView() {
|
|
249
|
+
if (this.service?.isSimulated() && !this.getGoogleMaps().hasPersonalApiKey()) {
|
|
250
|
+
this.rideViewOverride = 'map';
|
|
251
|
+
}
|
|
249
252
|
return this.rideViewOverride ?? this.getRideSettingsDisplay().getRideView();
|
|
250
253
|
}
|
|
251
254
|
onRideSettingsChanged(settings = {}) {
|
|
@@ -36,7 +36,7 @@ import { getBindings } from "../../api";
|
|
|
36
36
|
import { IncyclistService } from "../../base/service";
|
|
37
37
|
import { Singleton } from "../../base/types";
|
|
38
38
|
import { Observer } from "../../base/types/observer";
|
|
39
|
-
import { getLoadButtonMode, useDeviceRide } from "../../devices";
|
|
39
|
+
import { getLoadButtonMode, useDeviceRide } from "../../devices/ride";
|
|
40
40
|
import { useUserSettings } from "../../settings";
|
|
41
41
|
import { waitNextTick } from "../../utils";
|
|
42
42
|
import { valid } from "../../utils/valid";
|
|
@@ -197,7 +197,7 @@ export declare class ActivityRideService extends IncyclistService {
|
|
|
197
197
|
protected update(): void;
|
|
198
198
|
protected isLoop(): boolean;
|
|
199
199
|
protected createFreeRide(settings: FreeRideStartSettings): Route;
|
|
200
|
-
protected getMode(routeType: ActivityRouteType): "
|
|
200
|
+
protected getMode(routeType: ActivityRouteType): "video" | "workout" | "follow route" | "free ride";
|
|
201
201
|
protected updateActivityTime(): void;
|
|
202
202
|
getRideProps(): any;
|
|
203
203
|
protected logActivityUpdateMessage(): void;
|