Fixes the BookmarkScreen update after adding and removing a bookmark to the list

This commit is contained in:
Vitor Pamplona
2024-01-11 10:43:51 -05:00
parent 81400eb863
commit 383d859544
2 changed files with 13 additions and 4 deletions
@@ -454,11 +454,21 @@ class Account(
val liveHiddenUsers = flowHiddenUsers.asLiveData()
val decryptBookmarks: LiveData<BookmarkListEvent> by lazy {
val decryptBookmarks: LiveData<BookmarkListEvent?> by lazy {
userProfile().live().innerBookmarks.switchMap { userState ->
liveData(Dispatchers.IO) {
userState.user.latestBookmarkList?.privateTags(signer) {
scope.launch(Dispatchers.IO) { userState.user.latestBookmarkList?.let { emit(it) } }
if (userState.user.latestBookmarkList == null) {
emit(null)
} else {
emit(
withTimeoutOrNull(1000) {
suspendCancellableCoroutine { continuation ->
userState.user.latestBookmarkList?.privateTags(signer) {
continuation.resume(userState.user.latestBookmarkList)
}
}
},
)
}
}
}
@@ -68,7 +68,6 @@ fun BookmarkListScreen(
privateFeedViewModel.invalidateData()
}
RenderBookmarkScreen(privateFeedViewModel, accountViewModel, nav, publicFeedViewModel)
}