62 lines
2.2 KiB
TypeScript
62 lines
2.2 KiB
TypeScript
// Metro module 12225 (f12226).
|
|
import { useCallback } from "react";
|
|
import ChannelStore from "../../../stores/ChannelStore";
|
|
import { useStateFromStoresObject } from "../../../_bundle/Module589";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import getPrivateChannelCall from "./getPrivateChannelCall";
|
|
import ChannelActionCreators from "../../../actions/ChannelActionCreators";
|
|
export default function usePrivateChannelCall(a0, a1, a2) {
|
|
const stateFromStoresObject = useStateFromStoresObject([ChannelStore], () => {
|
|
const channel = ChannelStore.getChannel(ChannelStore.getDMFromUserId(a0));
|
|
if (channel != null && channel.isPrivate()) {
|
|
const privateChannelCall = getPrivateChannelCall(channel, a1);
|
|
return {
|
|
text: privateChannelCall.text,
|
|
accessibilityHint: privateChannelCall.accessibilityHint,
|
|
inCall: privateChannelCall.inCall
|
|
};
|
|
}
|
|
return {
|
|
text: a1 ? intl.string(t["7AWk50"]) : intl.string(t["EZgS+9"]),
|
|
accessibilityHint: a1 ? intl.string(t.oCqlGG) : intl.string(t.focH1t),
|
|
inCall: false
|
|
};
|
|
}, [a1, a0]);
|
|
return {
|
|
text: stateFromStoresObject.text,
|
|
inCall: stateFromStoresObject.inCall,
|
|
accessibilityHint: stateFromStoresObject.accessibilityHint,
|
|
handlePress: useCallback(async () => {
|
|
let c27275_1;
|
|
let c30513_0, c30513_1;
|
|
L25: {
|
|
c27275_1 = void 0;
|
|
c30513_0 = void 0;
|
|
c30513_1 = void 0;
|
|
c30513_0 = ChannelStore.getChannel(ChannelStore.getDMFromUserId(a0));
|
|
if (c30513_0 == null) {
|
|
c30513_1 = await ChannelActionCreators.ensurePrivateChannel(a0);
|
|
c30513_0 = ChannelStore.getChannel(c30513_1);
|
|
const r82 = c30513_0;
|
|
if (r82 == null ? void 0 : r82.isPrivate()) {
|
|
getPrivateChannelCall(c30513_0, a1).onPress();
|
|
}
|
|
if (a2 == null) {
|
|
break L25;
|
|
}
|
|
a2();
|
|
break L25;
|
|
}
|
|
const r41 = c30513_0;
|
|
if (r41 == null ? void 0 : r41.isPrivate()) {
|
|
getPrivateChannelCall(c30513_0, a1).onPress();
|
|
}
|
|
if (a2 != null) {
|
|
a2();
|
|
}
|
|
return void 0;
|
|
}
|
|
}, [a0, a1, a2])
|
|
};
|
|
};
|