27 lines
2.3 KiB
TypeScript
27 lines
2.3 KiB
TypeScript
// Metro module 8848 (f8849).
|
|
import { useMemo } from "react";
|
|
import UserSettingsProtoStore from "../user_settings/UserSettingsProtoStore";
|
|
import UserStore from "../../stores/UserStore";
|
|
import { getVideoBackgroundOptionFromProto, isCustomBackgroundOption, isDefaultBackgroundOption } from "./VideoBackgroundUtils";
|
|
import PremiumUtils from "../../utils/PremiumUtils";
|
|
import { useStateFromStores } from "../../_bundle/Module589";
|
|
export function getLastUsedVideoBackgroundOption(a0) {
|
|
const videoBackgroundOptionFromProto = getVideoBackgroundOptionFromProto(UserSettingsProtoStore.settings.voiceAndVideo?.videoBackgroundFilterDesktop, a0.id);
|
|
return isCustomBackgroundOption(videoBackgroundOptionFromProto) ? PremiumUtils.canUseCustomBackgrounds(a0) ? typeof videoBackgroundOptionFromProto === "number" ? isDefaultBackgroundOption(videoBackgroundOptionFromProto) ? videoBackgroundOptionFromProto : null : videoBackgroundOptionFromProto : null : typeof videoBackgroundOptionFromProto === "number" ? isDefaultBackgroundOption(videoBackgroundOptionFromProto) ? videoBackgroundOptionFromProto : null : videoBackgroundOptionFromProto;
|
|
}
|
|
export function useLastUsedVideoBackgroundOption() {
|
|
let stateFromStores, videoBackgroundFilterDesktop;
|
|
const stateFromStores2 = useStateFromStores([UserSettingsProtoStore], () => UserSettingsProtoStore.settings);
|
|
stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
|
|
videoBackgroundFilterDesktop = stateFromStores2.voiceAndVideo?.videoBackgroundFilterDesktop;
|
|
return useMemo(() => {
|
|
const r0 = stateFromStores == null;
|
|
let r1 = null;
|
|
if (!r0) {
|
|
const videoBackgroundOptionFromProto = getVideoBackgroundOptionFromProto(videoBackgroundFilterDesktop, stateFromStores.id);
|
|
r1 = isCustomBackgroundOption(videoBackgroundOptionFromProto) ? PremiumUtils.canUseCustomBackgrounds(stateFromStores) ? typeof videoBackgroundOptionFromProto === "number" ? isDefaultBackgroundOption(videoBackgroundOptionFromProto) ? videoBackgroundOptionFromProto : null : videoBackgroundOptionFromProto : null : typeof videoBackgroundOptionFromProto === "number" ? isDefaultBackgroundOption(videoBackgroundOptionFromProto) ? videoBackgroundOptionFromProto : null : videoBackgroundOptionFromProto;
|
|
}
|
|
return r1;
|
|
}, [videoBackgroundFilterDesktop, stateFromStores]);
|
|
}
|