325 lines
18 KiB
TypeScript
325 lines
18 KiB
TypeScript
/* Metro module 8769; source: modules/markup/native/MarkupReactCommandRule.tsx; dependencies: [31, 1379, 1483, 5066, 6625, 33, 5068, 4008, 4080, 1583, 4496, 1244, 1305, 8770, 3856, 6797, 3829, 8772, 6802, 8774, 4573, 4015, 8776, 8778, 2] */
|
|
import ChannelStore from '../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import ActionSheetActionCreators from '../../action_sheet/native/ActionSheetActionCreators.tsx'; /* Metro dependency 4080 */
|
|
import NavigateToLastChannel from '../../main_tabs_v2/native/navigateToLastChannel.tsx'; /* Metro dependency 8776 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
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 IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as AppLauncherNativeConstantsModule from '../../app_launcher/native/AppLauncherNativeConstants.tsx'; /* Metro dependency 1483 */
|
|
import * as KeyboardTypesModule from '../../keyboard/native/KeyboardTypes.tsx'; /* Metro dependency 1583 */
|
|
import * as UserSettingsModule from '../../user_settings/UserSettings.tsx'; /* Metro dependency 3829 */
|
|
import * as ToastUtilsModule from '../../toast/native/ToastUtils.tsx'; /* Metro dependency 3856 */
|
|
import * as ChatInputUtilsModule from '../../../utils/native/ChatInputUtils.tsx'; /* Metro dependency 4015 */
|
|
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
|
|
import * as ApplicationCommandConstantsModule from '../../application_commands/ApplicationCommandConstants.tsx'; /* Metro dependency 5066 */
|
|
import * as ApplicationCommandTypesModule from '../../application_commands/ApplicationCommandTypes.tsx'; /* Metro dependency 5068 */
|
|
import * as ChannelAutocompleteConstantsModule from '../../channel_autocomplete/ChannelAutocompleteConstants.tsx'; /* Metro dependency 6625 */
|
|
import * as ClipboardUtilsNativeModule from '../../../utils/ClipboardUtils.native.tsx'; /* Metro dependency 6797 */
|
|
import * as ShowSimpleActionSheetModule from '../../action_sheet/native/showSimpleActionSheet.tsx'; /* Metro dependency 6802 */
|
|
import * as SlashBoxIconModule from '../../../design/components/Icon/native/redesign/generated/SlashBoxIcon.tsx'; /* Metro dependency 8770 */
|
|
import * as AppLauncherContextModule from '../../app_launcher/native/AppLauncherContext.tsx'; /* Metro dependency 8774 */
|
|
import * as MarkupRulesUtilsModule from '../MarkupRulesUtils.tsx'; /* Metro dependency 8778 */
|
|
|
|
function _fun68600(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#68600, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:6, offset: 0x01c55991, size: 268 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const handleTapCommandMention2 = handleTapCommandMention;
|
|
const handleLongPressCommandMention2 = handleLongPressCommandMention;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/markup/native/MarkupReactCommandRule.tsx');
|
|
exports.default = MarkupReactCommandRule;
|
|
exports.handleTapCommandMention = handleTapCommandMention2;
|
|
exports.handleLongPressCommandMention = handleLongPressCommandMention2;
|
|
function handleTapCommandMention({appLauncherNavigator, channelId, currentText, onSetCommand, onOpenCustomKeyboard, commandId, commandName}) { // fn#68601, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:260, offset: 0x01c55a9d, size: 797 bytes, params: 2, frame: 27
|
|
var r6;
|
|
var length;
|
|
var r1;
|
|
var defaultImport;
|
|
var show;
|
|
var object;
|
|
const intl = (IndexNativeModule).intl;
|
|
const t = (IndexNativeModule).t;
|
|
var includes;
|
|
var value4;
|
|
var split;
|
|
var value5;
|
|
var slice;
|
|
var value6;
|
|
var join;
|
|
var value7;
|
|
var moduleValue;
|
|
var getRootNavigationRef;
|
|
var value8;
|
|
var getState;
|
|
var value9;
|
|
var routes;
|
|
var value10;
|
|
var value11;
|
|
var goBack;
|
|
var value12;
|
|
var defaultImport2;
|
|
var hideActionSheet;
|
|
var setTimeout;
|
|
var navigate;
|
|
var object2;
|
|
var env0_2;
|
|
const channel = ChannelStore.getChannel(channelId);
|
|
if (channel != null) {
|
|
reducibleJoin2: while (true) {
|
|
if (channel.guild_id != null) {
|
|
includes = commandName.includes;
|
|
reducibleJoin7: while (true) {
|
|
if (Reflect.apply(includes, commandName, [' '])) {
|
|
value4 = commandId + SUB_COMMAND_KEY_SEPARATOR;
|
|
split = commandName.split;
|
|
value5 = Reflect.apply(split, commandName, [' ']);
|
|
slice = value5.slice;
|
|
value6 = Reflect.apply(slice, value5, [1]);
|
|
join = value6.join;
|
|
value7 = value4 + Reflect.apply(join, value6, [SUB_COMMAND_KEY_SEPARATOR]);
|
|
r6 = value7;
|
|
break reducibleJoin7;
|
|
}
|
|
r6 = commandId;
|
|
break reducibleJoin7;
|
|
}
|
|
env0_2 = r6;
|
|
if (appLauncherNavigator != null) {
|
|
reducibleJoin9: while (true) {
|
|
if (channel != null) {
|
|
navigate = appLauncherNavigator.navigate;
|
|
object = {};
|
|
object.name = AppLauncherRouteName.COMMAND_VIEW;
|
|
object2 = {};
|
|
object2.analyticsLocation = (require(5068) /* metro dependency 5068: ApplicationCommandTypes */).ApplicationCommandTriggerLocations.MENTION;
|
|
object2.preSelectedCommand = {commandId: r6};
|
|
object2.context = {type: 'channel', channel: channel};
|
|
object.params = object2;
|
|
Reflect.apply(navigate, appLauncherNavigator, [object]);
|
|
return undefined;
|
|
}
|
|
break reducibleJoin9;
|
|
}
|
|
}
|
|
moduleValue = require(4008) /* metro dependency 4008: RootNavigationRefNative */;
|
|
getRootNavigationRef = moduleValue.getRootNavigationRef;
|
|
value8 = Reflect.apply(getRootNavigationRef, moduleValue, []);
|
|
reducibleJoin20: while (true) {
|
|
if (value8 == null) {
|
|
break reducibleJoin20;
|
|
}
|
|
getState = value8.getState;
|
|
value9 = Reflect.apply(getState, value8, []);
|
|
reducibleJoin13: while (true) {
|
|
if (value9 == null) {
|
|
length = undefined;
|
|
break reducibleJoin13;
|
|
}
|
|
routes = value9.routes;
|
|
if (routes == null) {
|
|
length = undefined;
|
|
break reducibleJoin13;
|
|
}
|
|
length = routes.length;
|
|
break reducibleJoin13;
|
|
}
|
|
if (!(length > 1)) {
|
|
break reducibleJoin20;
|
|
}
|
|
getState = value8.getState;
|
|
value10 = Reflect.apply(getState, value8, []);
|
|
reducibleJoin17: while (true) {
|
|
if (value10 == null) {
|
|
length = undefined;
|
|
break reducibleJoin17;
|
|
}
|
|
routes = value10.routes;
|
|
if (routes == null) {
|
|
length = undefined;
|
|
break reducibleJoin17;
|
|
}
|
|
length = routes.length;
|
|
break reducibleJoin17;
|
|
}
|
|
value11 = 0;
|
|
r1 = length ?? value11;
|
|
if (!(r1 > 1)) {
|
|
break reducibleJoin20;
|
|
}
|
|
reducibleLoop19: while (true) {
|
|
goBack = value8.goBack;
|
|
Reflect.apply(goBack, value8, []);
|
|
value12 = typeof r1 === 'bigint' ? r1 - 1n : +r1 - 1;
|
|
if (value12 > 1) {
|
|
r1 = value12;
|
|
continue reducibleLoop19;
|
|
}
|
|
break reducibleJoin20;
|
|
}
|
|
}
|
|
defaultImport2 = importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */;
|
|
hideActionSheet = defaultImport2.hideActionSheet;
|
|
Reflect.apply(hideActionSheet, defaultImport2, []);
|
|
setTimeout = global.setTimeout;
|
|
setTimeout(_fun68602, 0);
|
|
return undefined;
|
|
}
|
|
break reducibleJoin2;
|
|
}
|
|
}
|
|
if (currentText === '') {
|
|
onSetCommand();
|
|
} else {
|
|
defaultImport = importDefault(4496) /* metro dependency 4496: AlertActionCreators */;
|
|
show = defaultImport.show;
|
|
object = {};
|
|
object.title = intl.string(t.pe26Cj);
|
|
object.confirmText = intl.string(t.VkKicb);
|
|
object.onConfirm = function() {
|
|
return onSetCommand();
|
|
};
|
|
object.cancelText = intl.string(t['ETE/oC']);
|
|
object.confirmColor = (require(1305) /* metro dependency 1305: native */).ButtonColors.BRAND;
|
|
object.body = intl.string(t['+awCIy']);
|
|
Reflect.apply(show, defaultImport, [object]);
|
|
}
|
|
function _fun68602() { // fn#68602, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:995, offset: 0x01c55dba, size: 123 bytes, params: 1, frame: 16
|
|
const onOpenCustomKeyboardBinding = onOpenCustomKeyboard;
|
|
const object = {};
|
|
const KeyboardTypes = (KeyboardTypesModule).KeyboardTypes;
|
|
const APP_LAUNCHER = KeyboardTypes.APP_LAUNCHER;
|
|
object.type = APP_LAUNCHER;
|
|
const object2 = {};
|
|
const COMMAND_VIEW = AppLauncherRouteName.COMMAND_VIEW;
|
|
object2.initialRouteName = COMMAND_VIEW;
|
|
const ApplicationCommandTriggerLocations = (ApplicationCommandTypesModule).ApplicationCommandTriggerLocations;
|
|
const MENTION = ApplicationCommandTriggerLocations.MENTION;
|
|
object2.analyticsLocation = MENTION;
|
|
object2.preSelectedCommand = {commandId: env0_2};
|
|
object.context = object2;
|
|
return onOpenCustomKeyboardBinding(object);
|
|
}
|
|
|
|
}
|
|
|
|
function handleLongPressCommandMention(a0, a1) { // fn#68604, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:1484, offset: 0x01c55e35, size: 310 bytes, params: 3, frame: 19
|
|
var push;
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
let object = {};
|
|
const intl = (IndexNativeModule).intl;
|
|
const string = intl.string;
|
|
const t = (IndexNativeModule).t;
|
|
object.label = Reflect.apply(string, intl, [t['42H+Nb']]);
|
|
const SlashBoxIcon = (SlashBoxIconModule).SlashBoxIcon;
|
|
object.IconComponent = SlashBoxIcon;
|
|
object.onPress = onPress_68605;
|
|
const items2 = [object];
|
|
const DeveloperMode = (UserSettingsModule).DeveloperMode;
|
|
const getSetting = DeveloperMode.getSetting;
|
|
if (Reflect.apply(getSetting, DeveloperMode, [])) {
|
|
push = items2.push;
|
|
object = {};
|
|
object.label = intl.string(t.oJ1Muw);
|
|
object.IconComponent = (require(8772) /* metro dependency 8772: IdIcon */).IdIcon;
|
|
object.onPress = onPress_68606;
|
|
Reflect.apply(push, items2, [object]);
|
|
}
|
|
(ShowSimpleActionSheetModule).showSimpleActionSheet({'key': 'LongPressCommandMention',
|
|
'options': null, 'hasIcons': true, options: items2});
|
|
function handleLongPressCommandMentionOnPress() { // fn#68605, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:1621, owner: handleLongPressCommandMention.onPress, offset: 0x01c55f6b, size: 94 bytes, params: 1, frame: 16
|
|
(ToastUtilsModule).presentCommandCopied();
|
|
ClipboardUtilsNativeModule.copy('' + COMMAND_SENTINEL + env0_0);
|
|
}
|
|
|
|
function handleLongPressCommandMentionOnPress_68606() { // fn#68606, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:1813, owner: handleLongPressCommandMention.onPress, offset: 0x01c55fc9, size: 67 bytes, params: 1, frame: 13
|
|
const value = environment.__proto__;
|
|
(ToastUtilsModule).presentIdCopied();
|
|
(ClipboardUtilsNativeModule).copy(require);
|
|
}
|
|
|
|
}
|
|
|
|
function MarkupReactCommandRule({node, output, state, style}) { // fn#68607, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:2049, offset: 0x01c5600c, size: 210 bytes, params: 2, frame: 22
|
|
const useContext = ReactModule.useContext;
|
|
const AppLauncherContext = (AppLauncherContextModule).AppLauncherContext;
|
|
const result = Reflect.apply(useContext, ReactModule, [AppLauncherContext]) != null;
|
|
const env0_2 = useAppLauncherNavigation();
|
|
const Text = (TextModule).Text;
|
|
const object = {style: style, variant: 'text-md/bold', onPress: onPress_68608, onLongPress: function() {
|
|
var handleLongPressCommandMentionBinding = handleLongPressCommandMention;
|
|
var nodeBinding = node;
|
|
handleLongPressCommandMentionBinding(nodeBinding.commandName, nodeBinding.commandId);
|
|
}};
|
|
let value = MarkupRulesUtilsModule;
|
|
value = value.smartOutput(node, output, state);
|
|
return (
|
|
<Text {...object}>
|
|
{'/'}
|
|
{value}
|
|
</Text>
|
|
);
|
|
function MarkupReactCommandRuleOnPress() { // fn#68608, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:2239, owner: MarkupReactCommandRule.onPress, offset: 0x01c560de, size: 174 bytes, params: 1, frame: 16
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
const value2 = undefined;
|
|
const bestActiveInput = (ChatInputUtilsModule).getBestActiveInput();
|
|
const handleTapCommandMentionBinding = handleTapCommandMention;
|
|
const object = {};
|
|
object.appLauncherNavigator = result ? env0_2 : value2;
|
|
const nodeBinding = node;
|
|
object.channelId = nodeBinding.channelId;
|
|
object.commandId = nodeBinding.commandId;
|
|
object.commandName = nodeBinding.commandName;
|
|
object.currentText = (bestActiveInput == null ? value2 : bestActiveInput.getText()) ?? '';
|
|
object.onOpenCustomKeyboard = onOpenCustomKeyboard;
|
|
object.onSetCommand = onSetCommand;
|
|
handleTapCommandMentionBinding(object);
|
|
return value2;
|
|
function onPressOnOpenCustomKeyboard_68609(a0) { // fn#68609, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:2484, owner: MarkupReactCommandRule.onPress.onOpenCustomKeyboard, offset: 0x01c557b4, size: 38 bytes, params: 2, frame: 12
|
|
return env0_0?.openCustomKeyboard(a0);
|
|
}
|
|
|
|
function onPressOnSetCommand_68610() { // fn#68610, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8954:2539, owner: MarkupReactCommandRule.onPress.onSetCommand, offset: 0x01c5618c, size: 181 bytes, params: 1, frame: 18
|
|
var r2;
|
|
var r5;
|
|
var applicationCommandManager;
|
|
var setPartialCommand;
|
|
var value7;
|
|
var nodeBinding;
|
|
const value2 = undefined;
|
|
(NavigateToLastChannel)();
|
|
(ActionSheetActionCreators).hideActionSheet();
|
|
if (env0_0 != null) {
|
|
env0_0.openSystemKeyboard();
|
|
}
|
|
const value4 = env0_0 == null;
|
|
if (value4) {
|
|
r2 = value4;
|
|
r5 = value2;
|
|
} else {
|
|
applicationCommandManager = env0_0.getApplicationCommandManager();
|
|
r2 = applicationCommandManager == null;
|
|
r5 = applicationCommandManager;
|
|
}
|
|
if (!r2) {
|
|
setPartialCommand = r5.setPartialCommand;
|
|
value7 = environment.__proto__;
|
|
nodeBinding = node;
|
|
Reflect.apply(setPartialCommand, r5, [nodeBinding.commandId, nodeBinding.commandName,
|
|
(require(5068) /* metro dependency 5068: ApplicationCommandTypes */).ApplicationCommandTriggerLocations.MENTION]);
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun68600, 8769, [31, 1379, 1483, 5066, 6625, 33, 5068, 4008, 4080, 1583, 4496, 1244, 1305, 8770, 3856,
|
|
6797, 3829, 8772, 6802, 8774, 4573, 4015, 8776, 8778,
|
|
2]) /* metro module 8769, dependencies: [31, 1379, 1483, 5066, 6625, 33, 5068, 4008, 4080, 1583, 4496, 1244, 1305, 8770, 3856, 6797, 3829, 8772, 6802, 8774, 4573, 4015, 8776, 8778, 2] */;
|