decord/source/modules/custom_status/utils/userSettingToActivity.tsx

100 lines
3.2 KiB
TypeScript
Raw Normal View History

// Module ID: 11249
// Function ID: 11250
// Name: userSettingToActivity
// Dependencies: [19, 5544, 1074, 4292, 1936, 504, 2]
2026-07-20 16:05:17 +00:00
// Exports: getActivityFromCustomStatus, useCustomStatusActivity
// Module 11249 (userSettingToActivity)
import _mod19 from "module_19" /* 19 */;
import Constants from "Constants" /* 1074 */;
import UnicodeEmojisDefault from "UnicodeEmojis" /* 4292 */;
import EmojiStore from "EmojiStore" /* 5544 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
function _activityFromSetting(emojiName, stateFromStores) {
if (null != stateFromStores) {
({ id: obj2.id, name: obj2.name, animated: obj2.animated } = stateFromStores);
let tmp = { id: null, name: null, animated: null };
const obj3 = { id: null, name: null, animated: null };
2026-07-20 16:05:17 +00:00
} else {
tmp = null;
if (null != emojiName.emojiName) {
tmp = null;
if ("" !== emojiName.emojiName) {
const obj5 = UnicodeEmojisDefault;
const byName = obj5.getByName(UnicodeEmojisDefault.convertSurrogateToName(emojiName.emojiName, false));
2026-07-20 16:05:17 +00:00
let tmp2 = null;
if (null != byName) {
const obj = { id: null, name: byName.surrogates, animated: false };
2026-07-20 16:05:17 +00:00
tmp2 = obj;
}
tmp = tmp2;
}
}
}
const NumberResult = Number(emojiName.expiresAtMs);
value = undefined;
2026-07-29 08:29:29 +00:00
if (emojiName.label != null) {
2026-07-20 16:05:17 +00:00
value = iter.value;
}
const obj4 = { name: "Custom Status", type: ActivityTypes.CUSTOM_STATUS, state: null, timestamps: null, emoji: null, details: null, metadata: null };
2026-07-20 16:05:17 +00:00
let text;
if (emojiName.text.length > 0) {
text = emojiName.text;
}
obj4.state = text;
2026-07-20 16:05:17 +00:00
let tmp6;
if (NumberResult > 0) {
const obj9 = { end: NumberResult };
tmp6 = obj9;
2026-07-20 16:05:17 +00:00
}
obj4.timestamps = tmp6;
obj4.emoji = tmp;
obj4.details = value;
obj4.metadata = { label: value };
return obj4;
2026-07-20 16:05:17 +00:00
}
const useMemo = _mod19.useMemo;
const ActivityTypes = Constants.ActivityTypes;
const result = size.fileFinishedImporting("modules/custom_status/utils/userSettingToActivity.tsx");
2026-07-20 16:05:17 +00:00
export const getActivityFromCustomStatus = function getActivityFromCustomStatus(setting) {
const emojiId = setting.emojiId;
let usableCustomEmojiById = null;
if (null != emojiId) {
usableCustomEmojiById = null;
if ("0" !== emojiId) {
usableCustomEmojiById = EmojiStore.getUsableCustomEmojiById(emojiId);
2026-07-20 16:05:17 +00:00
}
}
return _activityFromSetting(setting, usableCustomEmojiById);
};
export const useCustomStatusActivity = function useCustomStatusActivity() {
2026-07-23 10:11:24 +00:00
const CustomStatusSetting = setting(stateFromStores[4]).CustomStatusSetting;
setting = CustomStatusSetting.useSetting();
2026-07-20 16:05:17 +00:00
let emojiId;
2026-07-29 08:29:29 +00:00
if (setting != null) {
2026-07-20 16:05:17 +00:00
emojiId = setting.emojiId;
}
const items = [EmojiStore];
2026-07-20 16:05:17 +00:00
const items1 = [emojiId];
2026-07-23 10:11:24 +00:00
stateFromStores = setting(stateFromStores[5]).useStateFromStores(items, () => {
2026-07-20 16:05:17 +00:00
let usableCustomEmojiById = null;
if (null != emojiId) {
usableCustomEmojiById = null;
2026-07-29 08:29:29 +00:00
if ("0" !== tmp) {
usableCustomEmojiById = EmojiStore.getUsableCustomEmojiById(tmp);
2026-07-20 16:05:17 +00:00
}
}
return usableCustomEmojiById;
}, items1);
const items2 = [setting, stateFromStores];
return useMemo(() => {
2026-07-29 08:29:29 +00:00
let tmp2 = null;
2026-07-20 16:05:17 +00:00
if (null != setting) {
tmp2 = _activityFromSetting(tmp, stateFromStores);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp2;
2026-07-20 16:05:17 +00:00
}, items2);
};