Address review feedback

This commit is contained in:
Robin 2024-07-12 14:15:27 -04:00
parent 41083c0f9e
commit 599d6fd007
4 changed files with 8 additions and 11 deletions

View File

@ -36,3 +36,8 @@ if (/android/i.test(navigator.userAgent)) {
} else {
platform = "desktop";
}
export const isFirefox = (): boolean => {
const { userAgent } = navigator;
return userAgent.includes("Firefox");
};

View File

@ -33,8 +33,8 @@ import {
audioInput as audioInputSetting,
audioOutput as audioOutputSetting,
videoInput as videoInputSetting,
isFirefox,
} from "../settings/settings";
import { isFirefox } from "../Platform";
export interface MediaDevice {
available: MediaDeviceInfo[];

View File

@ -44,8 +44,8 @@ import {
useSetting,
optInAnalytics as optInAnalyticsSetting,
developerSettingsTab as developerSettingsTabSetting,
isFirefox,
} from "./settings";
import { isFirefox } from "../Platform";
type SettingsTab =
| "audio"

View File

@ -56,12 +56,6 @@ export function useSetting<T>(setting: Setting<T>): [T, (value: T) => void] {
return [useObservableEagerState(setting.value), setting.setValue];
}
// TODO: This doesn't belong here
export const isFirefox = (): boolean => {
const { userAgent } = navigator;
return userAgent.includes("Firefox");
};
// null = undecided
export const optInAnalytics = new Setting<boolean | null>(
"opt-in-analytics",
@ -74,9 +68,7 @@ export const useOptInAnalytics = (): [
((value: boolean | null) => void) | null,
] => {
const setting = useSetting(optInAnalytics);
if (PosthogAnalytics.instance.isEnabled()) return setting;
return [false, null];
return PosthogAnalytics.instance.isEnabled() ? setting : [false, null];
};
export const developerSettingsTab = new Setting(