76 lines
3.8 KiB
TypeScript
76 lines
3.8 KiB
TypeScript
// Metro module 7886 (f7887).
|
|
import { NativeModules } from "react-native";
|
|
import AccessibilityStore from "../../../a11y/AccessibilityStore";
|
|
import ChannelStore from "../../../../stores/ChannelStore";
|
|
import GuildStore from "../../../../stores/GuildStore";
|
|
import { DEFAULT_GUILD_OFFICIAL_COLOR, GUILD_OFFICIAL_HIGHLIGHT_ALPHA_COLOR } from "../../MessageConstants";
|
|
import { SwipeActionsType } from "./RowGeneratorConstants";
|
|
import { MessageFlags, MessageTypes } from "../../../../Constants";
|
|
import { createNativeStyleProperties, experimental_createToken } from "../../../../design/components/Styles/native/createStyles";
|
|
import { hexWithOpacity } from "../../../../utils/ColorUtils";
|
|
import Module712 from "../../../../_bundle/Module712";
|
|
import { showGuildOfficialMessageGradient, isGuildOfficialMessagesEnabled } from "../../GuildOfficialMessageUtils";
|
|
import { hasEphemeralAppearance } from "../../MessageRecordUtils";
|
|
import ImageUtils from "../../../../utils/native/ImageUtils";
|
|
let c4983_12;
|
|
const nativeStyleProperties = createNativeStyleProperties({
|
|
ephemeralBackgroundColor: Module712.colors.INTERACTIVE_BACKGROUND_ACTIVE,
|
|
ephemeralGutterColor: Module712.colors.BACKGROUND_BRAND,
|
|
giftIntentEphemeralBackgroundColor: experimental_createToken(() => hexWithOpacity(Module712.unsafe_rawColors.BRAND_500, 0.1)),
|
|
mentionedBackgroundColor: Module712.colors.MESSAGE_MENTIONED_BACKGROUND_DEFAULT,
|
|
mentionedGutterColor: Module712.unsafe_rawColors.YELLOW_300,
|
|
automodBlockedBackgroundColor: Module712.colors.MESSAGE_AUTOMOD_BACKGROUND_DEFAULT,
|
|
automodBlockedGutterColor: Module712.unsafe_rawColors.RED_345,
|
|
editingColor: Module712.colors.MESSAGE_HIGHLIGHT_BACKGROUND_DEFAULT
|
|
});
|
|
c4983_12 = new Set(NativeModules.MediaManager.getConstants().supportedExtensions);
|
|
const r82 = {
|
|
getImageSrc: function getImageSrc(a0, a1, a2, a3) {
|
|
const r12 = a0.endsWith(".webp");
|
|
return ImageUtils.getMobileOptimizedSrc(a0, a1, a2, ((r12 ? !r12 : !a0.endsWith(".avif")) || c4983_12.has("webp") ? a3 : true) ? "png" : null);
|
|
},
|
|
createBackgroundHighlight: function createBackgroundHighlight({ message, theme, isEditing, isAutomodBlockedMessage }) {
|
|
const r13 = nativeStyleProperties(theme);
|
|
if (isEditing) {
|
|
return {
|
|
backgroundColor: r13.editingColor
|
|
};
|
|
}
|
|
if (isAutomodBlockedMessage) {
|
|
return {
|
|
backgroundColor: r13.automodBlockedBackgroundColor,
|
|
gutterColor: r13.automodBlockedGutterColor
|
|
};
|
|
}
|
|
if (message.hasFlag(MessageFlags.IS_GUILD_OFFICIAL) && showGuildOfficialMessageGradient(AccessibilityStore.officialMessageStyle)) {
|
|
const guild = GuildStore.getGuild(ChannelStore.getChannel(message.getChannelId())?.guild_id);
|
|
if (isGuildOfficialMessagesEnabled(guild, "RowGeneratorUtils")) {
|
|
let r55 = guild?.officialMessageColor;
|
|
if (r55 == null) {
|
|
r55 = DEFAULT_GUILD_OFFICIAL_COLOR;
|
|
}
|
|
return {
|
|
backgroundColor: r55 | GUILD_OFFICIAL_HIGHLIGHT_ALPHA_COLOR,
|
|
gutterColor: message.mentioned ? r13.mentionedGutterColor : hasEphemeralAppearance(message) ? r13.ephemeralGutterColor : void 0
|
|
};
|
|
}
|
|
}
|
|
return message.mentioned ? {
|
|
backgroundColor: r13.mentionedBackgroundColor,
|
|
gutterColor: r13.mentionedGutterColor
|
|
} : hasEphemeralAppearance(message) ? {
|
|
backgroundColor: message.type === MessageTypes.GIFTING_PROMPT ? r13.giftIntentEphemeralBackgroundColor : r13.ephemeralBackgroundColor,
|
|
gutterColor: r13.ephemeralGutterColor
|
|
} : void 0;
|
|
},
|
|
createSwipeActions: function createSwipeActions(a0, a1) {
|
|
return a0 ? a1 ? SwipeActionsType.REPLY_EDIT : SwipeActionsType.REPLY : SwipeActionsType.NONE;
|
|
}
|
|
};
|
|
export default r82;
|
|
export const InviteEmbedBackground = {
|
|
dark: "#313339",
|
|
light: "#fafafa"
|
|
};
|
|
export { nativeStyleProperties as resolveHighlightThemedColors };
|