Added message resync

pull/153/head
M66B 6 years ago
parent 89ffe76064
commit 2585b089a4

@ -355,6 +355,8 @@ You can enable *Encrypt by default* in the identity settings.
Encryption is [Autocrypt](https://autocrypt.org/) compatible. For security reasons received messages are not decrypted automatically.
The decrypted message text and decrypted attachments are stored. If you want to undo this, you can use the *resync* message 'more' menu.
Inline PGP in received messages is supported, but inline PGP in outgoing messages is not supported,
see [here](https://josefsson.org/inline-openpgp-considered-harmful.html) about why not.

@ -2149,6 +2149,41 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
.putExtra("id", data.message.id));
}
private void onMenuResync(ActionData data) {
Bundle args = new Bundle();
args.putLong("id", data.message.id);
new SimpleTask<Void>() {
@Override
protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id");
DB db = DB.getInstance(context);
try {
db.beginTransaction();
EntityMessage message = db.message().getMessage(id);
if (message == null || message.uid == null)
return null;
db.message().deleteMessage(id);
EntityOperation.sync(context, message.folder, true);
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
return null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
}
}.execute(context, owner, args, "message:share");
}
private void onMenuCreateRule(ActionData data) {
Intent rule = new Intent(ActivityView.ACTION_EDIT_RULE);
rule.putExtra("account", data.message.account);
@ -2535,6 +2570,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
popupMenu.getMenu().findItem(R.id.menu_decrypt).setEnabled(
data.message.content && data.message.to != null && data.message.to.length > 0);
popupMenu.getMenu().findItem(R.id.menu_resync).setEnabled(data.message.uid != null);
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem target) {
@ -2561,6 +2598,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
case R.id.menu_decrypt:
onMenuDecrypt(data);
return true;
case R.id.menu_resync:
onMenuResync(data);
return true;
case R.id.menu_create_rule:
onMenuCreateRule(data);
return true;

@ -28,6 +28,10 @@
android:id="@+id/menu_decrypt"
android:title="@string/title_decrypt" />
<item
android:id="@+id/menu_resync"
android:title="@string/title_resync" />
<item
android:id="@+id/menu_create_rule"
android:title="@string/title_create_rule" />

@ -422,6 +422,7 @@
<string name="title_encrypt">Encrypt</string>
<string name="title_decrypt">Decrypt</string>
<string name="title_resync">Resync</string>
<string name="title_no_openpgp">OpenKeychain not found</string>
<string name="title_not_encrypted">Message is not encrypted</string>

Loading…
Cancel
Save