chore: improve performance (#41)

Reviewed-on: https://git.reya.su/reya/coop-mobile/pulls/41
This commit is contained in:
2026-07-11 12:45:53 +00:00
parent 175c06a1a8
commit a5951e03cf
34 changed files with 1236 additions and 913 deletions
@@ -29,16 +29,14 @@ class UniversalSigner(initialSigner: AsyncNostrSigner) : AsyncNostrSigner {
/**
* Switch to a new signer.
*/
suspend fun switch(newSigner: AsyncNostrSigner) = mutex.withLock {
val pubkey = try {
withTimeoutOrNull(20.seconds) {
newSigner.getPublicKeyAsync()
}
} catch (e: Exception) {
throw IllegalStateException("Failed to get public key from signer", e)
suspend fun switch(newSigner: AsyncNostrSigner) {
val pubkey = withTimeoutOrNull(20.seconds) { newSigner.getPublicKeyAsync() }
?: throw IllegalStateException("Failed to get public key from signer")
mutex.withLock {
signer = newSigner
_publicKeyFlow.value = pubkey
}
signer = newSigner
_publicKeyFlow.value = pubkey
}
override suspend fun getPublicKeyAsync(): PublicKey? {