78 lines
3.1 KiB
TypeScript
78 lines
3.1 KiB
TypeScript
// Metro module 13852 (f13853).
|
|
import UserStore from "../../../stores/UserStore";
|
|
import { EXPLICIT_MEDIA_SETTINGS_ACTION_SHEET_KEY } from "../ExplicitMediaRedactionConstants";
|
|
import { SearchMediaTypes } from "../../search/SearchConstants";
|
|
import { ExplicitContentRedaction } from "../../../_bundle/Module1306";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { shouldAgeVerifyForExplicitMedia } from "../ExplicitMediaRedactionUtils";
|
|
import AgeVerificationActionCreators_native from "../../age_assurance/AgeVerificationActionCreators.native";
|
|
import { AgeVerificationModalEntryPoint } from "../../age_assurance/AgeVerificationAnalyticsUtils";
|
|
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
|
|
import { getEnabledHarmTypesForMessage, isMediaObscuredForHarmTypes } from "../ObscuredMediaUtils";
|
|
import { ObscuredMediaTypes } from "../ExplicitMediaRedactionModels";
|
|
export function handleSensitiveMediaFilterPress({ title, subtitle, handlePress, excluded, currentValue }) {
|
|
const nsfwAllowed = UserStore.getCurrentUser()?.nsfwAllowed;
|
|
const r7 = excluded == null ? void 0 : excluded.includes(ExplicitContentRedaction.SHOW);
|
|
const r26 = r7 ? !r7 : nsfwAllowed;
|
|
const options = [];
|
|
if (r26) {
|
|
options.push({
|
|
value: ExplicitContentRedaction.SHOW,
|
|
label: intl.string(t["5k5OFp"]),
|
|
onPress: () => {
|
|
if (shouldAgeVerifyForExplicitMedia()) {
|
|
AgeVerificationActionCreators_native.showAgeVerificationGetStartedModal({
|
|
entryPoint: AgeVerificationModalEntryPoint.OBSCURED_MEDIA
|
|
});
|
|
} else {
|
|
handlePress(ExplicitContentRedaction.SHOW);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
if (!(excluded == null ? void 0 : excluded.includes(ExplicitContentRedaction.BLUR))) {
|
|
options.push({
|
|
value: ExplicitContentRedaction.BLUR,
|
|
label: intl.string(t.S49Uad),
|
|
onPress: () => {
|
|
handlePress(ExplicitContentRedaction.BLUR);
|
|
}
|
|
});
|
|
}
|
|
if (!(excluded == null ? void 0 : excluded.includes(ExplicitContentRedaction.BLOCK))) {
|
|
options.push({
|
|
value: ExplicitContentRedaction.BLOCK,
|
|
label: intl.string(t["D/157Y"]),
|
|
onPress: () => {
|
|
handlePress(ExplicitContentRedaction.BLOCK);
|
|
}
|
|
});
|
|
}
|
|
ActionSheetActionCreators.openLazy(import("./ExplicitMediaSettingsActionSheet"), EXPLICIT_MEDIA_SETTINGS_ACTION_SHEET_KEY, {
|
|
title,
|
|
subtitle,
|
|
options,
|
|
currentValue
|
|
});
|
|
}
|
|
export function shouldAgeVerifyForSearchMedia(a0, a1) {
|
|
if (a1 == null) {
|
|
return false;
|
|
}
|
|
const enabledHarmTypesForMessage = getEnabledHarmTypesForMessage(a1);
|
|
if (enabledHarmTypesForMessage === 0) {
|
|
return false;
|
|
}
|
|
const r19 = a0.type === SearchMediaTypes.ATTACHMENT ? {
|
|
type: ObscuredMediaTypes.Attachment,
|
|
media: a0.attachment
|
|
} : a0.type === SearchMediaTypes.EMBED ? {
|
|
type: ObscuredMediaTypes.Embed,
|
|
media: a0.embed
|
|
} : a0.type === SearchMediaTypes.COMPONENT ? {
|
|
type: ObscuredMediaTypes.GenericMedia,
|
|
media: a0.unfurledMediaItem
|
|
} : null;
|
|
return r19 != null && (isMediaObscuredForHarmTypes(r19, enabledHarmTypesForMessage) && shouldAgeVerifyForExplicitMedia());
|
|
}
|