84 lines
3.2 KiB
TypeScript
84 lines
3.2 KiB
TypeScript
// Metro module 12824 (f12825).
|
|
import GuildMemberStore from "../../../stores/GuildMemberStore";
|
|
import GuildStore from "../../../stores/GuildStore";
|
|
import SelectedGuildStore from "../../../stores/SelectedGuildStore";
|
|
import UserStore from "../../../stores/UserStore";
|
|
import { GuildFeatures } from "../../../Constants";
|
|
import { GuildMemberFlags } from "../../guild_member/GuildMemberConstants";
|
|
import { Storage } from "../../../_bundle/Module595";
|
|
import { isNewUser } from "../../../utils/UserUtils";
|
|
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
|
|
import { getRootNavigationRef } from "../../main_tabs_v2/RootNavigationRef.native";
|
|
import { getCurrentNavigationRouteName } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native";
|
|
import { hasFlag } from "../../../_bundle/Module1384";
|
|
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
|
|
let c8847_9 = "2020_02_nuf_channels";
|
|
let c8847_10 = "2020_02_nuf_voice_channels";
|
|
class NUFChannelsManager extends AutomaticLifecycleManager {
|
|
actions = {
|
|
LOGOUT: () => this.clear()
|
|
};
|
|
handleNavigationStateChanged = () => {
|
|
if (getCurrentNavigationRouteName() === "guilds") {
|
|
const guildId = SelectedGuildStore.getGuildId();
|
|
const guild = GuildStore.getGuild(guildId);
|
|
let r1 = guildId != null && !(guild == null ? void 0 : guild.features.has(GuildFeatures.HUB));
|
|
const r26 = guild != null ? GuildMemberStore.getSelfMember(guild.id) : null;
|
|
let r30 = guild != null && guild.features.has(GuildFeatures.GUILD_ONBOARDING);
|
|
if (r30) {
|
|
let r38 = r26?.flags;
|
|
if (r38 == null) {
|
|
r38 = 0;
|
|
}
|
|
r30 = hasFlag(r38, GuildMemberFlags.STARTED_ONBOARDING);
|
|
}
|
|
if (r30) {
|
|
let r45 = r26?.flags;
|
|
if (r45 == null) {
|
|
r45 = 0;
|
|
}
|
|
r30 = !hasFlag(r45, GuildMemberFlags.COMPLETED_ONBOARDING);
|
|
}
|
|
if (r1) {
|
|
r1 = !r30;
|
|
}
|
|
if (r1) {
|
|
const r54 = Storage.get(c8847_9);
|
|
if (r54 ? !r54 : isNewUser(UserStore.getCurrentUser())) {
|
|
ActionSheetActionCreators.openLazy(import("./components/NUFChannelsActionSheet"), "NUFChannelsActionSheet");
|
|
Storage.set(c8847_9, true);
|
|
}
|
|
this.terminate();
|
|
}
|
|
}
|
|
};
|
|
requiresVoiceChannelsOnboard = () => {
|
|
const r9 = Storage.get(c8847_10);
|
|
return r9 ? !r9 : isNewUser(UserStore.getCurrentUser());
|
|
};
|
|
handleVoiceChannelsOnboard = () => {
|
|
Storage.set(c8847_10, true);
|
|
};
|
|
clear = () => {
|
|
Storage.remove(c8847_9);
|
|
Storage.remove(c8847_10);
|
|
};
|
|
_initialize() {
|
|
const r11 = Storage.get(c8847_9);
|
|
if (r11 ? !r11 : isNewUser(UserStore.getCurrentUser())) {
|
|
const rootNavigationRef = getRootNavigationRef();
|
|
if (rootNavigationRef != null) {
|
|
rootNavigationRef.addListener("state", this.handleNavigationStateChanged);
|
|
}
|
|
}
|
|
}
|
|
_terminate() {
|
|
const rootNavigationRef = getRootNavigationRef();
|
|
if (rootNavigationRef != null) {
|
|
rootNavigationRef.removeListener("state", this.handleNavigationStateChanged);
|
|
}
|
|
}
|
|
}
|
|
const nUFChannelsManager = new NUFChannelsManager();
|
|
export default nUFChannelsManager;
|