Files
discord-decomp/sources/modules/custom_status/utils/userSettingToActivity.tsx
T
2026-07-28 01:06:53 +03:00

86 lines
5.2 KiB
TypeScript

/* Metro module 6882; source: modules/custom_status/utils/userSettingToActivity.tsx; dependencies: [31, 6540, 661, 3797, 3829, 566, 2] */
import EmojiStore from '../../emojis/EmojiStore.tsx'; /* Metro dependency 6540 */
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 FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as UserSettingsModule from '../../user_settings/UserSettings.tsx'; /* Metro dependency 3829 */
function _fun54648(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#54648, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7060:6, offset: 0x0136ae22, size: 179 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/custom_status/utils/userSettingToActivity.tsx');
exports.getActivityFromCustomStatus = getActivityFromCustomStatus;
exports.useCustomStatusActivity = useCustomStatusActivity;
function _activityFromSetting(a0, a1) { // fn#54649, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7060:148, offset: 0x0136aed5, size: 338 bytes, params: 3, frame: 19
var r1;
var defaultImport;
var getByName;
var defaultImport2;
var value3;
const value = null;
if (value != a1) {
r1 = {id: a1.id, name: a1.name, animated: a1.animated};
} else if (value != a0.emojiName) {
if (a0.emojiName === '') {
r1 = value;
} else {
defaultImport = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
getByName = defaultImport.getByName;
defaultImport2 = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
value3 = Reflect.apply(getByName, defaultImport, [defaultImport2.convertSurrogateToName(a0.emojiName,
false)]);
r1 = value != value3 ? {'id': null, 'name': null, 'animated': false, name: value3.surrogates} : value;
}
} else {
r1 = value;
}
const Number = global.Number;
const expiresAtMs = a0.expiresAtMs;
const value4 = undefined;
const value5 = Number(expiresAtMs);
const label = a0.label;
const r2 = value == label ? value4 : label.value;
const CUSTOM_STATUS = ActivityTypes.CUSTOM_STATUS;
let text = a0.text;
text = text.length > 0 ? a0.text : value4;
return {name: 'Custom Status', type: CUSTOM_STATUS, state: text, timestamps: value5 > 0 ? {end: value5} : value4,
emoji: r1, details: r2, metadata: {label: r2}};
}
function getActivityFromCustomStatus(a0) { // fn#54650, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7060:756, offset: 0x0136b027, size: 64 bytes, params: 2, frame: 16
const emojiId = a0.emojiId;
const _activityFromSettingBinding = _activityFromSetting;
const value2 = null;
return _activityFromSettingBinding(a0,
value2 != emojiId ? emojiId === '0' ? value2 : EmojiStore.getUsableCustomEmojiById(emojiId) : value2);
}
function useCustomStatusActivity() { // fn#54651, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7060:922, offset: 0x0136b067, size: 158 bytes, params: 1, frame: 19
const value2 = undefined;
const CustomStatusSetting = (UserSettingsModule).CustomStatusSetting;
const value3 = CustomStatusSetting.useSetting();
const emojiId = value3 == null ? value2 : value3.emojiId;
const useStateFromStores = FluxModule.useStateFromStores;
let items2 = [EmojiStore];
items2 = [value3, Reflect.apply(useStateFromStores, FluxModule, [items2, _fun54652, [emojiId]])];
return useMemo(_fun54653, items2);
function _fun54652() { // fn#54652, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7060:1065, offset: 0x0136b105, size: 58 bytes, params: 1, frame: 13
const emojiIdBinding = emojiId;
const value2 = null;
return value2 != emojiIdBinding ? emojiId === '0' ? value2 : EmojiStore.getUsableCustomEmojiById(emojiId) : value2;
}
function _fun54653() { // fn#54653, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7060:1137, offset: 0x0136b13f, size: 41 bytes, params: 1, frame: 14
const value2 = null;
return value2 != env0_0 ? _activityFromSetting(env0_0, env0_2) : value2;
}
}
}
global.__d(_fun54648, 6882, [31, 6540, 661, 3797, 3829, 566,
2]) /* metro module 6882, dependencies: [31, 6540, 661, 3797, 3829, 566, 2] */;