// Metro module 16764 (f16765). import { useState, useEffect } from "react"; import { BackHandler, NativeModules } from "react-native"; import "../../../stores/AnalyticsTrackingStore"; import "../../../stores/native/ShareStore"; import AuthenticationStore from "../../../stores/AuthenticationStore"; import { AnalyticEvents } from "../../../Constants"; import { MultiAccountSwitchLocation } from "../../multi_account/Constants"; import { useStateFromStores } from "../../../_bundle/Module589"; import AuthenticationActionCreators from "../../../actions/AuthenticationActionCreators"; import { isAndroid } from "../../../utils/PlatformUtils"; import AccessibilityManager from "../../a11y/native/AccessibilityManager"; import { switchAccount } from "../../multi_account/MultiAccountActionCreators"; import { trackAppUIViewed } from "../../tti_analytics/native/TTIAnalyticsUtils"; import AnalyticsUtils from "../../../utils/AnalyticsUtils"; import useMountEffect from "../../../hooks/useMountEffect"; import AppContainer from "../../../components_native/AppContainer"; import ShareScreen from "./ShareScreen"; import { isMetaQuest } from "../../device/MetaQuestUtils.android"; import Module8197 from "../../../_bundle/Module8197"; import { SceneLoadingIndicator } from "../../../design/components/Navigator/native/SceneLoadingIndicator.native"; import { ActionSheetContainer } from "../../../components_native/MainShared"; import ToastContainer from "../../toast/native/ToastContainer"; import { AlertModalContainer } from "../../../design/components/AlertModal/native/AlertModal.native"; const appEntryKey = "share"; export default function AppShare(props) { let c23404_0 = props; const targetUserId = props.targetUserId; let [state2, setState] = useState(false); const state = state2; const [state3, setState2] = useState(targetUserId == null || AuthenticationStore.getId() === targetUserId); useEffect(() => { if (!state) { AccessibilityManager.init(); setState(true); } }, [state]); useEffect(() => { if (targetUserId != null && AuthenticationStore.getId() !== targetUserId) { setTimeout(() => { switchAccount(targetUserId, false, MultiAccountSwitchLocation.SHARE_EXTENSION).then(() => { setState2(true); }); }, 18); } }, [targetUserId]); if (state) { state2 = state3; } const stateFromStores = useStateFromStores([AuthenticationStore], () => AuthenticationStore.isAuthenticated()); useEffect(() => { if (stateFromStores) { AuthenticationActionCreators.startSession(AuthenticationStore.getToken()); if (isAndroid()) { NativeModules.NativePermissionManager.requestNotificationAuthorization(); } } }, [stateFromStores]); useEffect(() => { const EXTERNAL_SHARE_OPENED = AnalyticEvents.EXTERNAL_SHARE_OPENED; AnalyticsUtils.track(EXTERNAL_SHARE_OPENED, { has_content: c23404_0.text != null && c23404_0.text.length > 0, has_attachment: c23404_0.attachments.length > 0 }); }, [props.attachments.length, props.text]); useMountEffect(() => { trackAppUIViewed("share", { share_num_attachments: c23404_0.attachments.length, share_attachment_mimetypes: c23404_0.attachments.map(({ mimeType }) => { if (mimeType == null) { mimeType = "unknown"; } return mimeType; }) }); }); return {state2 ? : } ; };