decord/source/modules/a11y/native/AccessibilityManager.tsx

139 lines
4.9 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 13868
// Function ID: 13869
// Dependencies: [5, 17, 4669, 676, 1305, 13869, 709, 698, 13872, 10600, 13870, 4226, 1363, 2]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 13868
import dispatcherDefault from "dispatcher" /* 709 */;
import setSystemTheme from "setSystemTheme" /* 4226 */;
import uDefault from "u" /* 10600 */;
import AccessibilityFeatureFlagsDefault from "AccessibilityFeatureFlags" /* 13869 */;
import A11Y_FEATURE_MAP from "A11Y_FEATURE_MAP" /* 13870 */;
import updateSaturation from "updateSaturation" /* 13872 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
import get_ActivityIndicator from "get ActivityIndicator" /* 17 */;
import closure_6 from "maybeApplyNoTextColorForLightCustomTheme" /* 4669 */;
import { AnalyticEvents } from "ME" /* 676 */;
import { SystemTheme } from "SystemThemeState" /* 1305 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
({ AccessibilityInfo: c4, Appearance: c5 } = get_ActivityIndicator);
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/a11y/native/AccessibilityManager.tsx");
2026-07-23 10:11:24 +00:00
export default {
2026-07-20 16:05:17 +00:00
init() {
2026-07-23 10:11:24 +00:00
const self = this;
2026-08-24 06:08:38 +00:00
AccessibilityFeatureFlagsDefault.init();
2026-07-20 16:05:17 +00:00
this.updateNativeColors();
this.updateMotionSettings();
2026-08-24 06:08:38 +00:00
closure_6.addChangeListener(this.updateNativeColors);
closure_6.addChangeListener(this.updateMotionSettings);
let obj = AccessibilityFeatureFlagsDefault;
const subscription = dispatcherDefault.subscribe("CONNECTION_OPEN", this.updateMotionSettings);
2026-07-20 16:05:17 +00:00
closure_5.addChangeListener(this.updateSystemAppearance);
const listener = closure_4.addEventListener("screenReaderChanged", (arg0) => {
const result = self.updateScreenReaderEnabled(arg0);
});
2026-08-24 06:08:38 +00:00
const obj2 = dispatcherDefault;
const subscription1 = dispatcherDefault.subscribe("ACCESSIBILITY_COLORBLIND_TOGGLE", () => {
2026-07-29 08:29:29 +00:00
let obj = callback(table[7]);
obj = { colorblind_enabled: colorblindMode.colorblindMode };
obj.track(constants.LOCAL_SETTINGS_UPDATED, obj);
2026-07-20 16:05:17 +00:00
});
2026-07-23 10:11:24 +00:00
let result = this.startAnnouncementQueue();
2026-07-20 16:05:17 +00:00
},
updateNativeColors() {
2026-08-24 06:08:38 +00:00
updateSaturation.updateSaturation(closure_6.saturation);
2026-07-20 16:05:17 +00:00
},
updateMotionSettings() {
2026-08-24 06:08:38 +00:00
uDefault(A11Y_FEATURE_MAP.accessibilityPreferencesSharedValue, { reduceMotion: closure_6.useReducedMotion, prefersCrossfades: closure_6.systemPrefersCrossfades });
2026-07-20 16:05:17 +00:00
},
checkScreenreaderEnabled() {
2026-07-23 10:11:24 +00:00
const self = this;
2026-07-29 08:29:29 +00:00
return callback(function*() {
if (c3 === 2) {
c3 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c3 = 2;
if (0 === c2) {
if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp5;
closure_0 = tmp2;
2026-07-29 08:29:29 +00:00
closure_0 = undefined;
c2 = 1;
c3 = 1;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
obj1[0] = closure_1_4.isScreenReaderEnabled();
2026-07-29 08:29:29 +00:00
return obj1;
}
} else if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
closure_0 = arg1;
const result = closure_0.updateScreenReaderEnabled(closure_0);
c3 = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} catch (tmp12) {
c3 = tmp;
throw tmp12;
}
}
})();
2026-07-20 16:05:17 +00:00
},
updateScreenReaderEnabled(screenReaderEnabled) {
2026-08-24 06:08:38 +00:00
uDefault(A11Y_FEATURE_MAP.accessibilityPreferencesSharedValue, { screenReaderEnabled });
2026-07-20 16:05:17 +00:00
},
updateSystemAppearance(colorScheme) {
let DARK = SystemTheme.NO_PREFERENCE;
colorScheme = colorScheme.colorScheme;
if ("light" === colorScheme) {
2026-07-29 08:29:29 +00:00
DARK = tmp.LIGHT;
2026-07-20 16:05:17 +00:00
} else if ("dark" === colorScheme) {
2026-07-29 08:29:29 +00:00
DARK = tmp.DARK;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
setSystemTheme.setSystemTheme(DARK);
2026-07-20 16:05:17 +00:00
},
startAnnouncementQueue() {
2026-07-23 10:11:24 +00:00
const set = new Set();
2026-07-20 16:05:17 +00:00
const listener = closure_4.addEventListener("announcementFinished", (success) => {
if (!success.success) {
if (!set.has(success.announcement)) {
set.add(success.announcement);
const _setTimeout = setTimeout;
const timerId = setTimeout(() => {
2026-08-24 06:08:38 +00:00
const AccessibilityAnnouncer = success(closure_1_2[12]).AccessibilityAnnouncer;
2026-07-23 10:11:24 +00:00
AccessibilityAnnouncer.announce(success.announcement);
2026-07-20 16:05:17 +00:00
}, 150);
}
}
success.delete(success.announcement);
});
}
};