incyclist-services 1.9.6 → 1.9.7
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.
|
@@ -67,23 +67,27 @@ let RideSettingsDisplayService = (() => {
|
|
|
67
67
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
68
68
|
}
|
|
69
69
|
observer = __runInitializers(this, _instanceExtraInitializers);
|
|
70
|
+
isRide;
|
|
70
71
|
constructor() {
|
|
71
72
|
super('GearSettings');
|
|
72
73
|
}
|
|
73
|
-
open() {
|
|
74
|
+
open(isRide = false) {
|
|
74
75
|
if (this.observer)
|
|
75
76
|
this.close();
|
|
76
77
|
this.observer = new types_1.Observer();
|
|
78
|
+
this.isRide = isRide;
|
|
77
79
|
return this.observer;
|
|
78
80
|
}
|
|
79
81
|
close() {
|
|
80
82
|
this.observer.stop();
|
|
83
|
+
delete this.isRide;
|
|
81
84
|
delete this.observer;
|
|
82
85
|
}
|
|
83
86
|
getDisplayProps() {
|
|
84
87
|
return {
|
|
85
88
|
rideView: this.getRideView(),
|
|
86
|
-
rideViewOptions: this.getRideViewOptions()
|
|
89
|
+
rideViewOptions: this.getRideViewOptions(),
|
|
90
|
+
...this.getVideoOptions()
|
|
87
91
|
};
|
|
88
92
|
}
|
|
89
93
|
setRideView(rideView) {
|
|
@@ -94,6 +98,18 @@ let RideSettingsDisplayService = (() => {
|
|
|
94
98
|
this.logError(err, 'setRideView');
|
|
95
99
|
}
|
|
96
100
|
}
|
|
101
|
+
setVideoAudioEnabled(enabled) {
|
|
102
|
+
try {
|
|
103
|
+
this.getUserSettings().set('preferences.video.sound', enabled);
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
this.logError(err, 'setVideoAudioEnabled');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
getVideoOptions() {
|
|
110
|
+
const enableAudio = this.getUserSettings().getValue('preferences.video.sound', false);
|
|
111
|
+
return { showVideo: true, videoOptions: { enableAudio } };
|
|
112
|
+
}
|
|
97
113
|
emitChanged() {
|
|
98
114
|
if (this.observer)
|
|
99
115
|
this.observer.emit('changed', this.getDisplayProps());
|
|
@@ -64,23 +64,27 @@ let RideSettingsDisplayService = (() => {
|
|
|
64
64
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
65
65
|
}
|
|
66
66
|
observer = __runInitializers(this, _instanceExtraInitializers);
|
|
67
|
+
isRide;
|
|
67
68
|
constructor() {
|
|
68
69
|
super('GearSettings');
|
|
69
70
|
}
|
|
70
|
-
open() {
|
|
71
|
+
open(isRide = false) {
|
|
71
72
|
if (this.observer)
|
|
72
73
|
this.close();
|
|
73
74
|
this.observer = new Observer();
|
|
75
|
+
this.isRide = isRide;
|
|
74
76
|
return this.observer;
|
|
75
77
|
}
|
|
76
78
|
close() {
|
|
77
79
|
this.observer.stop();
|
|
80
|
+
delete this.isRide;
|
|
78
81
|
delete this.observer;
|
|
79
82
|
}
|
|
80
83
|
getDisplayProps() {
|
|
81
84
|
return {
|
|
82
85
|
rideView: this.getRideView(),
|
|
83
|
-
rideViewOptions: this.getRideViewOptions()
|
|
86
|
+
rideViewOptions: this.getRideViewOptions(),
|
|
87
|
+
...this.getVideoOptions()
|
|
84
88
|
};
|
|
85
89
|
}
|
|
86
90
|
setRideView(rideView) {
|
|
@@ -91,6 +95,18 @@ let RideSettingsDisplayService = (() => {
|
|
|
91
95
|
this.logError(err, 'setRideView');
|
|
92
96
|
}
|
|
93
97
|
}
|
|
98
|
+
setVideoAudioEnabled(enabled) {
|
|
99
|
+
try {
|
|
100
|
+
this.getUserSettings().set('preferences.video.sound', enabled);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
this.logError(err, 'setVideoAudioEnabled');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
getVideoOptions() {
|
|
107
|
+
const enableAudio = this.getUserSettings().getValue('preferences.video.sound', false);
|
|
108
|
+
return { showVideo: true, videoOptions: { enableAudio } };
|
|
109
|
+
}
|
|
94
110
|
emitChanged() {
|
|
95
111
|
if (this.observer)
|
|
96
112
|
this.observer.emit('changed', this.getDisplayProps());
|
|
@@ -2,14 +2,20 @@ import { IncyclistService } from "../../../base/service";
|
|
|
2
2
|
import { Observer } from "../../../base/types";
|
|
3
3
|
import { IObserver } from "../../../types";
|
|
4
4
|
import { UserSettingsService } from "../../service";
|
|
5
|
-
import { RideSettingsDisplayProps, TRideView, TRideViewOption } from "./types";
|
|
5
|
+
import { RideSettingsDisplayProps, TRideView, TRideViewOption, TVideoOption } from "./types";
|
|
6
6
|
export declare class RideSettingsDisplayService extends IncyclistService {
|
|
7
7
|
protected observer: Observer;
|
|
8
|
+
protected isRide?: boolean;
|
|
8
9
|
constructor();
|
|
9
|
-
open(): IObserver;
|
|
10
|
+
open(isRide?: boolean): IObserver;
|
|
10
11
|
close(): void;
|
|
11
12
|
getDisplayProps(): RideSettingsDisplayProps;
|
|
12
13
|
setRideView(rideView: TRideView): void;
|
|
14
|
+
setVideoAudioEnabled(enabled: boolean): void;
|
|
15
|
+
protected getVideoOptions(): {
|
|
16
|
+
showVideo?: boolean;
|
|
17
|
+
videoOptions?: TVideoOption;
|
|
18
|
+
};
|
|
13
19
|
protected emitChanged(): void;
|
|
14
20
|
getRideView(): TRideView;
|
|
15
21
|
getRideViewOptions(): Map<TRideView, TRideViewOption>;
|
|
@@ -4,7 +4,12 @@ export interface TRideViewOption {
|
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
message?: string;
|
|
6
6
|
}
|
|
7
|
+
export interface TVideoOption {
|
|
8
|
+
enableAudio: boolean;
|
|
9
|
+
}
|
|
7
10
|
export interface RideSettingsDisplayProps {
|
|
8
11
|
rideView: TRideView;
|
|
9
12
|
rideViewOptions: Map<TRideView, TRideViewOption>;
|
|
13
|
+
showVideo?: boolean;
|
|
14
|
+
videoOptions?: TVideoOption;
|
|
10
15
|
}
|