decord/source/utils/LibraryApplicationUtils.tsx

109 lines
3.6 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 4525
// Function ID: 4526
2026-07-29 08:29:29 +00:00
// Name: getComboId
2026-08-24 06:08:38 +00:00
// Dependencies: [32, 1922, 4526, 676, 4069, 2]
2026-07-29 08:29:29 +00:00
// Exports: calculateProgressPercentage, convertComboId, convertToTransitionState, getCombinedProgress, getComboId, isUserEntitledToLibraryApplication, shouldShareApplicationActivity, shouldShowGameInLibrary
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 4525 (getComboId)
import explicitContentFromProto from "explicitContentFromProto" /* 4069 */;
import closure_2 from "_slicedToArray" /* 32 */;
import closure_3 from "mergeGuildAvatar" /* 1922 */;
import closure_4 from "addSku" /* 4526 */;
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
({ LibraryApplicationFlags: c5, LocalDispatchApplicationStates: closure_6, StatusTypes: error } = ME);
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("utils/LibraryApplicationUtils.tsx");
2026-07-20 16:05:17 +00:00
export const getComboId = function getComboId(arg0, arg1) {
return "" + arg0 + ":" + arg1;
};
export const convertComboId = function convertComboId(str) {
const tmp = callback(str.split(":"), 2);
return { applicationId: tmp[0], branchId: tmp[1] };
};
2026-07-29 08:29:29 +00:00
export const shouldShareApplicationActivity = function shouldShareApplicationActivity(application_id, closure_7) {
2026-08-24 06:08:38 +00:00
const ShowCurrentGame = explicitContentFromProto.ShowCurrentGame;
2026-07-20 16:05:17 +00:00
if (ShowCurrentGame.getSetting()) {
2026-08-24 06:08:38 +00:00
const StatusSetting = explicitContentFromProto.StatusSetting;
2026-07-20 16:05:17 +00:00
if (StatusSetting.getSetting() !== constants3.INVISIBLE) {
2026-07-29 08:29:29 +00:00
const activeLibraryApplication = closure_7.getActiveLibraryApplication(application_id);
let tmp7 = null == activeLibraryApplication;
if (!tmp7) {
tmp7 = !activeLibraryApplication.hasFlag(constants.PRIVATE);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp7;
2026-07-20 16:05:17 +00:00
}
}
return false;
};
export const calculateProgressPercentage = function calculateProgressPercentage(arg0, arg1) {
let num = 100;
if (0 !== arg1) {
num = arg0 / arg1 * 100;
}
return num;
};
export const shouldShowGameInLibrary = function shouldShowGameInLibrary(arg0, hasFlag, enabled) {
let tmp = null != hasFlag;
if (tmp) {
2026-07-29 08:29:29 +00:00
enabled = enabled.enabled;
let tmp3 = !enabled;
if (enabled) {
2026-07-20 16:05:17 +00:00
tmp3 = !hasFlag.hasFlag(constants.PRIVATE);
}
if (tmp3) {
tmp3 = !hasFlag.isHidden();
}
tmp = tmp3;
}
return tmp;
};
2026-07-29 08:29:29 +00:00
export const convertToTransitionState = function convertToTransitionState(type) {
let tmp = null;
if (null != type) {
if (type.type !== constants2.INSTALLING) {
if (type.type !== tmp2.UPDATING) {
let tmp3 = null;
}
tmp = tmp3;
}
tmp3 = type;
}
return tmp;
};
2026-07-20 16:05:17 +00:00
export const getCombinedProgress = function getCombinedProgress(arr) {
return arr.reduce((total, type) => {
2026-07-29 08:29:29 +00:00
let tmp = null;
if (null != type) {
if (type.type !== constants.INSTALLING) {
if (type.type !== tmp2.UPDATING) {
let tmp3 = null;
}
tmp = tmp3;
}
tmp3 = type;
}
let tmp4 = total;
2026-07-20 16:05:17 +00:00
if (null != tmp) {
2026-07-29 08:29:29 +00:00
tmp4 = total;
if (type.type !== constants.UP_TO_DATE) {
const obj = { total: null, progress: null };
2026-07-20 16:05:17 +00:00
const _Number = Number;
2026-07-29 08:29:29 +00:00
obj[0] = total.total + Number(tmp.total);
2026-07-20 16:05:17 +00:00
const _Number2 = Number;
2026-07-29 08:29:29 +00:00
obj[1] = total.progress + Number(tmp.progress);
tmp4 = obj;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return tmp4;
2026-07-23 10:11:24 +00:00
}, { total: 0, progress: 0 });
2026-07-20 16:05:17 +00:00
};
export const isUserEntitledToLibraryApplication = function isUserEntitledToLibraryApplication(libraryApplication) {
2026-07-29 08:29:29 +00:00
let isEntitledResult = libraryApplication.isDiscordApplication();
if (isEntitledResult) {
2026-08-24 06:08:38 +00:00
isEntitledResult = libraryApplication.isEntitled(currentUser.getCurrentUser(), closure_4);
2026-07-20 16:05:17 +00:00
}
return isEntitledResult;
};