Remove all the stupid code while trying to fix the crash

This commit is contained in:
Kgothatso Ngako
2026-05-02 03:21:47 +02:00
parent dc147255e6
commit fa8855fe1e
4 changed files with 13 additions and 13 deletions

View File

@@ -19,41 +19,41 @@ import kotlinx.coroutines.flow.Flow
interface NostrEventDao {
@Transaction
@Query("SELECT * FROM NostrEvent WHERE kind in (:kinds) ORDER BY createdAt DESC")
fun observeNostrEvents(kinds: Array<Kind>): Flow<List<LocalNostrEvent>?>
fun observeNostrEvents(kinds: Array<Kind>): Flow<List<LocalNostrEvent>>
@Transaction
@Query("SELECT * FROM NostrEvent WHERE content LIKE '%' || :search || '%' AND kind in (:kinds) ORDER BY createdAt DESC")
fun observeFilteredNostrEvents(
kinds: Array<Kind>,
search: String
): Flow<List<LocalNostrEvent>?>
): Flow<List<LocalNostrEvent>>
@Transaction
@Query("SELECT * FROM NostrEvent WHERE kind in (:kinds) AND id in (:ids) ORDER BY createdAt DESC")
fun observeFilteredNostrEvents(
kinds: Array<Kind>,
ids: Array<HexKey>,
): Flow<List<LocalNostrEvent>?>
): Flow<List<LocalNostrEvent>>
@Transaction
@Query("SELECT * FROM NostrEvent WHERE kind in (:kinds) AND pubKey in (:authors) ORDER BY createdAt DESC LIMIT 50")
fun observeAuthoredNostrEvents(
kinds: Array<Kind>,
authors: Array<HexKey>,
): Flow<List<LocalNostrEvent>?>
): Flow<List<LocalNostrEvent>>
@Transaction
@Query("SELECT * FROM NostrEvent WHERE tags LIKE '%' || :publicKey || '%' AND kind in (:kinds) ORDER BY createdAt DESC")
fun observePublicKeyMentionedNostrEvents(
kinds: Array<Kind>,
publicKey: HexKey
): Flow<List<LocalNostrEvent>?>
): Flow<List<LocalNostrEvent>>
@Transaction
@RawQuery
fun observePublicKeyFollowingNostrEvents(
query: RoomRawQuery
): Flow<List<LocalNostrEvent>?>
): Flow<List<LocalNostrEvent>>
@Query("SELECT * FROM NostrEvent WHERE kind in (:kinds) ORDER BY savedAt DESC")
fun getAllNostrEvents(kinds: Array<Kind>): List<NostrEvent>

View File

@@ -61,7 +61,7 @@ data class LocalNostrEvent(
parentColumn = "id",
entityColumn = "mentioningNostrEventId",
)
val mentionedProfiles: List<LocalMention>? = emptyList(),
val mentionedProfiles: List<LocalMention> = emptyList(),
) {
@Composable
fun RenderNotePreview() {

View File

@@ -441,7 +441,7 @@ class DatabaseNostrRepository(
)
}
override suspend fun observeNostrFeed(): Flow<List<LocalNostrEvent>?> {
override suspend fun observeNostrFeed(): Flow<List<LocalNostrEvent>> {
return database.nostrEventDao().observeNostrEvents(
kinds = arrayOf(
TextNoteEvent.KIND,
@@ -452,7 +452,7 @@ class DatabaseNostrRepository(
)
}
override suspend fun observeNostrFeed(synchronizationFilter: SynchronizationFilter): Flow<List<LocalNostrEvent>?> {
override suspend fun observeNostrFeed(synchronizationFilter: SynchronizationFilter): Flow<List<LocalNostrEvent>> {
return when {
synchronizationFilter.kinds != null && synchronizationFilter.search != null -> {

View File

@@ -84,9 +84,9 @@ interface NostrRepository {
suspend fun getNostrEvent(publicKey: HexKey, kind: Kind): NostrEvent?
suspend fun observeNostrFeed(): Flow<List<LocalNostrEvent>?>
suspend fun observeNostrFeed(): Flow<List<LocalNostrEvent>>
suspend fun observeNostrFeed(synchronizationFilter: SynchronizationFilter): Flow<List<LocalNostrEvent>?>
suspend fun observeNostrFeed(synchronizationFilter: SynchronizationFilter): Flow<List<LocalNostrEvent>>
suspend fun observeLocalNostrEventById(nostrEventId: String): Flow<LocalNostrEvent?>
@@ -207,11 +207,11 @@ interface NostrRepository {
TODO("Not yet implemented")
}
override suspend fun observeNostrFeed(): Flow<List<LocalNostrEvent>?> {
override suspend fun observeNostrFeed(): Flow<List<LocalNostrEvent>> {
TODO("Not yet implemented")
}
override suspend fun observeNostrFeed(synchronizationFilter: SynchronizationFilter): Flow<List<LocalNostrEvent>?> {
override suspend fun observeNostrFeed(synchronizationFilter: SynchronizationFilter): Flow<List<LocalNostrEvent>> {
TODO("Not yet implemented")
}