/* Metro module 10935; source: components_native/channel_settings/ChannelSettingsNotifications.tsx; dependencies: [6, 7, 15, 17, 18, 31, 1383, 1379, 4111, 3793, 4864, 1878, 661, 33, 1244, 4501, 697, 6613, 4080, 10936, 1962, 6610, 4863, 4805, 6231, 6238, 10938, 6808, 7988, 7987, 4573, 7972, 4572, 3868, 566, 10939, 10940, 2] */
function _fun83826(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#83826, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:6, offset: 0x01f2a05f, size: 623 bytes, params: 8, frame: 23
var object3;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
let value = importAll(31) /* metro dependency 31 */;
const channelRecordModule = require(1383) /* metro dependency 1383: ChannelRecord */;
const env0_9 = channelRecordModule.isGuildTextChannelType;
const env0_10 = channelRecordModule.CHANNEL_ELIGIBLE_FOR_UNREAD_SETTING;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const guildMemberCountStore = importDefault(4111) /* metro dependency 4111: GuildMemberCountStore */;
const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */;
const userGuildSettingsStore = importDefault(4864) /* metro dependency 4864: UserGuildSettingsStore */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
const constantsModule = require(661) /* metro dependency 661: Constants */;
const env0_16 = constantsModule.AnalyticEvents;
const env0_17 = constantsModule.UserNotificationSettings;
const env0_18 = constantsModule.ChannelTypes;
const env0_19 = constantsModule.SettingsPaneTypes;
const env0_20 = constantsModule.MAX_MEMBERS_NOTIFY_ALL_MESSAGES;
const value4 = require(33) /* metro dependency 33 */;
const env0_21 = value4.jsx;
const env0_22 = value4.Fragment;
const env0_23 = value4.jsxs;
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
const createLegacyClassComponentStyles = createStylesModule.createLegacyClassComponentStyles;
object3 = {};
const object4 = {flex: 1};
const BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object4.backgroundColor = BACKGROUND_BASE_LOWER;
const PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object4.paddingTop = PX_16;
object3.screenContainer = object4;
const TABLE_ROW_PADDING = (importDefault(697) /* metro dependency 697: native */).modules.mobile.TABLE_ROW_PADDING;
object3.stackPadding = {paddingHorizontal: TABLE_ROW_PADDING};
const env0_24 = Reflect.apply(createLegacyClassComponentStyles, createStylesModule, [object3]);
const PureComponent = value.PureComponent;
value = _fun83836(PureComponent);
const ThemeContext = (require(3868) /* metro dependency 3868: native */).ThemeContext;
value.contextType = ThemeContext;
(require(2) /* metro dependency 2 */).fileFinishedImporting('components_native/channel_settings/ChannelSettingsNotifications.tsx');
exports.default = ChannelSettingsNotificationsSplit;
}
function _isNativeReflectConstruct_83827() { // fn#83827, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:462, offset: 0x01f2a2ce, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_83827_isNativeReflectConstruct = function() {
return !!result;
})();
}
function getDefaultNotificationsSublabel(a0) { // fn#83830, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:655, offset: 0x01f2a330, size: 235 bytes, params: 2, frame: 16
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const ALL_MESSAGES = UserNotificationSettings.ALL_MESSAGES;
if (ALL_MESSAGES === a0) {
return intl.string(t['n/bTaY']);
}
const ONLY_MENTIONS = UserNotificationSettings.ONLY_MENTIONS;
if (ONLY_MENTIONS === a0) {
return intl.format(t.L2hmYy, {});
}
const NO_MESSAGES = UserNotificationSettings.NO_MESSAGES;
if (NO_MESSAGES === a0) {
return intl.string(t.CtVGyQ);
}
}
function ChannelSettingsNotificationsGuard({onClose, channelId}) { // fn#83831, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:6202, offset: 0x01f2a41b, size: 288 bytes, params: 2, frame: 22
const channel = (require(566) /* metro dependency 566: flux */).useStateFromStores([ChannelStore], function() {
return ChannelStore.getChannel(channelId);
});
const env0_3 = channel?.getGuildId();
const value5 = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([UserGuildSettingsStore],
_fun83833);
const memberCount = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildMemberCountStore],
_fun83834);
env0_8.useEffect(function() {
if (channel == null) {
if (onClose != null) {
onClose();
}
}
}, [channel, onClose]);
return channel != null ? ((Component) => )(env0_25) : null;
}
function _fun83836(a0) { // fn#83836, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:1171, offset: 0x01f2a6a5, size: 201 bytes, params: 2, frame: 16
const closure = ChannelSettingsNotifications;
env0_7(closure, a0);
return env0_4(closure, [{key: 'componentDidMount', value: function() {
var defaultImport = importDefault(dependencyMap[22]);
var SETTINGS_PANE_VIEWED = AnalyticEvents.SETTINGS_PANE_VIEWED;
defaultImport.trackWithMetadata(SETTINGS_PANE_VIEWED, {settings_type: 'channel',
destination_pane: SettingsPaneTypes.CHANNEL_NOTIFICATION_SETTINGS});
}}, {key: 'componentDidUpdate', value: function(a0) {
if (a0.muted !== this.props.muted) {
this.setState({muted: this.props.muted});
}
if (a0.messageNotifications !== this.props.messageNotifications) {
this.setState({messageNotifications: this.props.messageNotifications});
}
}}, {key: 'renderMuteSection', value: value_83846}, {key: 'renderForumSettings', value: value_83847},
{key: 'renderNotificationSettings', value: value_83849}, {key: 'render', value: value_83850}]);
}
function ChannelSettingsNotificationsSplit(a0) { // fn#83853, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:7154, offset: 0x01f2b5bc, size: 206 bytes, params: 2, frame: 19
var r1;
var r0;
const env0_0 = a0;
var value;
const channel = (require(566) /* metro dependency 566: flux */).useStateFromStores([ChannelStore], _fun83854);
const value2 = (require(10939) /* metro dependency 10939: NotificationUtils */).useShouldUseNewNotificationSystem('ChannelSettingsNotificationsNative');
const value3 = null;
if (value3 == channel) {
r0 = value3;
} else {
if (value2) {
if (CHANNEL_ELIGIBLE_FOR_UNREAD_SETTING.has(channel.type)) {
value = importDefault(10940) /* metro dependency 10940: NotificationSettingsChannel */;
value = ((Component) => )(value);
r1 = value;
} else {
r1 = ;
}
} else {
r1 = ;
}
r0 = r1;
}
return r0;
}
function _fun83833() { // fn#83833, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:6404, offset: 0x01f2a555, size: 274 bytes, params: 1, frame: 19
const r0 = channel?.parent_id != null ? UserGuildSettingsStore.getChannelMessageNotifications(env0_3,
channel.parent_id) : UserNotificationSettings.NULL;
const messageNotifications = UserGuildSettingsStore.getMessageNotifications(env0_3);
const NULL = UserNotificationSettings.NULL;
const r1 = r0 === NULL ? messageNotifications : r0;
const object2 = {};
const getChannelMessageNotifications = UserGuildSettingsStore.getChannelMessageNotifications;
const binding = env0_3;
const channelIdBinding = channelId;
object2.messageNotifications = Reflect.apply(getChannelMessageNotifications, UserGuildSettingsStore, [binding,
channelIdBinding]);
object2.muted = UserGuildSettingsStore.isChannelMuted(env0_3, channelIdBinding);
object2.muteConfig = UserGuildSettingsStore.getChannelMuteConfig(env0_3, channelIdBinding);
object2.guildMuted = UserGuildSettingsStore.isMuted(env0_3);
object2.guildMessageNotifications = messageNotifications;
object2.newForumThreadsCreated = channel != null && UserGuildSettingsStore.getNewForumThreadsCreated(channel);
object2.defaultSetting = r1;
return object2;
}
function _fun83834() { // fn#83834, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:6857, offset: 0x01f2a667, size: 27 bytes, params: 1, frame: 11
return GuildMemberCountStore.getMemberCount(env0_3);
}
function ChannelSettingsNotifications(a0) { // fn#83837, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:1183, offset: 0x01f2a76e, size: 210 bytes, params: 2, frame: 22
env1_3(this, ChannelSettingsNotifications);
const items = [a0];
const value3 = env1_6(ChannelSettingsNotifications);
const value6 = env1_5(this, _isNativeReflectConstruct_83827() ? global.Reflect.construct(value3, items,
env1_6(this).constructor) : value3.apply(this, items));
value6.radioGroupRef = env1_8.createRef();
value6.updateSetting = updateSetting_83838;
value6.handleToggleMuteChannel = handleToggleMuteChannel;
value6.handleTypeChange = function(a0) {
a0.setState({messageNotifications: a0}, _fun83843);
};
value6.state = {messageNotifications: a0.messageNotifications, muted: a0.muted};
return value6;
}
function value_83846() { // fn#83846, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:2837, offset: 0x01f2ab7c, size: 470 bytes, params: 1, frame: 33
const {channel, muteConfig} = this.props;
const muted = this.state.muted;
const value = environment.__proto__;
const useChannelNameModule = require(4805) /* metro dependency 4805: useChannelName */;
const channelName = useChannelNameModule.computeChannelName(channel, UserStore, RelationshipStore, true);
const jsxRuntimeEnv1_22Binding = jsxRuntimeEnv1_22;
const TableRowGroup = (require(6231) /* metro dependency 6231: TableRowGroupNative */).TableRowGroup;
const object = {};
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const string = intl.string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
object.description = Reflect.apply(string, intl, [t['6yI+JS']]);
object.hasIcons = false;
const TableRow = (require(6238) /* metro dependency 6238: TableRowNative */).TableRow;
const format = intl.format;
return (
<>
{muted ? ((Component) => )(importDefault(10938) /* metro dependency 10938: MutedUntilText */) : null}
>
);
}
function value_83847() { // fn#83847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:3425, offset: 0x01f2ad52, size: 168 bytes, params: 1, frame: 22
const props = this.props;
const env0_0 = props.channel;
const newForumThreadsCreated = props.newForumThreadsCreated;
const guildMuted = props.guildMuted;
const muted = this.state.muted;
const TableSwitchRow = (require(6808) /* metro dependency 6808: TableSwitchRowNative */).TableSwitchRow;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const string = intl.string;
const Rkgjph = (require(1244) /* metro dependency 1244: indexNative */).t.Rkgjph;
return (
);
}
function value_83849() { // fn#83849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:3730, offset: 0x01f2ae2f, size: 1151 bytes, params: 1, frame: 33
var r0;
var r18;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var items3;
var object3;
var format;
var L2hmYy;
var CtVGyQ;
var items2;
const {channel, guildMuted, guildMemberCount, defaultSetting} = this.props;
const {muted, messageNotifications} = this.state;
const parent_id = channel.parent_id;
let value = null;
const r8 = value != parent_id ? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.wlrV1c) : intl.string((require(1244) /* metro dependency 1244: indexNative */).t['1Wn2M4']);
const isGuildStageVoice2 = channel.isGuildStageVoice();
const TableRadioGroup = (require(7988) /* metro dependency 7988: TableRadioGroupNative */).TableRadioGroup;
const object4 = {value: messageNotifications};
object4.onChange = this.handleTypeChange;
object4.groupRef = this.radioGroupRef;
object4.title = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.h850Ss);
object4.hasIcons = false;
const TableRadioRow = (require(7987) /* metro dependency 7987: TableRadioRowNative */).TableRadioRow;
const object5 = {};
if (isGuildStageVoice2) {
object5.disabled = muted || guildMuted;
object5.label = r8;
object5.subLabel = getDefaultNotificationsSublabel(defaultSetting);
object5.value = UserNotificationSettings.NULL;
value = ;
items2 = [value];
items2[1] = ;
items2[2] = ;
value = {items2};
r0 = value;
} else {
object5.label = r8;
object5.subLabel = getDefaultNotificationsSublabel(defaultSetting);
r0 = muted || guildMuted;
object5.disabled = r0;
object5.value = UserNotificationSettings.NULL;
items3 = [];
var tableRadioRowProps = {label: intl.string(t['n/bTaY'])};
r18 = muted || guildMuted;
tableRadioRowProps.disabled = r18;
r18 = value != guildMemberCount && guildMemberCount >= MAX_MEMBERS_NOTIFY_ALL_MESSAGES ? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.Dh5p5j) : value;
tableRadioRowProps.subLabel = r18;
tableRadioRowProps.value = UserNotificationSettings.ALL_MESSAGES;
items3[1] = ;
format = intl.format;
L2hmYy = t.L2hmYy;
r18 = muted || guildMuted;
items3[2] = ;
string = intl.string;
CtVGyQ = t.CtVGyQ;
r18 = muted || guildMuted;
items3[3] = ;
value = {items3};
r0 = value;
}
return r0;
}
function value_83850() { // fn#83850, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:5195, offset: 0x01f2b2ae, size: 648 bytes, params: 1, frame: 29
var environment;
var r9;
var r0;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var Form;
var Stack;
var items2;
const value = environment.__proto__;
const binding = env1_24;
const context = this.context;
const value2 = undefined;
const value3 = binding(context);
const {guildMuted, channel, guildMessageNotifications} = this.props;
const r8 = isGuildTextChannelType(channel.type) || channel.isForumLikeChannel();
const value4 = null;
if (value4 == channel) {
r0 = value4;
} else {
r9 = guildMuted ? {intl.format((require(1244) /* metro dependency 1244: indexNative */).t.O34r15,
{mutedHook: mutedHook_83851})} : guildMessageNotifications !== UserNotificationSettings.NO_MESSAGES ? value2 : {intl.format((require(1244) /* metro dependency 1244: indexNative */).t.nRwUIL,
{notificationHook: notificationHook_83852})};
Form = (require(7972) /* metro dependency 7972: native */).Form;
var formProps = {style: value3.screenContainer};
Stack = (require(4572) /* metro dependency 4572: StackNative */).Stack;
var stackProps = {spacing: (importDefault(697) /* metro dependency 697: native */).space.PX_24,
style: value3.stackPadding};
items2 = [r8 ? this.renderMuteSection() : value4];
items2[1] = this.renderNotificationSettings();
items2[2] = channel.isForumLikeChannel() ? ((TableRowGroup) => {this.renderForumSettings()})((require(6231) /* metro dependency 6231: TableRowGroupNative */).TableRowGroup) : value4;
items2[3] = r9;
r0 =
;
}
return r0;
}
function _fun83854() { // fn#83854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:7239, offset: 0x01f2b68a, size: 31 bytes, params: 1, frame: 11
return ChannelStore.getChannel(env0_0.channelId);
}
function ChannelSettingsNotificationsUpdateSetting({muted, messageNotifications, mute_config}, a1) { // fn#83838, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:1493, owner: ChannelSettingsNotifications.updateSetting, offset: 0x01f2a840, size: 148 bytes, params: 3, frame: 19
var r2;
const channel = env0_0.props.channel;
const object2 = {};
let value = false;
if (muted === undefined) {
r2 = value;
} else {
object2.muted = muted;
value = null;
object2.mute_config = value != mute_config ? mute_config : value;
value = true;
r2 = value;
}
if (messageNotifications !== undefined) {
object2.message_notifications = messageNotifications;
r2 = true;
}
if (r2) {
value = environment.__proto__.__proto__;
value = importDefault(6613) /* metro dependency 6613: NotificationSettingsModalActionCreators */;
value.updateChannelOverrideSettings(channel.getGuildId(), channel.id, object2, a1);
}
}
function handleToggleMuteChannel() { // fn#83839, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:1775, owner: ChannelSettingsNotifications.handleToggleMuteChannel, offset: 0x01f2a8d4, size: 217 bytes, params: 1, frame: 20
var environment;
var defaultImport;
var openLazy;
var id;
var value2;
var object2;
var value;
let binding = env0_0;
const muted = binding.state.muted;
var env0_0 = muted;
const channel = binding.props.channel;
if (muted) {
binding = env0_0;
binding.setState({muted: !muted}, _fun83840);
} else {
value = environment.__proto__.__proto__;
defaultImport = importDefault(dependencyMap[18]);
openLazy = defaultImport.openLazy;
value = require(dependencyMap[20]);
value = value(dependencyMap[19], dependencyMap.paths);
id = channel.id;
value2 = 'muteSettings' + id;
object2 = {};
object2.guildId = channel.getGuildId();
id = channel.id;
object2.channelId = id;
object2.onOptionPress = onOptionPress_83841;
Reflect.apply(openLazy, defaultImport, [value, value2, object2]);
}
}
function ChannelSettingsNotificationsHandleTypeChange(a0) { // fn#83842, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:2117, owner: ChannelSettingsNotifications.handleTypeChange, offset: 0x01f2aa48, size: 46 bytes, params: 2, frame: 14
a0.setState({messageNotifications: a0}, _fun83843);
}
function value_83847OnValueChange() { // fn#83848, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:3642, owner: value_83847.onValueChange, offset: 0x01f2adfa, size: 53 bytes, params: 1, frame: 14
let value = environment.__proto__.__proto__;
value = importDefault(6613) /* metro dependency 6613: NotificationSettingsModalActionCreators */;
value.setForumThreadsCreated(channel, !newForumThreadsCreated);
}
function value_83850MutedHook(a0, a1) { // fn#83851, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:5481, owner: value_83850.mutedHook, offset: 0x01f2b536, size: 67 bytes, params: 3, frame: 15
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
return (
{a0}
);
}
function value_83850NotificationHook(a0, a1) { // fn#83852, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:5729, owner: value_83850.notificationHook, offset: 0x01f2b579, size: 67 bytes, params: 3, frame: 15
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
return (
{a0}
);
}
function _fun83840() { // fn#83840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:1843, offset: 0x01f2a9ad, size: 83 bytes, params: 1, frame: 16
let value = environment.__proto__;
const binding = env1_0;
const updateSetting = binding.updateSetting;
const object2 = {};
value = !muted;
object2.muted = value;
const NotificationLabel = (require(6610) /* metro dependency 6610: NotificationSettingsUtils */).NotificationLabel;
return Reflect.apply(updateSetting, binding, [object2, NotificationLabel.muted(value)]);
}
function handleToggleMuteChannelOnOptionPress(a0) { // fn#83841, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:2031, owner: ChannelSettingsNotifications.handleToggleMuteChannel.onOptionPress, offset: 0x01f2aa00, size: 72 bytes, params: 2, frame: 15
const binding = env1_0;
const updateSetting = binding.updateSetting;
const NotificationLabel = (require(6610) /* metro dependency 6610: NotificationSettingsUtils */).NotificationLabel;
return Reflect.apply(updateSetting, binding, [a0, NotificationLabel.muted(a0.muted)]);
}
function _fun83843() { // fn#83843, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11121:2158, offset: 0x01f2aa76, size: 77 bytes, params: 1, frame: 16
const binding = env1_0;
const updateSetting = binding.updateSetting;
const object2 = {};
const binding2 = env0_0;
object2.messageNotifications = binding2;
const NotificationLabel = (require(6610) /* metro dependency 6610: NotificationSettingsUtils */).NotificationLabel;
return Reflect.apply(updateSetting, binding, [object2, NotificationLabel.notifications(binding2)]);
}