incyclist-services 1.7.21 → 1.7.23

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 (58) hide show
  1. package/lib/cjs/activities/active-rides/mq.js +8 -3
  2. package/lib/cjs/activities/types.js +17 -0
  3. package/lib/cjs/apps/base/app/index.js +10 -1
  4. package/lib/cjs/apps/komoot/KomootAppConnection.js +13 -9
  5. package/lib/cjs/apps/velohero/VeloHeroAppConnection.js +0 -1
  6. package/lib/cjs/base/pages/service.js +26 -0
  7. package/lib/cjs/devices/page/service.js +23 -24
  8. package/lib/cjs/devices/pairing/service.js +0 -3
  9. package/lib/cjs/devices/ride/index.js +0 -1
  10. package/lib/cjs/devices/ride/types.js +2 -0
  11. package/lib/cjs/ride/display/service.js +2 -2
  12. package/lib/cjs/ride/index.js +1 -0
  13. package/lib/cjs/ride/page/index.js +17 -0
  14. package/lib/cjs/ride/page/service.js +225 -0
  15. package/lib/cjs/ride/page/types.js +2 -0
  16. package/lib/cjs/ride/route/RLVDisplayService.js +29 -26
  17. package/lib/cjs/ride/types.js +2 -0
  18. package/lib/cjs/routes/page/service.js +16 -0
  19. package/lib/esm/activities/active-rides/mq.js +8 -3
  20. package/lib/esm/activities/types.js +1 -0
  21. package/lib/esm/apps/base/app/index.js +10 -1
  22. package/lib/esm/apps/komoot/KomootAppConnection.js +13 -9
  23. package/lib/esm/apps/velohero/VeloHeroAppConnection.js +0 -1
  24. package/lib/esm/base/pages/service.js +26 -0
  25. package/lib/esm/devices/page/service.js +23 -24
  26. package/lib/esm/devices/pairing/service.js +0 -3
  27. package/lib/esm/devices/ride/index.js +0 -1
  28. package/lib/esm/devices/ride/types.js +1 -0
  29. package/lib/esm/ride/display/service.js +2 -2
  30. package/lib/esm/ride/index.js +1 -0
  31. package/lib/esm/ride/page/index.js +1 -0
  32. package/lib/esm/ride/page/service.js +221 -0
  33. package/lib/esm/ride/page/types.js +1 -0
  34. package/lib/esm/ride/route/RLVDisplayService.js +29 -26
  35. package/lib/esm/ride/types.js +1 -0
  36. package/lib/esm/routes/page/service.js +16 -0
  37. package/lib/types/activities/ride/service.d.ts +1 -1
  38. package/lib/types/activities/ride/types.d.ts +14 -0
  39. package/lib/types/activities/types.d.ts +1 -0
  40. package/lib/types/apps/base/app/index.d.ts +2 -0
  41. package/lib/types/apps/komoot/KomootAppConnection.d.ts +2 -2
  42. package/lib/types/apps/velohero/VeloHeroAppConnection.d.ts +0 -1
  43. package/lib/types/base/pages/service.d.ts +4 -0
  44. package/lib/types/devices/page/service.d.ts +2 -4
  45. package/lib/types/devices/ride/index.d.ts +1 -1
  46. package/lib/types/devices/ride/service.d.ts +1 -1
  47. package/lib/types/devices/ride/types.d.ts +54 -0
  48. package/lib/types/devices/types.d.ts +1 -0
  49. package/lib/types/ride/display/service.d.ts +1 -1
  50. package/lib/types/ride/index.d.ts +1 -0
  51. package/lib/types/ride/page/index.d.ts +1 -0
  52. package/lib/types/ride/page/service.d.ts +40 -0
  53. package/lib/types/ride/page/types.d.ts +34 -0
  54. package/lib/types/ride/route/types.d.ts +19 -0
  55. package/lib/types/ride/types.d.ts +3 -0
  56. package/lib/types/routes/page/service.d.ts +2 -0
  57. package/lib/types/types.d.ts +2 -0
  58. package/package.json +1 -1
@@ -0,0 +1,221 @@
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
34
+ };
35
+ import { EventLogger } from "gd-eventlog";
36
+ import { Singleton } from "../../base/decorators";
37
+ import { IncyclistPageService } from "../../base/pages";
38
+ import { useRideDisplay } from "../display";
39
+ import { sleep } from "../../utils/sleep";
40
+ const BACKGROUND_PAUSE_TIMEOUT_MS = 60000;
41
+ let RidePageService = (() => {
42
+ let _classDecorators = [Singleton];
43
+ let _classDescriptor;
44
+ let _classExtraInitializers = [];
45
+ let _classThis;
46
+ let _classSuper = IncyclistPageService;
47
+ var RidePageService = class extends _classSuper {
48
+ static { _classThis = this; }
49
+ static {
50
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
51
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
52
+ RidePageService = _classThis = _classDescriptor.value;
53
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
54
+ __runInitializers(_classThis, _classExtraInitializers);
55
+ }
56
+ eventHandler = {};
57
+ backgroundTimer;
58
+ backgroundPausedByService = false;
59
+ menuProps = null;
60
+ isInitialized = false;
61
+ constructor() {
62
+ super('RidePage');
63
+ this.eventHandler['state-update'] = this.onDisplayStateUpdate.bind(this);
64
+ this.eventHandler['route-update'] = this.onRouteUpdate.bind(this);
65
+ }
66
+ async initPage() {
67
+ const service = this.getRideDisplay();
68
+ await service.init();
69
+ this.isInitialized = true;
70
+ return service.getRideType();
71
+ }
72
+ openPage(simulate) {
73
+ this.logEvent({ message: 'page shown', page: 'Rides' });
74
+ EventLogger.setGlobalConfig('page', 'Rides');
75
+ super.openPage();
76
+ try {
77
+ const service = this.getRideDisplay();
78
+ if (!this.isInitialized) {
79
+ service.init();
80
+ }
81
+ this.registerEventHandlers();
82
+ service.start(simulate);
83
+ sleep(5).then(() => {
84
+ this.updatePageDisplay();
85
+ });
86
+ }
87
+ catch (err) {
88
+ this.logError(err, 'openPage');
89
+ }
90
+ return this.getPageObserver();
91
+ }
92
+ closePage() {
93
+ EventLogger.setGlobalConfig('page', null);
94
+ this.logEvent({ message: 'page closed', page: 'Rides' });
95
+ this.getRideDisplay().stop();
96
+ this.menuProps = null;
97
+ this.isInitialized = false;
98
+ super.closePage();
99
+ }
100
+ pausePage() {
101
+ this.backgroundTimer = setTimeout(() => {
102
+ this.getRideDisplay().pause('user');
103
+ this.backgroundPausedByService = true;
104
+ }, BACKGROUND_PAUSE_TIMEOUT_MS);
105
+ this.isInitialized = false;
106
+ return super.pausePage();
107
+ }
108
+ resumePage() {
109
+ if (this.backgroundTimer) {
110
+ clearTimeout(this.backgroundTimer);
111
+ }
112
+ return super.resumePage();
113
+ }
114
+ getRideObserver() {
115
+ return this.rideObserver;
116
+ }
117
+ getPageDisplayProps() {
118
+ const rideType = this.getRideDisplay().getRideType();
119
+ switch (rideType) {
120
+ case 'Video': return this.getVideoRideDisplayProps();
121
+ default:
122
+ return null;
123
+ }
124
+ }
125
+ onMenuOpen() {
126
+ const state = this.getRideDisplay().getState();
127
+ this.menuProps = { showResume: state === 'Paused' };
128
+ this.updatePageDisplay();
129
+ }
130
+ onMenuClose() {
131
+ this.menuProps = null;
132
+ this.updatePageDisplay();
133
+ }
134
+ onPause() {
135
+ this.getRideDisplay().pause('user');
136
+ this.menuProps = { showResume: false };
137
+ this.updatePageDisplay();
138
+ }
139
+ onResume() {
140
+ this.getRideDisplay().resume();
141
+ this.menuProps = null;
142
+ this.updatePageDisplay();
143
+ }
144
+ onEndRide() {
145
+ this.getRideDisplay().stop();
146
+ this.moveToPreviousPage();
147
+ this.closePage();
148
+ }
149
+ onRetryStart() {
150
+ this.getRideDisplay().retryStart();
151
+ }
152
+ onIgnoreStart() {
153
+ this.getRideDisplay().startWithMissingSensors();
154
+ }
155
+ async onCancelStart() {
156
+ this.rideObserver?.stop();
157
+ await this.getRideDisplay().cancelStart();
158
+ this.moveToPreviousPage();
159
+ this.closePage();
160
+ }
161
+ getVideoRideDisplayProps() {
162
+ const props = this.rideDisplayProps;
163
+ const state = this.getRideDisplay().getState();
164
+ const rideType = this.getRideDisplay().getRideType();
165
+ const isStarting = state === 'Idle' || state === 'Starting' || state === 'Error';
166
+ const displayProps = {
167
+ rideState: state,
168
+ rideType,
169
+ startOverlayProps: isStarting ? this.getRideDisplay().getStartOverlayProps() : null,
170
+ menuProps: this.menuProps,
171
+ video: props.video,
172
+ videos: props.videos,
173
+ route: props.route
174
+ };
175
+ return displayProps;
176
+ }
177
+ getRideType() {
178
+ return this.getRideDisplay().getRideType();
179
+ }
180
+ updatePageDisplay() {
181
+ this.getPageObserver().emit('page-update');
182
+ }
183
+ registerEventHandlers() {
184
+ const events = Object.keys(this.eventHandler);
185
+ events.forEach(event => { this.rideObserver.on(event, this.eventHandler[event]); });
186
+ }
187
+ unregisterEventHandlers() {
188
+ const events = Object.keys(this.eventHandler);
189
+ events.forEach(event => { this.rideObserver.off(event, this.eventHandler[event]); });
190
+ }
191
+ onDisplayStateUpdate(state, props) {
192
+ switch (state) {
193
+ case 'Paused':
194
+ this.menuProps = { showResume: true };
195
+ break;
196
+ case 'Active':
197
+ this.menuProps = null;
198
+ break;
199
+ }
200
+ this.updatePageDisplay();
201
+ }
202
+ onRouteUpdate() {
203
+ this.updatePageDisplay();
204
+ }
205
+ moveToPreviousPage() {
206
+ this.moveTo('$contentPage');
207
+ }
208
+ get rideObserver() {
209
+ return this.getRideDisplay().getObserver();
210
+ }
211
+ get rideDisplayProps() {
212
+ return this.getRideDisplay().getDisplayProperties();
213
+ }
214
+ getRideDisplay() {
215
+ return useRideDisplay();
216
+ }
217
+ };
218
+ return RidePageService = _classThis;
219
+ })();
220
+ export { RidePageService };
221
+ export const getRidePageService = () => new RidePageService();
@@ -0,0 +1 @@
1
+ export {};
@@ -132,12 +132,12 @@ let RLVDisplayService = (() => {
132
132
  }
133
133
  pause() {
134
134
  super.pause();
135
- this.currentVideo.syncHelper.pause();
135
+ this.currentVideo?.syncHelper.pause();
136
136
  this.isVideoPaused = true;
137
137
  }
138
138
  resume() {
139
139
  super.resume();
140
- this.currentVideo.syncHelper.resume();
140
+ this.currentVideo?.syncHelper.resume();
141
141
  this.isVideoPaused = false;
142
142
  }
143
143
  getDisplayProperties(props) {
@@ -154,14 +154,14 @@ let RLVDisplayService = (() => {
154
154
  if (this.videos.length === 1) {
155
155
  const autoConvert = this.currentVideo?.playback === 'converted';
156
156
  const video = {
157
- src: this.currentVideo.source,
157
+ src: this.currentVideo?.source,
158
158
  startTime,
159
159
  autoConvert,
160
160
  info: this.getInfotextDisplayProps(),
161
161
  muted: true,
162
162
  loop: this.isLoopEnabled() ? true : undefined,
163
- playback: this.currentVideo.playback,
164
- observer: this.currentVideo.observer,
163
+ playback: this.currentVideo?.playback,
164
+ observer: this.currentVideo?.observer,
165
165
  onLoaded: this.onVideoLoaded.bind(this),
166
166
  onLoadError: this.onVideoLoadError.bind(this),
167
167
  onPlaybackError: this.onVideoPlaybackError.bind(this),
@@ -236,8 +236,8 @@ let RLVDisplayService = (() => {
236
236
  }
237
237
  onNextVideo() {
238
238
  const old = this.currentVideo;
239
- const next = this.currentVideo.next;
240
- if (!next)
239
+ const next = this.currentVideo?.next;
240
+ if (!next || !old)
241
241
  return;
242
242
  old.isCurrent = false;
243
243
  old.isInitial = false;
@@ -258,13 +258,13 @@ let RLVDisplayService = (() => {
258
258
  this.emit('route-updated', this.getCurrentRoute());
259
259
  this.getCoaches().updateRoute(this.getCurrentRoute());
260
260
  this.logEvent({ message: 'switching to next video', route: this.getCurrentRoute().details.title,
261
- segment: this.currentVideo.route.description.title, offset: this.offset, segmentDistance: this.currentVideo.route.description.distance,
261
+ segment: this.currentVideo?.route.description.title, offset: this.offset, segmentDistance: this.currentVideo?.route.description.distance,
262
262
  totalDistance: this.getCurrentRoute().details.distance });
263
263
  }
264
264
  checkInfotextDisplayProps(time) {
265
265
  if (!this.currentVideo?.info)
266
266
  return;
267
- const info = this.currentVideo.info.find(i => i.start <= time && i.stop > time);
267
+ const info = this.currentVideo?.info.find(i => i.start <= time && i.stop > time);
268
268
  if (info) {
269
269
  this.infotext = info.props;
270
270
  }
@@ -320,7 +320,7 @@ let RLVDisplayService = (() => {
320
320
  }
321
321
  async stop() {
322
322
  try {
323
- this.currentVideo.syncHelper.stop();
323
+ this.currentVideo?.syncHelper.stop();
324
324
  delete this.startTime;
325
325
  await super.stop();
326
326
  }
@@ -336,7 +336,7 @@ let RLVDisplayService = (() => {
336
336
  if (this.currentRoute?.description?.hasGpx && !this.currentRoute?.points?.length) {
337
337
  state = 'Start:Failed';
338
338
  const errMessage = 'Invalid route (GPX missing)';
339
- if (!this.currentVideo.error) {
339
+ if (!this.currentVideo?.error) {
340
340
  this.logError(new Error(errMessage), 'getVideoState', { route: this.currentVideo.route });
341
341
  }
342
342
  this.currentVideo.error = errMessage;
@@ -354,7 +354,7 @@ let RLVDisplayService = (() => {
354
354
  return state;
355
355
  }
356
356
  getVideoLoadProgress() {
357
- return { loaded: this.currentVideo?.loaded, bufferTime: this.currentVideo.bufferTime };
357
+ return { loaded: this.currentVideo?.loaded, bufferTime: this.currentVideo?.bufferTime };
358
358
  }
359
359
  onConvertUpdate(progress, frames, time) {
360
360
  if (!this.currentVideo || this.currentVideo.loaded)
@@ -430,7 +430,7 @@ let RLVDisplayService = (() => {
430
430
  }
431
431
  onVideoEnded(video = this.currentVideo) {
432
432
  video.syncHelper.onVideoEnded();
433
- if (this.currentVideo.next) {
433
+ if (this.currentVideo?.next) {
434
434
  this.onNextVideo();
435
435
  }
436
436
  }
@@ -439,7 +439,7 @@ let RLVDisplayService = (() => {
439
439
  const offset = this.offset ?? 0;
440
440
  const { routeDistance, speed } = activityPos;
441
441
  if (!this.isVideoPaused) {
442
- this.currentVideo.syncHelper.onActivityUpdate(routeDistance - offset, speed);
442
+ this.currentVideo?.syncHelper.onActivityUpdate(routeDistance - offset, speed);
443
443
  }
444
444
  }
445
445
  initVideoSource(video) {
@@ -465,18 +465,21 @@ let RLVDisplayService = (() => {
465
465
  buildVideoError(error, video = this.currentVideo) {
466
466
  const src = this.getVideoUrl(video);
467
467
  const remote = src?.startsWith('http');
468
- switch (error.code) {
469
- case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:
470
- if (error.message.includes('Format error'))
468
+ try {
469
+ switch (error.code) {
470
+ case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:
471
+ if (error.message.includes('Format error'))
472
+ return remote ? 'Could not load video' : 'Could not open video file';
473
+ return 'Could not decode video';
474
+ case MediaError.MEDIA_ERR_NETWORK:
471
475
  return remote ? 'Could not load video' : 'Could not open video file';
472
- return 'Could not decode video';
473
- case MediaError.MEDIA_ERR_NETWORK:
474
- return remote ? 'Could not load video' : 'Could not open video file';
475
- case MediaError.MEDIA_ERR_ABORTED:
476
- return 'The playback was canceled';
477
- case MediaError.MEDIA_ERR_DECODE:
478
- return 'Could not decode video';
476
+ case MediaError.MEDIA_ERR_ABORTED:
477
+ return 'The playback was canceled';
478
+ case MediaError.MEDIA_ERR_DECODE:
479
+ return 'Could not decode video';
480
+ }
479
481
  }
482
+ catch { }
480
483
  return error.message;
481
484
  }
482
485
  getVideoUrl(video) {
@@ -525,11 +528,11 @@ let RLVDisplayService = (() => {
525
528
  let distance = startPos;
526
529
  if (startPos === undefined) {
527
530
  distance = this.isLoopEnabled() ? lapDistance : routeDistance - (this.offset ?? 0);
528
- if (distance > this.currentVideo.route.details.distance) {
531
+ if (distance > this.currentVideo?.route.details.distance) {
529
532
  distance = 0;
530
533
  }
531
534
  }
532
- const routeId = this.currentVideo.route.description.id;
535
+ const routeId = this.currentVideo?.route.description.id;
533
536
  this.getUserSettings().set(`routeSelection.video.prevSetting.${routeId}.startPos`, distance);
534
537
  }
535
538
  catch (err) {
@@ -0,0 +1 @@
1
+ export {};
@@ -40,6 +40,7 @@ import { useUserSettings } from "../../settings";
40
40
  import { Observer } from "../../base/types";
41
41
  import { v4 } from "uuid";
42
42
  import { sleep } from "../../utils/sleep";
43
+ import { useDevicePairing } from "../../devices";
43
44
  let RoutesPageService = (() => {
44
45
  let _classDecorators = [Singleton];
45
46
  let _classDescriptor;
@@ -48,14 +49,17 @@ let RoutesPageService = (() => {
48
49
  let _classSuper = IncyclistPageService;
49
50
  let _instanceExtraInitializers = [];
50
51
  let _getRouteList_decorators;
52
+ let _getDevicePairing_decorators;
51
53
  let _getUserSettings_decorators;
52
54
  var RoutesPageService = class extends _classSuper {
53
55
  static { _classThis = this; }
54
56
  static {
55
57
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
56
58
  _getRouteList_decorators = [Injectable];
59
+ _getDevicePairing_decorators = [Injectable];
57
60
  _getUserSettings_decorators = [Injectable];
58
61
  __esDecorate(this, null, _getRouteList_decorators, { kind: "method", name: "getRouteList", static: false, private: false, access: { has: obj => "getRouteList" in obj, get: obj => obj.getRouteList }, metadata: _metadata }, null, _instanceExtraInitializers);
62
+ __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);
59
63
  __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);
60
64
  __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
61
65
  RoutesPageService = _classThis = _classDescriptor.value;
@@ -141,6 +145,15 @@ let RoutesPageService = (() => {
141
145
  if (card)
142
146
  card.delete();
143
147
  }
148
+ start() {
149
+ const service = this.getRouteList();
150
+ const pairing = this.getDevicePairing();
151
+ const { id, title, videoUrl } = service.getStartSettings() ?? {};
152
+ this.logEvent({ message: 'Attempting to start a ride', id, title, videoUrl, readyToStart: pairing.isReadyToStart(), });
153
+ service.close();
154
+ const next = pairing.isReadyToStart() ? '/rideDeviceOK' : '/pairingStart';
155
+ this.moveTo(next);
156
+ }
144
157
  startImport(info) {
145
158
  if (this.importObserver)
146
159
  return this.importObserver;
@@ -248,6 +261,9 @@ let RoutesPageService = (() => {
248
261
  getRouteList() {
249
262
  return useRouteList();
250
263
  }
264
+ getDevicePairing() {
265
+ return useDevicePairing();
266
+ }
251
267
  getUserSettings() {
252
268
  return useUserSettings();
253
269
  }
@@ -187,7 +187,7 @@ export declare class ActivityRideService extends IncyclistService {
187
187
  protected update(): void;
188
188
  protected isLoop(): boolean;
189
189
  protected createFreeRide(settings: FreeRideStartSettings): Route;
190
- protected getMode(routeType: ActivityRouteType): "video" | "workout" | "free ride" | "follow route";
190
+ protected getMode(routeType: ActivityRouteType): "video" | "workout" | "follow route" | "free ride";
191
191
  protected updateActivityTime(): void;
192
192
  getRideProps(): any;
193
193
  protected logActivityUpdateMessage(): void;
@@ -1,3 +1,4 @@
1
+ import { HealthStatus } from "../../devices";
1
2
  import { Dimension, Unit } from "../../i18n";
2
3
  import { ActivityDetailsUI } from "../base";
3
4
  export type ActivityState = 'ininitalized' | 'active' | 'paused' | 'completed' | 'idle';
@@ -15,3 +16,16 @@ export type ActivityUpdate = {
15
16
  routeDistance: number;
16
17
  distance: number;
17
18
  };
19
+ export interface ActivityDashboardDataItem {
20
+ value: string | number | undefined;
21
+ unit?: string;
22
+ label?: string;
23
+ info?: string;
24
+ }
25
+ export interface ActivityDashboardItem {
26
+ title: string;
27
+ data: ActivityDashboardDataItem[];
28
+ size?: number;
29
+ dataState?: HealthStatus;
30
+ }
31
+ export type ActivityDashboardDisplayProperties = ActivityDashboardItem[];
@@ -0,0 +1 @@
1
+ export * from './ride/types';
@@ -6,6 +6,7 @@ export declare class ConnectedAppService<C extends AppCredentials> extends Incyc
6
6
  protected appKey: string;
7
7
  protected isInitialized: boolean;
8
8
  protected id: any;
9
+ protected credentials: C;
9
10
  constructor(service: any, appKey: string);
10
11
  init(): boolean;
11
12
  connect(credentials: C): Promise<boolean>;
@@ -13,6 +14,7 @@ export declare class ConnectedAppService<C extends AppCredentials> extends Incyc
13
14
  isConnected(): boolean;
14
15
  getCredentials(): C;
15
16
  protected initAuth(): boolean;
17
+ protected checkAuth(): boolean;
16
18
  protected ensureInitialized(): boolean;
17
19
  protected getUserSettings(): import("../../../settings").UserSettingsService;
18
20
  }
@@ -4,7 +4,6 @@ import { KomootAuth, KomootCredentials } from "./types";
4
4
  export declare class KomootAppConnection extends ConnectedAppService<KomootCredentials> {
5
5
  protected _isConnecting: any;
6
6
  protected api: KomootApi;
7
- protected credentials: KomootCredentials;
8
7
  constructor();
9
8
  connect(credentials: KomootCredentials): Promise<boolean>;
10
9
  isConnecting(): boolean;
@@ -12,7 +11,8 @@ export declare class KomootAppConnection extends ConnectedAppService<KomootCrede
12
11
  isConnected(): boolean;
13
12
  getCredentials(): KomootCredentials;
14
13
  getApi(): KomootApi;
15
- protected initAuth(): boolean;
14
+ protected iniAuth(): boolean;
15
+ protected checkAuth(): boolean;
16
16
  protected getAuthConfig(): KomootAuth | KomootCredentials;
17
17
  protected getUuid(): any;
18
18
  protected saveCredentials(): void;
@@ -4,7 +4,6 @@ import { VeloHeroAuth, VeloHeroCredentials } from "./types";
4
4
  export declare class VeloHeroAppConnection extends ConnectedAppService<VeloHeroCredentials> {
5
5
  protected _isConnecting: any;
6
6
  protected api: VeloHeroApi;
7
- protected credentials: VeloHeroCredentials;
8
7
  constructor();
9
8
  connect(credentials: VeloHeroCredentials): Promise<boolean>;
10
9
  isConnecting(): boolean;
@@ -15,5 +15,9 @@ export declare class IncyclistPageService extends IncyclistService implements IP
15
15
  resumePage(): Promise<void>;
16
16
  getPageObserver(): IObserver;
17
17
  protected stopObserver(): void;
18
+ protected getPrevContentPage(): string;
19
+ protected moveTo(route: string, close?: boolean): void;
20
+ protected getUIBinding(): import("../../api").INativeUI;
21
+ protected getBindings(): import("../../api").IncyclistBindings;
18
22
  protected getAppState(): import("../../appstate").AppStateService;
19
23
  }
@@ -13,8 +13,9 @@ export declare class DevicesPageService extends IncyclistPageService {
13
13
  protected openedCapability: IncyclistCapability | undefined;
14
14
  protected openedInterfaceSettings: TInterface;
15
15
  protected interfaceSettingsObserver: Observer | undefined;
16
+ protected isPairingForRide: boolean;
16
17
  constructor();
17
- openPage(): IObserver;
18
+ openPage(forRide?: boolean): IObserver;
18
19
  closePage(): void;
19
20
  pausePage(): Promise<void>;
20
21
  resumePage(): Promise<void>;
@@ -43,14 +44,11 @@ export declare class DevicesPageService extends IncyclistPageService {
43
44
  protected onOK(): void;
44
45
  protected onSimulate(): void;
45
46
  protected onCancel(): void;
46
- protected moveTo(route: string, close?: boolean): void;
47
47
  protected start(): Promise<void>;
48
48
  stop(adapters?: Array<string>, forExit?: boolean): Promise<void>;
49
49
  protected get state(): InternalPairingState;
50
- protected getUIBinding(): import("../../types").INativeUI;
51
50
  protected getDevicePairing(): import("../pairing").DevicePairingService;
52
51
  protected getDeviceConfiguration(): import("../configuration").DeviceConfigurationService;
53
- protected getBindings(): import("../../api").IncyclistBindings;
54
52
  protected getIncyclist(): import("../../ui").UserInterfaceServcie;
55
53
  }
56
54
  export declare const getDevicesPageService: () => DevicesPageService;
@@ -1,2 +1,2 @@
1
1
  export * from './service';
2
- export * from './model';
2
+ export type * from './types';
@@ -1,5 +1,5 @@
1
1
  import { AdapterInfo, IncyclistDeviceSettings } from "../configuration";
2
- import { AdapterRideInfo, AdapterStateInfo, LegacyRoute, PreparedRoute, RideServiceCheckFilter, RideServiceDeviceProperties } from "./model";
2
+ import { AdapterRideInfo, AdapterStateInfo, LegacyRoute, PreparedRoute, RideServiceCheckFilter, RideServiceDeviceProperties } from "./types";
3
3
  import { CyclingMode, DeviceData, DeviceSettings, ICyclingMode, IncyclistCapability, IncyclistDeviceAdapter, UpdateRequest } from "incyclist-devices";
4
4
  import { IncyclistService } from "../../base/service";
5
5
  import { Route } from "../../routes/base/model/route";
@@ -0,0 +1,54 @@
1
+ import { DeviceProperties } from "incyclist-devices";
2
+ import { AdapterInfo, ExtendedIncyclistCapability } from "../configuration";
3
+ import { Route } from "../../routes/base/model/route";
4
+ import { RouteApiDetail } from "../../routes/base/api/types";
5
+ export type HealthStatus = 'green' | 'amber' | 'red';
6
+ export interface AdapterRideInfo extends AdapterInfo {
7
+ isStarted: boolean;
8
+ tsLastData?: number;
9
+ isHealthy?: boolean;
10
+ isRestarting?: boolean;
11
+ dataStatus?: HealthStatus;
12
+ ivToCheck?: NodeJS.Timeout;
13
+ isControl?: boolean;
14
+ }
15
+ export interface AdapterStateInfo {
16
+ udid: string;
17
+ name: string;
18
+ isControl: boolean;
19
+ capabilities: Array<ExtendedIncyclistCapability>;
20
+ isStarted: boolean;
21
+ }
22
+ export interface LegacyRoute {
23
+ get(): RouteApiDetail;
24
+ isLap(): boolean;
25
+ getTitle(): string;
26
+ }
27
+ export interface RideServiceDeviceProperties extends DeviceProperties {
28
+ forceErgMode?: boolean;
29
+ startPos?: number;
30
+ realityFactor?: number;
31
+ rideMode?: string;
32
+ route?: Route | LegacyRoute;
33
+ }
34
+ export interface RideServiceCheckFilter {
35
+ interface?: string;
36
+ interfaces?: string[];
37
+ udid?: string;
38
+ }
39
+ export interface Point {
40
+ elevation: number;
41
+ distance: number;
42
+ }
43
+ export interface PreparedRoute {
44
+ name: string;
45
+ description: string;
46
+ programId: number;
47
+ type: string;
48
+ totalDistance: number;
49
+ lapMode: boolean;
50
+ minElevation: number;
51
+ maxElevation: number;
52
+ sampleRate: number;
53
+ points: Point[];
54
+ }
@@ -1 +1,2 @@
1
1
  export type * from './page/types';
2
+ export type * from './ride/types';
@@ -115,7 +115,7 @@ export declare class RideDisplayService extends IncyclistService implements ICur
115
115
  protected isStartDeviceCompleted(): boolean;
116
116
  protected isStartDeviceReadyToStart(): boolean;
117
117
  protected isSensorsReadyToStart(): boolean;
118
- protected getStartOverlayProps: () => StartOverlayProps;
118
+ getStartOverlayProps: () => StartOverlayProps;
119
119
  protected getDeviceStartSettings(): any;
120
120
  protected isSimulator(): boolean;
121
121
  protected getBike(): string;
@@ -1,2 +1,3 @@
1
1
  export * from './base';
2
2
  export * from './display';
3
+ export * from './page';
@@ -0,0 +1 @@
1
+ export * from './service';