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

103 lines
3.2 KiB
TypeScript
Raw Normal View History

2026-08-26 06:04:24 +00:00
// Module ID: 9662
// Function ID: 9663
2026-07-20 16:05:17 +00:00
// Name: _activityFromSetting
2026-08-26 06:04:24 +00:00
// Dependencies: [19, 5348, 676, 4102, 4134, 589, 2]
2026-07-20 16:05:17 +00:00
// Exports: getActivityFromCustomStatus, useCustomStatusActivity
2026-08-26 06:04:24 +00:00
// Module 9662 (_activityFromSetting)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import noop from "noop" /* 19 */;
import ME from "ME" /* 676 */;
2026-08-26 06:04:24 +00:00
import parseRawEmojiObjectDefault from "parseRawEmojiObject" /* 4102 */;
import closure_4 from "getEmojiToGroupId" /* 5348 */;
2026-07-23 10:11:24 +00:00
2026-07-20 16:05:17 +00:00
function _activityFromSetting(emojiName) {
if (null != arg1) {
2026-07-29 08:29:29 +00:00
let obj = { id: null, name: null, animated: null };
({ id: obj2[0], name: obj2[1], animated: obj2[2] } = arg1);
2026-07-20 16:05:17 +00:00
let tmp = obj;
} else {
tmp = null;
if (null != emojiName.emojiName) {
tmp = null;
if ("" !== emojiName.emojiName) {
2026-08-24 06:08:38 +00:00
const obj5 = parseRawEmojiObjectDefault;
const byName = obj5.getByName(parseRawEmojiObjectDefault.convertSurrogateToName(emojiName.emojiName, false));
2026-07-20 16:05:17 +00:00
let tmp2 = null;
if (null != byName) {
2026-07-29 08:29:29 +00:00
obj = { id: null, name: null, animated: false };
obj[1] = byName.surrogates;
2026-07-20 16:05:17 +00:00
tmp2 = obj;
}
tmp = tmp2;
2026-08-24 06:08:38 +00:00
const obj6 = parseRawEmojiObjectDefault;
2026-07-20 16:05:17 +00:00
}
}
}
const NumberResult = Number(emojiName.expiresAtMs);
let value;
2026-07-29 08:29:29 +00:00
if (emojiName.label != null) {
2026-07-20 16:05:17 +00:00
value = iter.value;
}
2026-07-29 08:29:29 +00:00
obj = { 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;
}
2026-07-29 08:29:29 +00:00
obj[2] = text;
2026-07-20 16:05:17 +00:00
let tmp6;
if (NumberResult > 0) {
2026-08-24 06:08:38 +00:00
obj1 = { end: null };
2026-07-29 08:29:29 +00:00
obj1[0] = NumberResult;
2026-07-20 16:05:17 +00:00
tmp6 = obj1;
}
2026-07-29 08:29:29 +00:00
obj[3] = tmp6;
obj[4] = tmp;
obj[5] = value;
obj[6] = { label: value };
2026-07-20 16:05:17 +00:00
return obj;
}
2026-08-24 06:08:38 +00:00
const useMemo = noop.useMemo;
const ActivityTypes = ME.ActivityTypes;
const result = set.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 = usableCustomEmojiById.getUsableCustomEmojiById(emojiId);
}
}
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;
}
2026-08-24 06:08:38 +00:00
const items = [closure_4];
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) {
2026-08-24 06:08:38 +00:00
usableCustomEmojiById = closure_1_4.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) {
2026-08-24 06:08:38 +00:00
tmp2 = closure_1_6(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);
};