mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-06 03:49:58 +02:00
Show channels in a proper "Channel" chat (#3783)
* Rename "broadcast list" to "channel"/"broadcast channel" both in UI and code * feat: Add new channel types * Update CHANGELOG.md * adb's review * refactor: Rename BroadcastChannel to Broadcast * Revert accidental change * Make it possible to leave channels - In a chat, if the chat is an InBroadcast, and it's not a contact request, then the `Leave` menu option is shown with the translated stock string `menu_leave_channel` as its label. - If the user clicks on it, the confirmation dialog has `menu_leave_channel` (rather than `menu_leave_group`) as its positive option. Counterpart of https://github.com/chatmail/core/pull/6984. --------- Co-authored-by: adbenitez <asieldbenitez@gmail.com> Co-authored-by: adb <adb@merlinux.eu>
This commit is contained in:
parent
23d521beed
commit
717777f628
23 changed files with 102 additions and 55 deletions
|
@ -59,6 +59,7 @@ import android.widget.Toast;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
|
@ -431,7 +432,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
|
||||
getMenuInflater().inflate(R.menu.conversation, menu);
|
||||
|
||||
if (dcChat.isSelfTalk() || dcChat.isBroadcast()) {
|
||||
if (dcChat.isSelfTalk() || dcChat.isOutBroadcast()) {
|
||||
menu.findItem(R.id.menu_mute_notifications).setVisible(false);
|
||||
} else if(dcChat.isMuted()) {
|
||||
menu.findItem(R.id.menu_mute_notifications).setTitle(R.string.menu_unmute);
|
||||
|
@ -441,14 +442,16 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
menu.findItem(R.id.menu_show_map).setVisible(false);
|
||||
}
|
||||
|
||||
if (!dcChat.canSend() || dcChat.isBroadcast() || dcChat.isMailingList()) {
|
||||
if (!dcChat.canSend() || dcChat.isMailingList() ) {
|
||||
menu.findItem(R.id.menu_ephemeral_messages).setVisible(false);
|
||||
}
|
||||
|
||||
if (isMultiUser()) {
|
||||
if (dcChat.isEncrypted()
|
||||
if (dcChat.isInBroadcast() && !dcChat.isContactRequest()) {
|
||||
menu.findItem(R.id.menu_leave).setTitle(R.string.menu_leave_channel).setVisible(true);
|
||||
} else if (dcChat.isEncrypted()
|
||||
&& dcChat.canSend()
|
||||
&& !dcChat.isBroadcast()
|
||||
&& !dcChat.isOutBroadcast()
|
||||
&& !dcChat.isMailingList()) {
|
||||
menu.findItem(R.id.menu_leave).setVisible(true);
|
||||
}
|
||||
|
@ -625,9 +628,16 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||
}
|
||||
|
||||
private void handleLeaveGroup() {
|
||||
@StringRes int leaveLabel;
|
||||
if (dcChat.isInBroadcast()) {
|
||||
leaveLabel = R.string.menu_leave_channel;
|
||||
} else {
|
||||
leaveLabel = R.string.menu_leave_group;
|
||||
}
|
||||
|
||||
AlertDialog dialog = new AlertDialog.Builder(this)
|
||||
.setMessage(getString(R.string.ask_leave_group))
|
||||
.setPositiveButton(R.string.menu_leave_group, (d, which) -> {
|
||||
.setPositiveButton(leaveLabel, (d, which) -> {
|
||||
dcContext.removeContactFromChat(chatId, DcContact.DC_CONTACT_ID_SELF);
|
||||
Toast.makeText(this, getString(R.string.done), Toast.LENGTH_SHORT).show();
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue