store correcting message in db
This commit is contained in:
parent
ef555063d9
commit
d2c9ce7bf0
|
@ -60,6 +60,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_NEXT_MESSAGE_TIMESTAMP = "next_message_timestamp";
|
||||||
private static final String ATTRIBUTE_CRYPTO_TARGETS = "crypto_targets";
|
private static final String ATTRIBUTE_CRYPTO_TARGETS = "crypto_targets";
|
||||||
private static final String ATTRIBUTE_NEXT_ENCRYPTION = "next_encryption";
|
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_MEMBERS_ONLY = "members_only";
|
||||||
static final String ATTRIBUTE_MODERATED = "moderated";
|
static final String ATTRIBUTE_MODERATED = "moderated";
|
||||||
static final String ATTRIBUTE_NON_ANONYMOUS = "non_anonymous";
|
static final String ATTRIBUTE_NON_ANONYMOUS = "non_anonymous";
|
||||||
|
@ -82,7 +83,6 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
private ChatState mOutgoingChatState = Config.DEFAULT_CHATSTATE;
|
private ChatState mOutgoingChatState = Config.DEFAULT_CHATSTATE;
|
||||||
private ChatState mIncomingChatState = Config.DEFAULT_CHATSTATE;
|
private ChatState mIncomingChatState = Config.DEFAULT_CHATSTATE;
|
||||||
private String mFirstMamReference = null;
|
private String mFirstMamReference = null;
|
||||||
private Message correctingMessage;
|
|
||||||
|
|
||||||
public Conversation(final String name, final Account account, final Jid contactJid,
|
public Conversation(final String name, final Account account, final Jid contactJid,
|
||||||
final int mode) {
|
final int mode) {
|
||||||
|
@ -424,15 +424,14 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
setAttribute(ATTRIBUTE_CRYPTO_TARGETS, acceptedTargets);
|
setAttribute(ATTRIBUTE_CRYPTO_TARGETS, acceptedTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO store uuid in attribute
|
|
||||||
public boolean setCorrectingMessage(Message correctingMessage) {
|
public boolean setCorrectingMessage(Message correctingMessage) {
|
||||||
this.correctingMessage = correctingMessage;
|
setAttribute(ATTRIBUTE_CORRECTING_MESSAGE,correctingMessage == null ? null : correctingMessage.getUuid());
|
||||||
return correctingMessage == null && draftMessage != null;
|
return correctingMessage == null && draftMessage != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: dynamically find by uuid
|
|
||||||
public Message getCorrectingMessage() {
|
public Message getCorrectingMessage() {
|
||||||
return this.correctingMessage;
|
final String uuid = getAttribute(ATTRIBUTE_CORRECTING_MESSAGE);
|
||||||
|
return uuid == null ? null : findSentMessageWithUuid(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean withSelf() {
|
public boolean withSelf() {
|
||||||
|
|
|
@ -432,6 +432,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
conversation.setDraftMessage(null);
|
conversation.setDraftMessage(null);
|
||||||
} else if (conversation.getMode() == Conversation.MODE_MULTI) {
|
} else if (conversation.getMode() == Conversation.MODE_MULTI) {
|
||||||
conversation.setNextCounterpart(null);
|
conversation.setNextCounterpart(null);
|
||||||
|
binding.textinput.setText("");
|
||||||
|
} else {
|
||||||
|
binding.textinput.setText("");
|
||||||
}
|
}
|
||||||
updateChatMsgHint();
|
updateChatMsgHint();
|
||||||
updateSendButton();
|
updateSendButton();
|
||||||
|
@ -455,11 +458,11 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
|
|
||||||
private static ConversationFragment findConversationFragment(Activity activity) {
|
private static ConversationFragment findConversationFragment(Activity activity) {
|
||||||
Fragment fragment = activity.getFragmentManager().findFragmentById(R.id.main_fragment);
|
Fragment fragment = activity.getFragmentManager().findFragmentById(R.id.main_fragment);
|
||||||
if (fragment != null && fragment instanceof ConversationFragment) {
|
if (fragment instanceof ConversationFragment) {
|
||||||
return (ConversationFragment) fragment;
|
return (ConversationFragment) fragment;
|
||||||
}
|
}
|
||||||
fragment = activity.getFragmentManager().findFragmentById(R.id.secondary_fragment);
|
fragment = activity.getFragmentManager().findFragmentById(R.id.secondary_fragment);
|
||||||
if (fragment != null && fragment instanceof ConversationFragment) {
|
if (fragment instanceof ConversationFragment) {
|
||||||
return (ConversationFragment) fragment;
|
return (ConversationFragment) fragment;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue