Brings notifications back

This commit is contained in:
Vitor Pamplona
2023-10-27 13:58:26 -04:00
parent 116bb19bc6
commit 92a39c4305
2 changed files with 9 additions and 2 deletions
@@ -2142,9 +2142,13 @@ class Account(
}
fun createAuthEvent(relay: Relay, challenge: String): RelayAuthEvent? {
return createAuthEvent(relay.url, challenge)
}
fun createAuthEvent(relayUrl: String, challenge: String): RelayAuthEvent? {
if (!isWriteable() && !loginWithExternalSigner) return null
var event = RelayAuthEvent.create(relay.url, challenge, keyPair.pubKey.toHexKey(), keyPair.privKey)
var event = RelayAuthEvent.create(relayUrl, challenge, keyPair.pubKey.toHexKey(), keyPair.privKey)
if (loginWithExternalSigner) {
ExternalSignerUtils.openSigner(event)
val eventContent = ExternalSignerUtils.content[event.id] ?: ""
@@ -28,7 +28,10 @@ class RegisterAccounts(
if (acc.loginWithExternalSigner) {
ExternalSignerUtils.account = acc
}
val relayToUse = acc.activeRelays()?.firstOrNull { it.read }
val readRelays = acc.userProfile().latestContactList?.relays() ?: acc.backupContactList?.relays()
val relayToUse = readRelays?.firstNotNullOfOrNull { if (it.value.read) it.key else null }
if (relayToUse != null) {
acc.createAuthEvent(relayToUse, notificationToken)
} else {