Bugfix on startup profile loading
This commit is contained in:
1 parent
c47751ad55
commit
91b9c14992
8 files changed
+146
-101
No files matched your search
+6
-1
@@ -5,6 +5,7 @@ import androidx.room3.Insert
|
||||
import androidx.room3.Query
|
||||
import androidx.room3.Transaction
|
||||
import androidx.room3.Upsert
|
||||
import at.torch.compose.database.model.intermdiate.LocalAccount
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
@@ -26,7 +27,11 @@ interface UnsignedNostrEventDao {
|
||||
|
||||
@Transaction
|
||||
@Query("SELECT * FROM UnsignedNostrEvent WHERE kind = 0 AND pubKey = :publicKey")
|
||||
fun observeProfile(publicKey: String): Flow<at.torch.compose.database.model.intermdiate.LocalAccount?>
|
||||
fun observeProfile(publicKey: String): Flow<LocalAccount?>
|
||||
|
||||
@Transaction
|
||||
@Query("SELECT * FROM UnsignedNostrEvent WHERE kind = 0")
|
||||
fun getLocalAccounts(): List<LocalAccount>
|
||||
|
||||
@Query("SELECT * FROM UnsignedNostrEvent WHERE pubKey = :publicKey AND signedAt IS NULL")
|
||||
fun observeUnsignedNostrEvents(publicKey: String): Flow<at.torch.compose.database.model.UnsignedNostrEvent?>
|
||||
|
||||
+5
-1
@@ -1,7 +1,7 @@
|
||||
package at.torch.compose.database.repository
|
||||
|
||||
import at.torch.compose.database.model.Profile
|
||||
import at.torch.compose.database.model.UnsignedNostrEvent
|
||||
import at.torch.compose.database.model.intermdiate.LocalAccount
|
||||
import at.torch.compose.nostr.Relays
|
||||
import co.touchlab.kermit.Logger
|
||||
import com.vitorpamplona.quartz.marmot.mip00KeyPackages.KeyPackageEvent
|
||||
@@ -72,6 +72,10 @@ class DatabaseNostrRepository(
|
||||
|
||||
val logger = Logger.withTag(TAG)
|
||||
|
||||
override suspend fun getLocalAccounts(): List<LocalAccount> {
|
||||
return database.unsignedNostrEventDao().getLocalAccounts()
|
||||
}
|
||||
|
||||
override suspend fun observeProfile(publicKey: HexKey): Flow<at.torch.compose.database.model.intermdiate.LocalAccount?> {
|
||||
return database.unsignedNostrEventDao().observeProfile(publicKey)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user