feat: immersive onboarding (#189)
* feat: change the default onboarding column * feat: add newsfeed onboarding * feat: add topic onboarding * feat: add group onboarding * chore: polish and format * feat: rename foryou to topic * fix: array
This commit is contained in:
@@ -7,12 +7,12 @@
|
||||
"cover": "/newsfeed.png",
|
||||
"coverRetina": "/newsfeed@2x.png",
|
||||
"author": "Lume",
|
||||
"description": "Keep up to date with people you're following."
|
||||
"description": "Keep up to date with the people you're following."
|
||||
},
|
||||
{
|
||||
"label": "rRtguZwIpd5G8Wt54OTb7",
|
||||
"name": "For you",
|
||||
"content": "/foryou",
|
||||
"name": "Topic",
|
||||
"content": "/topic",
|
||||
"logo": "",
|
||||
"cover": "/foryou.png",
|
||||
"coverRetina": "/foryou@2x.png",
|
||||
@@ -21,13 +21,13 @@
|
||||
},
|
||||
{
|
||||
"label": "fve9fk2fVyFWORPBkjd79",
|
||||
"name": "Group Feeds",
|
||||
"name": "Group",
|
||||
"content": "/group",
|
||||
"logo": "",
|
||||
"cover": "/group.png",
|
||||
"coverRetina": "/group@2x.png",
|
||||
"author": "Lume",
|
||||
"description": "Collective of people you're interested in."
|
||||
"description": "Focus feeds for people you like."
|
||||
},
|
||||
{
|
||||
"label": "gxtcIbgD8YNPbeI5o92I8",
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
[
|
||||
{ "label": "onboarding", "name": "Onboarding", "content": "/onboarding" },
|
||||
{ "label": "lume_newsfeed", "name": "Newsfeed", "content": "/newsfeed" },
|
||||
{ "label": "lume_topic", "name": "Topic", "content": "/topic" },
|
||||
{ "label": "lume_group", "name": "Group", "content": "/group" },
|
||||
{ "label": "open", "name": "Open", "content": "/open" }
|
||||
]
|
||||
|
||||
@@ -153,7 +153,8 @@ pub fn open_window(
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
// Create a custom titlebar
|
||||
#[cfg(target_os = "windows")]
|
||||
// Create a custom titlebar for Windows
|
||||
window.create_overlay_titlebar().unwrap();
|
||||
|
||||
// Set a custom inset to the traffic lights
|
||||
|
||||
@@ -26,8 +26,10 @@ pub struct Nostr {
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.setup(|app| {
|
||||
// Create a custom titlebar for main window
|
||||
let main_window = app.get_webview_window("main").unwrap();
|
||||
|
||||
// Create a custom titlebar for Windows
|
||||
#[cfg(target_os = "windows")]
|
||||
main_window.create_overlay_titlebar().unwrap();
|
||||
|
||||
// Set a custom inset to the traffic lights
|
||||
@@ -115,6 +117,7 @@ fn main() {
|
||||
nostr::metadata::get_current_user_profile,
|
||||
nostr::metadata::get_profile,
|
||||
nostr::metadata::get_contact_list,
|
||||
nostr::metadata::set_contact_list,
|
||||
nostr::metadata::create_profile,
|
||||
nostr::metadata::follow,
|
||||
nostr::metadata::unfollow,
|
||||
|
||||
@@ -97,6 +97,7 @@ pub async fn get_events_by(
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_local_events(
|
||||
pubkeys: Vec<String>,
|
||||
limit: usize,
|
||||
until: Option<&str>,
|
||||
state: State<'_, Nostr>,
|
||||
@@ -106,26 +107,21 @@ pub async fn get_local_events(
|
||||
Some(until) => Timestamp::from_str(until).unwrap(),
|
||||
None => Timestamp::now(),
|
||||
};
|
||||
let authors: Vec<PublicKey> = pubkeys
|
||||
.into_iter()
|
||||
.map(|p| PublicKey::from_hex(p).unwrap())
|
||||
.collect();
|
||||
let filter = Filter::new()
|
||||
.kinds(vec![Kind::TextNote, Kind::Repost])
|
||||
.limit(limit)
|
||||
.authors(authors)
|
||||
.until(as_of);
|
||||
|
||||
match client
|
||||
.get_contact_list_public_keys(Some(Duration::from_secs(10)))
|
||||
.get_events_of(vec![filter], Some(Duration::from_secs(8)))
|
||||
.await
|
||||
{
|
||||
Ok(contacts) => {
|
||||
let filter = Filter::new()
|
||||
.kinds(vec![Kind::TextNote, Kind::Repost])
|
||||
.limit(limit)
|
||||
.authors(contacts)
|
||||
.until(as_of);
|
||||
|
||||
match client
|
||||
.get_events_of(vec![filter], Some(Duration::from_secs(8)))
|
||||
.await
|
||||
{
|
||||
Ok(events) => Ok(events),
|
||||
Err(err) => Err(err.to_string()),
|
||||
}
|
||||
}
|
||||
Ok(events) => Ok(events),
|
||||
Err(err) => Err(err.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,19 +182,38 @@ pub async fn get_profile(id: &str, state: State<'_, Nostr>) -> Result<Metadata,
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn set_contact_list(pubkeys: Vec<&str>, state: State<'_, Nostr>) -> Result<bool, String> {
|
||||
let client = &state.client;
|
||||
let contact_list: Vec<Contact> = pubkeys
|
||||
.into_iter()
|
||||
.map(|p| Contact::new(PublicKey::from_hex(p).unwrap(), None, Some("")))
|
||||
.collect();
|
||||
|
||||
match client.set_contact_list(contact_list).await {
|
||||
Ok(_) => Ok(true),
|
||||
Err(err) => Err(err.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_contact_list(state: State<'_, Nostr>) -> Result<Vec<String>, String> {
|
||||
let client = &state.client;
|
||||
|
||||
if let Ok(contact_list) = client.get_contact_list(Some(Duration::from_secs(10))).await {
|
||||
let list = contact_list
|
||||
.into_iter()
|
||||
.map(|f| f.public_key.to_hex())
|
||||
.collect();
|
||||
match client.get_contact_list(Some(Duration::from_secs(10))).await {
|
||||
Ok(contact_list) => {
|
||||
if !contact_list.is_empty() {
|
||||
let list = contact_list
|
||||
.into_iter()
|
||||
.map(|f| f.public_key.to_hex())
|
||||
.collect();
|
||||
|
||||
Ok(list)
|
||||
} else {
|
||||
Err("Contact list not found".into())
|
||||
Ok(list)
|
||||
} else {
|
||||
Err("Empty.".into())
|
||||
}
|
||||
}
|
||||
Err(err) => Err(err.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user