Merge pull request #3224 from nextcloud/issue-1918-chat-message-draft

Message drafts are now saved
This commit is contained in:
Andy Scherzinger 2023-08-01 18:24:58 +02:00 committed by GitHub
commit 1f6ced7c65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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>