74 lines
4.1 KiB
TypeScript
74 lines
4.1 KiB
TypeScript
// Metro module 10311 (f10312).
|
|
import { useLayoutEffect, useCallback } from "react";
|
|
import { View } from "react-native";
|
|
import UserGuildSettingsStore from "../../../../stores/UserGuildSettingsStore";
|
|
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../../_bundle/Module712";
|
|
import { useChannelPresetInheritance, updateChannelToGuildDefault } from "../utils/notficationSettingsChannelFlagUtils";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
import useChannelName from "../../../channel/useChannelName";
|
|
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
|
|
import { NavigatorHeader, getHeaderBackButton } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
|
|
import NotificationSettingsModalActionCreators from "../../../../actions/NotificationSettingsModalActionCreators";
|
|
import { NotificationLabels } from "../../../../utils/NotificationSettingsUtils";
|
|
import { useStateFromStoresObject } from "../../../../_bundle/Module589";
|
|
import { Form } from "../../../../design/void/Form/native/index";
|
|
import { NotificationSettingsMuteBanner, getMuteBannerSubtitleFromConfig } from "./NotificationSettingsMuteBanner";
|
|
import { NotificationSettingsChannelPresets } from "./NotificationSettingsPresets";
|
|
import { NotificationSettingsChannelMessageNotification } from "./NotificationSettingsMessageNotification";
|
|
import { NotificationSettingsChannelMessageUnread } from "./NotificationSettingsMessageUnread";
|
|
import { NotificationSettingsChannelPost } from "./NotificationSettingsChannelPost";
|
|
import { Button } from "../../../../design/components/Button/native/Button.native";
|
|
const useStyles = createStyles({
|
|
screenContainer: {
|
|
flex: 1,
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
|
|
padding: 16
|
|
}
|
|
});
|
|
export default function NotificationSettingsChannel(props) {
|
|
let c17860_0 = props;
|
|
const channelPresetInheritance = useChannelPresetInheritance(props.channel);
|
|
const title = intl.string(t.h850Ss);
|
|
const subtitle = useChannelName(props.channel);
|
|
const navigation = useNavigation();
|
|
const styles = useStyles();
|
|
useLayoutEffect(() => {
|
|
navigation.setOptions({
|
|
title: `${title} (${subtitle})`,
|
|
headerTitle: () => <NavigatorHeader title={title} subtitle={subtitle} />
|
|
});
|
|
if (c17860_0.inGuildContext) {
|
|
navigation.setOptions({
|
|
headerLeft: getHeaderBackButton(() => navigation.popToTop())
|
|
});
|
|
}
|
|
});
|
|
const callback2 = useCallback(() => updateChannelToGuildDefault(c17860_0.channel.guild_id, c17860_0.channel.id), [props.channel]);
|
|
const callback = useCallback(() => {
|
|
NotificationSettingsModalActionCreators.updateChannelOverrideSettings(c17860_0.channel.guild_id, c17860_0.channel.id, {
|
|
muted: false
|
|
}, NotificationLabels.Unmuted);
|
|
}, [props.channel]);
|
|
const stateFromStoresObject = useStateFromStoresObject([UserGuildSettingsStore], () => ({
|
|
config: UserGuildSettingsStore.getChannelMuteConfig(c17860_0.channel.guild_id, c17860_0.channel.id),
|
|
muted: UserGuildSettingsStore.isChannelMuted(c17860_0.channel.guild_id, c17860_0.channel.id)
|
|
}));
|
|
const r79 = [stateFromStoresObject.muted && <NotificationSettingsMuteBanner style={{
|
|
marginBottom: 16
|
|
}} title={intl.string(t["6MCxAy"])} subtitle={getMuteBannerSubtitleFromConfig(stateFromStoresObject.config)} onPressUnmute={callback} />, <NotificationSettingsChannelPresets channel={props.channel} />, <NotificationSettingsChannelMessageNotification style={{
|
|
marginTop: 24
|
|
}} channel={props.channel} />, <NotificationSettingsChannelMessageUnread style={{
|
|
marginTop: 24
|
|
}} channel={props.channel} />, props.channel.isForumLikeChannel() && <NotificationSettingsChannelPost style={{
|
|
marginTop: 24
|
|
}} channel={props.channel} />, ,];
|
|
const inherited = channelPresetInheritance.inherited;
|
|
r79[5] = inherited ? !inherited : <View style={{
|
|
marginTop: 24
|
|
}}>
|
|
<Button variant="secondary" onPress={callback2} text={intl.string(t["3PBFN6"])} />
|
|
</View>;
|
|
return <Form style={styles.screenContainer}>{r79}</Form>;
|
|
};
|