Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

safe way to collect flows from android UI #2550

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

MuindiStephen
Copy link

The safest way to collecting flows from UI eg. HomeActivity

repeatOnLifecycle is a suspend function that takes a Lifecycle.State as a parameter which is used to automatically create and launch a new coroutine with the block passed to it when the lifecycle reaches that state, and cancel the ongoing coroutine that’s executing the block when the lifecycle falls below the state

@@ -2,6 +2,7 @@ package org.mifos.mobile.utils

import android.graphics.Bitmap
import org.mifos.mobile.models.client.Client
import org.mifos.mobile.ui.user_profile.UserDetails
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused imports

@@ -10,3 +11,11 @@ sealed class UserDetailUiState {
data class ShowUserDetails(val client: Client) : UserDetailUiState()
data class ShowUserImage(val image: Bitmap?) : UserDetailUiState()
}

Copy link
Author

@MuindiStephen MuindiStephen Mar 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this class, just that its another way to declare ui state

var error: String? = null,
var allUserDetails: List<Client> = listOf()
)
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this unused code block.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this unused code block.

Yes. Looking into that.

@@ -2,6 +2,7 @@ package org.mifos.mobile.utils

import android.graphics.Bitmap
import org.mifos.mobile.models.client.Client
import org.mifos.mobile.ui.user_profile.UserDetails


sealed class UserDetailUiState {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be removed, since unused block of code stmt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants