mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
rename isGroup() to isMultiUser() (#2063)
* rename isGroup() to isMultiUser() * rename isGroupConversation()/isPushGroupConversation() to isMultiUser() * rename chatIsGroup to chatIsMultiUser * rename isGroupRecipient() to isMultiUserRecipient()
This commit is contained in:
@@ -45,9 +45,7 @@ public class DcChat {
|
||||
|
||||
// aliases and higher-level tools
|
||||
|
||||
public boolean isGroup() {
|
||||
// isMultiUser() might fit better,
|
||||
// however, would result in lots of code changes, so we leave this as is for now.
|
||||
public boolean isMultiUser() {
|
||||
int type = getType();
|
||||
return type == DC_CHAT_TYPE_GROUP || type == DC_CHAT_TYPE_MAILINGLIST || type == DC_CHAT_TYPE_BROADCAST;
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
menu.findItem(R.id.menu_ephemeral_messages).setVisible(false);
|
||||
}
|
||||
|
||||
if (isGroupConversation()) {
|
||||
if (isMultiUser()) {
|
||||
if (dcChat.canSend() && !dcChat.isBroadcast()) {
|
||||
inflater.inflate(R.menu.conversation_push_group_options, menu);
|
||||
}
|
||||
@@ -704,7 +704,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
SendRelayedMessageUtil.immediatelyRelay(this, chatId);
|
||||
} else {
|
||||
String name = dcChat.getName();
|
||||
if (!dcChat.isGroup()) {
|
||||
if (!dcChat.isMultiUser()) {
|
||||
int[] contactIds = dcContext.getChatContacts(chatId);
|
||||
if (contactIds.length == 1 || contactIds.length == 2) {
|
||||
name = dcContext.getContact(contactIds[0]).getNameNAddr();
|
||||
@@ -854,7 +854,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
{
|
||||
final SettableFuture<Boolean> future = new SettableFuture<>();
|
||||
|
||||
handleSecurityChange(currentSecureText || isPushGroupConversation(), currentIsDefaultSms);
|
||||
handleSecurityChange(currentSecureText || isMultiUser(), currentIsDefaultSms);
|
||||
|
||||
future.set(true);
|
||||
return future;
|
||||
@@ -1022,12 +1022,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
composeText.append(name + "\n" + mail);
|
||||
}
|
||||
|
||||
private boolean isGroupConversation() {
|
||||
return dcChat.isGroup();
|
||||
}
|
||||
|
||||
private boolean isPushGroupConversation() {
|
||||
return isGroupConversation(); // push groups are non-sms groups, so in delta, these are all groups
|
||||
private boolean isMultiUser() {
|
||||
return dcChat.isMultiUser();
|
||||
}
|
||||
|
||||
private boolean isArchived() {
|
||||
|
||||
@@ -174,7 +174,7 @@ public class ConversationFragment extends MessageSelectorFragment
|
||||
|
||||
private void setNoMessageText() {
|
||||
DcChat dcChat = getListAdapter().getChat();
|
||||
if(dcChat.isGroup()){
|
||||
if(dcChat.isMultiUser()){
|
||||
if (dcChat.isBroadcast()) {
|
||||
noMessageTextView.setText(R.string.chat_new_broadcast_hint);
|
||||
} else if (dcChat.isUnpromoted()) {
|
||||
@@ -328,7 +328,7 @@ public class ConversationFragment extends MessageSelectorFragment
|
||||
menu.findItem(R.id.menu_context_share).setVisible(messageRecord.hasFile());
|
||||
boolean canReply = canReplyToMsg(messageRecord);
|
||||
menu.findItem(R.id.menu_context_reply).setVisible(chat.canSend() && canReply);
|
||||
boolean showReplyPrivately = chat.isGroup() && !messageRecord.isOutgoing() && canReply;
|
||||
boolean showReplyPrivately = chat.isMultiUser() && !messageRecord.isOutgoing() && canReply;
|
||||
menu.findItem(R.id.menu_context_reply_privately).setVisible(showReplyPrivately);
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ public class ConversationItem extends BaseConversationItem
|
||||
this.locale = locale;
|
||||
this.glideRequests = glideRequests;
|
||||
this.conversationRecipient = recipients;
|
||||
this.showSender = dcChat.isGroup() || messageRecord.getOverrideSenderName() != null;
|
||||
this.showSender = dcChat.isMultiUser() || messageRecord.getOverrideSenderName() != null;
|
||||
|
||||
if (showSender && !messageRecord.isOutgoing()) {
|
||||
this.dcContact = dcContext.getContact(messageRecord.getFromId());
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ConversationTitleView extends RelativeLayout {
|
||||
subtitleStr = context.getString(R.string.mailing_list);
|
||||
} else if (dcChat.isBroadcast()) {
|
||||
subtitleStr = context.getResources().getQuantityString(R.plurals.n_recipients, chatContacts.length, chatContacts.length);
|
||||
} else if( dcChat.isGroup() ) {
|
||||
} else if( dcChat.isMultiUser() ) {
|
||||
subtitleStr = context.getResources().getQuantityString(R.plurals.n_members, chatContacts.length, chatContacts.length);
|
||||
} else if( chatContacts.length>=1 ) {
|
||||
if( dcChat.isSelfTalk() ) {
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
private DcContext dcContext;
|
||||
private int chatId;
|
||||
private boolean chatIsGroup;
|
||||
private boolean chatIsMultiUser;
|
||||
private boolean chatIsDeviceTalk;
|
||||
private boolean chatIsMailingList;
|
||||
private boolean chatIsBroadcast;
|
||||
@@ -135,7 +135,7 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
menu.findItem(R.id.edit_name).setVisible(false);
|
||||
menu.findItem(R.id.show_encr_info).setVisible(false);
|
||||
menu.findItem(R.id.copy_addr_to_clipboard).setVisible(false);
|
||||
} else if (chatIsGroup) {
|
||||
} else if (chatIsMultiUser) {
|
||||
if (chatIsBroadcast) {
|
||||
canReceive = false;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
private void initializeResources() {
|
||||
chatId = getIntent().getIntExtra(CHAT_ID_EXTRA, 0);
|
||||
contactId = getIntent().getIntExtra(CONTACT_ID_EXTRA, 0);
|
||||
chatIsGroup = false;
|
||||
chatIsMultiUser = false;
|
||||
chatIsDeviceTalk = false;
|
||||
chatIsMailingList= false;
|
||||
chatIsBroadcast = false;
|
||||
@@ -223,11 +223,11 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
}
|
||||
else if(chatId!=0) {
|
||||
DcChat dcChat = dcContext.getChat(chatId);
|
||||
chatIsGroup = dcChat.isGroup();
|
||||
chatIsMultiUser = dcChat.isMultiUser();
|
||||
chatIsDeviceTalk = dcChat.isDeviceTalk();
|
||||
chatIsMailingList = dcChat.isMailingList();
|
||||
chatIsBroadcast = dcChat.isBroadcast();
|
||||
if(!chatIsGroup) {
|
||||
if(!chatIsMultiUser) {
|
||||
final int[] members = dcContext.getChatContacts(chatId);
|
||||
contactId = members.length>=1? members[0] : 0;
|
||||
}
|
||||
@@ -267,7 +267,7 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
private boolean isContactProfile() {
|
||||
// contact-profiles are profiles without a chat or with a one-to-one chat
|
||||
return contactId!=0 && (chatId==0 || !chatIsGroup);
|
||||
return contactId!=0 && (chatId==0 || !chatIsMultiUser);
|
||||
}
|
||||
|
||||
private boolean isSelfProfile() {
|
||||
@@ -478,7 +478,7 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
Intent intent = new Intent(this, MediaPreviewActivity.class);
|
||||
intent.setDataAndType(profileImageUri, type);
|
||||
intent.putExtra(MediaPreviewActivity.ACTIVITY_TITLE_EXTRA, title);
|
||||
intent.putExtra(MediaPreviewActivity.EDIT_AVATAR_CHAT_ID, chatIsGroup ? chatId : 0); // shows edit-button, might be 0 for a contact-profile
|
||||
intent.putExtra(MediaPreviewActivity.EDIT_AVATAR_CHAT_ID, chatIsMultiUser ? chatId : 0); // shows edit-button, might be 0 for a contact-profile
|
||||
startActivity(intent);
|
||||
} else {
|
||||
onEditName();
|
||||
@@ -486,7 +486,7 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
|
||||
}
|
||||
|
||||
private void onEditName() {
|
||||
if (chatIsGroup) {
|
||||
if (chatIsMultiUser) {
|
||||
Intent intent = new Intent(this, GroupCreateActivity.class);
|
||||
intent.putExtra(GroupCreateActivity.EDIT_GROUP_CHAT_ID, chatId);
|
||||
if (dcContext.getChat(chatId).isProtected()) {
|
||||
|
||||
@@ -125,7 +125,7 @@ public class ProfileSettingsFragment extends Fragment
|
||||
if (contactId>0) { dcContact = dcContext.getContact(contactId); }
|
||||
if (chatId>0) { dcChat = dcContext.getChat(chatId); }
|
||||
|
||||
if(dcChat!=null && dcChat.isGroup()) {
|
||||
if(dcChat!=null && dcChat.isMultiUser()) {
|
||||
memberList = dcContext.getChatContacts(chatId);
|
||||
}
|
||||
else if(contactId>0) {
|
||||
|
||||
@@ -67,7 +67,7 @@ public class AvatarImageView extends AppCompatImageView {
|
||||
}
|
||||
|
||||
private void setAvatarClickHandler(final Recipient recipient, boolean quickContactEnabled) {
|
||||
if (!recipient.isGroupRecipient() && quickContactEnabled) {
|
||||
if (!recipient.isMultiUserRecipient() && quickContactEnabled) {
|
||||
super.setOnClickListener(v -> {
|
||||
if(recipient.getAddress().isDcContact()) {
|
||||
Intent intent = new Intent(getContext(), ProfileActivity.class);
|
||||
|
||||
@@ -331,7 +331,7 @@ public class NotificationCenter {
|
||||
|
||||
DcMsg dcMsg = dcContext.getMsg(msgId);
|
||||
String line = privacy.isDisplayMessage()? dcMsg.getSummarytext(2000) : context.getString(R.string.notify_new_message);
|
||||
if (dcChat.isGroup() && privacy.isDisplayContact()) {
|
||||
if (dcChat.isMultiUser() && privacy.isDisplayContact()) {
|
||||
line = dcMsg.getSenderName(dcContext.getContact(dcMsg.getFromId()), false) + ": " + line;
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ public class NotificationCenter {
|
||||
// if privacy allows, for better accessibility,
|
||||
// prepend the sender in the ticker also for one-to-one chats (for group-chats, this is already done)
|
||||
String tickerLine = line;
|
||||
if (!dcChat.isGroup() && privacy.isDisplayContact()) {
|
||||
if (!dcChat.isMultiUser() && privacy.isDisplayContact()) {
|
||||
line = dcMsg.getSenderName(dcContext.getContact(dcMsg.getFromId()), false) + ": " + line;
|
||||
}
|
||||
builder.setTicker(tickerLine);
|
||||
|
||||
@@ -117,7 +117,7 @@ public class Recipient {
|
||||
else if(dcChat!=null) {
|
||||
int chatId = dcChat.getId();
|
||||
this.address = Address.fromChat(chatId);
|
||||
if (!dcChat.isGroup()) {
|
||||
if (!dcChat.isMultiUser()) {
|
||||
DcContext dcContext = DcHelper.getContext(context);
|
||||
int[] contacts = dcContext.getChatContacts(chatId);
|
||||
if( contacts.length>=1 ) {
|
||||
@@ -160,8 +160,8 @@ public class Recipient {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
public boolean isGroupRecipient() {
|
||||
return dcChat!=null && dcChat.isGroup();
|
||||
public boolean isMultiUserRecipient() {
|
||||
return dcChat!=null && dcChat.isMultiUser();
|
||||
}
|
||||
|
||||
public @NonNull List<Recipient> loadParticipants(Context context) {
|
||||
|
||||
Reference in New Issue
Block a user