From b74fa975ba0c3ccb28162b3e3e3aea02478071d7 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Thu, 16 May 2024 14:24:13 +0200 Subject: [PATCH] Show DVM Status Limitation: This will only show the first reply from the DVM, if mutliple status updates follow they will be ignored. --- .../loggedIn/NIP90ContentDiscoveryScreen.kt | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/NIP90ContentDiscoveryScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/NIP90ContentDiscoveryScreen.kt index 66a40016f..d2b42e677 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/NIP90ContentDiscoveryScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/NIP90ContentDiscoveryScreen.kt @@ -122,26 +122,27 @@ fun RenderNostrNIP90ContentDiscoveryScreen( thread.join() } - // TODO 2 Get the latest event from the statusFeedViewModel - // TODO How do we extract the latest event.content (or event.status) from statusFeedViewModel - // TODO We want to update dvmStatus with the content of the latest Status event + // TODO this shows the status but there might be a better way var dvmStatus = "DVM is processing..." + val thread = + Thread { + println(dvmStatus) + while (resultFeedViewModel.localFilter.feed().isEmpty()) { + try { + if (statusFeedViewModel.localFilter.feed().isNotEmpty()) { + statusFeedViewModel.localFilter.feed()[0].event?.let { dvmStatus = it.content() } + println(dvmStatus) + break + } else { + } + } catch (e: Exception) { + e.printStackTrace() + } + } + } - /* if (statusFeedViewModel.localFilter.feed().isNotEmpty()) { - statusFeedViewModel.localFilter.feed()[0].event?.let { Text(text = it.content()) } - } else { - Text(text = "Nah") - } - - DVMStatusView( - statusFeedViewModel, - null, - enablePullRefresh = false, - accountViewModel = accountViewModel, - nav = nav, - )*/ - - // Text(text = dvminfo) + thread.start() + thread.join() HorizontalPager(state = pagerState) { RefresheableBox(resultFeedViewModel, false) {