Преглед изворни кода

wallet: cleanup dir a little bit

darkfi пре 1 година
родитељ
комит
495713e4b6

+ 3 - 1
bin/darkwallet/Cargo.toml

@@ -57,6 +57,8 @@ parking_lot = { version = "0.12", features = ["nightly"] }
 [features]
 emulate-android = []
 enable-plugins = []
+# Network debugging. Should be disabled in release.
+enable-netdebug = []
 
 [patch.crates-io]
 # We can remove these patches. But unfortunately harfbuzz-sys is still linking
@@ -97,7 +99,7 @@ workspace = true
 [package.metadata.android]
 package_name = "darkfi.darkwallet"
 label = "DarkWallet"
-res = "res"
+res = "data/res"
 icon = "@mipmap/ic_launcher"
 assets = "assets"
 

+ 1 - 0
bin/darkwallet/Makefile

@@ -13,6 +13,7 @@ SRC = \
 
 #FEATURES = --features=emulate-android
 #FEATURES = --features=enable-plugins
+FEATURES = --features=enable-netdebug
 
 all: $(SRC) fonts
 	# You can either install cargo-limit or just s/lbuild/build

+ 0 - 4
bin/darkwallet/client.py

@@ -1,4 +0,0 @@
-#!/usr/bin/python
-import gui
-gui.main()
-

+ 0 - 0
bin/darkwallet/chat.txt → bin/darkwallet/data/chat.txt


+ 0 - 0
bin/darkwallet/res/mipmap-hdpi/ic_launcher.png → bin/darkwallet/data/res/mipmap-hdpi/ic_launcher.png


+ 0 - 0
bin/darkwallet/res/mipmap-mdpi/ic_launcher.png → bin/darkwallet/data/res/mipmap-mdpi/ic_launcher.png


+ 0 - 0
bin/darkwallet/res/mipmap-xhdpi/ic_launcher.png → bin/darkwallet/data/res/mipmap-xhdpi/ic_launcher.png


+ 0 - 0
bin/darkwallet/res/mipmap-xxhdpi/ic_launcher.png → bin/darkwallet/data/res/mipmap-xxhdpi/ic_launcher.png


+ 0 - 0
bin/darkwallet/res/mipmap-xxxhdpi/ic_launcher.png → bin/darkwallet/data/res/mipmap-xxxhdpi/ic_launcher.png


+ 0 - 19
bin/darkwallet/insert_line.py

@@ -1,19 +0,0 @@
-#!/usr/bin/python
-from gui import *
-import os, time
-
-def send(timest, nick, msg):
-    arg_data = bytearray()
-    serial.write_u64(arg_data, timest)
-    arg_data += os.urandom(32)
-    serial.encode_str(arg_data, nick)
-    serial.encode_str(arg_data, msg)
-
-    api.call_method("/window/view/chatty", "insert_line", arg_data)
-
-for i in range(200):
-    name = f"bob-{i}"
-    send(1732944640000 + i*60000, "hhi12", f"hello {name}")
-    #time.sleep(0.4)
-    #input("> ")
-

+ 1 - 1
bin/darkwallet/src/app/mod.rs

@@ -384,7 +384,7 @@ impl Drop for App {
 
 // Just for testing
 fn populate_tree(tree: &sled::Tree) {
-    let chat_txt = include_str!("../../chat.txt");
+    let chat_txt = include_str!("../../data/chat.txt");
     for line in chat_txt.lines() {
         let parts: Vec<&str> = line.splitn(3, ' ').collect();
         assert_eq!(parts.len(), 3);

+ 9 - 7
bin/darkwallet/src/main.rs

@@ -116,13 +116,15 @@ fn main() {
     let async_runtime = app::AsyncRuntime::new(ex.clone());
     async_runtime.start();
 
-    let sg_root2 = sg_root.clone();
-    let ex2 = ex.clone();
-    let zmq_task = ex.spawn(async {
-        let zmq_rpc = ZeroMQAdapter::new(sg_root2, ex2).await;
-        zmq_rpc.run().await;
-    });
-    async_runtime.push_task(zmq_task);
+    if cfg!(features = "enable-netdebug") {
+        let sg_root2 = sg_root.clone();
+        let ex2 = ex.clone();
+        let zmq_task = ex.spawn(async {
+            let zmq_rpc = ZeroMQAdapter::new(sg_root2, ex2).await;
+            zmq_rpc.run().await;
+        });
+        async_runtime.push_task(zmq_task);
+    }
 
     let (method_req, method_rep) = mpsc::channel();
     // The UI actually needs to be running for this to reply back.