incyclist-services 1.9.12 → 1.9.13

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 (37) hide show
  1. package/lib/cjs/apps/googleMaps/consts.js +10 -0
  2. package/lib/cjs/apps/googleMaps/index.js +1 -0
  3. package/lib/cjs/apps/googleMaps/service.js +46 -1
  4. package/lib/cjs/ride/display/service.js +95 -0
  5. package/lib/cjs/ride/index.js +1 -0
  6. package/lib/cjs/ride/page/service.js +69 -1
  7. package/lib/cjs/ride/route/GpxDisplayService.js +46 -1
  8. package/lib/cjs/ride/view-restriction/index.js +18 -0
  9. package/lib/cjs/ride/view-restriction/service.js +221 -0
  10. package/lib/cjs/ride/view-restriction/types.js +2 -0
  11. package/lib/cjs/settings/display/ride/service.js +22 -4
  12. package/lib/esm/apps/googleMaps/consts.js +7 -0
  13. package/lib/esm/apps/googleMaps/index.js +1 -0
  14. package/lib/esm/apps/googleMaps/service.js +46 -1
  15. package/lib/esm/ride/display/service.js +95 -0
  16. package/lib/esm/ride/index.js +1 -0
  17. package/lib/esm/ride/page/service.js +69 -1
  18. package/lib/esm/ride/route/GpxDisplayService.js +46 -1
  19. package/lib/esm/ride/view-restriction/index.js +2 -0
  20. package/lib/esm/ride/view-restriction/service.js +217 -0
  21. package/lib/esm/ride/view-restriction/types.js +1 -0
  22. package/lib/esm/settings/display/ride/service.js +20 -2
  23. package/lib/types/apps/googleMaps/consts.d.ts +7 -0
  24. package/lib/types/apps/googleMaps/index.d.ts +1 -0
  25. package/lib/types/apps/googleMaps/service.d.ts +8 -0
  26. package/lib/types/ride/base/types.d.ts +3 -0
  27. package/lib/types/ride/display/service.d.ts +15 -0
  28. package/lib/types/ride/index.d.ts +1 -0
  29. package/lib/types/ride/page/service.d.ts +10 -0
  30. package/lib/types/ride/page/types.d.ts +10 -0
  31. package/lib/types/ride/route/GpxDisplayService.d.ts +5 -0
  32. package/lib/types/ride/view-restriction/index.d.ts +2 -0
  33. package/lib/types/ride/view-restriction/service.d.ts +30 -0
  34. package/lib/types/ride/view-restriction/types.d.ts +57 -0
  35. package/lib/types/settings/display/ride/service.d.ts +1 -0
  36. package/lib/types/settings/display/ride/types.d.ts +4 -0
  37. package/package.json +3 -3
@@ -12,6 +12,7 @@ import { RouteListService } from "../../routes/list/service";
12
12
  import type { Route } from "../../routes/base/model/route";
13
13
  import type { VideoDisplayProps } from "../base/types";
14
14
  import type { RouteVideoState } from "../../routes/video-availability/types";
15
+ import type { RideViewNoticeActionId, RideViewRestrictionDialogProps } from "../view-restriction/types";
15
16
  export declare class RidePageService extends IncyclistPageService implements IRidePageService {
16
17
  protected eventHandler: Record<string, any>;
17
18
  protected workoutEventHandler: Record<string, any>;
@@ -26,6 +27,7 @@ export declare class RidePageService extends IncyclistPageService implements IRi
26
27
  protected prevRidesVisibleRows: number;
27
28
  protected prevRidesMode: 'condensed' | 'list';
28
29
  protected gestureHintDismissed: boolean;
30
+ protected rideViewRestrictionDialog: RideViewRestrictionDialogProps | null;
29
31
  protected prevRidesShown: boolean;
30
32
  protected nearbyRiders?: RidePageDisplayProps['nearbyRiders'];
31
33
  protected nearbyRidersSubscribed: boolean;
@@ -62,6 +64,14 @@ export declare class RidePageService extends IncyclistPageService implements IRi
62
64
  protected getVideoEntryRouteId(entry: VideoDisplayProps): string | undefined;
63
65
  protected getActiveVideoPaths(video: VideoDisplayProps | undefined, videos: Array<VideoDisplayProps> | undefined): Array<string>;
64
66
  protected getGPXRideDisplayProps(): GPXRidePageDisplayProps;
67
+ protected canShowRideViewRestrictionNotice(base: ReturnType<RidePageService['buildBaseDisplayProps']>): boolean;
68
+ onRideViewNoticeAction(id: RideViewNoticeActionId): void;
69
+ onRideViewNoticeClosed(): void;
70
+ onOpenRideViewRestrictionDialog(): void;
71
+ onCloseRideViewRestrictionDialog(): void;
72
+ onRideViewReminderChanged(enabled: boolean): void;
73
+ onDiscardSimulatedRide(): Promise<void>;
74
+ protected openRideViewRestrictionDialog(): void;
65
75
  protected buildWorkoutOverlayProps(props: CurrentRideDisplayProps & {
66
76
  showWorkout?: boolean;
67
77
  }): Partial<RidePageDisplayProps>;
@@ -6,6 +6,7 @@ import type { LoadButtonMode, PowerAdjustmentResult } from "../../workouts/ride/
6
6
  import type { WorkoutGraphPlanBar } from "../../workouts/base/graph/types";
7
7
  import type { Avatar } from "../../avatars";
8
8
  import type { ActiveRideListAvatar } from "../../activities";
9
+ import type { RideViewNoticeActionId, RideViewRestriction, RideViewRestrictionDialogProps, RideViewRestrictionNoticeProps } from "../view-restriction/types";
9
10
  export interface StartGateProps {
10
11
  title: string;
11
12
  body: string;
@@ -113,6 +114,9 @@ export interface GPXRidePageDisplayProps extends RidePageDisplayProps {
113
114
  ts: number;
114
115
  };
115
116
  svHasCoverage?: boolean;
117
+ rideViewRestriction?: RideViewRestriction;
118
+ rideViewRestrictionNotice?: RideViewRestrictionNoticeProps;
119
+ rideViewRestrictionDialog?: RideViewRestrictionDialogProps | null;
116
120
  }
117
121
  export type AnyRidePageDisplayProps = VideoRidePageDisplayProps | GPXRidePageDisplayProps | RidePageDisplayProps;
118
122
  interface RidePageCallbacks {
@@ -127,6 +131,12 @@ interface RidePageCallbacks {
127
131
  onEndRide(): void;
128
132
  onRefreshSecrets(): void;
129
133
  onContinueAnyway(): void;
134
+ onRideViewNoticeAction(id: RideViewNoticeActionId): void;
135
+ onRideViewNoticeClosed(): void;
136
+ onOpenRideViewRestrictionDialog(): void;
137
+ onCloseRideViewRestrictionDialog(): void;
138
+ onRideViewReminderChanged(enabled: boolean): void;
139
+ onDiscardSimulatedRide(): Promise<void>;
130
140
  onStop(): void;
131
141
  onStopWorkout(): void;
132
142
  onStepBack(): void;
@@ -39,6 +39,7 @@ export declare class GpxDisplayService extends RouteDisplayService {
39
39
  ts: number;
40
40
  };
41
41
  protected svHasCoverage: boolean;
42
+ protected restrictionEvaluated: boolean;
42
43
  protected svPhaseDelayTimeout: NodeJS.Timeout;
43
44
  protected svSlowTimeout: NodeJS.Timeout;
44
45
  protected svStartTimeout: NodeJS.Timeout;
@@ -46,6 +47,9 @@ export declare class GpxDisplayService extends RouteDisplayService {
46
47
  constructor();
47
48
  protected initView(): void;
48
49
  getStreetViewProps(rideProps: CurrentRideDisplayProps): any;
50
+ start(): void;
51
+ protected startViewRestriction(): void;
52
+ protected endViewRestriction(): void;
49
53
  isSideViewsSupported(): boolean;
50
54
  protected getInitialStreetViewPosition(): CurrentPosition;
51
55
  protected getSatelliteViewPosition(): CurrentPosition;
@@ -132,5 +136,6 @@ export declare class GpxDisplayService extends RouteDisplayService {
132
136
  protected getGoogleMaps(): GoogleMapsService;
133
137
  protected getBindings(): import("../../api").IncyclistBindings;
134
138
  protected getRideSettingsDisplay(): import("../../settings/display").RideSettingsDisplayService;
139
+ protected getRideViewRestriction(): import("../view-restriction/service").RideViewRestrictionService;
135
140
  protected getAppState(): import("../../appstate").AppStateService;
136
141
  }
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './service';
@@ -0,0 +1,30 @@
1
+ import { IncyclistService } from '../../base/service';
2
+ import { RideViewDeviceOption, RideViewNoticeActionId, RideViewOwnKeyOption, RideViewRestriction, RideViewRestrictionDialogProps, RideViewRestrictionNoticeProps, RideViewRestrictionStartProps } from './types';
3
+ type NoticeState = 'inactive' | 'armed' | 'due' | 'acknowledged' | 'closed';
4
+ export declare class RideViewRestrictionService extends IncyclistService {
5
+ protected restriction?: RideViewRestriction;
6
+ protected noticeState: NoticeState;
7
+ protected noticeId: number;
8
+ constructor();
9
+ beginRide(props: RideViewRestrictionStartProps): void;
10
+ onRideStarted(): void;
11
+ endRide(): void;
12
+ getActiveRestriction(): RideViewRestriction | undefined;
13
+ getNotice(): RideViewRestrictionNoticeProps | undefined;
14
+ onNoticeAction(id: RideViewNoticeActionId): void;
15
+ onNoticeClosed(): void;
16
+ isReminderEnabled(): boolean;
17
+ setReminderEnabled(enabled: boolean): void;
18
+ getDialogProps(props?: {
19
+ inRide?: boolean;
20
+ }): RideViewRestrictionDialogProps;
21
+ protected isNoticeWanted(restriction: RideViewRestriction): boolean;
22
+ protected getDeviceOption(inRide: boolean): RideViewDeviceOption;
23
+ protected getOwnKeyOption(): RideViewOwnKeyOption;
24
+ protected isMobile(): boolean;
25
+ protected getAppState(): import("../../appstate/service").AppStateService;
26
+ protected getGoogleMaps(): import("../../apps/googleMaps/service").GoogleMapsService;
27
+ protected getBindings(): import("../../api").IncyclistBindings;
28
+ }
29
+ export declare const useRideViewRestriction: () => RideViewRestrictionService;
30
+ export {};
@@ -0,0 +1,57 @@
1
+ export type RideViewRestrictionCause = 'simulation';
2
+ export type RideViewRestrictionView = 'sv' | 'sat' | 'map';
3
+ export interface RideViewRestriction {
4
+ cause: RideViewRestrictionCause;
5
+ preferredView: RideViewRestrictionView;
6
+ }
7
+ export interface RideViewRestrictionStartProps {
8
+ simulated: boolean;
9
+ preferredView: RideViewRestrictionView;
10
+ }
11
+ export type RideViewNoticeActionId = 'how-to' | 'dont-show-again' | 'change-this';
12
+ export interface RideViewRestrictionNoticeProps {
13
+ id: number;
14
+ state: 'message' | 'acknowledged';
15
+ text?: string;
16
+ actions: Array<{
17
+ id: RideViewNoticeActionId;
18
+ label: string;
19
+ }>;
20
+ }
21
+ export interface RideViewDeviceOption {
22
+ id: 'device';
23
+ heading?: string;
24
+ text: string;
25
+ discard?: {
26
+ label: string;
27
+ confirm: {
28
+ question: string;
29
+ confirmLabel: string;
30
+ cancelLabel: string;
31
+ };
32
+ };
33
+ }
34
+ export interface RideViewOwnKeyOption {
35
+ id: 'own-key';
36
+ heading: string;
37
+ text: string;
38
+ addKey?: {
39
+ label: string;
40
+ };
41
+ helpLink: {
42
+ label: string;
43
+ url: string;
44
+ };
45
+ pendingRestart?: {
46
+ text: string;
47
+ };
48
+ }
49
+ export interface RideViewRestrictionDialogProps {
50
+ title: string;
51
+ body: string;
52
+ options: Array<RideViewDeviceOption | RideViewOwnKeyOption>;
53
+ reminder?: {
54
+ label: string;
55
+ checked: boolean;
56
+ };
57
+ }
@@ -23,6 +23,7 @@ export declare class RideSettingsDisplayService extends IncyclistService {
23
23
  protected isMobile(): boolean;
24
24
  protected isAndroid(): boolean;
25
25
  protected isIOS(): boolean;
26
+ protected getRideViewRestriction(): import("../../../ride/view-restriction/service").RideViewRestrictionService;
26
27
  protected getUserSettings(): UserSettingsService;
27
28
  protected getBindings(): import("../../../api").IncyclistBindings;
28
29
  }
@@ -3,6 +3,7 @@ export interface TRideViewOption {
3
3
  label: string;
4
4
  disabled?: boolean;
5
5
  message?: string;
6
+ reason?: 'simulation';
6
7
  }
7
8
  export interface TVideoOption {
8
9
  enableAudio: boolean;
@@ -10,6 +11,9 @@ export interface TVideoOption {
10
11
  export interface RideSettingsDisplayProps {
11
12
  rideView: TRideView;
12
13
  rideViewOptions: Map<TRideView, TRideViewOption>;
14
+ rideViewHelp?: {
15
+ label: string;
16
+ };
13
17
  showVideo?: boolean;
14
18
  videoOptions?: TVideoOption;
15
19
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "incyclist-services",
3
- "version": "1.9.12",
3
+ "version": "1.9.13",
4
4
  "peerDependencies": {
5
5
  "gd-eventlog": "^0.1.27"
6
6
  },
7
7
  "dependencies": {
8
- "@garmin/fitsdk": "^21.217.0",
9
- "axios": "^1.20.0",
8
+ "@garmin/fitsdk": "^21.218.0",
9
+ "axios": "^1.21.0",
10
10
  "incyclist-devices": "^3.0.42",
11
11
  "promise.any": "^2.0.6",
12
12
  "semver": "^7.7.4",