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

134 lines
5 KiB
TypeScript
Raw Normal View History

// Module ID: 14130
// Function ID: 14131
// Name: AccessibilityManager
// Dependencies: [5, 17, 4834, 1074, 1185, 14131, 573, 1241, 14208, 11105, 14132, 4711, 4714, 2]
2026-07-20 16:05:17 +00:00
// Module 14130 (AccessibilityManager)
import DispatcherDefault from "Dispatcher" /* 573 */;
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1241 */;
import ThemeActionCreators from "ThemeActionCreators" /* 4711 */;
import updateSharedValueIfChangedDefault from "updateSharedValueIfChanged" /* 11105 */;
import AccessibilitySystemFeaturesDefault from "AccessibilitySystemFeatures" /* 14131 */;
import AccessibilityPreferencesSharedValue from "AccessibilityPreferencesSharedValue" /* 14132 */;
import updateSaturation from "updateSaturation" /* 14208 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
import AccessibilityStore from "AccessibilityStore" /* 4834 */;
2026-07-23 10:11:24 +00:00
require = fn;
get_ActivityIndicator = fn(17);
({ AccessibilityInfo: closure_4, Appearance: hasOwnProperty } = get_ActivityIndicator);
const AnalyticEvents = fn(1074).AnalyticEvents;
const SystemTheme = fn(1185).SystemTheme;
const size = fn(2);
let result = size.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;
AccessibilitySystemFeaturesDefault.init();
2026-07-20 16:05:17 +00:00
this.updateNativeColors();
this.updateMotionSettings();
AccessibilityStore.addChangeListener(this.updateNativeColors);
AccessibilityStore.addChangeListener(this.updateMotionSettings);
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", (event) => {
const result = self.updateScreenReaderEnabled(event);
2026-07-20 16:05:17 +00:00
});
const subscription1 = DispatcherDefault.subscribe("ACCESSIBILITY_COLORBLIND_TOGGLE", () => {
AnalyticsUtilsDefault.track(constants.LOCAL_SETTINGS_UPDATED, { colorblind_enabled: colorblindMode.colorblindMode });
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() {
updateSaturation.updateSaturation(AccessibilityStore.saturation);
2026-07-20 16:05:17 +00:00
},
updateMotionSettings() {
updateSharedValueIfChangedDefault(AccessibilityPreferencesSharedValue.accessibilityPreferencesSharedValue, { reduceMotion: AccessibilityStore.useReducedMotion, prefersCrossfades: AccessibilityStore.systemPrefersCrossfades });
2026-07-20 16:05:17 +00:00
},
checkScreenreaderEnabled() {
2026-07-23 10:11:24 +00:00
const self = this;
return (async (arg0, value) => {
2026-07-29 08:29:29 +00:00
if (c3 === 2) {
c3 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-07-29 08:29:29 +00:00
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
const obj2 = { value, done: true };
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-09-01 10:26:29 +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 value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c3 = 3;
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp5;
closure_0 = tmp2;
closure_128_0 = undefined;
2026-07-29 08:29:29 +00:00
c2 = 1;
c3 = 1;
const obj4 = { value: screenReaderEnabled.isScreenReaderEnabled(), done: false };
return obj4;
2026-07-29 08:29:29 +00:00
}
} else if (arg0 === 1) {
c3 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c3 = 3;
const obj = { value, done: true };
2026-07-29 08:29:29 +00:00
return obj;
} else {
closure_128_0 = value;
const result = closure_129_0.updateScreenReaderEnabled(closure_128_0);
2026-07-29 08:29:29 +00:00
c3 = 3;
2026-09-01 10:26:29 +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) {
updateSharedValueIfChangedDefault(AccessibilityPreferencesSharedValue.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
}
ThemeActionCreators.setSystemTheme(DARK);
2026-07-20 16:05:17 +00:00
},
startAnnouncementQueue() {
2026-07-23 10:11:24 +00:00
const set = new Set();
const listener = closure_4.addEventListener("announcementFinished", (event) => {
if (!event.success) {
if (!set.has(event.announcement)) {
set.add(event.announcement);
2026-07-20 16:05:17 +00:00
const _setTimeout = setTimeout;
const timerId = setTimeout(() => {
const AccessibilityAnnouncer = set(dependencyMap[12]).AccessibilityAnnouncer;
AccessibilityAnnouncer.announce(event.announcement);
2026-07-20 16:05:17 +00:00
}, 150);
}
}
set.delete(event.announcement);
2026-07-20 16:05:17 +00:00
});
}
};