Files
discord-decomp/modules/activity_status/getActivityStatusText.tsx
T
2026-11-01 12:12:55 +02:00

90 lines
3.0 KiB
TypeScript

// Metro module 9076 (f9077).
import { ActivityTypes } from "../../Constants";
import { StatusDisplayTypes } from "../../_bundle/Module9077";
import isEmbeddedActivity from "../activities/utils/isEmbeddedActivity";
import getChannelCopyForEmbeddedActivity from "../activities/utils/getChannelCopyForEmbeddedActivity";
import { intl, t } from "../../intl/index.native";
import isListeningOnSpotify from "../activities/utils/isListeningOnSpotify";
import { isStageActivity } from "../stage_channels/StageChannelRichPresenceUtils";
import isCrunchyrollActivity from "../activities/utils/isCrunchyrollActivity";
export default function getActivityStatusText(a0, r8 = false) {
let text3;
const text = a0?.name !== "" ? a0?.name : null;
const text2 = a0?.details !== "" ? a0?.details : null;
const r10 = a0?.state !== "" ? a0?.state : null;
const r13 = a0?.type === ActivityTypes.STREAMING ? text2 == null ? text : text2 : text;
const status_display_type = a0?.status_display_type;
L40: {
if (status_display_type === StatusDisplayTypes.NAME) {
text3 = text;
if (text3 != null) {
break L40;
}
}
if (a0?.status_display_type === StatusDisplayTypes.STATE) {
text3 = r10;
if (text3 == null) {
text3 = a0?.status_display_type === StatusDisplayTypes.DETAILS && text2 != null ? text2 : r13;
}
} else {
text3 = a0?.status_display_type === StatusDisplayTypes.DETAILS && text2 != null ? text2 : r13;
}
}
if (isEmbeddedActivity(a0)) {
const channelCopyForEmbeddedActivity = getChannelCopyForEmbeddedActivity(text);
return {
text: channelCopyForEmbeddedActivity,
tooltip: channelCopyForEmbeddedActivity
};
}
if (a0?.type === ActivityTypes.PLAYING && text3 != null) {
return {
text: text3,
tooltip: intl.formatToPlainString(t.lFApmz, {
game: text3
})
};
}
if (isListeningOnSpotify(a0) && r8 && r10 != null) {
const r148 = r10.split("; ");
const text4 = r148 == null ? void 0 : r148.join(", ");
return {
text: text4,
tooltip: intl.formatToPlainString(t.Vnuxue, {
name: text4
})
};
}
return isStageActivity(a0) && text != null ? {
text,
tooltip: intl.formatToPlainString(t.pW3Ip3, {
name: text
})
} : a0?.type === ActivityTypes.LISTENING && text3 != null ? {
text: text3,
tooltip: intl.formatToPlainString(t.Vnuxue, {
name: text3
})
} : isCrunchyrollActivity(a0) && (r8 && text2 != null) ? {
text: text2,
tooltip: intl.formatToPlainString(t.pW3Ip3, {
name: text2
})
} : a0?.type === ActivityTypes.WATCHING && text3 != null ? {
text: text3,
tooltip: intl.formatToPlainString(t.pW3Ip3, {
name: text3
})
} : a0?.type === ActivityTypes.COMPETING && text3 != null ? {
text: text3,
tooltip: intl.formatToPlainString(t.QQ2wVE, {
name: text3
})
} : a0?.type === ActivityTypes.STREAMING && text3 != null ? {
text: text3,
tooltip: intl.formatToPlainString(t["0wJXSh"], {
name: text3
})
} : {};
};