فهرست منبع

wallet: add property Role::Ignored to prevent property triggering update

darkfi 1 سال پیش
والد
کامیت
e12315d64d

+ 2 - 2
bin/darkwallet/src/app/schema/chat.rs

@@ -685,7 +685,7 @@ pub async fn make(
 
     // Create the emoji button
     let node = create_vector_art("emoji_btn_bg");
-    let emoji_btn_is_visible = PropertyBool::wrap(&node, Role::App, "is_visible", 0).unwrap();
+    let emoji_btn_is_visible = PropertyBool::wrap(&node, Role::Ignored, "is_visible", 0).unwrap();
     let prop = node.get_property("rect").unwrap();
     prop.set_f32(Role::App, 0, EMOJI_BTN_X).unwrap();
     let code = cc.compile("h - EMOJI_NEG_Y").unwrap();
@@ -706,7 +706,7 @@ pub async fn make(
     let node = create_vector_art("emoji_close_btn_bg");
     node.set_property_bool(Role::App, "is_visible", false).unwrap();
     let prop = node.get_property("rect").unwrap();
-    let emoji_close_is_visible = PropertyBool::wrap(&node, Role::App, "is_visible", 0).unwrap();
+    let emoji_close_is_visible = PropertyBool::wrap(&node, Role::Ignored, "is_visible", 0).unwrap();
     prop.set_f32(Role::App, 0, EMOJI_BTN_X).unwrap();
     let code = cc.compile("h - EMOJI_NEG_Y").unwrap();
     prop.set_expr(Role::App, 1, code).unwrap();

+ 5 - 1
bin/darkwallet/src/net.rs

@@ -196,7 +196,11 @@ impl ZeroMQAdapter {
                     prop.max_val.encode(&mut reply).unwrap();
                     prop.enum_items.encode(&mut reply).unwrap();
 
-                    let depends: Vec<_> = prop.get_depends().into_iter().map(|d| (d.i as u32, d.local_name)).collect();
+                    let depends: Vec<_> = prop
+                        .get_depends()
+                        .into_iter()
+                        .map(|d| (d.i as u32, d.local_name))
+                        .collect();
                     depends.encode(&mut reply).unwrap();
                 }
             }

+ 2 - 1
bin/darkwallet/src/plugin/darkirc.rs

@@ -182,6 +182,7 @@ impl DarkIrc {
         p2p_settings.app_version = semver::Version::parse("0.5.0").unwrap();
         p2p_settings.seeds.push(url::Url::parse("tcp+tls://lilith1.dark.fi:5262").unwrap());
         p2p_settings.seeds.push(url::Url::parse("tcp+tls://agorism.dev:26661").unwrap());
+        p2p_settings.seeds.push(url::Url::parse("tcp+tls://agorism.dev:26671").unwrap());
         p2p_settings.outbound_connect_timeout = 40;
         p2p_settings.channel_handshake_timeout = 30;
         p2p_settings.p2p_datastore = p2p_datastore_path().into_os_string().into_string().ok();
@@ -240,7 +241,7 @@ impl DarkIrc {
         }
 
         inf!("Waiting for some P2P connections...");
-        sleep(1).await;
+        sleep(4).await;
 
         loop {
             // We'll attempt to sync {sync_attempts} times

+ 1 - 0
bin/darkwallet/src/prop/mod.rs

@@ -79,6 +79,7 @@ pub enum Role {
     User = 0,
     App = 1,
     Internal = 2,
+    Ignored = 3,
 }
 
 #[derive(Debug, Clone)]

+ 2 - 2
bin/darkwallet/src/ui/mod.rs

@@ -149,8 +149,8 @@ impl<T: Send + Sync + 'static> OnModify<T> {
                     return
                 };
 
-                // Skip internal messages from ourselves
-                if idx == 0 && role == Role::Internal {
+                // Skip internal messages from ourselves or explicitly marked ignored
+                if (idx == 0 && role == Role::Internal) || role == Role::Ignored{
                     continue
                 }
                 if let Some(prop_i) = prop_i {

+ 8 - 11
bin/darkwallet/src/ui/vector_art/mod.rs

@@ -93,9 +93,13 @@ impl VectorArt {
         Pimpl::VectorArt(self_)
     }
 
+    fn node_path(&self) -> String {
+        format!("{:?}", self.node.upgrade().unwrap())
+    }
+
     async fn redraw(self: Arc<Self>) {
         let timest = unixtime();
-        debug!(target: "ui::vector_art", "VectorArt::redraw({:?})", self.node.upgrade().unwrap());
+        debug!(target: "ui::vector_art", "VectorArt::redraw({})", self.node_path());
         let Some(parent_rect) = self.parent_rect.lock().unwrap().clone() else { return };
 
         let Some(draw_update) = self.get_draw_calls(parent_rect).await else {
@@ -103,11 +107,11 @@ impl VectorArt {
             return;
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
-        debug!(target: "ui::vector_art", "VectorArt::redraw({:?}) DONE [timest={timest}]", self.node.upgrade().unwrap());
     }
 
     fn get_draw_instrs(&self) -> Vec<GfxDrawInstruction> {
         if !self.is_visible.get() {
+            debug!(target: "ui::vector_art", "Skipping draw for invisible {}", self.node_path());
             return vec![]
         }
 
@@ -128,16 +132,11 @@ impl VectorArt {
     }
 
     async fn get_draw_calls(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
-        //debug!(target: "ui::vector_art", "VectorArt::draw_cached()");
         if let Err(e) = self.rect.eval(&parent_rect) {
             warn!(target: "ui::vector_art", "Rect eval failure: {e}");
             return None
         }
-        let rect = self.rect.get();
-        debug!(target: "ui::vector_art", "VectorArt::get_draw_calls() [rect={rect:?}, dc={}]", self.dc_key);
-
         let instrs = self.get_draw_instrs();
-
         Some(DrawUpdate {
             key: self.dc_key,
             draw_calls: vec![(
@@ -170,11 +169,9 @@ impl UIObject for VectorArt {
     }
 
     async fn draw(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
-        debug!(target: "ui::vector_art", "VectorArt::draw({:?})", self.node.upgrade().unwrap());
+        debug!(target: "ui::vector_art", "VectorArt::draw({})", self.node_path());
         *self.parent_rect.lock().unwrap() = Some(parent_rect);
-        let update = self.get_draw_calls(parent_rect).await;
-        debug!(target: "ui::vector_art", "VectorArt::draw({:?}) DONE", self.node.upgrade().unwrap());
-        update
+        self.get_draw_calls(parent_rect).await
     }
 }
 

+ 1 - 2
src/net/session/outbound_session.rs

@@ -538,10 +538,9 @@ impl PeerDiscoveryBase for PeerDiscovery {
             }
 
             if current_attempt >= 4 {
-                debug!("current attempt: {}", current_attempt);
                 info!(
                     target: "net::outbound_session::peer_discovery()",
-                    "[P2P] [PEER DISCOVERY] Sleeping and trying again..."
+                    "[P2P] [PEER DISCOVERY] Sleeping and trying again. Attempt {current_attempt}"
                 );
 
                 dnetev!(self, OutboundPeerDiscovery, {