mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
Merge pull request #4439 from nextcloud/bugfix/noid/fixNpeInRestoreMessageQueue
fix NPE in restoreMessageQueue
This commit is contained in:
commit
9257d41197
@ -411,12 +411,11 @@ class ChatActivity :
|
|||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
setupSystemColors()
|
setupSystemColors()
|
||||||
|
|
||||||
messageInputFragment = MessageInputFragment()
|
|
||||||
|
|
||||||
conversationUser = currentUserProvider.currentUser.blockingGet()
|
conversationUser = currentUserProvider.currentUser.blockingGet()
|
||||||
|
|
||||||
handleIntent(intent)
|
handleIntent(intent)
|
||||||
|
|
||||||
|
messageInputFragment = getMessageInputFragment()
|
||||||
|
|
||||||
chatViewModel = ViewModelProvider(this, viewModelFactory)[ChatViewModel::class.java]
|
chatViewModel = ViewModelProvider(this, viewModelFactory)[ChatViewModel::class.java]
|
||||||
|
|
||||||
messageInputViewModel = ViewModelProvider(this, viewModelFactory)[MessageInputViewModel::class.java]
|
messageInputViewModel = ViewModelProvider(this, viewModelFactory)[MessageInputViewModel::class.java]
|
||||||
@ -457,6 +456,15 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getMessageInputFragment(): MessageInputFragment {
|
||||||
|
val internalId = conversationUser!!.id.toString() + "@" + roomToken
|
||||||
|
return MessageInputFragment().apply {
|
||||||
|
arguments = Bundle().apply {
|
||||||
|
putString(CONVERSATION_INTERNAL_ID, internalId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent) {
|
override fun onNewIntent(intent: Intent) {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
val extras: Bundle? = intent.extras
|
val extras: Bundle? = intent.extras
|
||||||
@ -990,7 +998,7 @@ class ChatActivity :
|
|||||||
} else {
|
} else {
|
||||||
supportFragmentManager.commit {
|
supportFragmentManager.commit {
|
||||||
setReorderingAllowed(true)
|
setReorderingAllowed(true)
|
||||||
replace(R.id.fragment_container_activity_chat, MessageInputFragment())
|
replace(R.id.fragment_container_activity_chat, getMessageInputFragment())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3786,5 +3794,6 @@ class ChatActivity :
|
|||||||
private const val RESUME_AUDIO_TAG = "RESUME_AUDIO_TAG"
|
private const val RESUME_AUDIO_TAG = "RESUME_AUDIO_TAG"
|
||||||
private const val DELAY_TO_SHOW_PROGRESS_BAR = 1000L
|
private const val DELAY_TO_SHOW_PROGRESS_BAR = 1000L
|
||||||
private const val FIVE_MINUTES_IN_SECONDS: Long = 300
|
private const val FIVE_MINUTES_IN_SECONDS: Long = 300
|
||||||
|
const val CONVERSATION_INTERNAL_ID = "CONVERSATION_INTERNAL_ID"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,7 @@ class MessageInputFragment : Fragment() {
|
|||||||
lateinit var networkMonitor: NetworkMonitor
|
lateinit var networkMonitor: NetworkMonitor
|
||||||
|
|
||||||
lateinit var binding: FragmentMessageInputBinding
|
lateinit var binding: FragmentMessageInputBinding
|
||||||
|
private lateinit var conversationInternalId: String
|
||||||
private var typedWhileTypingTimerIsRunning: Boolean = false
|
private var typedWhileTypingTimerIsRunning: Boolean = false
|
||||||
private var typingTimer: CountDownTimer? = null
|
private var typingTimer: CountDownTimer? = null
|
||||||
private lateinit var chatActivity: ChatActivity
|
private lateinit var chatActivity: ChatActivity
|
||||||
@ -122,6 +123,10 @@ class MessageInputFragment : Fragment() {
|
|||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
sharedApplication!!.componentApplication.inject(this)
|
sharedApplication!!.componentApplication.inject(this)
|
||||||
|
conversationInternalId = arguments?.getString(ChatActivity.CONVERSATION_INTERNAL_ID).orEmpty()
|
||||||
|
if (conversationInternalId.isEmpty()) {
|
||||||
|
Log.e(TAG, "internalId for conversation passed to MessageInputFragment is empty")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
@ -143,7 +148,7 @@ class MessageInputFragment : Fragment() {
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
chatActivity.messageInputViewModel.restoreMessageQueue(chatActivity.currentConversation!!.internalId)
|
chatActivity.messageInputViewModel.restoreMessageQueue(conversationInternalId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
@ -728,9 +733,8 @@ class MessageInputFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isTypingStatusEnabled(): Boolean {
|
private fun isTypingStatusEnabled(): Boolean =
|
||||||
return !CapabilitiesUtil.isTypingStatusPrivate(chatActivity.conversationUser!!)
|
!CapabilitiesUtil.isTypingStatusPrivate(chatActivity.conversationUser!!)
|
||||||
}
|
|
||||||
|
|
||||||
private fun uploadFile(fileUri: String, isVoiceMessage: Boolean, caption: String = "", token: String = "") {
|
private fun uploadFile(fileUri: String, isVoiceMessage: Boolean, caption: String = "", token: String = "") {
|
||||||
var metaData = ""
|
var metaData = ""
|
||||||
|
Loading…
Reference in New Issue
Block a user