51 lines
3.1 KiB
TypeScript
51 lines
3.1 KiB
TypeScript
// Metro module 15396 (f15397).
|
|
import { useRef, useState, useEffect } from "react";
|
|
import SelectedChannelStore from "../../../../../stores/SelectedChannelStore";
|
|
import VoiceStateStore from "../../../../../stores/VoiceStateStore";
|
|
import { PermissionPromptType } from "../../../../../stores/native/PushNotificationPermissionStore";
|
|
import { EventActionLocation, NotificationNudgeSurface } from "./NotificationPermissionConstants";
|
|
import NotificationNudgeBottomSheet from "./NotificationNudgeBottomSheet";
|
|
import { intl, t } from "../../../../../intl/index.native";
|
|
import ContextualOptInNudgeHoldoutExperiment from "../../ContextualOptInNudgeHoldoutExperiment";
|
|
import { useCanSeePushNotificationNudge } from "../../NotificationPermissionUtil";
|
|
import { useStateFromStores } from "../../../../../_bundle/Module589";
|
|
import { useSelectedTimeRecurringDismissibleContent } from "../../../../dismissible_content/hooks/useSelectedDismissibleContent";
|
|
import { DismissibleContent } from "../../../../../_bundle/Module1358";
|
|
import { setPushPermissionReactivationSeen } from "../../../../../actions/native/PushNotificationActionCreators";
|
|
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
|
|
let c10948_11 = "post-call-disconnect-nudge-key";
|
|
let c10948_12 = {
|
|
cooldownDurationMs: 604800000
|
|
};
|
|
export default function PostCallDisconnectNudge(props) {
|
|
const { markAsDismissed: markAsDismissed2, onHide } = props;
|
|
return <NotificationNudgeBottomSheet title={intl.string(t.pJbYq1)} body={intl.string(t.vegtFT)} actionLocation={EventActionLocation.CALL_DISCONNECT} surface={NotificationNudgeSurface.CALL_DISCONNECT_BOTTOM_SHEET} markAsDismissed={markAsDismissed2} onHide={onHide} />;
|
|
};
|
|
export const POST_CALL_DISCONNECT_NUDGE_KEY = "post-call-disconnect-nudge-key";
|
|
export function usePostCallDisconnectNudge() {
|
|
let stateFromStores2, ref, c21957_4;
|
|
const inHoldout = ContextualOptInNudgeHoldoutExperiment.useConfig({
|
|
location: "usePostCallDisconnectNudge"
|
|
}).inHoldout;
|
|
const canSeePushNotificationNudge = useCanSeePushNotificationNudge();
|
|
const stateFromStores = useStateFromStores([VoiceStateStore], () => VoiceStateStore.getCurrentClientVoiceChannelId(null));
|
|
stateFromStores2 = useStateFromStores([SelectedChannelStore], () => SelectedChannelStore.getChannelId());
|
|
ref = useRef(stateFromStores);
|
|
const [state, setState] = useState(false);
|
|
useEffect(() => {
|
|
const current = ref.current;
|
|
ref.current = stateFromStores;
|
|
setState(current != null && stateFromStores == null && current === stateFromStores2);
|
|
}, [stateFromStores, stateFromStores2]);
|
|
let [r55, markAsDismissed] = useSelectedTimeRecurringDismissibleContent(state ? inHoldout ? null : canSeePushNotificationNudge ? DismissibleContent.NOTIFICATION_NUDGE_POST_CALL_DISCONNECT : null : null, c10948_12);
|
|
c21957_4 = r55;
|
|
useEffect(() => {
|
|
if (c21957_4 != null) {
|
|
setPushPermissionReactivationSeen(PermissionPromptType.CALL_DISCONNECT_BOTTOM_SHEET);
|
|
ActionSheetActionCreators.openLazy(import("./PostCallDisconnectNudge"), c10948_11, {
|
|
markAsDismissed
|
|
});
|
|
}
|
|
}, [r55, markAsDismissed]);
|
|
}
|