Minor bug fixes
This commit is contained in:
@@ -330,6 +330,7 @@ abstract class NostrDao(
|
||||
}
|
||||
|
||||
nostrEvent.toProfile()?.let { profile ->
|
||||
logger.d("Profile: $profile")
|
||||
database.profileDao().upsert(profile)
|
||||
}
|
||||
|
||||
|
||||
@@ -111,8 +111,11 @@ class DatabaseNostrRepository(
|
||||
override suspend fun createNewProfile(
|
||||
publicKey: HexKey,
|
||||
name: String?,
|
||||
biography: String?
|
||||
biography: String?,
|
||||
onCompletion: suspend () -> Unit
|
||||
) {
|
||||
logger.d("createNewProfile: $publicKey")
|
||||
|
||||
val profileEventTemplate = MetadataEvent.createNew(
|
||||
name = name,
|
||||
about = biography,
|
||||
@@ -202,6 +205,8 @@ class DatabaseNostrRepository(
|
||||
)
|
||||
|
||||
saveUnsignedNostrEvents(unsignedNostrEvents)
|
||||
|
||||
onCompletion.invoke()
|
||||
}
|
||||
|
||||
override suspend fun signInToProfile(
|
||||
@@ -356,7 +361,6 @@ class DatabaseNostrRepository(
|
||||
|
||||
override suspend fun saveUnsignedNostrEvents(unsignedNostrEvents: List<UnsignedNostrEvent>) {
|
||||
logger.d("saveUnsignedNostrEvents: $unsignedNostrEvents")
|
||||
delay(2_100)
|
||||
|
||||
database.unsignedNostrEventDao().insert(
|
||||
unsignedNostrEvents
|
||||
|
||||
@@ -45,7 +45,8 @@ interface NostrRepository {
|
||||
suspend fun createNewProfile(
|
||||
publicKey: HexKey,
|
||||
name: String?,
|
||||
biography: String?
|
||||
biography: String?,
|
||||
onCompletion: suspend () -> Unit
|
||||
)
|
||||
|
||||
suspend fun signInToProfile(
|
||||
@@ -190,7 +191,8 @@ interface NostrRepository {
|
||||
override suspend fun createNewProfile(
|
||||
publicKey: HexKey,
|
||||
name: String?,
|
||||
biography: String?
|
||||
biography: String?,
|
||||
onCompletion: suspend () -> Unit
|
||||
) {
|
||||
TODO("")
|
||||
}
|
||||
|
||||
@@ -24,7 +24,9 @@ import fr.acinq.phoenix.utils.MnemonicLanguage
|
||||
import kotlinx.coroutines.CoroutineExceptionHandler
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.IO
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
class CreateProfileViewModel(
|
||||
val initialCreateProfileUIState: CreateProfileUIState,
|
||||
@@ -106,15 +108,19 @@ class CreateProfileViewModel(
|
||||
|
||||
val pubkey = localKeyManager.nostrPublicKey()
|
||||
|
||||
logger.d("Pubkey: $pubkey" )
|
||||
nostrRepository.createNewProfile(
|
||||
pubkey,
|
||||
name = createProfileFormState.nameField.textFieldState.text.toString(),
|
||||
biography = createProfileFormState.biographyField.textFieldState.text.toString()
|
||||
)
|
||||
biography = createProfileFormState.biographyField.textFieldState.text.toString(),
|
||||
onCompletion = {
|
||||
logger.d("Created: $pubkey" )
|
||||
|
||||
marmotRepository.publishMarmotKeyPackageBundle(
|
||||
publicKey = pubkey,
|
||||
nsecPassword = localKeyManager.nsecPassword()
|
||||
marmotRepository.publishMarmotKeyPackageBundle(
|
||||
publicKey = pubkey,
|
||||
nsecPassword = localKeyManager.nsecPassword()
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.launch
|
||||
import press.mantra.compose.database.model.NostrEvent
|
||||
import kotlin.time.Instant
|
||||
|
||||
class NotaryViewModel(
|
||||
@@ -99,7 +100,7 @@ class NotaryViewModel(
|
||||
|
||||
nostrRepository.publishNostrEvent(
|
||||
unsignedNostrEvent,
|
||||
_root_ide_package_.press.mantra.compose.database.model.NostrEvent(
|
||||
NostrEvent(
|
||||
id = event.id,
|
||||
pubKey = event.pubKey,
|
||||
kind = event.kind,
|
||||
|
||||
@@ -53,7 +53,7 @@ class ShareProfileViewModel(
|
||||
|
||||
fun rebroadcastProfile(localNostrEvent: LocalNostrEvent) {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
// Rebroadcast
|
||||
// Rebroadcast localNostrEvent and relays
|
||||
nostrRepository.rescheduleBroadcastNostrEventRequests(
|
||||
Relays.eventFinderRelaySet.map {
|
||||
BroadcastNostrEventRequest(
|
||||
|
||||
Reference in New Issue
Block a user