// Metro module 8917 (f8918). import ChannelStore from "../stores/ChannelStore"; import RelationshipStore from "../stores/RelationshipStore"; import UserStore from "../stores/UserStore"; import { AnalyticEvents, ChannelTypes, ChannelTypesSets, Endpoints } from "../Constants"; import SelectedChannelActionCreators from "./SelectedChannelActionCreators"; import { HTTP } from "../_bundle/sendRequest"; import AnalyticsUtils from "../utils/AnalyticsUtils"; import AlertActionCreators from "./AlertActionCreators"; import { intl, t } from "../intl/index.native"; import RelationshipActionCreators from "./RelationshipActionCreators"; import * as _useCanRing from "../modules/calls/useCanRing"; import Dispatcher from "../Dispatcher"; const r25 = { call: function call(a0, a1, a2, a3, a4) { let user; const userId = a3; if (a3 != null) { if (RelationshipStore.isBlocked(a3)) { return void 0; } user = UserStore.getUser(a3); HTTP.get({ url: Endpoints.CALL(a0), oldFormErrors: true, rejectWithError: true }).then((result) => { const r4 = a2 && result.body.ringable; SelectedChannelActionCreators.selectVoiceChannel(a0, a1); if (r4) { this.ring(a0); } if (a4 != null) { a4(a0); } }, () => { AnalyticsUtils.track(AnalyticEvents.OPEN_POPOUT, { type: "Not Friend", source: "Call" }); AlertActionCreators.show({ title: intl.string(t.My50nf), body: intl.format(t.IdKo2z, { username: user != null ? user.username : "" }), confirmText: intl.string(t["PMsq/b"]), cancelText: intl.string(t.BddRzS), onConfirm: () => { RelationshipActionCreators.addRelationship({ userId, context: { location: "Call" } }); } }); }); } else { SelectedChannelActionCreators.selectVoiceChannel(a0, a1); if (a2) { this.ring(a0); } if (a4 != null) { a4(a0); } } }, ring: (a0, a1, a2) => { const channel = ChannelStore.getChannel(a0); if (channel != null) { const canRingUsersInChannel = _useCanRing.canRingUsersInChannel(channel); const r20 = ChannelTypesSets.CALLABLE.has(channel.type); if (canRingUsersInChannel) { HTTP.post({ url: Endpoints.CALL_RING(a0), body: { recipients: a1, analytics_location: a2 }, oldFormErrors: true, rejectWithError: true }); if (channel.type === ChannelTypes.GUILD_VOICE && a1 != null) { Dispatcher.dispatch({ type: "GUILD_LOCAL_RING_START", ringing: a1, guildId: channel.guild_id }); } return void 0; } if (r20) { Dispatcher.dispatch({ type: "CALL_ENQUEUE_RING", channelId: a0, recipients: a1 }); } } }, stopRinging: (a0, a1) => HTTP.post({ url: Endpoints.CALL_STOP_RINGING(a0), body: { recipients: a1 }, oldFormErrors: true, rejectWithError: true }) }; export default r25;