38 lines
1.7 KiB
TypeScript
38 lines
1.7 KiB
TypeScript
// Metro module 15898 (f15899).
|
|
import { useEffect } from "react";
|
|
import AccessibilityStore from "../../a11y/AccessibilityStore";
|
|
import ThemeStore from "../../user_settings/ThemeStore";
|
|
import { SOUNDS_PER_ROW, SOUND_ROW_PADDING } from "./SoundboardStyleConstants";
|
|
import { ACTION_SHEET_MAX_WIDTH } from "../../action_sheet/native/ActionSheetConstants";
|
|
import useWindowDimensions_native from "../../screen/useWindowDimensions.native";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
import { isThemeDark } from "../../../design/shared";
|
|
import { FrecencyUserSettingsActionCreators } from "../../user_settings/UserSettingsProtoActionCreators";
|
|
import { maybeFetchSoundboardSounds } from "../SoundboardActionCreators";
|
|
export function useSoundButtonStyleConfig() {
|
|
return {
|
|
buttonWidth: (Math.min(ACTION_SHEET_MAX_WIDTH, useWindowDimensions_native().width) - SOUND_ROW_PADDING) / SOUNDS_PER_ROW
|
|
};
|
|
}
|
|
export function useMaybeFetchSoundboardSounds({ shouldFetch }) {
|
|
useEffect(() => {
|
|
let _fetchAndHydrateColors2 = function _fetchAndHydrateColors() {
|
|
const r9 = async () => {
|
|
L11: {
|
|
if (shouldFetch) {
|
|
FrecencyUserSettingsActionCreators.loadIfNecessary();
|
|
await maybeFetchSoundboardSounds();
|
|
break L11;
|
|
}
|
|
return void 0;
|
|
}
|
|
};
|
|
_fetchAndHydrateColors2 = r9;
|
|
return r9.apply(this, arguments);
|
|
};
|
|
(function fetchAndHydrateColors() {
|
|
return _fetchAndHydrateColors2.apply(this, arguments);
|
|
})();
|
|
}, [useStateFromStores([AccessibilityStore], () => AccessibilityStore.saturation), useStateFromStores([ThemeStore], () => isThemeDark(ThemeStore.theme)), shouldFetch]);
|
|
}
|