Files
discord-decomp/modules/keyboard/native/useKeyboardIsOpen.tsx
T
2026-11-01 12:12:55 +02:00

49 lines
2.4 KiB
TypeScript

// Metro module 6744 (f6745).
import subscribeToKeyboardUIStore from "./subscribeToKeyboardUIStore";
import * as _AppEntryKeyContext from "../../window/native/AppEntryKeyContext";
import { useAppEntryKey } from "../../window/native/AppEntryKeyContext";
import KeyboardUIStore_native from "./KeyboardUIStore.native";
import { KeyboardTypes } from "./KeyboardTypes";
let c4331_4 = {};
export default function useKeyboardIsOpen(r2 = c4331_4) {
let includeCustomKeyboard2 = r2.includeCustomKeyboard;
if (includeCustomKeyboard2 === void 0) {
includeCustomKeyboard2 = false;
}
let c15888_0 = includeCustomKeyboard2;
const appEntryKey = useAppEntryKey();
return KeyboardUIStore_native((a0) => {
const r7 = a0.byAppEntry[appEntryKey];
const systemKeyboardOpen = r7.systemKeyboardOpen;
return c15888_0 ? systemKeyboardOpen ? systemKeyboardOpen : r7.keyboardType !== KeyboardTypes.SYSTEM : systemKeyboardOpen;
});
};
export function subscribeToKeyboardIsOpen(c15889_0, r7 = c4331_4) {
let includeCustomKeyboard2 = r7.includeCustomKeyboard;
if (includeCustomKeyboard2 === void 0) {
includeCustomKeyboard2 = false;
}
const includeCustomKeyboard = includeCustomKeyboard2;
let appEntryKey2 = r7.appEntryKey;
if (appEntryKey2 === void 0) {
appEntryKey2 = _AppEntryKeyContext.DEFAULT_APP_ENTRY_KEY;
}
const DEFAULT_APP_ENTRY_KEY = appEntryKey2;
return subscribeToKeyboardUIStore(() => {
const r4 = {
includeCustomKeyboard,
appEntryKey: DEFAULT_APP_ENTRY_KEY
};
const { includeCustomKeyboard: includeCustomKeyboard2 = false, appEntryKey: appEntryKey2 = _AppEntryKeyContext.DEFAULT_APP_ENTRY_KEY } = r4;
const r21 = KeyboardUIStore_native.getState().byAppEntry[appEntryKey2];
const systemKeyboardOpen = r21.systemKeyboardOpen;
return c15889_0(includeCustomKeyboard2 ? systemKeyboardOpen ? systemKeyboardOpen : r21.keyboardType !== KeyboardTypes.SYSTEM : systemKeyboardOpen);
}, DEFAULT_APP_ENTRY_KEY);
}
export function getKeyboardIsOpen(r3 = c4331_4) {
const { includeCustomKeyboard: includeCustomKeyboard2 = false, appEntryKey: appEntryKey2 = _AppEntryKeyContext.DEFAULT_APP_ENTRY_KEY } = r3;
const r17 = KeyboardUIStore_native.getState().byAppEntry[appEntryKey2];
const systemKeyboardOpen = r17.systemKeyboardOpen;
return includeCustomKeyboard2 ? systemKeyboardOpen ? systemKeyboardOpen : r17.keyboardType !== KeyboardTypes.SYSTEM : systemKeyboardOpen;
}