forked from reya/coop-mobile
chore: re-structure project (#31)
Reviewed-on: https://git.reya.su/reya/coop-mobile/pulls/31
This commit is contained in:
@@ -20,6 +20,8 @@ import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.launch
|
||||
import su.reya.coop.nostr.NostrManager
|
||||
import su.reya.coop.nostr.roomId
|
||||
import java.io.File
|
||||
|
||||
private const val GROUP_KEY_MESSAGES = "su.reya.coop.MESSAGES"
|
||||
@@ -65,17 +67,17 @@ class NostrForegroundService : Service() {
|
||||
} catch (e: Exception) {
|
||||
throw IllegalStateException("Failed to initialize Nostr Client", e)
|
||||
}
|
||||
|
||||
|
||||
// Connect to bootstrap relays
|
||||
nostr.connectBootstrapRelays()
|
||||
|
||||
// Handle notifications
|
||||
nostr.handleNotifications(
|
||||
onMetadataUpdate = { pubkey, metadata ->
|
||||
serviceScope.launch { nostr.emitMetadataUpdate(pubkey, metadata) }
|
||||
serviceScope.launch { nostr.profiles.emitMetadataUpdate(pubkey, metadata) }
|
||||
},
|
||||
onContactListUpdate = { contacts ->
|
||||
serviceScope.launch { nostr.emitContactListUpdate(contacts) }
|
||||
serviceScope.launch { nostr.profiles.emitContactListUpdate(contacts) }
|
||||
},
|
||||
onNewMessage = { event ->
|
||||
serviceScope.launch {
|
||||
|
||||
Reference in New Issue
Block a user