incyclist-services 1.9.18 → 1.9.19

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.
Files changed (34) hide show
  1. package/lib/cjs/devices/configuration/service.js +39 -9
  2. package/lib/cjs/devices/page/base/service.js +191 -3
  3. package/lib/cjs/devices/page/base/visit-log.js +13 -0
  4. package/lib/cjs/devices/page/desktop/service.js +8 -30
  5. package/lib/cjs/devices/page/mobile/service.js +9 -33
  6. package/lib/cjs/devices/pairing/guidance.js +151 -18
  7. package/lib/cjs/devices/pairing/index.js +1 -0
  8. package/lib/cjs/devices/pairing/service.js +56 -13
  9. package/lib/cjs/devices/pairing/status.js +54 -22
  10. package/lib/cjs/devices/ride/service.js +50 -13
  11. package/lib/esm/devices/configuration/service.js +39 -9
  12. package/lib/esm/devices/page/base/service.js +192 -4
  13. package/lib/esm/devices/page/base/visit-log.js +13 -0
  14. package/lib/esm/devices/page/desktop/service.js +9 -31
  15. package/lib/esm/devices/page/mobile/service.js +10 -34
  16. package/lib/esm/devices/pairing/guidance.js +149 -17
  17. package/lib/esm/devices/pairing/index.js +1 -0
  18. package/lib/esm/devices/pairing/service.js +56 -13
  19. package/lib/esm/devices/pairing/status.js +53 -22
  20. package/lib/esm/devices/ride/service.js +50 -13
  21. package/lib/types/devices/configuration/model/service/index.d.ts +7 -0
  22. package/lib/types/devices/configuration/service.d.ts +3 -1
  23. package/lib/types/devices/page/base/service.d.ts +23 -3
  24. package/lib/types/devices/page/base/types.d.ts +40 -0
  25. package/lib/types/devices/page/base/visit-log.d.ts +4 -1
  26. package/lib/types/devices/page/desktop/service.d.ts +2 -0
  27. package/lib/types/devices/page/mobile/service.d.ts +2 -0
  28. package/lib/types/devices/page/types.d.ts +1 -0
  29. package/lib/types/devices/pairing/guidance.d.ts +44 -4
  30. package/lib/types/devices/pairing/index.d.ts +1 -0
  31. package/lib/types/devices/pairing/service.d.ts +5 -0
  32. package/lib/types/devices/pairing/status.d.ts +11 -1
  33. package/lib/types/devices/ride/service.d.ts +5 -1
  34. package/package.json +7 -7
@@ -125,6 +125,7 @@ let DeviceConfigurationService = (() => {
125
125
  if (!this.settings?.devices)
126
126
  this.settings.devices = [];
127
127
  let updated = false;
128
+ const unbuildable = [];
128
129
  this.settings.devices.forEach(d => {
129
130
  if (!d?.udid) {
130
131
  if (d?.settings.interface === 'wifi') {
@@ -133,16 +134,14 @@ let DeviceConfigurationService = (() => {
133
134
  }
134
135
  return;
135
136
  }
136
- try {
137
- this.adapters[d.udid] = this.getAdapterFromSetting(d.settings);
138
- }
139
- catch (err) {
140
- this.logEvent({ message: 'error', fn: 'init()->Adapterfactory.create()', error: err.message, udid: d.udid, settings: d.settings, devices: this.settings.devices, stack: err.stack, });
141
- }
137
+ const failure = this.loadAdapter(d.udid, d.settings);
138
+ if (failure)
139
+ unbuildable.push(failure);
142
140
  });
143
141
  if (updated) {
144
142
  this.getUserSettings().set('devices', this.settings.devices);
145
143
  }
144
+ unbuildable.forEach(u => this.removeUnbuildableDevice(u));
146
145
  this.initWifiInterface();
147
146
  this.verifyCapabilitySettings();
148
147
  this.removeLegacySettings().catch(err => { this.logError(err, 'init()'); });
@@ -154,6 +153,34 @@ let DeviceConfigurationService = (() => {
154
153
  this.emitInitialized();
155
154
  }
156
155
  }
156
+ loadAdapter(udid, settings) {
157
+ try {
158
+ const adapter = this.getAdapterFromSetting(settings);
159
+ if (!adapter)
160
+ return { udid, settings, reason: 'no-adapter' };
161
+ this.adapters[udid] = adapter;
162
+ }
163
+ catch (err) {
164
+ return { udid, settings, reason: 'create-failed', error: err?.message ?? String(err) };
165
+ }
166
+ }
167
+ removeUnbuildableDevice(device) {
168
+ const { udid, settings, reason, error } = device;
169
+ const selectedFor = (this.settings.capabilities ?? [])
170
+ .filter(c => c.capability !== 'bike' && c.selected === udid)
171
+ .map(c => c.capability);
172
+ selectedFor.forEach(capability => { this.unselect(capability, false); });
173
+ this.delete(udid);
174
+ const stored = settings;
175
+ this.logEvent({
176
+ message: 'unsupported device removed',
177
+ interface: stored?.interface ?? '',
178
+ protocol: stored?.protocol ?? stored?.profile ?? '',
179
+ reason,
180
+ selectedFor: selectedFor.join(','),
181
+ ...(error === undefined ? {} : { error })
182
+ });
183
+ }
157
184
  setFeature(name, enabled) {
158
185
  this.features[name] = enabled;
159
186
  }
@@ -541,7 +568,10 @@ let DeviceConfigurationService = (() => {
541
568
  if (!udids)
542
569
  return [];
543
570
  udids.forEach(udid => {
544
- adapters.push({ udid, adapter: this.adapters[udid], capabilities: this.adapters[udid].getCapabilities() });
571
+ const adapter = this.adapters[udid];
572
+ if (!adapter)
573
+ return;
574
+ adapters.push({ udid, adapter, capabilities: adapter.getCapabilities() });
545
575
  });
546
576
  return adapters;
547
577
  }
@@ -561,9 +591,9 @@ let DeviceConfigurationService = (() => {
561
591
  return this.adapters[udid];
562
592
  }
563
593
  getSelectedDevices(capability) {
564
- let capabilites = this.settings?.capabilities;
594
+ let capabilites = this.settings?.capabilities ?? [];
565
595
  if (capability) {
566
- capabilites = this.settings?.capabilities.filter(c => c.capability === capability);
596
+ capabilites = capabilites.filter(c => c.capability === capability);
567
597
  }
568
598
  return capabilites.filter(c => c.capability !== 'bike' && c.disabled !== true && c.selected && !this.isExcluded(c.capability)).map(c => {
569
599
  const { capability, selected } = c;
@@ -43,6 +43,7 @@ const logobserver_1 = require("./logobserver");
43
43
  const incyclist_devices_1 = require("incyclist-devices");
44
44
  const configuration_1 = require("../../configuration");
45
45
  const visit_log_factory_1 = require("./visit-log-factory");
46
+ const guidance_1 = require("./guidance");
46
47
  let PairingPageService = (() => {
47
48
  let _classSuper = pages_1.IncyclistPageService;
48
49
  let _instanceExtraInitializers = [];
@@ -63,14 +64,27 @@ let PairingPageService = (() => {
63
64
  promiseOpen = __runInitializers(this, _instanceExtraInitializers);
64
65
  stateMachine;
65
66
  logObserver;
66
- openedCapability;
67
+ _openedCapability;
67
68
  isPairingForRide = false;
68
69
  isVisitOpen = false;
69
70
  handingOffToRide = false;
71
+ guidance;
72
+ onPairingStateHandler = this.onPairingState.bind(this);
70
73
  constructor() {
71
74
  super('pairing');
72
75
  this.stateMachine = this.createOrchestrator();
73
76
  this.logObserver = new logobserver_1.PageLogObserver('Pairing');
77
+ this.guidance = new guidance_1.PairingGuidance({
78
+ log: (message, fields) => { this.logEvent({ message, ...fields }); },
79
+ onChange: () => { this.updatePage(); },
80
+ });
81
+ }
82
+ get openedCapability() {
83
+ return this._openedCapability;
84
+ }
85
+ set openedCapability(cap) {
86
+ this._openedCapability = cap;
87
+ this.guidance?.setDeviceListOpen(cap !== undefined);
74
88
  }
75
89
  openPage(forRide) {
76
90
  try {
@@ -78,6 +92,7 @@ let PairingPageService = (() => {
78
92
  this.isPairingForRide = forRide ?? false;
79
93
  this.handingOffToRide = false;
80
94
  this.openVisit();
95
+ this.listenToPairingState(true);
81
96
  gd_eventlog_1.EventLogger.setGlobalConfig('page', 'Pairing');
82
97
  super.openPage();
83
98
  if (this.promiseOpen !== undefined) {
@@ -109,6 +124,9 @@ let PairingPageService = (() => {
109
124
  this.logEvent({ message: 'page closed', page: 'Pairing' });
110
125
  this.isVisitOpen = false;
111
126
  this.setPairingVisitOpen(false);
127
+ this.listenToPairingState(false);
128
+ this.trackVisit(t => t.setExitFields(undefined), 'closePage');
129
+ this.withGuidance(g => g.closeVisit(), 'closeVisit');
112
130
  gd_eventlog_1.EventLogger.setGlobalConfig('page', null);
113
131
  this.isPairingForRide = false;
114
132
  void this.stateMachine.stop();
@@ -124,6 +142,7 @@ let PairingPageService = (() => {
124
142
  async pausePage() {
125
143
  try {
126
144
  this.trackVisit(t => t.onBackground({ canStartRide: this.canStartRide() }), 'onBackground');
145
+ this.withGuidance(g => g.pauseVisit(), 'pauseVisit');
127
146
  await this.stateMachine.pause();
128
147
  this.logEvent({ message: 'page paused', page: 'Pairing' });
129
148
  }
@@ -134,6 +153,7 @@ let PairingPageService = (() => {
134
153
  async resumePage() {
135
154
  try {
136
155
  this.trackVisit(t => t.onForeground(), 'onForeground');
156
+ this.withGuidance(g => g.resumeVisit(), 'resumeVisit');
137
157
  this.stateMachine.resume();
138
158
  if (this.promiseOpen !== undefined)
139
159
  return;
@@ -173,9 +193,28 @@ let PairingPageService = (() => {
173
193
  return {
174
194
  title, capability, deviceName, disabled: false, connectState, value: value?.toString(), unit, interface: ifName,
175
195
  role, helpText, emptyFooter, stateText,
196
+ ...this.getTileState(data, role, noSearch),
176
197
  onClick, onUnselect
177
198
  };
178
199
  }
200
+ getTileState(data, role, noSearch) {
201
+ try {
202
+ const control = (this.state.capabilities ?? []).find(c => c.capability === incyclist_devices_1.IncyclistCapability.Control);
203
+ const { trainerPhase } = this.guidance.getState();
204
+ const { selectedReason, separateSensor } = this.guidance.getHelper();
205
+ return (0, pairing_1.getPairingTileState)({
206
+ capability: data.capability, role, disabled: data.disabled, selected: data.selected, connectState: data.connectState,
207
+ noSearch, canStartRide: this.canStartRide(),
208
+ trainerPhase, trainerUdid: control?.selected,
209
+ trainerUnavailablePicked: selectedReason === 'trainer_unavailable',
210
+ separateSensor: separateSensor !== undefined,
211
+ });
212
+ }
213
+ catch (err) {
214
+ this.logError(err, 'getTileState');
215
+ return { awaited: false };
216
+ }
217
+ }
179
218
  getDisabledCapabilityDisplayProps(data, common) {
180
219
  const { capability: cap, deviceName } = data;
181
220
  const { title, capability, role, helpText, onClick } = common;
@@ -185,7 +224,8 @@ let PairingPageService = (() => {
185
224
  deviceName: hasRememberedDevice ? deviceName : undefined,
186
225
  disabled: true,
187
226
  role, helpText,
188
- emptyFooter: hasRememberedDevice ? 'Not used' : 'Not used · tap to search',
227
+ emptyFooter: hasRememberedDevice ? 'Not used' : 'Tap to search',
228
+ awaited: false,
189
229
  onClick,
190
230
  onUse: hasRememberedDevice ? () => { this.onCapabilityUse(cap); } : undefined,
191
231
  };
@@ -337,14 +377,162 @@ let PairingPageService = (() => {
337
377
  this.setPairingVisitOpen(true);
338
378
  if (this.isVisitOpen)
339
379
  return;
340
- this.trackVisit(t => t.openVisit({ forRide: this.isPairingForRide }), 'openVisit');
380
+ let visitId;
381
+ this.trackVisit(t => { visitId = t.openVisit({ forRide: this.isPairingForRide })?.visitId; }, 'openVisit');
382
+ this.withGuidance(g => {
383
+ g.openVisit({ visitId, platform: this.getPlatform(), forRide: this.isPairingForRide });
384
+ g.setDeviceListOpen(this.openedCapability !== undefined);
385
+ }, 'openVisit');
386
+ this.trackVisit(t => t.setExitFields(() => ({ ...this.guidance.getExitFields() })), 'openVisit');
341
387
  this.isVisitOpen = true;
342
388
  }
343
389
  closeVisit(via) {
344
390
  this.trackVisit(t => t.closeVisit(via, { canStartRide: this.canStartRide() }), 'closeVisit');
391
+ this.trackVisit(t => t.setExitFields(undefined), 'closeVisit');
392
+ this.withGuidance(g => g.closeVisit(), 'closeVisit');
345
393
  this.isVisitOpen = false;
346
394
  this.setPairingVisitOpen(false);
347
395
  }
396
+ withGuidance(fn, name) {
397
+ try {
398
+ fn(this.guidance);
399
+ }
400
+ catch (err) {
401
+ this.logError(err, name);
402
+ }
403
+ }
404
+ listenToPairingState(listen) {
405
+ try {
406
+ const pairing = this.getDevicePairing();
407
+ pairing.off?.('pairing-state', this.onPairingStateHandler);
408
+ if (listen)
409
+ pairing.on?.('pairing-state', this.onPairingStateHandler);
410
+ }
411
+ catch (err) {
412
+ this.logError(err, 'listenToPairingState');
413
+ }
414
+ }
415
+ onPairingState(state) {
416
+ this.withGuidance(g => g.onPairingState(state), 'onPairingState');
417
+ }
418
+ getStatusDisplayProps(interfaces) {
419
+ const src = {
420
+ platform: this.getPlatform(),
421
+ interfaces,
422
+ capabilities: this.state.capabilities ?? [],
423
+ canStartRide: this.canStartRide(),
424
+ loading: this.promiseOpen !== undefined,
425
+ rideMode: this.isPairingForRide,
426
+ ...this.getSearchStatusSource(),
427
+ };
428
+ try {
429
+ return this.guidance.getStatus(src);
430
+ }
431
+ catch (err) {
432
+ this.logError(err, 'getStatusDisplayProps');
433
+ return (0, pairing_1.getPairingStatusDisplay)(src);
434
+ }
435
+ }
436
+ getCapabilityRowsDisplayProps(noSearch) {
437
+ const caps = this.state.capabilities ?? [];
438
+ const capProps = caps.map(c => this.getCapabilityDisplayProps(c, noSearch));
439
+ const row = (role) => pairing_1.PAIRING_CAPABILITY_ROLES
440
+ .filter(r => r.role === role)
441
+ .map(r => capProps.find(c => c.capability === this.getTCapability(r.capability)))
442
+ .filter(c => c !== undefined);
443
+ const trainerSelected = (0, pairing_1.isCapabilityActive)(caps.find(c => c.capability === incyclist_devices_1.IncyclistCapability.Control));
444
+ return {
445
+ top: row('required'),
446
+ bottom: row('optional'),
447
+ rowLabels: {
448
+ top: (0, pairing_1.getPairingGuidanceText)((0, pairing_1.getPairingRowLabelId)(trainerSelected, this.isStillLooking(), this.getTrainerPhase())),
449
+ bottom: (0, pairing_1.getPairingGuidanceText)('row-optional'),
450
+ },
451
+ };
452
+ }
453
+ getTrainerPhase() {
454
+ try {
455
+ return this.guidance.getState().trainerPhase;
456
+ }
457
+ catch (err) {
458
+ this.logError(err, 'getTrainerPhase');
459
+ return undefined;
460
+ }
461
+ }
462
+ getGuidanceDisplayProps() {
463
+ try {
464
+ const { pairingCase, trainerPhase } = this.guidance.getState();
465
+ return { pairingCase, trainerPhase, helper: this.getHelperDisplayProps() };
466
+ }
467
+ catch (err) {
468
+ this.logError(err, 'getGuidanceDisplayProps');
469
+ return {};
470
+ }
471
+ }
472
+ getHelperDisplayProps() {
473
+ if (!this.isVisitOpen)
474
+ return undefined;
475
+ const helper = this.guidance.getHelper();
476
+ const { platform, selectedReason, separateSensor } = helper;
477
+ const trainerConfigured = helper.trainerPhase !== undefined;
478
+ const props = {
479
+ phase: helper.phase,
480
+ title: (0, pairing_1.getPairingHelperTitle)(trainerConfigured),
481
+ reasons: helper.reasons.map(id => ({
482
+ id,
483
+ label: (0, pairing_1.getPairingHelperReasonLabel)(id, platform),
484
+ selected: id === selectedReason,
485
+ onSelect: () => { this.onHelperReasonSelected(id); },
486
+ })),
487
+ footer: (0, pairing_1.getPairingHelperFooter)(trainerConfigured),
488
+ onOpen: () => { this.onHelperOpen(); },
489
+ onDismiss: () => { this.onHelperDismissed(); },
490
+ };
491
+ if (helper.phase === 'resolved')
492
+ props.resolvedText = pairing_1.PAIRING_HELPER_RESOLVED_TEXT;
493
+ if (!selectedReason) {
494
+ props.subline = pairing_1.PAIRING_HELPER_SUBLINE;
495
+ return props;
496
+ }
497
+ props.tip = (0, pairing_1.getPairingHelperTip)(selectedReason, { platform, separateSensor });
498
+ if ((0, pairing_1.hasContinueWithoutDeviceAction)(selectedReason, separateSensor)) {
499
+ const { label, note } = this.guidance.getContinueWithoutDeviceAction();
500
+ props.action = { label, onClick: () => { this.onContinueWithoutDevice(); } };
501
+ if (note)
502
+ props.action.note = note;
503
+ }
504
+ return props;
505
+ }
506
+ onHelperOpen() {
507
+ this.withGuidance(g => g.openHelper(), 'onHelperOpen');
508
+ this.updatePage();
509
+ }
510
+ onHelperDismissed() {
511
+ this.withGuidance(g => g.dismissHelper(), 'onHelperDismissed');
512
+ this.updatePage();
513
+ }
514
+ onHelperReasonSelected(reason) {
515
+ this.withGuidance(g => g.selectReason(reason), 'onHelperReasonSelected');
516
+ this.updatePage();
517
+ }
518
+ onContinueWithoutDevice() {
519
+ const target = this.getContinueWithoutDeviceTarget();
520
+ if (target === 'simulate')
521
+ this.onSimulate();
522
+ else if (target === 'cancel')
523
+ this.onCancel();
524
+ else
525
+ this.onSkip();
526
+ }
527
+ getContinueWithoutDeviceTarget() {
528
+ try {
529
+ return this.guidance.continueWithoutDevice();
530
+ }
531
+ catch (err) {
532
+ this.logError(err, 'onContinueWithoutDevice');
533
+ return this.isPairingForRide ? 'cancel' : 'skip';
534
+ }
535
+ }
348
536
  setPairingVisitOpen(open) {
349
537
  try {
350
538
  this.getDevicePairing().setVisitOpen(open);
@@ -26,9 +26,21 @@ const getPreviousVisitOutcome = (last) => {
26
26
  exports.getPreviousVisitOutcome = getPreviousVisitOutcome;
27
27
  class PairingVisitTracker {
28
28
  deps;
29
+ exitFields;
29
30
  constructor(deps) {
30
31
  this.deps = deps;
31
32
  }
33
+ setExitFields(provider) {
34
+ this.exitFields = provider;
35
+ }
36
+ getExitFields() {
37
+ try {
38
+ return this.exitFields?.() ?? {};
39
+ }
40
+ catch {
41
+ return {};
42
+ }
43
+ }
32
44
  onAppLaunch(isNewUser) {
33
45
  const record = this.deps.store.get();
34
46
  if (!record) {
@@ -110,6 +122,7 @@ class PairingVisitTracker {
110
122
  const now = this.deps.now();
111
123
  const backgroundMs = last.backgroundMs + (last.backgroundedAt !== undefined ? now - last.backgroundedAt : 0);
112
124
  this.deps.log(exports.PAGE_LEFT_EVENT, {
125
+ ...this.getExitFields(),
113
126
  visitId: last.visitId,
114
127
  via,
115
128
  dwellMs: now - last.openedAt,
@@ -69,6 +69,9 @@ let DesktopPairingPageService = (() => {
69
69
  getUsageMode() {
70
70
  return 'direct';
71
71
  }
72
+ getPlatform() {
73
+ return 'desktop';
74
+ }
72
75
  openPage(forRide, source) {
73
76
  this.source = source;
74
77
  return super.openPage(forRide);
@@ -76,47 +79,22 @@ let DesktopPairingPageService = (() => {
76
79
  getPageDisplayProperties() {
77
80
  const title = 'Devices';
78
81
  try {
79
- const caps = this.state.capabilities ?? [];
80
82
  const allIfs = this.state.interfaces ?? [];
81
83
  const ifs = allIfs.filter(i => !i.invisible);
82
84
  this.getDeviceAccess().enrichWithAccessState(ifs);
83
85
  const interfaces = ifs.map(i => this.getInterfaceDisplayProps(i));
84
- const status = (0, pairing_1.getPairingStatusDisplay)({
85
- platform: 'desktop',
86
- interfaces: (0, pairing_1.toPairingInterfaceStates)(allIfs),
87
- capabilities: caps,
88
- canStartRide: this.canStartRide(),
89
- loading: this.promiseOpen !== undefined,
90
- rideMode: this.isPairingForRide,
91
- ...this.getSearchStatusSource(),
92
- });
93
- const capProps = caps.map(c => this.getCapabilityDisplayProps(c, status.id === 'S1'));
94
- const CP = (cap) => capProps.find(c => c.capability === cap);
95
- const top = [
96
- CP(incyclist_devices_1.IncyclistCapability.Control),
97
- CP(incyclist_devices_1.IncyclistCapability.Power),
98
- CP(incyclist_devices_1.IncyclistCapability.Speed)
99
- ].filter(c => c !== null && c !== undefined);
100
- const bottom = [
101
- CP(incyclist_devices_1.IncyclistCapability.HeartRate),
102
- CP(incyclist_devices_1.IncyclistCapability.Cadence),
103
- CP(incyclist_devices_1.IncyclistCapability.AppControl)
104
- ].filter(c => c !== null && c !== undefined);
105
- const trainerSelected = (0, pairing_1.isCapabilityActive)(caps.find(c => c.capability === incyclist_devices_1.IncyclistCapability.Control));
106
- const rowLabels = {
107
- top: (0, pairing_1.getPairingGuidanceText)((0, pairing_1.getPairingRowLabelId)(trainerSelected, this.isStillLooking())),
108
- bottom: (0, pairing_1.getPairingGuidanceText)('row-optional'),
109
- };
110
- const buttons = this.getButtonsDisplayProps(status.id === 'S1');
86
+ const status = this.getStatusDisplayProps((0, pairing_1.toPairingInterfaceStates)(allIfs));
87
+ const noSearch = status.id === 'S1';
111
88
  return {
112
89
  title,
113
90
  readyToStart: this.canStartRide(),
114
91
  status,
115
- capabilities: { top, bottom, rowLabels },
92
+ capabilities: this.getCapabilityRowsDisplayProps(noSearch),
116
93
  interfaces,
117
94
  deviceSelection: this.getDeviceListDisplayProps(),
118
- buttons,
95
+ buttons: this.getButtonsDisplayProps(noSearch),
119
96
  showInterfaceSettings: this.getInterfaceSettingsDisplayProps(),
97
+ ...this.getGuidanceDisplayProps(),
120
98
  };
121
99
  }
122
100
  catch (err) {
@@ -35,7 +35,6 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.DevicesPageService = exports.MobilePairingPageService = void 0;
38
- const incyclist_devices_1 = require("incyclist-devices");
39
38
  const decorators_1 = require("../../../base/decorators");
40
39
  const service_1 = require("../base/service");
41
40
  const orchestrator_1 = require("./orchestrator");
@@ -70,6 +69,9 @@ let MobilePairingPageService = (() => {
70
69
  getUsageMode() {
71
70
  return 'page';
72
71
  }
72
+ getPlatform() {
73
+ return 'mobile';
74
+ }
73
75
  getPageDisplayProperties() {
74
76
  const title = 'Devices';
75
77
  const onExit = () => {
@@ -86,48 +88,22 @@ let MobilePairingPageService = (() => {
86
88
  }
87
89
  };
88
90
  try {
89
- const caps = this.state.capabilities ?? [];
90
91
  const ifs = this.state.interfaces ?? [];
91
92
  (0, access_1.useDeviceAccess)().enrichWithAccessState(ifs);
92
93
  const interfaces = ifs.map(i => { return this.getInterfaceDisplayProps(i); });
93
- const loading = this.promiseOpen != undefined;
94
- const status = (0, pairing_1.getPairingStatusDisplay)({
95
- platform: 'mobile',
96
- interfaces: (0, pairing_1.toPairingInterfaceStates)(ifs),
97
- capabilities: caps,
98
- canStartRide: this.canStartRide(),
99
- loading,
100
- rideMode: this.isPairingForRide,
101
- ...this.getSearchStatusSource(),
102
- });
103
- const capProps = caps.map(c => this.getCapabilityDisplayProps(c, status.id === 'S1'));
104
- const CP = (cap) => capProps.find(c => c.capability === cap);
105
- const top = [
106
- CP('control'),
107
- CP('power'),
108
- CP('speed')
109
- ].filter(c => c !== null && c !== undefined);
110
- const bottom = [
111
- CP('heartrate'),
112
- CP('cadence'),
113
- CP('app_control')
114
- ].filter(c => c !== null && c !== undefined);
115
- const trainerSelected = (0, pairing_1.isCapabilityActive)(caps.find(c => c.capability === incyclist_devices_1.IncyclistCapability.Control));
116
- const rowLabels = {
117
- top: (0, pairing_1.getPairingGuidanceText)((0, pairing_1.getPairingRowLabelId)(trainerSelected, this.isStillLooking())),
118
- bottom: (0, pairing_1.getPairingGuidanceText)('row-optional'),
119
- };
120
- const buttons = this.getButtonsDisplayProps(status.id === 'S1');
94
+ const status = this.getStatusDisplayProps((0, pairing_1.toPairingInterfaceStates)(ifs));
95
+ const noSearch = status.id === 'S1';
121
96
  return {
122
97
  title,
123
98
  readyToStart: this.canStartRide(),
124
99
  status,
125
- capabilities: { top, bottom, rowLabels },
100
+ capabilities: this.getCapabilityRowsDisplayProps(noSearch),
126
101
  interfaces,
127
102
  deviceSelection: this.getDeviceListDisplayProps(),
128
103
  showInterfaceSettings: this.openedInterfaceSettings,
129
- buttons,
130
- onExit
104
+ buttons: this.getButtonsDisplayProps(noSearch),
105
+ onExit,
106
+ ...this.getGuidanceDisplayProps(),
131
107
  };
132
108
  }
133
109
  catch (err) {