incyclist-services 1.7.38 → 1.7.40

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.
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -279,7 +279,8 @@ let RidePageService = (() => {
279
279
  startGateProps: this.startGateProps,
280
280
  startOverlayProps: isStarting ? this.getRideDisplay().getStartOverlayProps() : null,
281
281
  menuProps: this.menuProps,
282
- gpx: props
282
+ rideView: props.rideView,
283
+ route: props.route
283
284
  };
284
285
  return displayProps;
285
286
  }
@@ -6,7 +6,7 @@ class FollowRouteDisplayService extends GpxDisplayService_1.GpxDisplayService {
6
6
  getLogProps() {
7
7
  const route = this.route;
8
8
  const settings = this.startSettings;
9
- const rideView = this.getUserSettings().get('preferences.rideView', undefined) ?? 'sv(default)';
9
+ const rideView = this.getRideView();
10
10
  const bikeProps = this.getBikeLogProps();
11
11
  const props = {
12
12
  mode: 'follow route',
@@ -35,6 +35,7 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.GpxDisplayService = void 0;
38
+ const api_1 = require("../../api");
38
39
  const apps_1 = require("../../apps");
39
40
  const decorators_1 = require("../../base/decorators");
40
41
  const types_1 = require("../../base/types");
@@ -49,13 +50,16 @@ let GpxDisplayService = (() => {
49
50
  let _instanceExtraInitializers = [];
50
51
  let _getUserSettings_decorators;
51
52
  let _getGoogleMaps_decorators;
53
+ let _getBindings_decorators;
52
54
  return class GpxDisplayService extends _classSuper {
53
55
  static {
54
56
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
55
57
  _getUserSettings_decorators = [decorators_1.Injectable];
56
58
  _getGoogleMaps_decorators = [decorators_1.Injectable];
59
+ _getBindings_decorators = [decorators_1.Injectable];
57
60
  __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);
58
61
  __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);
62
+ __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);
59
63
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
60
64
  }
61
65
  mapLoaded = (__runInitializers(this, _instanceExtraInitializers), false);
@@ -74,7 +78,7 @@ let GpxDisplayService = (() => {
74
78
  }
75
79
  initView() {
76
80
  try {
77
- const rideView = this.getUserSettings().get('preferences.rideView', 'sv');
81
+ const rideView = this.getRideView();
78
82
  if (rideView === 'sv') {
79
83
  const updateFreq = this.getDefaultUpdateFrequency();
80
84
  const minimalPause = this.getMinimalPause();
@@ -115,22 +119,30 @@ let GpxDisplayService = (() => {
115
119
  };
116
120
  }
117
121
  getStartOverlayProps() {
118
- const rideView = this.getUserSettings().get('preferences.rideView', 'sv');
122
+ const rideView = this.getRideView();
119
123
  if (rideView === 'map') {
120
- return {};
124
+ return {
125
+ mapType: this.getRideViewName(),
126
+ mapState: 'Loaded'
127
+ };
121
128
  }
122
129
  return {
123
- mapType: rideView === 'sv' ? 'StreetView' : 'SatelliteView',
130
+ mapType: this.getRideViewName(),
124
131
  mapState: this.mapLoaded ? 'Loaded' : 'Loading',
125
132
  mapStateError: this.mapError
126
133
  };
127
134
  }
128
135
  isStartRideCompleted() {
136
+ const rideView = this.getRideView();
137
+ if (rideView === 'map') {
138
+ this.mapLoaded = true;
139
+ return true;
140
+ }
129
141
  return this.mapLoaded;
130
142
  }
131
143
  getDisplayProperties(props) {
132
144
  let routeProps = super.getDisplayProperties(props);
133
- const rideView = this.getUserSettings().get('preferences.rideView', 'sv');
145
+ const rideView = this.getRideView();
134
146
  if (rideView === 'sv') {
135
147
  routeProps = { ...routeProps, ...this.getStreetViewProps(props) };
136
148
  }
@@ -145,6 +157,21 @@ let GpxDisplayService = (() => {
145
157
  ...routeProps
146
158
  };
147
159
  }
160
+ getRideView() {
161
+ if (this.isMobile())
162
+ return 'map';
163
+ const rideView = this.getUserSettings().get('preferences.rideView', 'sv');
164
+ return rideView;
165
+ }
166
+ getRideViewName() {
167
+ const rideView = this.getRideView();
168
+ const map = {
169
+ map: 'Map',
170
+ sv: 'Street View',
171
+ sat: 'Satellite View'
172
+ };
173
+ return map?.[rideView] ?? rideView;
174
+ }
148
175
  onSatelliteViewEvent(state, error) {
149
176
  if (state === 'Loaded') {
150
177
  this.mapLoaded = true;
@@ -232,7 +259,7 @@ let GpxDisplayService = (() => {
232
259
  }
233
260
  onPositionUpdate(state) {
234
261
  const { route, position } = state ?? {};
235
- const rideView = this.getUserSettings().getValue('preferences.rideView', 'sv');
262
+ const rideView = this.getRideView();
236
263
  if (rideView === 'sv') {
237
264
  const sincePrev = Date.now() - (this.tsPrevSVUpdate ?? 0);
238
265
  if (sincePrev > this.getStreetViewUpdateDelay() - 25) {
@@ -275,12 +302,18 @@ let GpxDisplayService = (() => {
275
302
  }
276
303
  catch { }
277
304
  }
305
+ isMobile() {
306
+ return this.getBindings().appInfo?.getChannel() === 'mobile';
307
+ }
278
308
  getUserSettings() {
279
309
  return (0, settings_1.useUserSettings)();
280
310
  }
281
311
  getGoogleMaps() {
282
312
  return (0, apps_1.useGoogleMaps)();
283
313
  }
314
+ getBindings() {
315
+ return (0, api_1.getBindings)();
316
+ }
284
317
  };
285
318
  })();
286
319
  exports.GpxDisplayService = GpxDisplayService;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -276,7 +276,8 @@ let RidePageService = (() => {
276
276
  startGateProps: this.startGateProps,
277
277
  startOverlayProps: isStarting ? this.getRideDisplay().getStartOverlayProps() : null,
278
278
  menuProps: this.menuProps,
279
- gpx: props
279
+ rideView: props.rideView,
280
+ route: props.route
280
281
  };
281
282
  return displayProps;
282
283
  }
@@ -3,7 +3,7 @@ export class FollowRouteDisplayService extends GpxDisplayService {
3
3
  getLogProps() {
4
4
  const route = this.route;
5
5
  const settings = this.startSettings;
6
- const rideView = this.getUserSettings().get('preferences.rideView', undefined) ?? 'sv(default)';
6
+ const rideView = this.getRideView();
7
7
  const bikeProps = this.getBikeLogProps();
8
8
  const props = {
9
9
  mode: 'follow route',
@@ -32,6 +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 { getBindings } from "../../api";
35
36
  import { useGoogleMaps } from "../../apps";
36
37
  import { Injectable } from "../../base/decorators";
37
38
  import { Observer } from "../../base/types";
@@ -46,13 +47,16 @@ let GpxDisplayService = (() => {
46
47
  let _instanceExtraInitializers = [];
47
48
  let _getUserSettings_decorators;
48
49
  let _getGoogleMaps_decorators;
50
+ let _getBindings_decorators;
49
51
  return class GpxDisplayService extends _classSuper {
50
52
  static {
51
53
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
52
54
  _getUserSettings_decorators = [Injectable];
53
55
  _getGoogleMaps_decorators = [Injectable];
56
+ _getBindings_decorators = [Injectable];
54
57
  __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);
55
58
  __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);
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);
56
60
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
57
61
  }
58
62
  mapLoaded = (__runInitializers(this, _instanceExtraInitializers), false);
@@ -71,7 +75,7 @@ let GpxDisplayService = (() => {
71
75
  }
72
76
  initView() {
73
77
  try {
74
- const rideView = this.getUserSettings().get('preferences.rideView', 'sv');
78
+ const rideView = this.getRideView();
75
79
  if (rideView === 'sv') {
76
80
  const updateFreq = this.getDefaultUpdateFrequency();
77
81
  const minimalPause = this.getMinimalPause();
@@ -112,22 +116,30 @@ let GpxDisplayService = (() => {
112
116
  };
113
117
  }
114
118
  getStartOverlayProps() {
115
- const rideView = this.getUserSettings().get('preferences.rideView', 'sv');
119
+ const rideView = this.getRideView();
116
120
  if (rideView === 'map') {
117
- return {};
121
+ return {
122
+ mapType: this.getRideViewName(),
123
+ mapState: 'Loaded'
124
+ };
118
125
  }
119
126
  return {
120
- mapType: rideView === 'sv' ? 'StreetView' : 'SatelliteView',
127
+ mapType: this.getRideViewName(),
121
128
  mapState: this.mapLoaded ? 'Loaded' : 'Loading',
122
129
  mapStateError: this.mapError
123
130
  };
124
131
  }
125
132
  isStartRideCompleted() {
133
+ const rideView = this.getRideView();
134
+ if (rideView === 'map') {
135
+ this.mapLoaded = true;
136
+ return true;
137
+ }
126
138
  return this.mapLoaded;
127
139
  }
128
140
  getDisplayProperties(props) {
129
141
  let routeProps = super.getDisplayProperties(props);
130
- const rideView = this.getUserSettings().get('preferences.rideView', 'sv');
142
+ const rideView = this.getRideView();
131
143
  if (rideView === 'sv') {
132
144
  routeProps = { ...routeProps, ...this.getStreetViewProps(props) };
133
145
  }
@@ -142,6 +154,21 @@ let GpxDisplayService = (() => {
142
154
  ...routeProps
143
155
  };
144
156
  }
157
+ getRideView() {
158
+ if (this.isMobile())
159
+ return 'map';
160
+ const rideView = this.getUserSettings().get('preferences.rideView', 'sv');
161
+ return rideView;
162
+ }
163
+ getRideViewName() {
164
+ const rideView = this.getRideView();
165
+ const map = {
166
+ map: 'Map',
167
+ sv: 'Street View',
168
+ sat: 'Satellite View'
169
+ };
170
+ return map?.[rideView] ?? rideView;
171
+ }
145
172
  onSatelliteViewEvent(state, error) {
146
173
  if (state === 'Loaded') {
147
174
  this.mapLoaded = true;
@@ -229,7 +256,7 @@ let GpxDisplayService = (() => {
229
256
  }
230
257
  onPositionUpdate(state) {
231
258
  const { route, position } = state ?? {};
232
- const rideView = this.getUserSettings().getValue('preferences.rideView', 'sv');
259
+ const rideView = this.getRideView();
233
260
  if (rideView === 'sv') {
234
261
  const sincePrev = Date.now() - (this.tsPrevSVUpdate ?? 0);
235
262
  if (sincePrev > this.getStreetViewUpdateDelay() - 25) {
@@ -272,12 +299,18 @@ let GpxDisplayService = (() => {
272
299
  }
273
300
  catch { }
274
301
  }
302
+ isMobile() {
303
+ return this.getBindings().appInfo?.getChannel() === 'mobile';
304
+ }
275
305
  getUserSettings() {
276
306
  return useUserSettings();
277
307
  }
278
308
  getGoogleMaps() {
279
309
  return useGoogleMaps();
280
310
  }
311
+ getBindings() {
312
+ return getBindings();
313
+ }
281
314
  };
282
315
  })();
283
316
  export { GpxDisplayService };
@@ -7,7 +7,7 @@ import { Step } from '../../../../workouts';
7
7
  export declare class IncyclistAttribution extends AbstractSource {
8
8
  toXml(): string;
9
9
  constructor();
10
- protected getAppInfo(): import("../../../../api/appInfo").IAppInfo;
10
+ protected getAppInfo(): import("../../../../api").IAppInfo;
11
11
  protected getBindings(): import("../../../../api").IncyclistBindings;
12
12
  }
13
13
  export declare class TcxConverter implements IActivityConverter {
@@ -1,6 +1,6 @@
1
1
  import type { IAppInfo } from '../appInfo';
2
2
  import type { IDownloadManager } from '../download';
3
- import type { IFormPostBinding } from '../form';
3
+ import type { IFormPostBinding } from '../form/types';
4
4
  import type { IFileSystem } from '../fs';
5
5
  import type { ILogBinding } from '../logging/types';
6
6
  import type { IMessageQueueBinding } from '../mq';
@@ -0,0 +1,14 @@
1
+ export type * from '../appInfo';
2
+ export type * from '../download';
3
+ export type * from '../form/types';
4
+ export type * from '../fs';
5
+ export type * from '../logging/types';
6
+ export type * from '../mq';
7
+ export type { IPathBinding } from '../path';
8
+ export type * from '../repository/types';
9
+ export type * from '../ui';
10
+ export type * from '../video';
11
+ export type * from '../secret';
12
+ export type { ISerialBinding } from '../serial/types';
13
+ export type * from '../crypto/types';
14
+ export type { IUserSettingsBinding } from './index';
@@ -0,0 +1,6 @@
1
+ export interface Form {
2
+ }
3
+ export interface IFormPostBinding {
4
+ createForm(opts: any, uploadInfo: any): Promise<Form>;
5
+ post(opts: Form): any;
6
+ }
@@ -4,3 +4,4 @@ export type * from './repository/types';
4
4
  export type * from './path';
5
5
  export type * from './video';
6
6
  export type * from './crypto/types';
7
+ export type * from './bindings/types';
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance, AxiosResponse } from "axios";
2
- import { Form } from "../../../api/form";
2
+ import type { Form } from "../../../api/form/types";
3
3
  export declare class AppApiBase {
4
4
  protected api: AxiosInstance;
5
5
  protected getBaseUrl(): string;
@@ -9,5 +9,5 @@ export declare class AppApiBase {
9
9
  protected createForm(url: string, uploadInfo: object, requestOpts?: {}): Promise<Form>;
10
10
  protected getApi(): AxiosInstance;
11
11
  protected getUserSettings(): import("../../../settings").UserSettingsService;
12
- protected getFormBinding(): import("../../../api/form").IFormPostBinding;
12
+ protected getFormBinding(): import("../../../api").IFormPostBinding;
13
13
  }
@@ -12,7 +12,7 @@ export declare class GoogleMapsService extends IncyclistService {
12
12
  getMapsDownloadUrl(): any;
13
13
  reload(): void;
14
14
  protected getSecret(key: string): string;
15
- protected getSecretBindings(): import("../../api/secret").ISecretBinding;
15
+ protected getSecretBindings(): import("../../api").ISecretBinding;
16
16
  protected getUserSettings(): import("../../settings").UserSettingsService;
17
17
  }
18
18
  export declare const useGoogleMaps: () => GoogleMapsService;
@@ -19,5 +19,5 @@ export declare class IntervalsAppConnection extends ConnectedAppService<Interval
19
19
  accessToken: string;
20
20
  };
21
21
  protected initApi(config: IntervalsConfig): void;
22
- protected getSecretBindings(): import("../../api/secret").ISecretBinding;
22
+ protected getSecretBindings(): import("../../api").ISecretBinding;
23
23
  }
@@ -21,5 +21,5 @@ export declare class KomootAppConnection extends ConnectedAppService<KomootCrede
21
21
  protected getCrypto(): any;
22
22
  protected encrypt(algo: string): KomootAuth;
23
23
  protected decrypt(algo: string, auth: KomootAuth): KomootCredentials;
24
- protected getSecretBindings(): import("../../api/secret").ISecretBinding;
24
+ protected getSecretBindings(): import("../../api").ISecretBinding;
25
25
  }
@@ -24,5 +24,5 @@ export declare class StravaAppConnection extends ConnectedAppService<StravaCrede
24
24
  expiration: Date;
25
25
  };
26
26
  protected initApi(config: StravaConfig): void;
27
- protected getSecretBindings(): import("../../api/secret").ISecretBinding;
27
+ protected getSecretBindings(): import("../../api").ISecretBinding;
28
28
  }
@@ -20,5 +20,5 @@ export declare class VeloHeroAppConnection extends ConnectedAppService<VeloHeroC
20
20
  protected getCrypto(): any;
21
21
  protected encrypt(algo: string): VeloHeroAuth;
22
22
  protected decrypt(algo: string, auth: VeloHeroAuth): VeloHeroCredentials;
23
- protected getSecretBindings(): import("../../api/secret").ISecretBinding;
23
+ protected getSecretBindings(): import("../../api").ISecretBinding;
24
24
  }
@@ -99,8 +99,9 @@ export interface MapOverlayDisplayProps extends OverlayDisplayProps {
99
99
  bounds?: Number[][];
100
100
  onViewportChange?: (viewport: MapViewPort) => void;
101
101
  }
102
+ export type RideViewType = 'sv' | 'map' | 'sat';
102
103
  export interface GpxDisplayProps extends RouteDisplayProps {
103
- rideView: 'sv' | 'map' | 'sat';
104
+ rideView: RideViewType;
104
105
  }
105
106
  export interface RouteOptionDisplayProps {
106
107
  optionsDelay?: number;
@@ -1,7 +1,7 @@
1
1
  import { IPageService } from "../../base/pages";
2
2
  import { Route } from "../../routes/base/model/route";
3
3
  import { IObserver } from "../../types";
4
- import { CurrentRideState, GpxDisplayProps, GPXStartOverlayProps, RideType, StartOverlayProps, VideoDisplayProps, VideoStartOverlayProps } from "../types";
4
+ import { CurrentRideState, GPXStartOverlayProps, RideType, RideViewType, StartOverlayProps, VideoDisplayProps, VideoStartOverlayProps } from "../types";
5
5
  export interface StartGateProps {
6
6
  title: string;
7
7
  body: string;
@@ -19,7 +19,7 @@ export interface VideoRidePageDisplayProps extends RidePageDisplayProps {
19
19
  videos?: VideoDisplayProps[];
20
20
  }
21
21
  export interface GPXRidePageDisplayProps extends RidePageDisplayProps {
22
- gpx?: GpxDisplayProps;
22
+ rideView?: RideViewType;
23
23
  }
24
24
  export type AnyRidePageDisplayProps = VideoRidePageDisplayProps | RidePageDisplayProps;
25
25
  export interface RideMenuProps {
@@ -33,8 +33,8 @@ export declare class GpxDisplayService extends RouteDisplayService {
33
33
  displayPosition: import("../base").CurrentPosition;
34
34
  };
35
35
  getStartOverlayProps(): {
36
- mapType?: undefined;
37
- mapState?: undefined;
36
+ mapType: string;
37
+ mapState: string;
38
38
  mapStateError?: undefined;
39
39
  } | {
40
40
  mapType: string;
@@ -43,6 +43,8 @@ export declare class GpxDisplayService extends RouteDisplayService {
43
43
  };
44
44
  isStartRideCompleted(): boolean;
45
45
  getDisplayProperties(props: CurrentRideDisplayProps): GpxDisplayProps;
46
+ protected getRideView(): string;
47
+ protected getRideViewName(): string;
46
48
  protected onSatelliteViewEvent(state: SatelliteViewEvent, error?: string): void;
47
49
  protected onMapViewEvent(state: SatelliteViewEvent, error?: string): void;
48
50
  protected onStreetViewEvent(event: StreetViewEvent, data: any): void;
@@ -53,6 +55,8 @@ export declare class GpxDisplayService extends RouteDisplayService {
53
55
  protected getMinimalPause(): number;
54
56
  protected getBestCaseUpdateFrequency(): number;
55
57
  protected getNumSetting(key: string): number;
58
+ protected isMobile(): boolean;
56
59
  protected getUserSettings(): UserSettingsService;
57
60
  protected getGoogleMaps(): GoogleMapsService;
61
+ protected getBindings(): import("../../api").IncyclistBindings;
58
62
  }
@@ -63,7 +63,7 @@ export declare class RouteDisplayService extends RideModeService {
63
63
  protected getRouteList(): import("../../routes").RouteListService;
64
64
  protected getActiveRides(): import("../../activities").ActiveRidesService;
65
65
  protected getDeviceRide(): import("../../devices").DeviceRideService;
66
- protected getAppInfo(): import("../../api/appInfo").IAppInfo;
66
+ protected getAppInfo(): import("../../api").IAppInfo;
67
67
  protected getUnitConversionShortcuts(): any[];
68
68
  protected getUnitConverter(): import("../../i18n").UnitConverterService;
69
69
  }
@@ -24,5 +24,5 @@ export declare class EPMParser extends XMLParser {
24
24
  protected buildInfo(context: EpmParserContext): Promise<RouteInfo>;
25
25
  validate(context: EpmParserContext): void;
26
26
  protected getChannel(): AppChannel;
27
- protected getAppInfo(): import("../../../api/appInfo").IAppInfo;
27
+ protected getAppInfo(): import("../../../api").IAppInfo;
28
28
  }
@@ -38,7 +38,7 @@ export declare class StravaActivityLoader extends Loader<Activity> {
38
38
  protected getCredentials(): StravaAuth;
39
39
  protected getSecret(key: string): string;
40
40
  protected getApi(): StravaApi;
41
- getSecretBindings(): import("../../../api/secret").ISecretBinding;
41
+ getSecretBindings(): import("../../../api").ISecretBinding;
42
42
  protected getUserSettings(): import("../../../settings").UserSettingsService;
43
43
  }
44
44
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-services",
3
- "version": "1.7.38",
3
+ "version": "1.7.40",
4
4
  "peerDependencies": {
5
5
  "gd-eventlog": "^0.1.27"
6
6
  },