diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedViewModel.kt index 7e323cf97..7610d51db 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedViewModel.kt @@ -236,8 +236,8 @@ class NostrBookmarkPrivateFeedViewModel( @Stable class NostrNIP90ContentDiscoveryFeedViewModel( val account: Account, - val dvmkey: String, - val requestid: String, + dvmkey: String, + requestid: String, ) : FeedViewModel(NIP90ContentDiscoveryResponseFilter(account, dvmkey, requestid)) { class Factory( val account: Account, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmContentDiscoveryScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmContentDiscoveryScreen.kt index 71a096e02..9ccdb8d2c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmContentDiscoveryScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmContentDiscoveryScreen.kt @@ -204,11 +204,13 @@ fun ObserverContentDiscoveryResponse( } val latestResponse by resultFlow.collectAsStateWithLifecycle() + val myResponse = latestResponse - if (latestResponse != null) { + if (myResponse != null) { PrepareViewContentDiscoveryModels( noteAuthor, dvmRequestId.idHex, + myResponse, onRefresh, accountViewModel, nav, @@ -236,6 +238,7 @@ fun ObserverDvmStatusResponse( } val latestStatus by statusFlow.collectAsStateWithLifecycle() + // TODO: Make a good splash screen with loading animation for this DVM. if (latestStatus != null) { // TODO: Make a good splash screen with loading animation for this DVM. @@ -252,6 +255,7 @@ fun ObserverDvmStatusResponse( fun PrepareViewContentDiscoveryModels( dvm: User, dvmRequestId: String, + latestResponse: NIP90ContentDiscoveryResponseEvent, onRefresh: () -> Unit, accountViewModel: AccountViewModel, nav: INav, @@ -262,7 +266,7 @@ fun PrepareViewContentDiscoveryModels( factory = NostrNIP90ContentDiscoveryFeedViewModel.Factory(accountViewModel.account, dvmkey = dvm.pubkeyHex, requestid = dvmRequestId), ) - LaunchedEffect(key1 = dvmRequestId) { + LaunchedEffect(key1 = dvmRequestId, latestResponse.id) { resultFeedViewModel.invalidateData() } diff --git a/commons/src/main/java/com/vitorpamplona/amethyst/commons/data/LargeCache.kt b/commons/src/main/java/com/vitorpamplona/amethyst/commons/data/LargeCache.kt index 2df08520b..ed2cbc9d5 100644 --- a/commons/src/main/java/com/vitorpamplona/amethyst/commons/data/LargeCache.kt +++ b/commons/src/main/java/com/vitorpamplona/amethyst/commons/data/LargeCache.kt @@ -307,7 +307,7 @@ class BiMaxOfCollector( v: V, ) { if (filter.filter(k, v)) { - if (maxK == null || comparator.compare(v, maxV) > 1) { + if (maxK == null || comparator.compare(v, maxV) > 0) { maxK = k maxV = v }