Files
discord-decomp/sources/modules/parent_tools/hooks/useParentalControlSettings.tsx
T
2026-07-27 16:20:00 +03:00

252 lines
13 KiB
TypeScript

/* Metro module 13347; source: modules/parent_tools/hooks/useParentalControlSettings.tsx; dependencies: [5, 31, 5119, 6263, 8172, 13348, 13351, 1314, 4844, 7004, 8170, 566, 5118, 6264, 2] */
function _fun101624(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#101624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13537:6, offset: 0x0221a9b6, size: 242 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(5) /* metro dependency 5 */;
const env0_4 = importAll(31) /* metro dependency 31 */;
const familyCenterControlledSettingsStore = importDefault(5119) /* metro dependency 5119: FamilyCenterControlledSettingsStore */;
const env0_6 = (require(6263) /* metro dependency 6263: Constants */).SafetyToastType;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/parent_tools/hooks/useParentalControlSettings.tsx');
exports.useParentalControlledExplicitContentSettings = useParentalControlledExplicitContentSettings;
exports.useParentalControlledGoreContentSettings = useParentalControlledGoreContentSettings;
exports.useDefaultGuildsRestricted = useDefaultGuildsRestricted;
exports.useAllowFriendsFromMutualGuildsOnlyForTeen = useAllowFriendsFromMutualGuildsOnlyForTeen;
exports.useIsParentallyControlled = useIsParentallyControlled;
exports.useParentalControlledConsent = function(a0) {
return {hasConsented: _fun101632(a0), updateConsent: _fun101634(a0)};
};
}
function useParentalControlledExplicitContentSettings() { // fn#101625, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13537:291, offset: 0x0221aaa8, size: 294 bytes, params: 1, frame: 21
var r0;
var object2;
var moduleValue2;
var resolveExplicitContentSettingWithDefaultsForTeen;
var moduleValue3;
const value2 = undefined;
const value3 = (require(8172) /* metro dependency 8172: useSelectedTeen */).useSelectedTeen();
const ParentalControlledExplicitContent = (require(13348) /* metro dependency 13348: ParentalControlledUserSettings */).ParentalControlledExplicitContent;
const useControlledSetting = ParentalControlledExplicitContent.useControlledSetting;
const value4 = null;
let id = value4 == value3 ? value2 : value3.id;
const value5 = Reflect.apply(useControlledSetting, ParentalControlledExplicitContent, [id]);
if (value4 == value3) {
r0 = value4;
} else {
object2 = {};
moduleValue2 = require(13351) /* metro dependency 13351: FamilyCenterControlledSettingsUtils */;
resolveExplicitContentSettingWithDefaultsForTeen = moduleValue2.resolveExplicitContentSettingWithDefaultsForTeen;
id = value4 == value3 ? value2 : value3.id;
object2.explicitContentNonFriendDm = Reflect.apply(resolveExplicitContentSettingWithDefaultsForTeen,
moduleValue2,
[{teenId: id, setting: value4 == value5 ? value2 : value5.explicitContentNonFriendDm}]);
moduleValue3 = require(13351) /* metro dependency 13351: FamilyCenterControlledSettingsUtils */;
resolveExplicitContentSettingWithDefaultsForTeen = moduleValue3.resolveExplicitContentSettingWithDefaultsForTeen;
id = value4 == value3 ? value2 : value3.id;
object2.explicitContentFriendDm = Reflect.apply(resolveExplicitContentSettingWithDefaultsForTeen, moduleValue3,
[{teenId: id, setting: value4 == value5 ? value2 : value5.explicitContentFriendDm, isFriend: true}]);
object2.explicitContentGuilds = (require(1314) /* metro dependency 1314: preloaded_user_settings */).ExplicitContentRedaction.BLUR;
r0 = object2;
}
return r0;
}
function useParentalControlledGoreContentSettings() { // fn#101626, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13537:878, offset: 0x0221abce, size: 308 bytes, params: 1, frame: 19
const value2 = undefined;
const value3 = (require(8172) /* metro dependency 8172: useSelectedTeen */).useSelectedTeen();
const ParentalControlledGoreContent = (require(13348) /* metro dependency 13348: ParentalControlledUserSettings */).ParentalControlledGoreContent;
const value4 = ParentalControlledGoreContent.useControlledSetting(value3 == null ? value2 : value3.id);
if (value3 == null) {
return null;
}
const {goreContentNonFriendDm, goreContentFriendDm} = value4 ?? ({});
const object2 = {};
const familyCenterControlledSettingsUtilsModule = require(13351) /* metro dependency 13351: FamilyCenterControlledSettingsUtils */;
object2.goreContentNonFriendDm = familyCenterControlledSettingsUtilsModule.isSetAndNotDefault(goreContentNonFriendDm) ? goreContentNonFriendDm : (require(4844) /* metro dependency 4844: SensitiveMediaGoreRedactionSettingsUtils */).resolveGoreSettingWithDefaultsForTeen({isDm: true});
const moduleValue4 = familyCenterControlledSettingsUtilsModule;
object2.goreContentFriendDm = moduleValue4.isSetAndNotDefault(goreContentFriendDm) ? goreContentFriendDm : (require(4844) /* metro dependency 4844: SensitiveMediaGoreRedactionSettingsUtils */).resolveGoreSettingWithDefaultsForTeen({'isDm': true,
'isFriend': true});
const ExplicitContentRedaction = (require(1314) /* metro dependency 1314: preloaded_user_settings */).ExplicitContentRedaction;
const BLUR = ExplicitContentRedaction.BLUR;
object2.goreContentGuilds = BLUR;
return object2;
}
function useDefaultGuildsRestricted() { // fn#101627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13537:1417, offset: 0x0221ad02, size: 149 bytes, params: 1, frame: 17
const value2 = undefined;
const value3 = (require(8172) /* metro dependency 8172: useSelectedTeen */).useSelectedTeen();
const ParentalControlledDefaultGuildsRestricted = (require(13348) /* metro dependency 13348: ParentalControlledUserSettings */).ParentalControlledDefaultGuildsRestricted;
const value4 = ParentalControlledDefaultGuildsRestricted.useControlledSetting(value3 == null ? value2 : value3.id);
const ParentalControlledDefaultGuildsRestrictedV2 = (require(13348) /* metro dependency 13348: ParentalControlledUserSettings */).ParentalControlledDefaultGuildsRestrictedV2;
return ParentalControlledDefaultGuildsRestrictedV2.useControlledSetting(value3 == null ? value2 : value3.id) ?? (value4 && !!value4);
}
function useAllowFriendsFromMutualGuildsOnlyForTeen() { // fn#101628, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13537:1714, offset: 0x0221ad97, size: 134 bytes, params: 1, frame: 16
const value2 = undefined;
const value3 = (require(8172) /* metro dependency 8172: useSelectedTeen */).useSelectedTeen();
const ParentalControlledFriendSourceFlags = (require(13348) /* metro dependency 13348: ParentalControlledUserSettings */).ParentalControlledFriendSourceFlags;
const value = env0_4.useMemo(_fun101629,
[ParentalControlledFriendSourceFlags.useControlledSetting(value3 == null ? value2 : value3.id)]);
return value.mutualGuilds && !value.all;
}
function useIsParentallyControlled() { // fn#101630, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13537:1994, offset: 0x0221ae4a, size: 37 bytes, params: 1, frame: 11
return (require(8170) /* metro dependency 8170: useUserLinks */).useHasActiveParentLinks();
}
function useParentalControlledConsent(a0) { // fn#101631, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13537:2105, offset: 0x0221ae6f, size: 47 bytes, params: 2, frame: 12
return {hasConsented: ((a0) => {
var env0_0 = a0;
var env0_1 = (require(8172) /* metro dependency 8172: useSelectedTeen */).useSelectedTeenId();
return (require(566) /* metro dependency 566: flux */).useStateFromStores([FamilyCenterControlledSettingsStore],
_fun101633);
})(a0), updateConsent: useUpdateParentalControlledConsent(a0)};
}
function _fun101629() { // fn#101629, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13537:1901, offset: 0x0221ae1d, size: 45 bytes, params: 1, frame: 11
const value = environment.__proto__;
return (require(7004) /* metro dependency 7004: UserSettingsUtils */).computeFlags(env0_0);
}
function useParentalControlledHasConsented(a0) { // fn#101632, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13537:2152, owner: useParentalControlledConsent.useParentalControlledHasConsented, offset: 0x0221ae9e, size: 92 bytes, params: 2, frame: 16
const env0_0 = a0;
const env0_1 = (require(8172) /* metro dependency 8172: useSelectedTeen */).useSelectedTeenId();
return (require(566) /* metro dependency 566: flux */).useStateFromStores([FamilyCenterControlledSettingsStore],
_fun101633);
}
function useUpdateParentalControlledConsent(a0) { // fn#101634, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13537:2304, owner: useParentalControlledConsent.useUpdateParentalControlledConsent, offset: 0x0221af1a, size: 88 bytes, params: 2, frame: 15
var environment;
const env0_0 = a0;
const value = environment.__proto__;
return env1_4.useCallback(_fun101635(),
[(require(8172) /* metro dependency 8172: useSelectedTeen */).useSelectedTeenId(), a0]);
}
function _fun101633() { // fn#101633, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13537:2272, offset: 0x0221aefa, size: 32 bytes, params: 1, frame: 13
return FamilyCenterControlledSettingsStore.hasConsented(env0_1, env0_0);
}
function _fun101635() { // fn#101635, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13537:2406, offset: 0x0221af72, size: 36 bytes, params: 1, frame: 12
const env0_0 = env2_3(_fun101637);
return _fun101638;
}
function* _fun101637(a0) { // fn#101637, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13537:2426, offset: 0x0221afa1, size: 193 bytes, params: 2, frame: 19
var items;
var items2;
var binding;
var binding2;
var property;
var value4;
var updateTeenConsents;
var value5;
var error;
var showFailedToast;
var GENERIC_ERROR;
if (false) {
return undefined;
}
value = environment.__proto__.__proto__;
if (env2_1 == null) {
return undefined;
}
if (a0) {
binding = env2_0;
items = [binding];
} else {
items = [];
}
if (a0) {
items2 = [];
} else {
binding = env2_0;
items2 = [binding];
}
try {
binding = env4_1;
} catch (error) {
binding = env4_1;
value = binding(env4_2[13]);
showFailedToast = value.showFailedToast;
GENERIC_ERROR = env4_6.GENERIC_ERROR;
Reflect.apply(showFailedToast, value, [GENERIC_ERROR]);
return undefined;
}
try {
binding2 = env4_2;
} catch (error) {
binding = env4_1;
value = binding(env4_2[13]);
showFailedToast = value.showFailedToast;
GENERIC_ERROR = env4_6.GENERIC_ERROR;
Reflect.apply(showFailedToast, value, [GENERIC_ERROR]);
return undefined;
}
try {
property = binding2[12];
} catch (error) {
binding = env4_1;
value = binding(env4_2[13]);
showFailedToast = value.showFailedToast;
GENERIC_ERROR = env4_6.GENERIC_ERROR;
Reflect.apply(showFailedToast, value, [GENERIC_ERROR]);
return undefined;
}
try {
value4 = binding(property);
} catch (error) {
binding = env4_1;
value = binding(env4_2[13]);
showFailedToast = value.showFailedToast;
GENERIC_ERROR = env4_6.GENERIC_ERROR;
Reflect.apply(showFailedToast, value, [GENERIC_ERROR]);
return undefined;
}
try {
updateTeenConsents = value4.updateTeenConsents;
} catch (error) {
binding = env4_1;
value = binding(env4_2[13]);
showFailedToast = value.showFailedToast;
GENERIC_ERROR = env4_6.GENERIC_ERROR;
Reflect.apply(showFailedToast, value, [GENERIC_ERROR]);
return undefined;
}
try {
binding = env2_1;
} catch (error) {
binding = env4_1;
value = binding(env4_2[13]);
showFailedToast = value.showFailedToast;
GENERIC_ERROR = env4_6.GENERIC_ERROR;
Reflect.apply(showFailedToast, value, [GENERIC_ERROR]);
return undefined;
}
try {
value = Reflect.apply(updateTeenConsents, value4, [binding, items, items2]);
} catch (error) {
binding = env4_1;
value = binding(env4_2[13]);
showFailedToast = value.showFailedToast;
GENERIC_ERROR = env4_6.GENERIC_ERROR;
Reflect.apply(showFailedToast, value, [GENERIC_ERROR]);
return undefined;
}
yield value;
try {
value = undefined;
value5 = false;
} catch (error) {
binding = env4_1;
value = binding(env4_2[13]);
showFailedToast = value.showFailedToast;
GENERIC_ERROR = env4_6.GENERIC_ERROR;
Reflect.apply(showFailedToast, value, [GENERIC_ERROR]);
return undefined;
}
return value5 ? value : undefined;
}