mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
Tidy config of show non-member settings
This commit is contained in:
@@ -152,12 +152,12 @@
|
|||||||
"feedback_tab_thank_you": "Thanks, we received your feedback!",
|
"feedback_tab_thank_you": "Thanks, we received your feedback!",
|
||||||
"feedback_tab_title": "Feedback",
|
"feedback_tab_title": "Feedback",
|
||||||
"more_tab_title": "More",
|
"more_tab_title": "More",
|
||||||
"non_member_tiles": "Show tiles for non-member media",
|
|
||||||
"opt_in_description": "<0></0><1></1>You may withdraw consent by unchecking this box. If you are currently in a call, this setting will take effect at the end of the call.",
|
"opt_in_description": "<0></0><1></1>You may withdraw consent by unchecking this box. If you are currently in a call, this setting will take effect at the end of the call.",
|
||||||
"preferences_tab_body": "Here you can configure extra options for an improved experience",
|
"preferences_tab_body": "Here you can configure extra options for an improved experience",
|
||||||
"preferences_tab_h4": "Preferences",
|
"preferences_tab_h4": "Preferences",
|
||||||
"preferences_tab_show_hand_raised_timer_description": "Show a timer when a participant raises their hand",
|
"preferences_tab_show_hand_raised_timer_description": "Show a timer when a participant raises their hand",
|
||||||
"preferences_tab_show_hand_raised_timer_label": "Show hand raise duration",
|
"preferences_tab_show_hand_raised_timer_label": "Show hand raise duration",
|
||||||
|
"show_non_member_tiles": "Show tiles for non-member media",
|
||||||
"speaker_device_selection_label": "Speaker"
|
"speaker_device_selection_label": "Speaker"
|
||||||
},
|
},
|
||||||
"star_rating_input_label_one": "{{count}} stars",
|
"star_rating_input_label_one": "{{count}} stars",
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import { Initializer } from "./initializer";
|
|||||||
import { MediaDevicesProvider } from "./livekit/MediaDevicesContext";
|
import { MediaDevicesProvider } from "./livekit/MediaDevicesContext";
|
||||||
import { widget } from "./widget";
|
import { widget } from "./widget";
|
||||||
import { useTheme } from "./useTheme";
|
import { useTheme } from "./useTheme";
|
||||||
import { nonMemberTiles } from "./settings/settings";
|
import { showNonMemberTiles } from "./settings/settings";
|
||||||
import { Config } from "./config/Config";
|
import { Config } from "./config/Config";
|
||||||
|
|
||||||
const SentryRoute = Sentry.withSentryRouting(Route);
|
const SentryRoute = Sentry.withSentryRouting(Route);
|
||||||
@@ -76,7 +76,7 @@ export const App: FC<AppProps> = ({ history }) => {
|
|||||||
// Update settings to use the non member tile information from the config if set
|
// Update settings to use the non member tile information from the config if set
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (loaded && Config.get().show_non_member_tiles) {
|
if (loaded && Config.get().show_non_member_tiles) {
|
||||||
nonMemberTiles.setValue(true);
|
showNonMemberTiles.setValue(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
ConfigOptions,
|
ConfigOptions,
|
||||||
ResolvedConfigOptions,
|
ResolvedConfigOptions,
|
||||||
} from "./ConfigOptions";
|
} from "./ConfigOptions";
|
||||||
|
import { showNonMemberTiles } from "../settings/settings";
|
||||||
|
|
||||||
export class Config {
|
export class Config {
|
||||||
private static internalInstance: Config | undefined;
|
private static internalInstance: Config | undefined;
|
||||||
@@ -32,6 +33,7 @@ export class Config {
|
|||||||
"../config.json",
|
"../config.json",
|
||||||
).then((config) => {
|
).then((config) => {
|
||||||
internalInstance.config = merge({}, DEFAULT_CONFIG, config);
|
internalInstance.config = merge({}, DEFAULT_CONFIG, config);
|
||||||
|
internalInstance.applyConfigToSettings();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return Config.internalInstance.initPromise;
|
return Config.internalInstance.initPromise;
|
||||||
@@ -66,6 +68,14 @@ export class Config {
|
|||||||
return Config.get().default_server_config?.["m.homeserver"].server_name;
|
return Config.get().default_server_config?.["m.homeserver"].server_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private applyConfigToSettings(): void {
|
||||||
|
if (!this.config) return;
|
||||||
|
// only the value from config if it hasn't been overridden
|
||||||
|
if (showNonMemberTiles.value === undefined) {
|
||||||
|
showNonMemberTiles.setValue(this.config.show_non_member_tiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public config?: ResolvedConfigOptions;
|
public config?: ResolvedConfigOptions;
|
||||||
private initPromise?: Promise<void>;
|
private initPromise?: Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import {
|
|||||||
useSetting,
|
useSetting,
|
||||||
developerSettingsTab as developerSettingsTabSetting,
|
developerSettingsTab as developerSettingsTabSetting,
|
||||||
duplicateTiles as duplicateTilesSetting,
|
duplicateTiles as duplicateTilesSetting,
|
||||||
nonMemberTiles as nonMemberTilesSetting,
|
showNonMemberTiles as showNonMemberTilesSetting,
|
||||||
useOptInAnalytics,
|
useOptInAnalytics,
|
||||||
} from "./settings";
|
} from "./settings";
|
||||||
import { isFirefox } from "../Platform";
|
import { isFirefox } from "../Platform";
|
||||||
@@ -69,7 +69,9 @@ export const SettingsModal: FC<Props> = ({
|
|||||||
);
|
);
|
||||||
const [duplicateTiles, setDuplicateTiles] = useSetting(duplicateTilesSetting);
|
const [duplicateTiles, setDuplicateTiles] = useSetting(duplicateTilesSetting);
|
||||||
|
|
||||||
const [nonMemberTiles, setNonMemberTiles] = useSetting(nonMemberTilesSetting);
|
const [showNonMemberTiles, setShowNonMemberTiles] = useSetting(
|
||||||
|
showNonMemberTilesSetting,
|
||||||
|
);
|
||||||
|
|
||||||
// Generate a `SelectInput` with a list of devices for a given device kind.
|
// Generate a `SelectInput` with a list of devices for a given device kind.
|
||||||
const generateDeviceSelection = (
|
const generateDeviceSelection = (
|
||||||
@@ -241,15 +243,15 @@ export const SettingsModal: FC<Props> = ({
|
|||||||
</FieldRow>
|
</FieldRow>
|
||||||
<FieldRow>
|
<FieldRow>
|
||||||
<InputField
|
<InputField
|
||||||
id="nonMemberTiles"
|
id="showNonMemberTiles"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
label={t("settings.non_member_tiles")}
|
label={t("settings.show_non_member_tiles")}
|
||||||
checked={nonMemberTiles}
|
checked={showNonMemberTiles}
|
||||||
onChange={useCallback(
|
onChange={useCallback(
|
||||||
(event: ChangeEvent<HTMLInputElement>): void => {
|
(event: ChangeEvent<HTMLInputElement>): void => {
|
||||||
setNonMemberTiles(event.target.checked);
|
setShowNonMemberTiles(event.target.checked);
|
||||||
},
|
},
|
||||||
[setNonMemberTiles],
|
[setShowNonMemberTiles],
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</FieldRow>
|
</FieldRow>
|
||||||
|
|||||||
@@ -72,7 +72,10 @@ export const developerSettingsTab = new Setting(
|
|||||||
|
|
||||||
export const duplicateTiles = new Setting("duplicate-tiles", 0);
|
export const duplicateTiles = new Setting("duplicate-tiles", 0);
|
||||||
|
|
||||||
export const nonMemberTiles = new Setting("non-member-tiles", false);
|
export const showNonMemberTiles = new Setting<boolean | undefined>(
|
||||||
|
"show-non-member-tiles",
|
||||||
|
undefined,
|
||||||
|
);
|
||||||
|
|
||||||
export const audioInput = new Setting<string | undefined>(
|
export const audioInput = new Setting<string | undefined>(
|
||||||
"audio-input",
|
"audio-input",
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ import {
|
|||||||
} from "./MediaViewModel";
|
} from "./MediaViewModel";
|
||||||
import { accumulate, finalizeValue } from "../utils/observable";
|
import { accumulate, finalizeValue } from "../utils/observable";
|
||||||
import { ObservableScope } from "./ObservableScope";
|
import { ObservableScope } from "./ObservableScope";
|
||||||
import { duplicateTiles, nonMemberTiles } from "../settings/settings";
|
import { duplicateTiles, showNonMemberTiles } from "../settings/settings";
|
||||||
import { isFirefox } from "../Platform";
|
import { isFirefox } from "../Platform";
|
||||||
import { setPipEnabled } from "../controls";
|
import { setPipEnabled } from "../controls";
|
||||||
import { GridTileViewModel, SpotlightTileViewModel } from "./TileViewModel";
|
import { GridTileViewModel, SpotlightTileViewModel } from "./TileViewModel";
|
||||||
@@ -434,7 +434,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
this.matrixRTCSession,
|
this.matrixRTCSession,
|
||||||
MatrixRTCSessionEvent.MembershipsChanged,
|
MatrixRTCSessionEvent.MembershipsChanged,
|
||||||
).pipe(startWith(null)),
|
).pipe(startWith(null)),
|
||||||
nonMemberTiles.value,
|
showNonMemberTiles.value,
|
||||||
]).pipe(
|
]).pipe(
|
||||||
scan(
|
scan(
|
||||||
(
|
(
|
||||||
@@ -444,7 +444,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
{ participant: localParticipant },
|
{ participant: localParticipant },
|
||||||
duplicateTiles,
|
duplicateTiles,
|
||||||
_membershipsChanged,
|
_membershipsChanged,
|
||||||
nonMemberTiles,
|
showNonMemberTiles,
|
||||||
],
|
],
|
||||||
) => {
|
) => {
|
||||||
const newItems = new Map(
|
const newItems = new Map(
|
||||||
@@ -534,7 +534,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
// - If one wants to test scalability using the livekit cli.
|
// - If one wants to test scalability using the livekit cli.
|
||||||
// - If an experimental project does not yet do the matrixRTC bits.
|
// - If an experimental project does not yet do the matrixRTC bits.
|
||||||
// - If someone wants to debug if the LK connection works but matrixRTC room state failed to arrive.
|
// - If someone wants to debug if the LK connection works but matrixRTC room state failed to arrive.
|
||||||
const debugShowNonMember = nonMemberTiles; //Config.get().show_non_member_tiles;
|
const debugShowNonMember = showNonMemberTiles; //Config.get().show_non_member_tiles;
|
||||||
const newNonMemberItems = debugShowNonMember
|
const newNonMemberItems = debugShowNonMember
|
||||||
? new Map(
|
? new Map(
|
||||||
function* (this: CallViewModel): Iterable<[string, MediaItem]> {
|
function* (this: CallViewModel): Iterable<[string, MediaItem]> {
|
||||||
@@ -689,7 +689,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
? ([of(screenShares.map((m) => m.vm)), this.spotlightSpeaker] as const)
|
? ([of(screenShares.map((m) => m.vm)), this.spotlightSpeaker] as const)
|
||||||
: ([
|
: ([
|
||||||
this.spotlightSpeaker.pipe(
|
this.spotlightSpeaker.pipe(
|
||||||
map((speaker) => (speaker && [speaker]) ?? []),
|
map((speaker) => (speaker ? [speaker] : [])),
|
||||||
),
|
),
|
||||||
this.spotlightSpeaker.pipe(
|
this.spotlightSpeaker.pipe(
|
||||||
switchMap((speaker) =>
|
switchMap((speaker) =>
|
||||||
@@ -722,7 +722,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
);
|
);
|
||||||
|
|
||||||
private readonly pip: Observable<UserMediaViewModel | null> =
|
private readonly pip: Observable<UserMediaViewModel | undefined> =
|
||||||
this.spotlightAndPip.pipe(switchMap(([, pip]) => pip));
|
this.spotlightAndPip.pipe(switchMap(([, pip]) => pip));
|
||||||
|
|
||||||
private readonly pipEnabled: Observable<boolean> = setPipEnabled.pipe(
|
private readonly pipEnabled: Observable<boolean> = setPipEnabled.pipe(
|
||||||
|
|||||||
Reference in New Issue
Block a user