add nostr foreground service

This commit is contained in:
2026-05-18 12:34:46 +07:00
parent 955da2fea6
commit 1c85e26e7f
7 changed files with 189 additions and 24 deletions
@@ -131,14 +131,11 @@ class NostrViewModel(
_metadataStore.getOrPut(pubkey) { MutableStateFlow(null) }.value = metadata
}
suspend fun initAndConnect(dbPath: String) {
suspend fun login() {
try {
// Initialize nostr client
nostr.init(dbPath)
// Get user's secret
getUserSecret()
} catch (e: Exception) {
showError("Failed to initialize Nostr: ${e.message}")
showError("Failed to login: ${e.message}")
}
}
@@ -151,7 +148,7 @@ class NostrViewModel(
onContactListUpdate = { contactList ->
_contactList.value = contactList.toSet()
},
onEose = {
onSubscriptionClose = {
getChatRooms()
},
onNewMessage = { event ->