-
-
Notifications
You must be signed in to change notification settings - Fork 272
Refactor drafts to save both Messages & Replies to Room Storage #5037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8818b47
to
666c4c9
Compare
I figured it would be simpler to clear the reply state when exiting |
Having the reply parent removed when leaving the chat is not expected. It should be possible to have drafts for each conversation including reply parent messages saved. I think best is to avoid the handling with with single sharedPreferences values. Maybe we could use room for this. Adding |
@@ -295,11 +311,20 @@ class MessageInputFragment : Fragment() { | |||
|
|||
private fun restoreState() { | |||
if (binding.fragmentMessageInputView.inputEditText.text.isEmpty()) { | |||
Log.d("Julius", "State restored from: ${chatActivity.localClassName}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove
Pretty simple right now, there's a column |
4b44a93
to
7bdce75
Compare
@rapterjet2004 whats the state of the PR? can you update the labels or let me know if it's to review again? |
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment
Error was caused by the ConversationDao function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems to work now. See comments for some improvement suggestions.
esp. runBlocking should be avoided. (I know.. we also use it in other places and it should also be improved there)
app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/nextcloud/talk/data/database/dao/ConversationsDao.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/com/nextcloud/talk/data/database/dao/ConversationsDao.kt
Show resolved
Hide resolved
app/src/main/java/com/nextcloud/talk/chat/viewmodels/ChatViewModel.kt
Outdated
Show resolved
Hide resolved
@sowjanyakch can you please also review and test? |
66c2249
to
9146b42
Compare
Signed-off-by: rapterjet2004 <[email protected]>
Signed-off-by: rapterjet2004 <[email protected]>
Signed-off-by: rapterjet2004 <[email protected]>
Signed-off-by: rapterjet2004 <[email protected]>
Signed-off-by: rapterjet2004 <[email protected]>
Signed-off-by: Marcel Hibbe <[email protected]>
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/5037-talk.apk |
--
MessageDraft
which holds the state of any message draft. Can be easily extended to support things like file URI's, in the future, as it's saved as TEXT in Json format.messageText != ""
upsertConversations
was edited to support syncing data sourced from the server, without overwriting data sourced from the user. We can now store any arbitrary conversation metadata without messing up the sync.TODO
🏁 Checklist
/backport to stable-xx.x