diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index a7f347c897..5e752eeae4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -8508,6 +8508,8 @@ protected float getTopOffset() { getNotificationCenter().postNotificationName(NotificationCenter.peerSettingsDidLoad, dialog_id); } } + if (Config.autoMuteAfterJoiningChannel) + getNotificationsController().muteDialog(dialog_id, getTopicId(), true); } else { toggleMute(true); } diff --git a/TMessagesProj/src/main/java/xyz/nextalone/nnngram/activity/ChatSettingActivity.java b/TMessagesProj/src/main/java/xyz/nextalone/nnngram/activity/ChatSettingActivity.java index 30131ba117..260858a1d1 100644 --- a/TMessagesProj/src/main/java/xyz/nextalone/nnngram/activity/ChatSettingActivity.java +++ b/TMessagesProj/src/main/java/xyz/nextalone/nnngram/activity/ChatSettingActivity.java @@ -144,6 +144,7 @@ public class ChatSettingActivity extends BaseActivity { private int disableAutoPipRow; private int sendMp4DocumentAsVideoRow; private int disableGravityDetectionInVideoRow; + private int autoMuteAfterJoiningChannelRow; private int chat2Row; private int markdownRow; @@ -478,6 +479,11 @@ protected void onItemClick(View view, int position, float x, float y) { if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(Config.disableGravityDetectionInVideo); } + } else if (position == autoMuteAfterJoiningChannelRow) { + Config.toggleAutoMuteAfterJoiningChannel(); + if (view instanceof TextCheckCell) { + ((TextCheckCell) view).setChecked(Config.autoMuteAfterJoiningChannel); + } } } @@ -548,6 +554,7 @@ protected void updateRows() { disableAutoPipRow = addRow("disableAutoPip"); sendMp4DocumentAsVideoRow = addRow("sendMp4DocumentAsVideo"); disableGravityDetectionInVideoRow = addRow("disableGravityDetectionInVideo"); + autoMuteAfterJoiningChannelRow = addRow("autoMuteAfterJoiningChannel"); chat2Row = addRow(); markdownRow = addRow(); @@ -731,6 +738,8 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position, boole textCell.setTextAndCheck(LocaleController.getString("sendMp4DocumentAsVideo", R.string.sendMp4DocumentAsVideo), Config.sendMp4DocumentAsVideo, true); } else if (position == disableGravityDetectionInVideoRow) { textCell.setTextAndCheck(LocaleController.getString("disableGravityDetectionInVideo", R.string.disableGravityDetectionInVideo), Config.disableGravityDetectionInVideo, true); + } else if (position == autoMuteAfterJoiningChannelRow) { + textCell.setTextAndCheck(LocaleController.getString(R.string.autoMuteAfterJoiningChannel), Config.autoMuteAfterJoiningChannel, true); } break; } diff --git a/TMessagesProj/src/main/java/xyz/nextalone/nnngram/utils/Defines.kt b/TMessagesProj/src/main/java/xyz/nextalone/nnngram/utils/Defines.kt index 1fc49ef822..ee5e1f1cac 100644 --- a/TMessagesProj/src/main/java/xyz/nextalone/nnngram/utils/Defines.kt +++ b/TMessagesProj/src/main/java/xyz/nextalone/nnngram/utils/Defines.kt @@ -222,6 +222,7 @@ object Defines { @BooleanConfig const val sendMp4DocumentAsVideo = "sendMp4DocumentAsVideo" @BooleanConfig const val disableGravityDetectionInVideo = "disableGravityDetectionInVideo" @BooleanConfig const val hideProxyEntryInTitle = "hideProxyEntryInTitle" + @BooleanConfig const val autoMuteAfterJoiningChannel = "autoMuteAfterJoinChannel" // Drawer List @BooleanConfig(true) const val showNewGroup = "showNewGroup" diff --git a/TMessagesProj/src/main/res/values-zh/strings_nullgram.xml b/TMessagesProj/src/main/res/values-zh/strings_nullgram.xml index f9671e971f..fede99fa7a 100644 --- a/TMessagesProj/src/main/res/values-zh/strings_nullgram.xml +++ b/TMessagesProj/src/main/res/values-zh/strings_nullgram.xml @@ -377,4 +377,5 @@ 以视频格式发送 MP4 文件 禁用视频重力检测 隐藏标题代理入口 + 加入频道后自动静音 diff --git a/TMessagesProj/src/main/res/values/strings_nullgram.xml b/TMessagesProj/src/main/res/values/strings_nullgram.xml index 8ea502af75..b94cf90d58 100644 --- a/TMessagesProj/src/main/res/values/strings_nullgram.xml +++ b/TMessagesProj/src/main/res/values/strings_nullgram.xml @@ -390,4 +390,5 @@ Send MP4 document as video Disable gravity detection in video Hide proxy entry in title + Auto mute after joining channel