feat: update ui and add compose dialog

This commit is contained in:
reya
2024-07-29 14:49:13 +07:00
parent a65d5d0c1a
commit 6ceac40394
16 changed files with 913 additions and 345 deletions

View File

@@ -141,6 +141,15 @@ pub async fn connect_account(uri: &str, state: State<'_, Nostr>) -> Result<Strin
}
}
#[tauri::command]
#[specta::specta]
pub async fn get_contact_list(state: State<'_, Nostr>) -> Result<Vec<String>, ()> {
let contact_list = state.contact_list.lock().await;
let list = contact_list.clone().into_iter().map(|c| c.public_key.to_hex()).collect::<Vec<_>>();
Ok(list)
}
#[tauri::command]
#[specta::specta]
pub async fn login(
@@ -185,6 +194,11 @@ pub async fn login(
}
}
if let Ok(contacts) = client.get_contact_list(Some(Duration::from_secs(10))).await {
let mut contact_list = state.contact_list.lock().await;
*contact_list = contacts;
};
let inbox = Filter::new().kind(Kind::Custom(10050)).author(public_key).limit(1);
if let Ok(events) = client.get_events_of(vec![inbox], None).await {