In this PR

- Drafts are now saved in between rooms.

Signed-off-by: Julius Linus <julius.linus@nextcloud.com>
This commit is contained in:
Julius Linus 2023-07-31 14:55:29 -05:00 committed by rapterjet2004
parent d0d170f0bc
commit e5afa96e26
2 changed files with 13 additions and 0 deletions

View file

@ -480,6 +480,10 @@ class ChatActivity :
override fun onStart() {
super.onStart()
active = true
context.getSharedPreferences(localClassName, MODE_PRIVATE).apply {
val text = getString(roomToken, "")
binding.messageInputView.messageInput.setText(text)
}
}
override fun onStop() {
@ -495,6 +499,14 @@ class ChatActivity :
if (currentlyPlayedVoiceMessage != null) {
stopMediaPlayer(currentlyPlayedVoiceMessage!!)
}
val text = binding.messageInputView.messageInput.text.toString()
val previous = context.getSharedPreferences(localClassName, MODE_PRIVATE).getString(roomToken, "null")
if (text != previous) {
context.getSharedPreferences(localClassName, MODE_PRIVATE).edit().apply {
putString(roomToken, text)
apply()
}
}
}
@Suppress("LongMethod")

View file

@ -698,5 +698,6 @@ How to translate with transifex:
<string name="nc_settings_socks_value" translatable="false">1080</string>
<string name="this_is_a_test_message">This is a test message</string>
<string name="continuous_voice_message_recording">Lock recording for continuously recording of the voice message</string>
<string name="saved_draft_message">Saved draft message.</string>
</resources>