chore: refactor the global state and improve signer (#56)

* refactor

* update

* .

* rustfmt

* .

* .

* .

* .

* .

* add document

* .

* add logout

* handle error

* chore: update gpui

* adjust timeout
This commit is contained in:
reya
2025-06-07 14:52:21 +07:00
committed by GitHub
parent 50beaebd2c
commit e687204361
73 changed files with 1871 additions and 1504 deletions

View File

@@ -1,6 +1,9 @@
use futures::{channel::oneshot, FutureExt};
use std::marker::PhantomData;
use std::time::Duration;
use futures::channel::oneshot;
use futures::FutureExt;
use gpui::{Context, Task};
use std::{marker::PhantomData, time::Duration};
pub struct DebouncedDelay<E: 'static> {
task: Option<Task<()>>,

View File

@@ -1,8 +1,6 @@
use std::{
collections::HashSet,
hash::{DefaultHasher, Hash, Hasher},
sync::Arc,
};
use std::collections::HashSet;
use std::hash::{DefaultHasher, Hash, Hasher};
use std::sync::Arc;
use global::constants::NIP96_SERVER;
use gpui::{Image, ImageFormat};
@@ -42,11 +40,12 @@ pub fn room_hash(event: &Event) -> u64 {
hasher.finish()
}
pub fn string_to_qr(data: &str) -> Result<Arc<Image>, anyhow::Error> {
let bytes = qrcode_generator::to_png_to_vec_from_str(data, QrCodeEcc::Medium, 256)?;
let img = Arc::new(Image::from_bytes(ImageFormat::Png, bytes));
pub fn string_to_qr(data: &str) -> Option<Arc<Image>> {
let Ok(bytes) = qrcode_generator::to_png_to_vec_from_str(data, QrCodeEcc::Medium, 256) else {
return None;
};
Ok(img)
Some(Arc::new(Image::from_bytes(ImageFormat::Png, bytes)))
}
pub fn compare<T>(a: &[T], b: &[T]) -> bool