update
This commit is contained in:
@@ -477,16 +477,13 @@ impl NostrRegistry {
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
/// Connect the browser extension signer (NIP-07), remembering the choice so
|
||||
/// reloads reconnect automatically
|
||||
/// Connect the browser extension signer (NIP-07).
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub fn connect_extension(&mut self, cx: &mut Context<Self>) {
|
||||
let signer = match BrowserSigner::new() {
|
||||
Ok(signer) => signer,
|
||||
Err(e) => {
|
||||
cx.emit(StateEvent::error(format!(
|
||||
"No Nostr extension found: {e}. Install a NIP-07 extension like Alby or nos2x."
|
||||
)));
|
||||
cx.emit(StateEvent::error(format!("No Nostr extension found: {e}.")));
|
||||
cx.emit(StateEvent::NoSigner);
|
||||
return;
|
||||
}
|
||||
@@ -495,7 +492,6 @@ impl NostrRegistry {
|
||||
self.tasks.push(cx.spawn(async move |this, cx| {
|
||||
match signer.get_public_key_async().await {
|
||||
Ok(public_key) => {
|
||||
// Remember the choice so reloads reconnect automatically
|
||||
this.update(cx, |this, cx| {
|
||||
credentials::write(cx, "extension", b"extension").detach_and_log_err(cx);
|
||||
this.signer.swap_inner(signer);
|
||||
@@ -507,8 +503,6 @@ impl NostrRegistry {
|
||||
})?;
|
||||
}
|
||||
Err(e) => {
|
||||
// Drop the remembered choice so the next visit does not
|
||||
// retry a signer that is no longer answering
|
||||
this.update(cx, |_, cx| {
|
||||
credentials::delete(cx).detach_and_log_err(cx);
|
||||
cx.emit(StateEvent::error(e.to_string()));
|
||||
|
||||
Reference in New Issue
Block a user