Skip to content

Commit

Permalink
feat: auto mute after joining channel
Browse files Browse the repository at this point in the history
Signed-off-by: Next Alone <[email protected]>
  • Loading branch information
NextAlone committed Oct 19, 2024
1 parent a971284 commit f611c9d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}

Expand Down Expand Up @@ -548,6 +554,7 @@ protected void updateRows() {
disableAutoPipRow = addRow("disableAutoPip");
sendMp4DocumentAsVideoRow = addRow("sendMp4DocumentAsVideo");
disableGravityDetectionInVideoRow = addRow("disableGravityDetectionInVideo");
autoMuteAfterJoiningChannelRow = addRow("autoMuteAfterJoiningChannel");
chat2Row = addRow();

markdownRow = addRow();
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values-zh/strings_nullgram.xml
Original file line number Diff line number Diff line change
Expand Up @@ -377,4 +377,5 @@
<string name="sendMp4DocumentAsVideo">以视频格式发送 MP4 文件</string>
<string name="disableGravityDetectionInVideo">禁用视频重力检测</string>
<string name="hideProxyEntryInTitle">隐藏标题代理入口</string>
<string name="autoMuteAfterJoiningChannel">加入频道后自动静音</string>
</resources>
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values/strings_nullgram.xml
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,5 @@
<string name="sendMp4DocumentAsVideo">Send MP4 document as video</string>
<string name="disableGravityDetectionInVideo">Disable gravity detection in video</string>
<string name="hideProxyEntryInTitle">Hide proxy entry in title</string>
<string name="autoMuteAfterJoiningChannel">Auto mute after joining channel</string>
</resources>

0 comments on commit f611c9d

Please sign in to comment.