72 lines
2.7 KiB
TypeScript
72 lines
2.7 KiB
TypeScript
// Metro module 11586 (f11587).
|
|
import UserSettingsProtoStore from "../user_settings/UserSettingsProtoStore";
|
|
import { AnalyticEvents } from "../../Constants";
|
|
import { ContentDismissActionType } from "../dismissible_content/DismissibleContentConstants";
|
|
import { UserSettingsDelay } from "../user_settings/UserSettingsConstants";
|
|
import { hasBit } from "../../utils/Uint8ArrayUtils";
|
|
import { useStateFromStores } from "../../_bundle/Module589";
|
|
import { updateUserGuildSettings } from "../user_settings/UserSettingsProtoActionCreators";
|
|
import AnalyticsUtils from "../../utils/AnalyticsUtils";
|
|
import { DismissibleGuildContent } from "../../_bundle/Module1358";
|
|
function $mk87692($env) {
|
|
return (a0) => {
|
|
const r4 = $env;
|
|
const r2 = $env.$parent;
|
|
const r5 = r4[1];
|
|
const dismissedGuildContent = r2[3].getDismissedGuildContent(r4[2]);
|
|
const r9 = dismissedGuildContent != null && (0, r2[0])(r2[2][4]).hasBit(dismissedGuildContent, r5);
|
|
const r1 = r4[0];
|
|
if (!(r1 && r9) && !(!r1 && !r9)) {
|
|
const r20 = (0, r2[0])(r2[2][4]);
|
|
a0.dismissedGuildContent = (r1 ? r20.addBit : r20.removeBit)(a0.dismissedGuildContent, r5);
|
|
return void 0;
|
|
}
|
|
return false;
|
|
};
|
|
}
|
|
let env7904 = {};
|
|
export function isContentDismissed(a0, a1) {
|
|
const dismissedGuildContent = UserSettingsProtoStore.getDismissedGuildContent(a1);
|
|
return dismissedGuildContent != null && hasBit(dismissedGuildContent, a0);
|
|
}
|
|
export function useIsContentDismissed(c19011_0, c19011_1) {
|
|
return useStateFromStores([UserSettingsProtoStore], () => {
|
|
const dismissedGuildContent = UserSettingsProtoStore.getDismissedGuildContent(c19011_1);
|
|
return dismissedGuildContent != null && hasBit(dismissedGuildContent, c19011_0);
|
|
});
|
|
}
|
|
export function markContentAsDismissed(a0, a1, a2, a3) {
|
|
let env19012;
|
|
const r2 = env19012 = {
|
|
$parent: env7904
|
|
};
|
|
env19012[0] = true;
|
|
env19012[1] = a0;
|
|
env19012[2] = a1;
|
|
const INFREQUENT_USER_ACTION = UserSettingsDelay.INFREQUENT_USER_ACTION;
|
|
updateUserGuildSettings(a1, $mk87692(r2), INFREQUENT_USER_ACTION);
|
|
if (a2) {
|
|
let action = a3;
|
|
const DISMISSIBLE_CONTENT_DISMISSED = AnalyticEvents.DISMISSIBLE_CONTENT_DISMISSED;
|
|
if (a3 == null) {
|
|
action = ContentDismissActionType.UNKNOWN;
|
|
}
|
|
AnalyticsUtils.track(DISMISSIBLE_CONTENT_DISMISSED, {
|
|
type: DismissibleGuildContent[a0],
|
|
guild_id: a1,
|
|
action
|
|
});
|
|
}
|
|
}
|
|
export function unmarkContentAsDismissed(a0, a1) {
|
|
let env19013;
|
|
const r1 = env19013 = {
|
|
$parent: env7904
|
|
};
|
|
env19013[0] = false;
|
|
env19013[1] = a0;
|
|
env19013[2] = a1;
|
|
const FREQUENT_USER_ACTION = UserSettingsDelay.FREQUENT_USER_ACTION;
|
|
updateUserGuildSettings(a1, $mk87692(r1), FREQUENT_USER_ACTION);
|
|
}
|