Skip to content

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rapterjet2004
Copy link
Contributor

@rapterjet2004 rapterjet2004 commented Jun 5, 2025

TODO

  • Make it not shown for all conversations 😢

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

@rapterjet2004 rapterjet2004 self-assigned this Jun 5, 2025
@rapterjet2004 rapterjet2004 added the 2. developing Work in progress label Jun 5, 2025
@rapterjet2004 rapterjet2004 added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jun 10, 2025
mahibi

This comment was marked as resolved.

Copy link
Contributor

Codacy

Lint

TypemasterPR
Warnings10099
Errors1010

SpotBugs

SpotBugs increased!

Copy link
Contributor

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/5037-talk.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud Talk app.

@rapterjet2004 rapterjet2004 requested a review from mahibi June 17, 2025 17:03
@rapterjet2004
Copy link
Contributor Author

rapterjet2004 commented Jun 17, 2025

I figured it would be simpler to clear the reply state when exiting ChatActivity. That way the reply view remains upon orientation change but is removed when exiting to ConversationListActivity.

@mahibi
Copy link
Collaborator

mahibi commented Jun 18, 2025

I figured it would be simpler to clear the reply state when exiting ChatActivity. That way the reply view remains upon orientation change but is removed when exiting to ConversationListActivity.

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 isDraft to a chat message is an option, while making use of the parent value.
Maybe @Ivansss or @SystemKeeper could give an insight how you handle message drafts on iOS? Do you use the DB table as for the other messages?

@@ -295,11 +311,20 @@ class MessageInputFragment : Fragment() {

private fun restoreState() {
if (binding.fragmentMessageInputView.inputEditText.text.isEmpty()) {
Log.d("Julius", "State restored from: ${chatActivity.localClassName}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove

@SystemKeeper
Copy link

Maybe @Ivansss or @SystemKeeper could give an insight how you handle message drafts on iOS? Do you use the DB table as for the other messages?

Pretty simple right now, there's a column pendingMessage on the room table where we store the conversations. On leaving a room, we save pending messages, on entering we restore, on sending we leave basically. Currently we don't keep replies, but that is something that bothers me for a while already...

@rapterjet2004 rapterjet2004 changed the title Allow replies to maintain state on orientation change Refactor drafts to save both Messages & Replies to Room Storage Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Screen rotation with quoted message
3 participants