forked from janek/mostr
fix(main): fetch task kinds before updates
This commit is contained in:
parent
c64a1fa051
commit
0296556bcd
2 changed files with 11 additions and 4 deletions
|
@ -9,10 +9,12 @@ pub const METADATA_KIND: u16 = 0;
|
||||||
pub const NOTE_KIND: u16 = 1;
|
pub const NOTE_KIND: u16 = 1;
|
||||||
pub const TASK_KIND: u16 = 1621;
|
pub const TASK_KIND: u16 = 1621;
|
||||||
pub const TRACKING_KIND: u16 = 1650;
|
pub const TRACKING_KIND: u16 = 1650;
|
||||||
pub const KINDS: [u16; 9] = [
|
pub const KINDS: [u16; 3] = [
|
||||||
METADATA_KIND,
|
METADATA_KIND,
|
||||||
NOTE_KIND,
|
NOTE_KIND,
|
||||||
TASK_KIND,
|
TASK_KIND,
|
||||||
|
];
|
||||||
|
pub const PROP_KINDS: [u16; 6] = [
|
||||||
TRACKING_KIND,
|
TRACKING_KIND,
|
||||||
State::Open as u16,
|
State::Open as u16,
|
||||||
State::Done as u16,
|
State::Done as u16,
|
||||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -23,7 +23,7 @@ use regex::Regex;
|
||||||
use xdg::BaseDirectories;
|
use xdg::BaseDirectories;
|
||||||
|
|
||||||
use crate::helpers::*;
|
use crate::helpers::*;
|
||||||
use crate::kinds::{KINDS, PROPERTY_COLUMNS, TRACKING_KIND};
|
use crate::kinds::{KINDS, PROP_KINDS, PROPERTY_COLUMNS, TRACKING_KIND};
|
||||||
use crate::task::{MARKER_DEPENDS, MARKER_PARENT, State};
|
use crate::task::{MARKER_DEPENDS, MARKER_PARENT, State};
|
||||||
use crate::tasks::{PropertyCollection, StateFilter, Tasks};
|
use crate::tasks::{PropertyCollection, StateFilter, Tasks};
|
||||||
|
|
||||||
|
@ -180,14 +180,19 @@ async fn main() {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
let sub_id = client.subscribe(vec![
|
let sub1 = client.subscribe(vec![
|
||||||
Filter::new().kinds(KINDS.into_iter().map(|k| Kind::from(k)))
|
Filter::new().kinds(KINDS.into_iter().map(|k| Kind::from(k)))
|
||||||
], None).await;
|
], None).await;
|
||||||
info!("Subscribed with {:?}", sub_id);
|
info!("Subscribed to tasks with {:?}", sub1);
|
||||||
|
|
||||||
let mut notifications = client.notifications();
|
let mut notifications = client.notifications();
|
||||||
client.connect().await;
|
client.connect().await;
|
||||||
|
|
||||||
|
let sub2 = client.subscribe(vec![
|
||||||
|
Filter::new().kinds(PROP_KINDS.into_iter().map(|k| Kind::from(k)))
|
||||||
|
], None).await;
|
||||||
|
info!("Subscribed to updates with {:?}", sub2);
|
||||||
|
|
||||||
let (tx, rx) = mpsc::channel::<MostrMessage>();
|
let (tx, rx) = mpsc::channel::<MostrMessage>();
|
||||||
let tasks_for_url = |url: Option<Url>| Tasks::from(url, &tx, &keys);
|
let tasks_for_url = |url: Option<Url>| Tasks::from(url, &tx, &keys);
|
||||||
let mut relays: HashMap<Url, Tasks> =
|
let mut relays: HashMap<Url, Tasks> =
|
||||||
|
|
Loading…
Add table
Reference in a new issue