diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/database/dao/NostrEventDao.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/database/dao/NostrEventDao.kt index 9b1dfec8..13970301 100644 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/database/dao/NostrEventDao.kt +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/database/dao/NostrEventDao.kt @@ -9,10 +9,11 @@ import androidx.room.Query import androidx.room.Upsert import com.vitorpamplona.quartz.nip01Core.core.Kind import kotlinx.coroutines.flow.Flow +import kotlin.time.Instant @Dao interface NostrEventDao { - @Query("SELECT * FROM NostrEvent WHERE kind in (:kinds) ORDER BY savedAt DESC") + @Query("SELECT * FROM NostrEvent WHERE kind in (:kinds) ORDER BY createdAt DESC") fun observeNostrEvents(kinds: Array): Flow> @Query("SELECT * FROM NostrEvent WHERE kind in (:kinds) ORDER BY savedAt DESC") diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/database/repository/DatabaseNostrRepository.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/database/repository/DatabaseNostrRepository.kt index e78c55bf..12507d74 100644 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/database/repository/DatabaseNostrRepository.kt +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/database/repository/DatabaseNostrRepository.kt @@ -34,6 +34,7 @@ import kotlinx.coroutines.flow.Flow import kotlin.collections.emptyMap import kotlin.collections.plus import kotlin.time.Clock +import kotlin.time.Duration.Companion.seconds import kotlin.time.Instant class DatabaseNostrRepository( @@ -298,8 +299,11 @@ class DatabaseNostrRepository( } override suspend fun observeNostrFeed(): Flow> { + val thirtySecondsAgo = Clock.System.now().minus(30.seconds) + return database.nostrEventDao().observeNostrEvents( kinds = arrayOf( + MetadataEvent.KIND, TextNoteEvent.KIND, RepostEvent.KIND, LnZapEvent.KIND diff --git a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/widgets/feed/EventListView.kt b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/widgets/feed/EventListView.kt index eaffc2ad..b50592cd 100644 --- a/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/widgets/feed/EventListView.kt +++ b/composeApp/src/commonMain/kotlin/ac/aux/compose/ui/composable/widgets/feed/EventListView.kt @@ -18,7 +18,9 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Person import androidx.compose.material3.AssistChip import androidx.compose.material3.ElevatedCard +import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialShapes import androidx.compose.material3.MaterialTheme import androidx.compose.material3.SuggestionChip import androidx.compose.material3.Surface @@ -100,12 +102,15 @@ fun LocalNostrEvent.ListView( TextNoteFeedItem( nostrEvent = nostrEvent, profile = profile, + taggedAuthor = taggedAuthor, + taggedNostrEvent = taggedNostrEvent, onNavigateToEvent = onNavigateToEvent ) } } } +@OptIn(ExperimentalMaterial3ExpressiveApi::class) @Composable private fun TextNoteFeedItem( nostrEvent: NostrEvent, @@ -115,9 +120,16 @@ private fun TextNoteFeedItem( onNavigateToEvent: (HexKey) -> Unit ) { if (nostrEvent.kind == 1 && taggedNostrEvent != null) { - Row { + Row( + modifier = Modifier.fillMaxWidth().padding( + horizontal = 20.dp + ), + horizontalArrangement = Arrangement.End, + verticalAlignment = Alignment.CenterVertically + ) { Text( - "In reply to" + "In reply to ", + style = MaterialTheme.typography.labelSmall ) Text( @@ -126,6 +138,7 @@ private fun TextNoteFeedItem( onNavigateToEvent.invoke(taggedNostrEvent.id) } ), + style = MaterialTheme.typography.labelLargeEmphasized, text = taggedAuthor?.displayName ?: taggedAuthor?.userName ?: "loading information..." ) }