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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user