Merge pull request #1657 from deltachat/adapt-to-protect-api

adapt to new protect-api
This commit is contained in:
bjoern
2020-10-13 22:19:22 +02:00
committed by GitHub
9 changed files with 15 additions and 17 deletions
+3 -4
View File
@@ -1022,8 +1022,7 @@ JNIEXPORT jint Java_com_b44t_messenger_DcChat_getId(JNIEnv *env, jobject obj)
JNIEXPORT jboolean Java_com_b44t_messenger_DcChat_isGroup(JNIEnv *env, jobject obj)
{
int chat_type = dc_chat_get_type(get_dc_chat(env, obj));
return (chat_type==DC_CHAT_TYPE_GROUP || chat_type==DC_CHAT_TYPE_VERIFIED_GROUP);
return dc_chat_get_type(get_dc_chat(env, obj)) == DC_CHAT_TYPE_GROUP;
}
@@ -1081,9 +1080,9 @@ JNIEXPORT jboolean Java_com_b44t_messenger_DcChat_canSend(JNIEnv *env, jobject o
}
JNIEXPORT jboolean Java_com_b44t_messenger_DcChat_isVerified(JNIEnv *env, jobject obj)
JNIEXPORT jboolean Java_com_b44t_messenger_DcChat_isProtected(JNIEnv *env, jobject obj)
{
return dc_chat_is_verified(get_dc_chat(env, obj))!=0;
return dc_chat_is_protected(get_dc_chat(env, obj))!=0;
}
+1 -1
View File
@@ -32,7 +32,7 @@ public class DcChat {
public native boolean isSelfTalk ();
public native boolean isDeviceTalk ();
public native boolean canSend ();
public native boolean isVerified ();
public native boolean isProtected ();
public native boolean isSendingLocations();
public native boolean isMuted ();
@@ -190,7 +190,7 @@ public class ConversationListItem extends RelativeLayout
fromView.setCompoundDrawablesWithIntrinsicBounds(
thread.isMuted()? R.drawable.ic_volume_off_grey600_18dp : 0,
0,
thread.isVerified()? R.drawable.ic_verified : 0,
thread.isProtected()? R.drawable.ic_verified : 0,
0);
}
@@ -97,7 +97,7 @@ public class ConversationTitleView extends RelativeLayout {
if (Prefs.isChatMuted(dcChat)) {
imgLeft = R.drawable.ic_volume_off_white_18dp;
}
if (dcChat.isVerified()) {
if (dcChat.isProtected()) {
imgRight = R.drawable.ic_verified;
}
@@ -259,7 +259,7 @@ public class MediaPreviewActivity extends PassphraseRequiredActionBarActivity
private void editAvatar() {
Intent intent = new Intent(this, GroupCreateActivity.class);
intent.putExtra(GroupCreateActivity.EDIT_GROUP_CHAT_ID, editAvatarChatId);
if (dcContext.getChat(editAvatarChatId).isVerified()) {
if (dcContext.getChat(editAvatarChatId).isProtected()) {
intent.putExtra(GroupCreateActivity.GROUP_CREATE_VERIFIED_EXTRA, true);
}
startActivity(intent);
@@ -425,7 +425,7 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
if (chatIsGroup) {
Intent intent = new Intent(this, GroupCreateActivity.class);
intent.putExtra(GroupCreateActivity.EDIT_GROUP_CHAT_ID, chatId);
if (dcContext.getChat(chatId).isVerified()) {
if (dcContext.getChat(chatId).isProtected()) {
intent.putExtra(GroupCreateActivity.GROUP_CREATE_VERIFIED_EXTRA, true);
}
startActivity(intent);
@@ -205,7 +205,7 @@ public class ProfileSettingsFragment extends Fragment
public void onAddMember() {
DcChat dcChat = dcContext.getChat(chatId);
Intent intent = new Intent(getContext(), ContactMultiSelectionActivity.class);
intent.putExtra(ContactSelectionListFragment.SELECT_VERIFIED_EXTRA, dcChat.isVerified());
intent.putExtra(ContactSelectionListFragment.SELECT_VERIFIED_EXTRA, dcChat.isProtected());
ArrayList<String> preselectedContacts = new ArrayList<>();
int[] memberIds = dcContext.getChatContacts(chatId);
for (int memberId : memberIds) {
@@ -324,11 +324,10 @@ public class ApplicationDcContext extends DcContext {
Recipient recipient = getRecipient(chat);
long date = summary.getTimestamp();
int unreadCount = getFreshMsgCount(chatId);
boolean verified = chat.isVerified();
return new ThreadRecord(body, recipient, date,
unreadCount, chatId,
chat.getVisibility(), verified, chat.isSendingLocations(), chat.isMuted(), summary);
chat.getVisibility(), chat.isProtected(), chat.isSendingLocations(), chat.isMuted(), summary);
}
/***********************************************************************************************
@@ -44,7 +44,7 @@ public class ThreadRecord {
private final int unreadCount;
private final int visibility;
private final boolean verified;
private final boolean isProtected;
private final boolean isSendingLocations;
private final boolean isMuted;
private @Nullable final DcLot dcSummary;
@@ -53,7 +53,7 @@ public class ThreadRecord {
@NonNull Recipient recipient, long dateReceived, int unreadCount,
long threadId,
int visibility,
boolean verified,
boolean isProtected,
boolean isSendingLocations,
boolean isMuted,
@Nullable DcLot dcSummary)
@@ -64,7 +64,7 @@ public class ThreadRecord {
this.body = body;
this.unreadCount = unreadCount;
this.visibility = visibility;
this.verified = verified;
this.isProtected = isProtected;
this.isSendingLocations = isSendingLocations;
this.isMuted = isMuted;
this.dcSummary = dcSummary;
@@ -114,8 +114,8 @@ public class ThreadRecord {
return visibility;
}
public boolean isVerified() {
return verified;
public boolean isProtected() {
return isProtected;
}
public boolean isSendingLocations() {