fix getNextEncryption

This commit is contained in:
Daniel Gultsch 2018-03-19 10:08:36 +01:00
parent 442c284c8e
commit 5363470bcf
2 changed files with 8 additions and 12 deletions

View File

@ -600,7 +600,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
defaultEncryption = Message.ENCRYPTION_NONE; defaultEncryption = Message.ENCRYPTION_NONE;
} }
int encryption = this.getIntAttribute(ATTRIBUTE_NEXT_ENCRYPTION, defaultEncryption); int encryption = this.getIntAttribute(ATTRIBUTE_NEXT_ENCRYPTION, defaultEncryption);
if (encryption == Message.ENCRYPTION_OTR) { if (encryption == Message.ENCRYPTION_OTR || encryption < 0) {
return defaultEncryption; return defaultEncryption;
} else { } else {
return encryption; return encryption;

View File

@ -884,7 +884,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
} }
highlightInConference(user.getResource()); highlightInConference(user.getResource());
} else { } else {
Toast.makeText(getActivity(),R.string.you_are_not_participating, Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), R.string.you_are_not_participating, Toast.LENGTH_SHORT).show();
} }
} }
return; return;
@ -972,7 +972,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
View view = activity.getCurrentFocus(); View view = activity.getCurrentFocus();
if (view != null && imm != null) { if (view != null && imm != null) {
imm.hideSoftInputFromWindow(view.getWindowToken(),0); imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
} }
} }
@ -1272,15 +1272,11 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
} }
selectPresenceToAttachFile(attachmentChoice); selectPresenceToAttachFile(attachmentChoice);
} else { } else {
final ConversationFragment fragment = (ConversationFragment) getFragmentManager() showNoPGPKeyDialog(false, (dialog, which) -> {
.findFragmentByTag("conversation"); conversation.setNextEncryption(Message.ENCRYPTION_NONE);
if (fragment != null) { activity.xmppConnectionService.updateConversation(conversation);
fragment.showNoPGPKeyDialog(false, (dialog, which) -> { selectPresenceToAttachFile(attachmentChoice);
conversation.setNextEncryption(Message.ENCRYPTION_NONE); });
activity.xmppConnectionService.updateConversation(conversation);
selectPresenceToAttachFile(attachmentChoice);
});
}
} }
} else { } else {
activity.showInstallPgpDialog(); activity.showInstallPgpDialog();