decord/alpha/source/modules/user_settings/UserSettingsProtoUtils.tsx

43 lines
1.4 KiB
TypeScript
Raw Permalink Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 2047
// Function ID: 2048
// Name: UserSettingsProtoUtils
2026-10-09 10:00:15 +00:00
// Dependencies: [1247, 2]
2026-07-20 16:05:17 +00:00
// Exports: createModifiedProto, getProtoFieldClass
2026-10-09 10:00:15 +00:00
// Module 2047 (UserSettingsProtoUtils)
import ProtoUtils from "ProtoUtils" /* 1247 */;
import size from "module_2" /* 2 */;
2026-08-24 06:08:38 +00:00
const result = size.fileFinishedImporting("modules/user_settings/UserSettingsProtoUtils.tsx");
2026-07-20 16:05:17 +00:00
export const getProtoFieldClass = function getProtoFieldClass(PreloadedUserSettings, field) {
2026-10-03 08:58:59 +00:00
let closure_0 = field;
2026-07-20 16:05:17 +00:00
const fields = PreloadedUserSettings.fields;
2026-10-03 08:58:59 +00:00
const found = fields.find((localName) => localName.localName === field);
2026-07-20 16:05:17 +00:00
if (null == found) {
const _Error = Error;
const _String = String;
const _HermesInternal = HermesInternal;
throw Error("Unknown proto field name " + String(field));
2026-07-20 16:05:17 +00:00
} else {
return found.T();
}
};
export const createModifiedProto = function createModifiedProto(favoriteGifs, fn, protoFieldClass, PreloadedUserSettings, arg4) {
2026-10-03 08:58:59 +00:00
let fromBinaryResult;
if (null != favoriteGifs) {
2026-10-03 08:58:59 +00:00
const fromBinary = protoFieldClass.fromBinary;
const toBinaryResult = protoFieldClass.toBinary(favoriteGifs);
2026-10-03 08:58:59 +00:00
fromBinaryResult = fromBinary(toBinaryResult, ProtoUtils.BINARY_READ_OPTIONS);
2026-07-20 16:05:17 +00:00
} else {
fromBinaryResult = protoFieldClass.create();
2026-07-20 16:05:17 +00:00
}
if (false === fn(fromBinaryResult)) {
2026-07-20 16:05:17 +00:00
return null;
} else {
const obj = PreloadedUserSettings.create();
obj[arg4] = fromBinaryResult;
2026-07-20 16:05:17 +00:00
return obj;
}
};