Fixing the delay in updating the Note tab on the Profile View

This commit is contained in:
Vitor Pamplona 2023-02-14 20:33:32 -05:00
parent af96f142cd
commit 0277fa7364
2 changed files with 9 additions and 5 deletions

View File

@ -18,7 +18,6 @@ object NostrUserProfileDataSource: NostrDataSource<Note>("UserProfileFeed") {
fun loadUserProfile(userId: String) {
user = LocalCache.getOrCreateUser(userId)
resetFilters()
}
fun createUserInfoFilter(): TypedFilter {

View File

@ -79,16 +79,21 @@ fun ProfileScreen(userId: String?, accountViewModel: AccountViewModel, navContro
if (userId == null) return
NostrUserProfileDataSource.loadUserProfile(userId)
NostrUserProfileFollowersDataSource.loadUserProfile(userId)
NostrUserProfileFollowsDataSource.loadUserProfile(userId)
NostrUserProfileZapsDataSource.loadUserProfile(userId)
val lifeCycleOwner = LocalLifecycleOwner.current
DisposableEffect(accountViewModel) {
val observer = LifecycleEventObserver { source, event ->
if (event == Lifecycle.Event.ON_RESUME) {
println("Profile Start")
NostrUserProfileDataSource.loadUserProfile(userId)
NostrUserProfileFollowersDataSource.loadUserProfile(userId)
NostrUserProfileFollowsDataSource.loadUserProfile(userId)
NostrUserProfileZapsDataSource.loadUserProfile(userId)
NostrUserProfileDataSource.start()
NostrUserProfileFollowersDataSource.start()
NostrUserProfileFollowsDataSource.start()
NostrUserProfileZapsDataSource.start()
}
if (event == Lifecycle.Event.ON_PAUSE) {
println("Profile Stop")