diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalNostrEvent.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalNostrEvent.kt index 30070925..8f1dcfce 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalNostrEvent.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalNostrEvent.kt @@ -42,21 +42,22 @@ data class LocalNostrEvent( val repostedRelation: RepostedRelation? = null, @Relation( + entity = QuotedRelation::class, parentColumn = "id", entityColumn = "quotingNostrEventId" ) - val quotedRelation: QuotedRelation? = null, + val localQuotedNostrEvent: LocalQuotedNostrEvent? = null, - @Relation( - parentColumn = "id", - entityColumn = "id", - associateBy = Junction( - value = QuotedRelation::class, - parentColumn = "quotingNostrEventId", - entityColumn = "quotedNostrEventId" - ) - ) - val quotedNostrEvent: NostrEvent? = null, +// @Relation( +// parentColumn = "id", +// entityColumn = "id", +// associateBy = Junction( +// value = QuotedRelation::class, +// parentColumn = "quotingNostrEventId", +// entityColumn = "quotedNostrEventId" +// ) +// ) +// val quotedNostrEvent: NostrEvent? = null, @Relation( parentColumn = "id", diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalQuotedNostrEvent.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalQuotedNostrEvent.kt index fba50a49..4d7b8d83 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalQuotedNostrEvent.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/database/model/intermdiate/LocalQuotedNostrEvent.kt @@ -1,11 +1,8 @@ package ac.cord.auxiliary.compose.database.model.intermdiate -import ac.cord.auxiliary.compose.database.model.InReplyToRelation -import ac.cord.auxiliary.compose.database.model.Mention import ac.cord.auxiliary.compose.database.model.NostrEvent import ac.cord.auxiliary.compose.database.model.Profile import ac.cord.auxiliary.compose.database.model.QuotedRelation -import ac.cord.auxiliary.compose.database.model.RepostedRelation import ac.cord.auxiliary.compose.extensions.toFormattedTimeAndDateString import ac.cord.auxiliary.compose.ui.composable.widgets.profile.ProfileAvatar import androidx.compose.foundation.layout.Arrangement @@ -22,24 +19,29 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.room.Embedded -import androidx.room.Junction import androidx.room.Relation data class LocalQuotedNostrEvent( - @Embedded val nostrEvent: NostrEvent, + @Embedded val quotedRelation: QuotedRelation, @Relation( - parentColumn = "pubKey", + parentColumn = "quotedNostrEventId", + entityColumn = "id" + ) + val nostrEvent: NostrEvent, + + @Relation( + parentColumn = "quotedProfilePublicKey", entityColumn = "publicKey" ) val profile: Profile?, - @Relation( - entity = Mention::class, - parentColumn = "id", - entityColumn = "nostrEventId", - ) - val mentionedProfiles: List = emptyList(), +// @Relation( +// entity = Mention::class, +// parentColumn = "id", +// entityColumn = "nostrEventId", +// ) +// val mentionedProfiles: List = emptyList(), ) { @Composable fun RenderNotePreview() { @@ -72,6 +74,8 @@ data class LocalQuotedNostrEvent( } } } + + // TODO: Use RichContent... Text( modifier = Modifier.fillMaxWidth().padding( horizontal = 20.dp diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/QuotedAddressableNote.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/QuotedAddressableNote.kt index 6b624ff0..f5f9a98e 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/QuotedAddressableNote.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/QuotedAddressableNote.kt @@ -40,9 +40,9 @@ internal fun QuotedAddressableNote( // } // } - if (localNostrEvent?.quotedRelation != null) { + if (localNostrEvent?.localQuotedNostrEvent != null) { QuotedNote( - quotedNostrEvent = localNostrEvent.quotedRelation, + localQuotedNostrEvent = localNostrEvent.localQuotedNostrEvent, onNoteClick = onNoteClick, noteActions = noteActions ) diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/QuotedNote.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/QuotedNote.kt index 767aee31..2a6aabd6 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/QuotedNote.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/QuotedNote.kt @@ -1,8 +1,8 @@ package ac.cord.auxiliary.compose.ui.composable.widgets.content -import ac.cord.auxiliary.compose.database.model.NostrEvent import ac.cord.auxiliary.compose.database.model.Profile import ac.cord.auxiliary.compose.database.model.QuotedRelation +import ac.cord.auxiliary.compose.database.model.intermdiate.LocalQuotedNostrEvent import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Row @@ -23,7 +23,7 @@ import androidx.compose.ui.unit.dp @Composable fun QuotedNote( - quotedNostrEvent: QuotedRelation? = null, + localQuotedNostrEvent: LocalQuotedNostrEvent? = null, quotedProfile: Profile? = null, relayHints: List = emptyList(), onNoteClick: ((String) -> Unit)? = null, @@ -50,7 +50,7 @@ fun QuotedNote( // } // } - if (quotedNostrEvent != null && noteActions != null) { + if (localQuotedNostrEvent != null && noteActions != null) { // Full rendering with all interactive features Surface( @@ -61,10 +61,10 @@ fun QuotedNote( .fillMaxWidth() .padding(vertical = 6.dp) ) { - Text("Quote render coming soon") + localQuotedNostrEvent.RenderNotePreview() // quotedNostrEvent.RenderNotePreview() } - } else if (quotedNostrEvent != null) { + } else if (localQuotedNostrEvent != null) { // Simple fallback rendering (no noteActions available) Surface( shape = RoundedCornerShape(12.dp), @@ -74,12 +74,11 @@ fun QuotedNote( .fillMaxWidth() .padding(vertical = 6.dp) .then( - if (effectiveNoteClick != null) Modifier.clickable { effectiveNoteClick(quotedNostrEvent.quotedNostrEventId) } + if (effectiveNoteClick != null) Modifier.clickable { effectiveNoteClick(localQuotedNostrEvent.nostrEvent.id) } else Modifier ) ) { - Text("Quote render coming soon") -// quotedPost.RenderNotePreview() + localQuotedNostrEvent.RenderNotePreview() } } else { // Loading state diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/RichContent.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/RichContent.kt index 051db797..258fbeab 100644 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/RichContent.kt +++ b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/content/RichContent.kt @@ -275,9 +275,9 @@ fun RichContent( LinkPreview(url = segment.url) } is ContentSegment.NostrNoteSegment -> { - if (localNostrEvent.quotedRelation != null) { + if (localNostrEvent.localQuotedNostrEvent != null) { QuotedNote( - quotedNostrEvent = localNostrEvent.quotedRelation, + localQuotedNostrEvent = localNostrEvent.localQuotedNostrEvent, relayHints = segment.relayHints, onNoteClick = onNoteClick, noteActions = noteActions diff --git a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/feed/Dummy.kt b/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/feed/Dummy.kt deleted file mode 100644 index c391a5a2..00000000 --- a/composeApp/src/commonMain/kotlin/ac/cord/auxiliary/compose/ui/composable/widgets/feed/Dummy.kt +++ /dev/null @@ -1,2 +0,0 @@ -package ac.cord.auxiliary.compose.ui.composable.widgets.feed -