Commit 9ebc290e authored by Hussein's avatar Hussein

P4A-881 - Fix Coroutine flow/Scopes

parent 4f9110b3
......@@ -35,7 +35,7 @@ buildscript {
'butterKnife' : '7.0.1',
'callygraphy' : '2.1.0',
'circleImageView' : '2.1.0',
'renderers' : '3.2.0',
'renderers' : '3.5.0',
'acra' : '4.6.1',
'appIntro' : '4.1.0',
'swipeLayout' : '1.2.0',
......@@ -47,7 +47,7 @@ buildscript {
'dagger' : '2.4',
'groupie' : '2.1.0',
'ankoCoroutines' : '0.10.4',
'kotlinCoroutines' : '1.2.1',
'kotlinCoroutines' : '1.3.3',
'multidex' : '2.0.0',
......
......@@ -20,6 +20,7 @@ class FolderRenderer : Renderer<FolderModel>() {
lateinit var folderNewMessages: TextView
private lateinit var onFolderClickListener: OnFolderClickListener
override fun setUpView(rootView: View) {
}
......@@ -40,7 +41,7 @@ class FolderRenderer : Renderer<FolderModel>() {
folderName.text =
FolderInfoHolder.getDisplayName(context, content.account, content.localFolder.name)
try {
val uiScope = CoroutineScope(Dispatchers.IO + SupervisorJob())
val uiScope = CoroutineScope(Dispatchers.Main + SupervisorJob())
uiScope.launch {
val unreadMessageCount = getUnreadMessageCount()
......@@ -56,7 +57,7 @@ class FolderRenderer : Renderer<FolderModel>() {
content.localFolder.unreadMessageCount
}
private suspend fun renderUnreadMessages(unreadMessageCount: Int) = withContext(Dispatchers.Main) {
private fun renderUnreadMessages(unreadMessageCount: Int) {
when {
unreadMessageCount == 0 -> {
folderNewMessages.visibility = View.VISIBLE
......@@ -70,7 +71,7 @@ class FolderRenderer : Renderer<FolderModel>() {
this.onFolderClickListener = onFolderClickListener
}
internal fun onFolderClicked() {
private fun onFolderClicked() {
onFolderClickListener.onClick(content.localFolder)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment