// Metro module 13507 (f13508). import AuthenticationStore from "../../../stores/AuthenticationStore"; import ChannelStore from "../../../stores/ChannelStore"; import RelationshipStore from "../../../stores/RelationshipStore"; import UserStore from "../../../stores/UserStore"; import { isIOS } from "../../../utils/PlatformUtils"; import { NativePhoneIntegrationEnabled } from "../../user_settings/UserSettings"; import { computeChannelName } from "../../channel/useChannelName"; import { AccessibilityAnnouncer } from "../../../design/shared"; import { intl, t } from "../../../intl/index.native"; import LifecycleManager from "../../../lib/LifecycleManager"; import Dispatcher from "../../../Dispatcher"; let c9376_7 = new Set(); let c9376_8 = new Map(); class AccessibilityCallManager extends LifecycleManager { handleCallCreate = ({ channelId, ongoingRings }) => { const id = AuthenticationStore.getId(); const r0 = id != null && id in ongoingRings; L9: { c9376_8.set(channelId, r0); if (r0 && !c9376_7.has(channelId)) { if (isIOS() && NativePhoneIntegrationEnabled.getSetting()) { break L9; } const channel = ChannelStore.getChannel(channelId); if (channel != null) { const callLocation = computeChannelName(channel, UserStore, RelationshipStore); if (callLocation != null) { c9376_7.add(channelId); AccessibilityAnnouncer.announce(intl.formatToPlainString(t["Bm0A/p"], { callLocation }), "assertive"); } } } } }; handleCallUpdate = ({ channelId, ongoingRings }) => { const id = AuthenticationStore.getId(); let r17 = c9376_8.get(channelId); if (r17 == null) { r17 = false; } const r0 = id != null && id in ongoingRings; L16: { c9376_8.set(channelId, r0); if (!r17 && r0) { if (c9376_7.has(channelId)) { break L16; } if (isIOS() && NativePhoneIntegrationEnabled.getSetting()) { break L16; } const channel = ChannelStore.getChannel(channelId); if (channel == null) { break L16; } const callLocation = computeChannelName(channel, UserStore, RelationshipStore); if (callLocation == null) { break L16; } c9376_7.add(channelId); AccessibilityAnnouncer.announce(intl.formatToPlainString(t["Bm0A/p"], { callLocation }), "assertive"); } else { if (r17) { r17 = !r0; } if (r17) { c9376_7.delete(channelId); } } } }; handleCallDelete = ({ channelId }) => { c9376_8.delete(channelId); c9376_7.delete(channelId); }; handleConnectionOpen = () => { c9376_8.clear(); c9376_7.clear(); }; _initialize() { Dispatcher.subscribe("CALL_CREATE", this.handleCallCreate); Dispatcher.subscribe("CALL_UPDATE", this.handleCallUpdate); Dispatcher.subscribe("CALL_DELETE", this.handleCallDelete); Dispatcher.subscribe("CONNECTION_OPEN", this.handleConnectionOpen); } _terminate() { Dispatcher.unsubscribe("CALL_CREATE", this.handleCallCreate); Dispatcher.unsubscribe("CALL_UPDATE", this.handleCallUpdate); Dispatcher.unsubscribe("CALL_DELETE", this.handleCallDelete); Dispatcher.unsubscribe("CONNECTION_OPEN", this.handleConnectionOpen); c9376_8.clear(); c9376_7.clear(); } } const accessibilityCallManager = new AccessibilityCallManager(); export default accessibilityCallManager;