103 lines
4.6 KiB
TypeScript
103 lines
4.6 KiB
TypeScript
// Metro module 15324 (f15325).
|
|
import { View } from "react-native";
|
|
import ReadStateStore from "../../../stores/ReadStateStore";
|
|
import ICYMIFiltersStore from "../ICYMIFiltersStore";
|
|
import ICYMIStore from "../ICYMIStore";
|
|
import { AnalyticsObjectTypes, AnalyticsObjects } from "../../../Constants";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { useStateFromStoresObject } from "../../../_bundle/Module589";
|
|
import { ICYMIStaffDebuggingUtilityExperiment } from "../ICYMIExperiment";
|
|
import { ActionSheet } from "../../../design/components/Sheet/native/ActionSheet.native";
|
|
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { TableSwitchRow } from "../../../design/components/TableRow/native/TableSwitchRow.native";
|
|
import ICYMIActionCreators from "../ICYMIActionCreators";
|
|
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
|
|
import { ICYMIItemTypes } from "../ICYMITypes";
|
|
import { ChannelTypes } from "../../../_bundle/Module692";
|
|
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
|
|
import { ack } from "../../../actions/ReadStateActionCreators";
|
|
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
|
|
import { regenerateFeedAndClearReadStates } from "../ICYMIUtils";
|
|
import ModalActionCreators from "../../../actions/ModalActionCreators";
|
|
import { ICYMI_CUSTOM_SCORES_MODAL_KEY } from "./custom_scores/ICYMICustomScoreTypes";
|
|
const useStyles = createStyles({
|
|
padding: {
|
|
bottomPadding: Module712.space.PX_16,
|
|
width: "100%"
|
|
}
|
|
});
|
|
export default function ICYMISettingsActionSheet() {
|
|
const stateFromStoresObject = useStateFromStoresObject([ICYMIFiltersStore], () => ICYMIFiltersStore.getState());
|
|
const styles = useStyles();
|
|
const enabled = ICYMIStaffDebuggingUtilityExperiment.useConfig({
|
|
location: "settings action sheet"
|
|
}).enabled;
|
|
const props = {
|
|
title: intl.string(t["7Si8Ul"]),
|
|
hasIcons: false,
|
|
children: null
|
|
};
|
|
let r43 = null;
|
|
if (enabled) {
|
|
const props2 = {
|
|
label: intl.string(t["3wDyfQ"]),
|
|
value: null,
|
|
onValueChange: null
|
|
};
|
|
let filterStaffContent = stateFromStoresObject.filterStaffContent;
|
|
if (filterStaffContent == null) {
|
|
filterStaffContent = false;
|
|
}
|
|
props2.value = filterStaffContent;
|
|
props2.onValueChange = () => {
|
|
ICYMIActionCreators.setFilters({
|
|
...stateFromStoresObject,
|
|
filterStaffContent: !stateFromStoresObject.filterStaffContent
|
|
});
|
|
ICYMIActionCreators.fetchDehydrated();
|
|
};
|
|
r43 = <>
|
|
<TableSwitchRow {...props2} />
|
|
<TableRow label="Clear read states" onPress={() => {
|
|
ICYMIStore.getDehydratedItems().forEach((item) => {
|
|
if (item.type === ICYMIItemTypes.MESSAGE && item.data.channel_type === ChannelTypes.GUILD_ANNOUNCEMENT && SnowflakeUtils.compare(ReadStateStore.ackMessageId(item.data.channel_id), item.data.message_id) >= 0) {
|
|
ack(item.data.channel_id, {
|
|
object: AnalyticsObjects.ACK_GRAVITY_CLEAR_READ_STATES_BUTTON,
|
|
objectType: AnalyticsObjectTypes.ACK_SEMI_AUTOMATIC
|
|
}, true, true, SnowflakeUtils.atPreviousMillisecond(item.data.message_id));
|
|
}
|
|
});
|
|
ICYMIActionCreators.clearReadStates();
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />
|
|
<TableRow label="Regenerate feed and clear read states" onPress={async () => {
|
|
let c27992_0;
|
|
c27992_0 = void 0;
|
|
await regenerateFeedAndClearReadStates(AnalyticsObjects.ACK_GRAVITY_REGENERATE_FEED_AND_CLEAR_READ_STATES_BUTTON);
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />
|
|
</>;
|
|
}
|
|
props.children = [r43, <TableRow label={intl.string(t.Eorjmy)} onPress={() => {
|
|
ICYMIActionCreators.itemInteracted("icymi_settings_action_sheet", "icymi_settings_action_sheet", "custom_scoring_button");
|
|
ICYMIActionCreators.feedPageActioned({
|
|
actionParameters: {
|
|
actionGestureType: "press",
|
|
actionTargetElement: "tune_settings_button",
|
|
actionIntentType: "open",
|
|
actionDestinationType: null
|
|
}
|
|
});
|
|
ModalActionCreators.pushLazy(import("./custom_scores/ICYMICustomScoresModal"), {}, ICYMI_CUSTOM_SCORES_MODAL_KEY, {
|
|
presentation: "modal"
|
|
});
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />];
|
|
return <ActionSheet showGradient startExpanded>
|
|
<TableRowGroup {...props} />
|
|
<View style={styles.padding} />
|
|
</ActionSheet>;
|
|
};
|