75 lines
2.7 KiB
TypeScript
75 lines
2.7 KiB
TypeScript
// Metro module 4197 (f4198).
|
|
import ChannelStore from "../../stores/ChannelStore";
|
|
import { Routes } from "../../Constants";
|
|
import { getGuildIdForGenericRedirect } from "./useGuildIdForChannelRoute";
|
|
import ChannelActionCreators from "../../actions/ChannelActionCreators";
|
|
import { transitionTo } from "./router_utils";
|
|
import ChannelRTCActionCreators from "../../actions/ChannelRTCActionCreators";
|
|
import Module38 from "../../_bundle/Module38";
|
|
export function transitionToChannel(a0, a1) {
|
|
const channel = ChannelStore.getChannel(a0);
|
|
if (channel != null) {
|
|
const guildIdForGenericRedirect = getGuildIdForGenericRedirect(channel);
|
|
ChannelActionCreators.preload(channel.guild_id, channel.id);
|
|
transitionTo(Routes.CHANNEL(guildIdForGenericRedirect, channel.id), {
|
|
openChannel: true,
|
|
...a1
|
|
});
|
|
if (a1?.openTextInVoiceIfVoiceChannel && channel.isGuildVocal()) {
|
|
ChannelRTCActionCreators.updateChatOpen(channel.id, true);
|
|
}
|
|
}
|
|
}
|
|
export function transitionToThread(a0, a1) {
|
|
Module38(a0.parent_id != null, "Thread must have a parent ID.");
|
|
transitionTo(Routes.CHANNEL(getGuildIdForGenericRedirect(a0), a0.id), {
|
|
openChannel: true,
|
|
...a1
|
|
});
|
|
}
|
|
export function transitionToThreadMessage(a0, a1, a2) {
|
|
Module38(a0.parent_id != null, "Thread must have a parent ID.");
|
|
transitionTo(Routes.CHANNEL(getGuildIdForGenericRedirect(a0), a0.id, a1), {
|
|
openChannel: true,
|
|
...a2
|
|
});
|
|
}
|
|
export function tryTransitionToThreadMessage(a0, a1, a2, a3) {
|
|
const channel = ChannelStore.getChannel(a1);
|
|
if (channel != null) {
|
|
Module38(channel.parent_id != null, "Thread must have a parent ID.");
|
|
transitionTo(Routes.CHANNEL(getGuildIdForGenericRedirect(channel), channel.id, a2), {
|
|
openChannel: true,
|
|
...a3
|
|
});
|
|
} else {
|
|
const channel2 = ChannelStore.getChannel(a0);
|
|
if (channel2 != null) {
|
|
const guildIdForGenericRedirect = getGuildIdForGenericRedirect(channel2);
|
|
ChannelActionCreators.preload(channel2.guild_id, channel2.id);
|
|
transitionTo(Routes.CHANNEL(guildIdForGenericRedirect, channel2.id), {
|
|
openChannel: true,
|
|
...a3
|
|
});
|
|
if (a3?.openTextInVoiceIfVoiceChannel && channel2.isGuildVocal()) {
|
|
ChannelRTCActionCreators.updateChatOpen(channel2.id, true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
export function transitionToMessage(a0, a1, a2) {
|
|
const channel = ChannelStore.getChannel(a0);
|
|
if (channel != null) {
|
|
transitionTo(Routes.CHANNEL(getGuildIdForGenericRedirect(channel), channel.id, a1), {
|
|
openChannel: true,
|
|
...a2
|
|
});
|
|
}
|
|
}
|
|
export function transitionToStaticChannelRoute(a0, a1, a2) {
|
|
transitionTo(Routes.CHANNEL(a0, a1), {
|
|
openChannel: true,
|
|
...a2
|
|
});
|
|
}
|