Now loading messages from archive when ChatActivity is visible again and when load messages added set of last message

This commit is contained in:
ChronosX88 2019-05-26 13:06:40 +04:00
parent 2f454ec05f
commit 18bce5605f
2 changed files with 5 additions and 2 deletions

View File

@ -179,6 +179,7 @@ class ChatPresenter(private val view: CoreContracts.IChatViewContract, private v
chatEntity.firstMessageUid = query.mamResultExtensions[0].id chatEntity.firstMessageUid = query.mamResultExtensions[0].id
LocalDBWrapper.updateChatEntity(chatEntity) LocalDBWrapper.updateChatEntity(chatEntity)
} }
EventBus.getDefault().post(LastMessageEvent(chatID, GenericMessage(LocalDBWrapper.getLastMessage(chatID))))
} }
} }
} }

View File

@ -69,7 +69,6 @@ class ChatActivity : AppCompatActivity(), CoreContracts.IChatViewContract {
presenter = ChatPresenter(this, intent.getStringExtra("chatID")) presenter = ChatPresenter(this, intent.getStringExtra("chatID"))
loadAvatarFromIntent(intent) loadAvatarFromIntent(intent)
presenter!!.loadLocalMessages() presenter!!.loadLocalMessages()
presenter!!.loadRecentPageMessages()
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
@ -119,5 +118,8 @@ class ChatActivity : AppCompatActivity(), CoreContracts.IChatViewContract {
return true return true
} }
override fun onResume() {
super.onResume()
presenter!!.loadRecentPageMessages()
}
} }