mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 09:49:21 +02:00
adapt to new PGP-contacts
This commit is contained in:
parent
bd3c4f9186
commit
966d8784f3
17 changed files with 96 additions and 9 deletions
|
@ -1237,6 +1237,12 @@ JNIEXPORT jint Java_com_b44t_messenger_DcChat_getColor(JNIEnv *env, jobject obj)
|
|||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean Java_com_b44t_messenger_DcChat_isEncrypted(JNIEnv *env, jobject obj)
|
||||
{
|
||||
return dc_chat_is_encrypted(get_dc_chat(env, obj))!=0;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean Java_com_b44t_messenger_DcChat_isUnpromoted(JNIEnv *env, jobject obj)
|
||||
{
|
||||
return dc_chat_is_unpromoted(get_dc_chat(env, obj))!=0;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 47b9bfc8bf807ad099d2211a59d6ba80290b0c95
|
||||
Subproject commit c0cf4e7e9b70c9d2201a1e30e5a0e782859ab95b
|
|
@ -38,6 +38,7 @@ public class DcChat {
|
|||
public native String getMailinglistAddr();
|
||||
public native String getProfileImage ();
|
||||
public native int getColor ();
|
||||
public native boolean isEncrypted ();
|
||||
public native boolean isUnpromoted ();
|
||||
public native boolean isSelfTalk ();
|
||||
public native boolean isDeviceTalk ();
|
||||
|
|
|
@ -173,6 +173,10 @@ public class Rpc {
|
|||
}
|
||||
}
|
||||
|
||||
public String getMigrationError(int accountId) throws RpcException {
|
||||
return gson.fromJson(getResult("get_migration_error", accountId), String.class);
|
||||
}
|
||||
|
||||
private static class Response {
|
||||
public final int id;
|
||||
public final JsonElement result;
|
||||
|
|
|
@ -194,6 +194,8 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
|||
refresh();
|
||||
|
||||
if (BuildConfig.DEBUG) checkNdkArchitecture();
|
||||
|
||||
DcHelper.maybeShowMigrationError(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -292,7 +292,7 @@ public class ProfileSettingsAdapter extends RecyclerView.Adapter
|
|||
|
||||
if (dcChat.isMailingList()) {
|
||||
isMailingList = true;
|
||||
} else if (dcChat.canSend()) {
|
||||
} else if (dcChat.canSend() && dcChat.isEncrypted()) {
|
||||
itemData.add(new ItemData(ItemData.CATEGORY_MEMBERS, DcContact.DC_CONTACT_ID_ADD_MEMBER, 0));
|
||||
if (!isBroadcast) {
|
||||
itemData.add(new ItemData(ItemData.CATEGORY_MEMBERS, DcContact.DC_CONTACT_ID_QR_INVITE, 0));
|
||||
|
|
|
@ -166,7 +166,7 @@ public class ProfileSettingsFragment extends Fragment
|
|||
if (contactId>DcContact.DC_CONTACT_ID_LAST_SPECIAL || contactId==DcContact.DC_CONTACT_ID_SELF) {
|
||||
if (actionMode==null) {
|
||||
DcChat dcChat = dcContext.getChat(chatId);
|
||||
if (dcChat.canSend()) {
|
||||
if (dcChat.canSend() && dcChat.isEncrypted()) {
|
||||
adapter.toggleMemberSelection(contactId);
|
||||
actionMode = ((AppCompatActivity) requireActivity()).startSupportActionMode(actionModeCallback);
|
||||
}
|
||||
|
|
|
@ -96,6 +96,8 @@ public class WelcomeActivity extends BaseActionBarActivity implements DcEventCen
|
|||
intent.setAction(DC_REQUEST_ACCOUNT_DATA);
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
|
||||
DcHelper.maybeShowMigrationError(this);
|
||||
}
|
||||
|
||||
protected void initializeActionBar() {
|
||||
|
|
|
@ -22,7 +22,7 @@ public class ConversationItemFooter extends LinearLayout {
|
|||
private TextView dateView;
|
||||
private TextView editedView;
|
||||
private ImageView bookmarkIndicatorView;
|
||||
private ImageView secureIndicatorView;
|
||||
private ImageView emailIndicatorView;
|
||||
private ImageView locationIndicatorView;
|
||||
private DeliveryStatusView deliveryStatusView;
|
||||
private Integer textColor = null;
|
||||
|
@ -48,7 +48,7 @@ public class ConversationItemFooter extends LinearLayout {
|
|||
dateView = findViewById(R.id.footer_date);
|
||||
editedView = findViewById(R.id.footer_edited);
|
||||
bookmarkIndicatorView = findViewById(R.id.footer_bookmark_indicator);
|
||||
secureIndicatorView = findViewById(R.id.footer_secure_indicator);
|
||||
emailIndicatorView = findViewById(R.id.footer_email_indicator);
|
||||
locationIndicatorView = findViewById(R.id.footer_location_indicator);
|
||||
deliveryStatusView = new DeliveryStatusView(findViewById(R.id.delivery_indicator));
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class ConversationItemFooter extends LinearLayout {
|
|||
boolean bookmark = messageRecord.getOriginalMsgId() != 0 || messageRecord.getSavedMsgId() != 0;
|
||||
bookmarkIndicatorView.setVisibility(bookmark ? View.VISIBLE : View.GONE);
|
||||
editedView.setVisibility(messageRecord.isEdited() ? View.VISIBLE : View.GONE);
|
||||
secureIndicatorView.setVisibility(messageRecord.isSecure() ? View.VISIBLE : View.GONE);
|
||||
emailIndicatorView.setVisibility(messageRecord.isSecure() ? View.GONE : View.VISIBLE);
|
||||
locationIndicatorView.setVisibility(messageRecord.hasLocation() ? View.VISIBLE : View.GONE);
|
||||
presentDeliveryStatus(messageRecord);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class ConversationItemFooter extends LinearLayout {
|
|||
dateView.setTextColor(color);
|
||||
editedView.setTextColor(color);
|
||||
bookmarkIndicatorView.setColorFilter(color);
|
||||
secureIndicatorView.setColorFilter(color);
|
||||
emailIndicatorView.setColorFilter(color);
|
||||
locationIndicatorView.setColorFilter(color);
|
||||
deliveryStatusView.setTint(color);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.b44t.messenger.DcContext;
|
|||
import com.b44t.messenger.DcLot;
|
||||
import com.b44t.messenger.DcMsg;
|
||||
import com.b44t.messenger.rpc.Rpc;
|
||||
import com.b44t.messenger.rpc.RpcException;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.BuildConfig;
|
||||
|
@ -36,6 +37,7 @@ import org.thoughtcrime.securesms.qr.QrActivity;
|
|||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.FileUtils;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
|
@ -495,4 +497,62 @@ public class DcHelper {
|
|||
if (section != null) { intent.putExtra(LocalHelpActivity.SECTION_EXTRA, section); }
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* For the PGP-Contacts migration, things can go wrong.
|
||||
* The migration happens when the account is setup, at which point no events can be sent yet.
|
||||
* So, instead, if something goes wrong, it's returned by getLastError().
|
||||
* This function shows the error message to the user.
|
||||
* <p>
|
||||
* A few releases after the PGP-contacts migration (which happened in 2025-05),
|
||||
* we can remove this function again.
|
||||
*/
|
||||
public static void maybeShowMigrationError(Context context) {
|
||||
try {
|
||||
String lastError = DcHelper.getRpc(context).getMigrationError(DcHelper.getContext(context).getAccountId());
|
||||
|
||||
if (lastError != null && !lastError.isEmpty()) {
|
||||
Log.w(TAG, "Opening account failed, trying to share error: " + lastError);
|
||||
|
||||
String subject = "Delta Chat failed to update";
|
||||
String email = "delta@merlinux.eu";
|
||||
|
||||
new AlertDialog.Builder(context)
|
||||
.setMessage(context.getString(R.string.error_x, lastError))
|
||||
.setNeutralButton(R.string.global_menu_edit_copy_desktop, (d, which) -> {
|
||||
Util.writeTextToClipboard(context, lastError);
|
||||
})
|
||||
.setPositiveButton(R.string.menu_send, (d, which) -> {
|
||||
Intent sharingIntent = new Intent(
|
||||
Intent.ACTION_SENDTO, Uri.fromParts(
|
||||
"mailto", email, null
|
||||
)
|
||||
);
|
||||
sharingIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{email});
|
||||
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
|
||||
sharingIntent.putExtra(Intent.EXTRA_TEXT, lastError);
|
||||
|
||||
if (sharingIntent.resolveActivity(context.getPackageManager()) == null) {
|
||||
Log.w(TAG, "No email client found to send crash report");
|
||||
sharingIntent = new Intent(Intent.ACTION_SEND);
|
||||
sharingIntent.setType("text/plain");
|
||||
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
|
||||
sharingIntent.putExtra(Intent.EXTRA_TEXT, lastError);
|
||||
sharingIntent.putExtra(Intent.EXTRA_EMAIL, email);
|
||||
}
|
||||
|
||||
Intent chooser =
|
||||
Intent.createChooser(sharingIntent, "Send using...");
|
||||
chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
chooser.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||
|
||||
context.startActivity(chooser);
|
||||
})
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
}
|
||||
} catch (RpcException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ public class BackupReceiverFragment extends Fragment implements DcEventCenter.Dc
|
|||
|
||||
Log.i(TAG,"DC_EVENT_IMEX_PROGRESS, " + permille);
|
||||
if (permille == 0) {
|
||||
DcHelper.maybeShowMigrationError(getTransferActivity());
|
||||
getTransferActivity().setTransferError("Receiving Error");
|
||||
} else if (permille < 1000) {
|
||||
percent = permille/10;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 374 B |
Binary file not shown.
Before Width: | Height: | Size: 298 B |
Binary file not shown.
Before Width: | Height: | Size: 429 B |
Binary file not shown.
Before Width: | Height: | Size: 604 B |
11
src/main/res/drawable/ic_outline_email.xml
Normal file
11
src/main/res/drawable/ic_outline_email.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="18sp"
|
||||
android:width="18sp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24"
|
||||
android:tint="#FFFFFF">
|
||||
|
||||
<path android:fillColor="@android:color/white" android:pathData="M22,6c0,-1.1 -0.9,-2 -2,-2L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6zM20,6l-8,5 -8,-5h16zM20,18L4,18L4,8l8,5 8,-5v10z"/>
|
||||
|
||||
</vector>
|
|
@ -19,10 +19,10 @@
|
|||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/footer_secure_indicator"
|
||||
android:id="@+id/footer_email_indicator"
|
||||
android:layout_width="12sp"
|
||||
android:layout_height="11sp"
|
||||
android:src="@drawable/msg_encr_out"
|
||||
android:src="@drawable/ic_outline_email"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:importantForAccessibility="no"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue