49 lines
1.8 KiB
TypeScript
49 lines
1.8 KiB
TypeScript
// Metro module 16122 (f16123).
|
|
import ChannelStore from "../../../stores/ChannelStore";
|
|
import RelationshipStore from "../../../stores/RelationshipStore";
|
|
import InstantInviteActionCreators from "../../../actions/InstantInviteActionCreators";
|
|
import ToastActionCreators from "../../toast/native/ToastActionCreators";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import Module10356 from "../../../_bundle/Module10356";
|
|
import Dispatcher from "../../../Dispatcher";
|
|
import navigateToLastChannel from "../../main_tabs_v2/native/navigateToLastChannel";
|
|
let $mk98730 = function() {
|
|
return () => navigateToLastChannel();
|
|
};
|
|
export const DEFAULT_EXPIRATION_DAYS = 7;
|
|
export const DEFAULT_EXPIRATION_USES = 5;
|
|
export function revokeAllFriendInvites() {
|
|
InstantInviteActionCreators.revokeFriendInvites().then(() => {
|
|
ToastActionCreators.open({
|
|
key: "TOAST_FRIEND_INVITES_REVOKED",
|
|
content: intl.string(t.jSHEOQ),
|
|
icon: Module10356
|
|
});
|
|
});
|
|
}
|
|
export function acceptFriendInvite(a0, a1) {
|
|
if (a0.channel == null && a0.guild == null && a0.inviter != null) {
|
|
if ((RelationshipStore.isFriend(a0.inviter.id) ? ChannelStore.getDMFromUserId(a0.inviter.id) : null) != null) {
|
|
InstantInviteActionCreators.transitionToInvite(a0, {
|
|
forceTransition: true
|
|
});
|
|
Dispatcher.wait($mk98730());
|
|
} else {
|
|
InstantInviteActionCreators.acceptInviteAndTransitionToInviteChannel({
|
|
inviteKey: a0.code,
|
|
context: a1,
|
|
callback: () => {
|
|
ToastActionCreators.open({
|
|
key: "FRIEND_INVITE_ACCEPT_CONFIRMATION",
|
|
content: intl.formatToPlainString(t.st2dcs, {
|
|
username: a0.inviter?.username
|
|
}),
|
|
icon: Module10356
|
|
});
|
|
Dispatcher.wait($mk98730());
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|