decord/source/modules/parent_tools/hooks/useParentalControlSettings.tsx

238 lines
8.5 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 14279
// Function ID: 14280
2026-07-20 16:05:17 +00:00
// Name: useParentalControlledExplicitContentSettings
2026-08-25 06:04:03 +00:00
// Dependencies: [5, 19, 7146, 7924, 7482, 14280, 14283, 1306, 6024, 6122, 7480, 589, 7145, 7929, 2]
2026-07-20 16:05:17 +00:00
// Exports: useAllowFriendsFromMutualGuildsOnlyForTeen, useDefaultGuildsRestricted, useIsParentallyControlled, useParentalControlledConsent, useParentalControlledExplicitContentSettings, useParentalControlledGoreContentSettings
2026-08-25 06:04:03 +00:00
// Module 14279 (useParentalControlledExplicitContentSettings)
import useUserIdsForLinkStatus from "useUserIdsForLinkStatus" /* 7480 */;
import useSelectedTeen from "useSelectedTeen" /* 7482 */;
import result2 from "result" /* 14280 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "noop" /* 19 */;
2026-08-25 06:04:03 +00:00
import closure_5 from "getSettings" /* 7146 */;
import { SafetyToastType } from "SafetyToastType" /* 7924 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
const result = require("set").fileFinishedImporting("modules/parent_tools/hooks/useParentalControlSettings.tsx");
2026-07-20 16:05:17 +00:00
export const useParentalControlledExplicitContentSettings = function useParentalControlledExplicitContentSettings() {
2026-08-24 06:08:38 +00:00
let obj = useSelectedTeen;
2026-07-20 16:05:17 +00:00
const selectedTeen = obj.useSelectedTeen();
2026-08-24 06:08:38 +00:00
const ParentalControlledExplicitContent = result2.ParentalControlledExplicitContent;
2026-07-20 16:05:17 +00:00
let id;
2026-07-29 08:29:29 +00:00
if (selectedTeen != null) {
2026-07-20 16:05:17 +00:00
id = selectedTeen.id;
}
const controlledSetting = ParentalControlledExplicitContent.useControlledSetting(id);
2026-07-29 08:29:29 +00:00
let tmp6 = null;
2026-07-20 16:05:17 +00:00
if (null != selectedTeen) {
2026-08-25 06:04:03 +00:00
let tmpResult = tmp(14283);
2026-07-20 16:05:17 +00:00
let id1;
2026-07-29 08:29:29 +00:00
if (selectedTeen != null) {
2026-07-20 16:05:17 +00:00
id1 = selectedTeen.id;
}
2026-07-29 08:29:29 +00:00
obj = { teenId: null, setting: null };
obj[0] = id1;
2026-07-20 16:05:17 +00:00
let prop;
2026-07-29 08:29:29 +00:00
if (controlledSetting != null) {
2026-07-20 16:05:17 +00:00
prop = controlledSetting.explicitContentNonFriendDm;
}
2026-07-29 08:29:29 +00:00
obj = { explicitContentNonFriendDm: null, explicitContentFriendDm: null, explicitContentGuilds: null };
obj[1] = prop;
obj[0] = tmpResult.resolveExplicitContentSettingWithDefaultsForTeen(obj);
2026-08-25 06:04:03 +00:00
tmpResult = tmp(14283);
2026-07-20 16:05:17 +00:00
let id2;
2026-07-29 08:29:29 +00:00
if (selectedTeen != null) {
2026-07-20 16:05:17 +00:00
id2 = selectedTeen.id;
}
2026-08-24 06:08:38 +00:00
obj1 = { teenId: null, setting: null, isFriend: true };
2026-07-29 08:29:29 +00:00
obj1[0] = id2;
2026-07-20 16:05:17 +00:00
let prop1;
2026-07-29 08:29:29 +00:00
if (controlledSetting != null) {
2026-07-20 16:05:17 +00:00
prop1 = controlledSetting.explicitContentFriendDm;
}
2026-07-29 08:29:29 +00:00
obj1[1] = prop1;
obj[1] = tmpResult.resolveExplicitContentSettingWithDefaultsForTeen(obj1);
obj[2] = tmp(1306).ExplicitContentRedaction.BLUR;
tmp6 = obj;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp6;
2026-07-20 16:05:17 +00:00
};
export const useParentalControlledGoreContentSettings = function useParentalControlledGoreContentSettings() {
2026-08-24 06:08:38 +00:00
let obj = useSelectedTeen;
2026-07-20 16:05:17 +00:00
const selectedTeen = obj.useSelectedTeen();
2026-08-24 06:08:38 +00:00
const ParentalControlledGoreContent = result2.ParentalControlledGoreContent;
2026-07-20 16:05:17 +00:00
let id;
2026-07-29 08:29:29 +00:00
if (selectedTeen != null) {
2026-07-20 16:05:17 +00:00
id = selectedTeen.id;
}
let controlledSetting = ParentalControlledGoreContent.useControlledSetting(id);
if (null == selectedTeen) {
return null;
} else {
2026-07-29 08:29:29 +00:00
if (controlledSetting == null) {
2026-07-20 16:05:17 +00:00
controlledSetting = {};
}
({ goreContentNonFriendDm, goreContentFriendDm } = controlledSetting);
2026-08-25 06:04:03 +00:00
let tmpResult = tmp(14283);
2026-07-29 08:29:29 +00:00
if (!tmpResult.isSetAndNotDefault(goreContentNonFriendDm)) {
2026-08-25 06:04:03 +00:00
tmpResult = tmp(6024);
2026-07-29 08:29:29 +00:00
goreContentNonFriendDm = tmpResult.resolveGoreSettingWithDefaultsForTeen({ isDm: true });
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { goreContentNonFriendDm: null, goreContentFriendDm: null, goreContentGuilds: null };
obj[0] = goreContentNonFriendDm;
if (!tmpResult1.isSetAndNotDefault(goreContentFriendDm)) {
2026-08-25 06:04:03 +00:00
goreContentFriendDm = tmp(6024).resolveGoreSettingWithDefaultsForTeen({ isDm: true, isFriend: true });
const tmpResult2 = tmp(6024);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = goreContentFriendDm;
obj[2] = tmp(1306).ExplicitContentRedaction.BLUR;
2026-07-20 16:05:17 +00:00
return obj;
}
};
export const useDefaultGuildsRestricted = function useDefaultGuildsRestricted() {
2026-08-24 06:08:38 +00:00
const selectedTeen = useSelectedTeen.useSelectedTeen();
const ParentalControlledDefaultGuildsRestricted = result2.ParentalControlledDefaultGuildsRestricted;
2026-07-20 16:05:17 +00:00
let id;
2026-07-29 08:29:29 +00:00
if (selectedTeen != null) {
2026-07-20 16:05:17 +00:00
id = selectedTeen.id;
}
const controlledSetting = ParentalControlledDefaultGuildsRestricted.useControlledSetting(id);
2026-08-24 06:08:38 +00:00
const ParentalControlledDefaultGuildsRestrictedV2 = result2.ParentalControlledDefaultGuildsRestrictedV2;
2026-07-20 16:05:17 +00:00
let id1;
2026-07-29 08:29:29 +00:00
if (selectedTeen != null) {
2026-07-20 16:05:17 +00:00
id1 = selectedTeen.id;
}
let controlledSetting1 = ParentalControlledDefaultGuildsRestrictedV2.useControlledSetting(id1);
if (null == controlledSetting1) {
2026-07-29 08:29:29 +00:00
controlledSetting1 = controlledSetting || controlledSetting;
const tmp8 = controlledSetting || controlledSetting;
2026-07-20 16:05:17 +00:00
}
return controlledSetting1;
};
export const useAllowFriendsFromMutualGuildsOnlyForTeen = function useAllowFriendsFromMutualGuildsOnlyForTeen() {
2026-08-25 06:04:03 +00:00
const selectedTeen = controlledSetting(7482).useSelectedTeen();
const ParentalControlledFriendSourceFlags = controlledSetting(14280).ParentalControlledFriendSourceFlags;
2026-07-20 16:05:17 +00:00
let id;
2026-07-29 08:29:29 +00:00
if (selectedTeen != null) {
2026-07-20 16:05:17 +00:00
id = selectedTeen.id;
}
2026-07-23 10:11:24 +00:00
controlledSetting = ParentalControlledFriendSourceFlags.useControlledSetting(id);
2026-07-20 16:05:17 +00:00
const items = [controlledSetting];
2026-08-24 06:08:38 +00:00
const memo = React.useMemo(() => controlledSetting(closure_1_2[9]).computeFlags(controlledSetting), items);
2026-07-20 16:05:17 +00:00
return memo.mutualGuilds && !memo.all;
};
export const useIsParentallyControlled = function useIsParentallyControlled() {
2026-08-24 06:08:38 +00:00
return useUserIdsForLinkStatus.useHasActiveParentLinks();
2026-07-20 16:05:17 +00:00
};
export const useParentalControlledConsent = function useParentalControlledConsent(PERSONALIZATION) {
2026-07-29 08:29:29 +00:00
let _require = PERSONALIZATION;
2026-08-25 06:04:03 +00:00
let obj = _require(7482);
2026-07-29 08:29:29 +00:00
let selectedTeenId = obj.useSelectedTeenId();
2026-08-24 06:08:38 +00:00
let items = [closure_5];
2026-07-29 08:29:29 +00:00
_require = PERSONALIZATION;
selectedTeenId = undefined;
2026-08-24 06:08:38 +00:00
const stateFromStores = _require(589).useStateFromStores(items, () => closure_1_5.hasConsented(selectedTeenId, closure_0));
2026-07-29 08:29:29 +00:00
let obj2 = _require(589);
2026-08-25 06:04:03 +00:00
selectedTeenId = _require(7482).useSelectedTeenId();
2026-07-29 08:29:29 +00:00
_require = undefined;
_require = callback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c2 = 0;
c5 = 0;
c4 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0) {
if (c5 === 2) {
c5 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp6 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-25 06:04:03 +00:00
return { value: "HermesInternal", done: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c5 = 2;
if (0 === c2) {
if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp3;
if (null != closure_1_1) {
2026-07-29 08:29:29 +00:00
if (tmp28) {
const items = [closure_0];
let items1 = items;
} else {
items1 = [];
}
if (tmp28) {
let items2 = [];
} else {
items2 = [closure_0];
}
2026-08-24 06:08:38 +00:00
c4 = 1;
selectedTeenId(closure_2_2[12]).updateTeenConsents(tmp29, items1, items2);
2026-07-29 08:29:29 +00:00
c2 = 2;
c5 = 1;
2026-08-24 06:08:38 +00:00
const obj3 = selectedTeenId(closure_2_2[12]);
2026-07-29 08:29:29 +00:00
}
}
} else {
if (1 === tmp7) {
c4 = 0;
2026-08-24 06:08:38 +00:00
selectedTeenId(closure_2_2[13]).showFailedToast(closure_2_6.GENERIC_ERROR);
const obj2 = selectedTeenId(closure_2_2[13]);
2026-07-29 08:29:29 +00:00
} else if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 !== 2) {
c4 = 0;
}
c4 = 0;
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
}
c5 = 3;
} catch (tmp19) {
2026-08-24 06:08:38 +00:00
closure_3 = tmp19;
2026-07-29 08:29:29 +00:00
if (tmp4 === c4) {
c5 = tmp2;
throw tmp19;
} else {
c2 = tmp;
}
}
}
})();
});
let items1 = [selectedTeenId, PERSONALIZATION];
obj = {
hasConsented: stateFromStores,
updateConsent: React.useCallback(function() {
const self = this;
const apply = closure_0.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
}, items1)
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
return obj;
2026-07-20 16:05:17 +00:00
};