Files
discord-decomp/sources/modules/spoiler_channels/native/ChannelSpoiler.tsx
T
2026-07-28 01:06:53 +03:00

198 lines
12 KiB
TypeScript

/* Metro module 11984; source: modules/spoiler_channels/native/ChannelSpoiler.tsx; dependencies: [57, 31, 27, 4606, 1379, 1867, 11793, 33, 4501, 697, 566, 4805, 11794, 7712, 6593, 4008, 6647, 4573, 1244, 4572, 6622, 5278, 11983, 5074, 2] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import ChannelStore from '../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import GuildStore from '../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import ChannelRTCStore from '../../calls/ChannelRTCStore.tsx'; /* Metro dependency 4606 */
import UseChannelName from '../../channel/useChannelName.tsx'; /* Metro dependency 4805 */
import GuildActionCreators from '../../../actions/GuildActionCreators.tsx'; /* Metro dependency 6593 */
import VoicePanelStateContext from '../../voice_panel/native/VoicePanelStateContext.tsx'; /* Metro dependency 11794 */
import GatedContent from '../../../components_native/warnings/GatedContent.tsx'; /* Metro dependency 11983 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as AgeVerificationAnalyticsUtilsModule from '../../age_assurance/AgeVerificationAnalyticsUtils.tsx'; /* Metro dependency 5074 */
import * as VoicePanelControlsConstantsModule from '../../voice_panel/native/controls/VoicePanelControlsConstants.tsx'; /* Metro dependency 11793 */
function _fun91983(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#91983, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12170:6, offset: 0x02078e4e, size: 387 bytes, params: 8, frame: 21
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = JsxRuntimeModule;
const env0_10 = value.jsx;
const env0_11 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
const BORDER_SUBTLE = (Native).colors.BORDER_SUBTLE;
const env0_12 = Reflect.apply(createStyles, value, [{subtitle: {'textAlign': 'center', 'lineHeight': 22},
subtitleContainer: {alignItems: 'center'}, divider: {'height': 1, 'width': '100%', 'backgroundColor': null,
'marginVertical': 16, backgroundColor: BORDER_SUBTLE}, subtitleMeasure: {'position': 'absolute', 'opacity': 0,
'left': 0, 'right': 0}}]);
(FileImportTrackerModule).fileFinishedImporting('modules/spoiler_channels/native/ChannelSpoiler.tsx');
exports.default = ChannelSpoiler;
function ChannelSpoiler(a0) { // fn#91984, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12170:498, offset: 0x02078fd1, size: 1408 bytes, params: 2, frame: 41
var r7;
var id;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const Text = (TextModule).Text;
var Stack;
var defaultImport;
var parseTopic;
var items2;
var defaultImport2;
const env0_0 = a0;
const value2 = undefined;
const guild = (FluxModule).useStateFromStores([GuildStore], _fun91985);
const channel = (FluxModule).useStateFromStores([ChannelStore], _fun91986);
const styles = useStyles();
let binding = ReactModule;
const [property, env0_1] = Module00057(binding.useState(false), 2);
const value5 = (UseChannelName)(channel);
const value6 = null;
const r0 = value6 == channel ? value2 : channel.isVocal();
binding = ReactModule;
const useContext = binding.useContext;
const value7 = binding.useCallback(_fun91987, [a0.guildId, a0.channelId, Reflect.apply(useContext, binding,
[VoicePanelStateContext]).setControlsMode, r0]);
const value8 = binding.useCallback(_fun91988, []);
const value9 = binding.useCallback(_fun91989, [a0.channelId]);
const r11 = value6 != channel ? (require(6647) /* metro dependency 6647: ChannelUtils */).getChannelIconComponent(channel) : value6;
const r8 = (
value6 != r11
? (
<View style={{'flexDirection': 'row', 'alignItems': 'center', 'gap': 4, 'flexShrink': 1}}>
{((Component) => <Component size="lg" color="mobile-text-heading-primary" />)(r11)}
<Text
variant="heading-xxl/bold"
color="mobile-text-heading-primary"
lineClamp={1}
style={{flexShrink: 1}}
>
{value5}
</Text>
</View>
)
: intl.string((require(1244) /* metro dependency 1244: indexNative */).t['q38/ae'])
);
let topic = value6 == channel ? value2 : channel.topic;
if (value6 != topic) {
topic = channel.topic;
if (topic.trim() === '') {
r7 = value6;
} else {
Stack = (require(4572) /* metro dependency 4572: StackNative */).Stack;
var stackProps = {spacing: 4, style: styles.subtitleContainer};
var viewBindingProps = {style: styles.subtitleMeasure, pointerEvents: 'none'};
var textProps = {'variant': 'text-md/medium', 'maxFontSizeMultiplier': 2, onTextLayout: value8};
defaultImport = importDefault(6622) /* metro dependency 6622: MarkupUtils */;
parseTopic = defaultImport.parseTopic;
topic = channel.topic;
id = channel.id;
items2 = [
<View {...viewBindingProps}>
<Text {...textProps}>
{Reflect.apply(parseTopic, defaultImport, [topic, true, {channelId: id}])}
</Text>
</View>,
];
var textProps2 = {'color': 'text-muted', 'variant': 'text-md/medium', 'style': null,
'maxFontSizeMultiplier': 2,
'lineClamp': 3, style: styles.subtitle};
defaultImport2 = importDefault(6622) /* metro dependency 6622: MarkupUtils */;
parseTopic = defaultImport2.parseTopic;
topic = channel.topic;
id = channel.id;
items2[1] = (
<Text {...textProps2}>
{Reflect.apply(parseTopic, defaultImport2, [topic, true, {channelId: id}])}
</Text>
);
items2[2] = (
property
? ((PressableHighlight) => <PressableHighlight onPress={value9} accessibilityRole="button"><Text variant="text-sm/medium" color="text-brand" style={{textDecorationLine: 'underline'}}>{intl.string((require(1244) /* metro dependency 1244: indexNative */).t['/QvRak'])}</Text></PressableHighlight>)((require(5278) /* metro dependency 5278: Pressables */).PressableHighlight)
: value6
);
items2[3] = <View style={styles.divider} />;
r7 = (
<Stack {...stackProps}>
{items2}
</Stack>
);
}
} else {
r7 = value6;
}
object = {};
const NsfwSpaceWarningModalType = (AgeVerificationAnalyticsUtilsModule).NsfwSpaceWarningModalType;
const SPOILER_CHANNEL = NsfwSpaceWarningModalType.SPOILER_CHANNEL;
object.modalType = SPOILER_CHANNEL;
object.onAgree = onAgree_91990;
object.onDisagree = value7;
object.title = r8;
object.subtitle = r7;
object.description = intl.string((require(1244) /* metro dependency 1244: indexNative */).t['08bm2Z']);
const string = intl.string;
const KmRwcW = (require(1244) /* metro dependency 1244: indexNative */).t.KmRwcW;
object.agreement = Reflect.apply(string, intl, [KmRwcW]);
object.disagreement = intl.string((require(1244) /* metro dependency 1244: indexNative */).t['/g10LC']);
object.guildId = value6 == guild ? value2 : guild.id;
object.channelId = a0.channelId;
return <GatedContent {...object} />;
function _fun91985() { // fn#91985, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12170:564, offset: 0x01db9505, size: 32 bytes, params: 1, frame: 11
return GuildStore.getGuild(env0_0.guildId);
}
function _fun91986() { // fn#91986, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12170:627, offset: 0x02079551, size: 31 bytes, params: 1, frame: 11
return ChannelStore.getChannel(env0_0.channelId);
}
function _fun91987() { // fn#91987, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12170:806, offset: 0x02079570, size: 161 bytes, params: 1, frame: 16
var value2;
var channelRTCStoreBinding;
var value3;
var defaultImport2;
if (env0_2) {
value2 = environment.__proto__;
channelRTCStoreBinding = ChannelRTCStore;
if (channelRTCStoreBinding.getChatOpen(env0_0.channelId)) {
defaultImport2 = importDefault(7712) /* metro dependency 7712: ChannelRTCActionCreators */;
defaultImport2.updateChatOpen(env0_0.channelId, false);
setControlsMode({mode: VoicePanelControlsModes.FLOATING_DEFAULT});
return undefined;
}
value3 = environment.__proto__;
}
const defaultImport = GuildActionCreators;
defaultImport.nsfwReturnToSafety(env0_0.guildId);
}
function _fun91988({nativeEvent}) { // fn#91988, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12170:1012, offset: 0x02079611, size: 43 bytes, params: 2, frame: 11
env0_1(nativeEvent.lines.length > 3);
}
function _fun91989() { // fn#91989, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12170:1071, offset: 0x0207963c, size: 86 bytes, params: 1, frame: 14
let value = environment.__proto__;
value = require(4008) /* metro dependency 4008: RootNavigationRefNative */;
value = value.getRootNavigationRef();
if (value != null) {
value.navigate('sidebar', {channelId: env0_0.channelId, expandTopic: true});
}
}
function ChannelSpoilerOnAgree() { // fn#91990, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12170:2424, owner: ChannelSpoiler.onAgree, offset: 0x02079692, size: 50 bytes, params: 1, frame: 12
let value = environment.__proto__;
value = importDefault(6593) /* metro dependency 6593: GuildActionCreators */;
value.spoilerAgree(env0_0.channelId);
}
}
}
global.__d(_fun91983, 11984, [57, 31, 27, 4606, 1379, 1867, 11793, 33, 4501, 697, 566, 4805, 11794, 7712, 6593,
4008, 6647, 4573, 1244, 4572, 6622, 5278, 11983, 5074,
2]) /* metro module 11984, dependencies: [57, 31, 27, 4606, 1379, 1867, 11793, 33, 4501, 697, 566, 4805, 11794, 7712, 6593, 4008, 6647, 4573, 1244, 4572, 6622, 5278, 11983, 5074, 2] */;