aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-05-03 21:11:19 +0200
committerChristian Schneppe <christian@pix-art.de>2019-05-03 21:11:19 +0200
commita129263860aca0f6b6a1dfec7f5439e7dcad17dd (patch)
tree851d904a6a1d541c8bfbdd30a08f95a7884f35d7
parentfb26ef3a49b27ca3d5e7e8e55ed65b26815fa508 (diff)
store correcting message in db
-rw-r--r--src/main/java/de/pixart/messenger/entities/Conversation.java9
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java7
2 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java
index 65dfba12d..acaf9b643 100644
--- a/src/main/java/de/pixart/messenger/entities/Conversation.java
+++ b/src/main/java/de/pixart/messenger/entities/Conversation.java
@@ -63,6 +63,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
private static final String ATTRIBUTE_NEXT_MESSAGE_TIMESTAMP = "next_message_timestamp";
private static final String ATTRIBUTE_CRYPTO_TARGETS = "crypto_targets";
private static final String ATTRIBUTE_NEXT_ENCRYPTION = "next_encryption";
+ private static final String ATTRIBUTE_CORRECTING_MESSAGE = "correcting_message";
static final String ATTRIBUTE_MEMBERS_ONLY = "members_only";
static final String ATTRIBUTE_MODERATED = "moderated";
static final String ATTRIBUTE_NON_ANONYMOUS = "non_anonymous";
@@ -90,7 +91,6 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
private ChatState mIncomingChatState = Config.DEFAULT_CHATSTATE;
private String mLastReceivedOtrMessageId = null;
private String mFirstMamReference = null;
- private Message correctingMessage;
public Conversation(final String name, final Account account, final Jid contactJid,
final int mode) {
@@ -486,15 +486,14 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
setAttribute(ATTRIBUTE_CRYPTO_TARGETS, acceptedTargets);
}
- //TODO store uuid in attribute
public boolean setCorrectingMessage(Message correctingMessage) {
- this.correctingMessage = correctingMessage;
+ setAttribute(ATTRIBUTE_CORRECTING_MESSAGE, correctingMessage == null ? null : correctingMessage.getUuid());
return correctingMessage == null && draftMessage != null;
}
- //TODO: dynamically find by uuid
public Message getCorrectingMessage() {
- return this.correctingMessage;
+ final String uuid = getAttribute(ATTRIBUTE_CORRECTING_MESSAGE);
+ return uuid == null ? null : findSentMessageWithUuid(uuid);
}
public boolean withSelf() {
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 3ac0a60bb..2c3a15b75 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -492,6 +492,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
conversation.setDraftMessage(null);
} else if (conversation.getMode() == Conversation.MODE_MULTI) {
conversation.setNextCounterpart(null);
+ binding.textinput.setText("");
+ } else {
+ binding.textinput.setText("");
}
updateChatMsgHint();
updateSendButton();
@@ -525,11 +528,11 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
private static ConversationFragment findConversationFragment(Activity activity) {
Fragment fragment = activity.getFragmentManager().findFragmentById(R.id.main_fragment);
- if (fragment != null && fragment instanceof ConversationFragment) {
+ if (fragment instanceof ConversationFragment) {
return (ConversationFragment) fragment;
}
fragment = activity.getFragmentManager().findFragmentById(R.id.secondary_fragment);
- if (fragment != null && fragment instanceof ConversationFragment) {
+ if (fragment instanceof ConversationFragment) {
return (ConversationFragment) fragment;
}
return null;