153 lines
5.5 KiB
TypeScript
153 lines
5.5 KiB
TypeScript
// Module ID: 13926
|
|
// Function ID: 13927
|
|
// Name: AccessibilityManager
|
|
// Dependencies: [5, 17, 4825, 1074, 1185, 13927, 573, 1241, 13999, 10896, 13928, 4682, 4685, 2]
|
|
|
|
// Module 13926 (AccessibilityManager)
|
|
import DispatcherDefault from "Dispatcher" /* 573 */;
|
|
import Constants from "Constants" /* 1074 */;
|
|
import ThemeConstants from "ThemeConstants" /* 1185 */;
|
|
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1241 */;
|
|
import ThemeActionCreators from "ThemeActionCreators" /* 4682 */;
|
|
import updateSharedValueIfChangedDefault from "updateSharedValueIfChanged" /* 10896 */;
|
|
import AccessibilitySystemFeaturesDefault from "AccessibilitySystemFeatures" /* 13927 */;
|
|
import AccessibilityPreferencesSharedValue from "AccessibilityPreferencesSharedValue" /* 13928 */;
|
|
import updateSaturation from "updateSaturation" /* 13999 */;
|
|
import _asyncToGenerator from "_asyncToGenerator" /* 5 */;
|
|
import react_native from "react-native" /* 17 */;
|
|
import AccessibilityStore from "AccessibilityStore" /* 4825 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
let c2, c3, set;
|
|
|
|
let closure_4;
|
|
let hasOwnProperty;
|
|
({ AccessibilityInfo: closure_4, Appearance: hasOwnProperty } = react_native);
|
|
const AnalyticEvents = Constants.AnalyticEvents;
|
|
const SystemTheme = ThemeConstants.SystemTheme;
|
|
let obj = {
|
|
init() {
|
|
let colorblindMode;
|
|
const self = this;
|
|
let obj = AccessibilitySystemFeaturesDefault;
|
|
obj.init();
|
|
this.updateNativeColors();
|
|
this.updateMotionSettings();
|
|
AccessibilityStore.addChangeListener(this.updateNativeColors);
|
|
AccessibilityStore.addChangeListener(this.updateMotionSettings);
|
|
let obj2 = DispatcherDefault;
|
|
const subscription = obj2.subscribe("CONNECTION_OPEN", this.updateMotionSettings);
|
|
closure_5.addChangeListener(this.updateSystemAppearance);
|
|
const listener = closure_4.addEventListener("screenReaderChanged", (event) => {
|
|
const result = self.updateScreenReaderEnabled(event);
|
|
});
|
|
const obj3 = DispatcherDefault;
|
|
const subscription1 = obj3.subscribe("ACCESSIBILITY_COLORBLIND_TOGGLE", () => {
|
|
const obj = AnalyticsUtilsDefault;
|
|
const obj2 = { colorblind_enabled: colorblindMode.colorblindMode };
|
|
obj.track(constants.LOCAL_SETTINGS_UPDATED, obj2);
|
|
});
|
|
let result = this.startAnnouncementQueue();
|
|
},
|
|
updateNativeColors() {
|
|
const obj = updateSaturation;
|
|
obj.updateSaturation(AccessibilityStore.saturation);
|
|
},
|
|
updateMotionSettings() {
|
|
const obj = { reduceMotion: AccessibilityStore.useReducedMotion, prefersCrossfades: AccessibilityStore.systemPrefersCrossfades };
|
|
const tmp = updateSharedValueIfChangedDefault;
|
|
tmp(AccessibilityPreferencesSharedValue.accessibilityPreferencesSharedValue, obj);
|
|
},
|
|
checkScreenreaderEnabled() {
|
|
const self = this;
|
|
return (async (arg0, value) => {
|
|
if (c3 === 2) {
|
|
c3 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp3 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj2 = { value, done: true };
|
|
return obj2;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
let closure_0;
|
|
c3 = 2;
|
|
if (0 === c2) {
|
|
if (arg0 === 1) {
|
|
c3 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c3 = 3;
|
|
const obj3 = { value, done: true };
|
|
return obj3;
|
|
} else {
|
|
let closure_1 = tmp4;
|
|
closure_0 = undefined;
|
|
c2 = 1;
|
|
c3 = 1;
|
|
const obj4 = { value: screenReaderEnabled.isScreenReaderEnabled(), done: false };
|
|
return obj4;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c3 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c3 = 3;
|
|
const obj = { value, done: true };
|
|
return obj;
|
|
} else {
|
|
closure_0 = value;
|
|
const result = closure_129_0.updateScreenReaderEnabled(closure_0);
|
|
c3 = 3;
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} catch (tmp11) {
|
|
c3 = 3;
|
|
throw tmp11;
|
|
}
|
|
}
|
|
})();
|
|
},
|
|
updateScreenReaderEnabled(screenReaderEnabled) {
|
|
const obj = { screenReaderEnabled };
|
|
const tmp = updateSharedValueIfChangedDefault;
|
|
tmp(AccessibilityPreferencesSharedValue.accessibilityPreferencesSharedValue, obj);
|
|
},
|
|
updateSystemAppearance(colorScheme) {
|
|
let DARK = SystemTheme.NO_PREFERENCE;
|
|
colorScheme = colorScheme.colorScheme;
|
|
if ("light" === colorScheme) {
|
|
DARK = tmp.LIGHT;
|
|
} else if ("dark" === colorScheme) {
|
|
DARK = tmp.DARK;
|
|
}
|
|
const obj = ThemeActionCreators;
|
|
obj.setSystemTheme(DARK);
|
|
},
|
|
startAnnouncementQueue() {
|
|
set = new Set();
|
|
const listener = closure_4.addEventListener("announcementFinished", (event) => {
|
|
let closure_0 = event;
|
|
if (!event.success) {
|
|
const obj = set;
|
|
if (!set.has(event.announcement)) {
|
|
obj.add(event.announcement);
|
|
const _setTimeout = setTimeout;
|
|
const timerId = setTimeout(() => {
|
|
const AccessibilityAnnouncer = set(closure_2_2[12]).AccessibilityAnnouncer;
|
|
AccessibilityAnnouncer.announce(announcement.announcement);
|
|
}, 150);
|
|
}
|
|
}
|
|
set.delete(event.announcement);
|
|
});
|
|
}
|
|
};
|
|
let result = size.fileFinishedImporting("modules/a11y/native/AccessibilityManager.tsx");
|
|
|
|
export default obj;
|