Compare commits
112 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
04f5725a9d
|
|||
|
59199d8197
|
|||
|
e6a27a53fe
|
|||
| 8138a0a1ca | |||
| 2444e24fb5 | |||
| fc509b1b26 | |||
| 1fd92e9e00 | |||
| 382ef772f5 | |||
| 53b4a8da5c | |||
| cb72592f4b | |||
| c60e1af3eb | |||
| 87cb5ed515 | |||
| 9cbba37507 | |||
| b94e715539 | |||
| d12f66e5cd | |||
| e8be471608 | |||
| 97d15e41e7 | |||
| ea5c876da6 | |||
| 75eefcbf72 | |||
| 54b86ee5a6 | |||
| f6c44bba8a | |||
| 3451206f1a | |||
| 0770bab37c | |||
| 48a11b9bab | |||
| 603de6bbab | |||
| 571bf35109 | |||
| 0dda26791a | |||
| 7e73ed2760 | |||
| 2fb9470ee6 | |||
| af2c556700 | |||
| 27df33dc83 | |||
| 2edc19fbcc | |||
| edf0e2498b | |||
| ad35547582 | |||
| 24f70930eb | |||
| 5b1bc442d4 | |||
| 391abe817d | |||
| 30eb2e0258 | |||
| 21fe3527a8 | |||
| 249e166a95 | |||
| 3f9d030046 | |||
|
fa13884908
|
|||
|
f8ae0825c4
|
|||
| 26ece3bc05 | |||
| a64ff3b630 | |||
| ab84304265 | |||
| 6a08d4b1b2 | |||
| d6d7e4c35e | |||
| c3499729f2 | |||
| dac786e60f | |||
| 41aa2db3c7 | |||
| 10225158e5 | |||
| 557608db9b | |||
| 8697a5cb0a | |||
| 7aca39aae8 | |||
| aa467b9be0 | |||
| 09eeb57bd9 | |||
| b1a5dd6cab | |||
| d12e5b363c | |||
| cc8bafddff | |||
| 3766308ce6 | |||
| 17f72f6127 | |||
| f592015c0c | |||
| 1ab4eeb48c | |||
| a8c6baeacb | |||
| a896a6ecfa | |||
| f282363748 | |||
| ba76b20ad2 | |||
| b04f50a9f6 | |||
| 233be47659 | |||
| 173972f920 | |||
| 31ec21ea02 | |||
| d3d8d7be4b | |||
| 09dc101c1b | |||
| 261477339b | |||
| 9ff5753bca | |||
| b9e2fe5dd1 | |||
| d1a9e0020e | |||
| 1163dd8461 | |||
| 692f4889cf | |||
| f2153f53dc | |||
| 40764d7368 | |||
| be720c0f76 | |||
| 5848f1c355 | |||
| 0dcf70bc15 | |||
| 0fc8e70180 | |||
| 2de6851fbd | |||
| f57d582307 | |||
| 09e608ca75 | |||
| 2bd636ce0a | |||
| 79bf6cf126 | |||
| b8207106d7 | |||
| 5280028a82 | |||
| f4a6e8f9bb | |||
| 83fd6de076 | |||
| b80a0ab0f1 | |||
| e437a0db1c | |||
| 6e81b98d2f | |||
| 217f1e45da | |||
| 96e0366787 | |||
| 2a85ee562c | |||
| 1fabd347ca | |||
| 0087fe7dff | |||
| 51f7744149 | |||
| 6d393c9c37 | |||
| 5c8ab0ce07 | |||
| 590ffa0680 | |||
| 3d18db8fd2 | |||
| 661acb3a12 | |||
| 8306003f6f | |||
| f2e01f0e40 | |||
| 0f00dcf7a7 |
@@ -18,4 +18,7 @@ export OLLAMA_HOST=http://ollama.jb55.com
|
||||
|
||||
# simple todo reminders
|
||||
export TODO_FILE=TODO
|
||||
|
||||
export RUST_LOG="egui=debug,egui-winit=debug,notedeck=debug,notedeck_columns=debug,notedeck_chrome=debug,enostr=debug,android_activity=debug,lnsocket=trace,notedeck_clndash=debug"
|
||||
|
||||
2>/dev/null todo.sh ls || :
|
||||
|
||||
+3
-1
@@ -20,4 +20,6 @@ queries/damus-notifs.json
|
||||
scripts/macos_build_secrets.sh
|
||||
/tags
|
||||
.zed
|
||||
.lsp
|
||||
.lsp
|
||||
.idea
|
||||
local.properties
|
||||
Generated
+299
-69
@@ -765,6 +765,25 @@ dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-sys"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae85a0696e7ea3b835a453750bf002770776609115e6d25c6d2ff28a8200f7e7"
|
||||
dependencies = [
|
||||
"objc-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block2"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e58aa60e59d8dbfcc36138f5f18be5f24394d33b38b24f7fd0b1caa33095f22f"
|
||||
dependencies = [
|
||||
"block-sys",
|
||||
"objc2 0.5.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block2"
|
||||
version = "0.5.1"
|
||||
@@ -989,6 +1008,7 @@ dependencies = [
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
"serde",
|
||||
"wasm-bindgen",
|
||||
"windows-link",
|
||||
]
|
||||
@@ -1244,6 +1264,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e"
|
||||
dependencies = [
|
||||
"powerfmt",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1389,20 +1410,26 @@ version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76"
|
||||
|
||||
[[package]]
|
||||
name = "dyn-clone"
|
||||
version = "1.0.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
|
||||
|
||||
[[package]]
|
||||
name = "ecolor"
|
||||
version = "0.31.1"
|
||||
source = "git+https://github.com/damus-io/egui?rev=041d4d18b16cf8be97e0d7ef5892c87436352dfc#041d4d18b16cf8be97e0d7ef5892c87436352dfc"
|
||||
source = "git+https://github.com/damus-io/egui?rev=a67ab901e197ce13948ff7d00aa6e07e31a68ccd#a67ab901e197ce13948ff7d00aa6e07e31a68ccd"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"emath 0.31.1 (git+https://github.com/damus-io/egui?rev=041d4d18b16cf8be97e0d7ef5892c87436352dfc)",
|
||||
"emath 0.31.1 (git+https://github.com/damus-io/egui?rev=a67ab901e197ce13948ff7d00aa6e07e31a68ccd)",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "eframe"
|
||||
version = "0.31.1"
|
||||
source = "git+https://github.com/damus-io/egui?rev=041d4d18b16cf8be97e0d7ef5892c87436352dfc#041d4d18b16cf8be97e0d7ef5892c87436352dfc"
|
||||
source = "git+https://github.com/damus-io/egui?rev=a67ab901e197ce13948ff7d00aa6e07e31a68ccd#a67ab901e197ce13948ff7d00aa6e07e31a68ccd"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
@@ -1438,24 +1465,25 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui"
|
||||
version = "0.31.1"
|
||||
source = "git+https://github.com/damus-io/egui?rev=041d4d18b16cf8be97e0d7ef5892c87436352dfc#041d4d18b16cf8be97e0d7ef5892c87436352dfc"
|
||||
source = "git+https://github.com/damus-io/egui?rev=a67ab901e197ce13948ff7d00aa6e07e31a68ccd#a67ab901e197ce13948ff7d00aa6e07e31a68ccd"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"ahash",
|
||||
"backtrace",
|
||||
"bitflags 2.9.1",
|
||||
"emath 0.31.1 (git+https://github.com/damus-io/egui?rev=041d4d18b16cf8be97e0d7ef5892c87436352dfc)",
|
||||
"emath 0.31.1 (git+https://github.com/damus-io/egui?rev=a67ab901e197ce13948ff7d00aa6e07e31a68ccd)",
|
||||
"epaint",
|
||||
"log",
|
||||
"nohash-hasher",
|
||||
"profiling",
|
||||
"serde",
|
||||
"similar",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "egui-wgpu"
|
||||
version = "0.31.1"
|
||||
source = "git+https://github.com/damus-io/egui?rev=041d4d18b16cf8be97e0d7ef5892c87436352dfc#041d4d18b16cf8be97e0d7ef5892c87436352dfc"
|
||||
source = "git+https://github.com/damus-io/egui?rev=a67ab901e197ce13948ff7d00aa6e07e31a68ccd#a67ab901e197ce13948ff7d00aa6e07e31a68ccd"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
@@ -1474,7 +1502,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui-winit"
|
||||
version = "0.31.1"
|
||||
source = "git+https://github.com/damus-io/egui?rev=041d4d18b16cf8be97e0d7ef5892c87436352dfc#041d4d18b16cf8be97e0d7ef5892c87436352dfc"
|
||||
source = "git+https://github.com/damus-io/egui?rev=a67ab901e197ce13948ff7d00aa6e07e31a68ccd#a67ab901e197ce13948ff7d00aa6e07e31a68ccd"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"arboard",
|
||||
@@ -1492,7 +1520,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui_extras"
|
||||
version = "0.31.1"
|
||||
source = "git+https://github.com/damus-io/egui?rev=041d4d18b16cf8be97e0d7ef5892c87436352dfc#041d4d18b16cf8be97e0d7ef5892c87436352dfc"
|
||||
source = "git+https://github.com/damus-io/egui?rev=a67ab901e197ce13948ff7d00aa6e07e31a68ccd#a67ab901e197ce13948ff7d00aa6e07e31a68ccd"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"egui",
|
||||
@@ -1509,7 +1537,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui_glow"
|
||||
version = "0.31.1"
|
||||
source = "git+https://github.com/damus-io/egui?rev=041d4d18b16cf8be97e0d7ef5892c87436352dfc#041d4d18b16cf8be97e0d7ef5892c87436352dfc"
|
||||
source = "git+https://github.com/damus-io/egui?rev=a67ab901e197ce13948ff7d00aa6e07e31a68ccd#a67ab901e197ce13948ff7d00aa6e07e31a68ccd"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
@@ -1526,7 +1554,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui_nav"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/damus-io/egui-nav?rev=3c67eb6298edbff36d46546897cfac33df4f04db#3c67eb6298edbff36d46546897cfac33df4f04db"
|
||||
source = "git+https://github.com/damus-io/egui-nav?rev=de6e2d51892478fdd516df166f866e64dedbae07#de6e2d51892478fdd516df166f866e64dedbae07"
|
||||
dependencies = [
|
||||
"egui",
|
||||
"egui_extras",
|
||||
@@ -1588,7 +1616,7 @@ checksum = "9e4cadcff7a5353ba72b7fea76bf2122b5ebdbc68e8155aa56dfdea90083fe1b"
|
||||
[[package]]
|
||||
name = "emath"
|
||||
version = "0.31.1"
|
||||
source = "git+https://github.com/damus-io/egui?rev=041d4d18b16cf8be97e0d7ef5892c87436352dfc#041d4d18b16cf8be97e0d7ef5892c87436352dfc"
|
||||
source = "git+https://github.com/damus-io/egui?rev=a67ab901e197ce13948ff7d00aa6e07e31a68ccd#a67ab901e197ce13948ff7d00aa6e07e31a68ccd"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"serde",
|
||||
@@ -1606,7 +1634,7 @@ version = "0.3.0"
|
||||
dependencies = [
|
||||
"bech32",
|
||||
"ewebsock",
|
||||
"hashbrown",
|
||||
"hashbrown 0.15.4",
|
||||
"hex",
|
||||
"mio",
|
||||
"nostr 0.37.0",
|
||||
@@ -1686,13 +1714,13 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "epaint"
|
||||
version = "0.31.1"
|
||||
source = "git+https://github.com/damus-io/egui?rev=041d4d18b16cf8be97e0d7ef5892c87436352dfc#041d4d18b16cf8be97e0d7ef5892c87436352dfc"
|
||||
source = "git+https://github.com/damus-io/egui?rev=a67ab901e197ce13948ff7d00aa6e07e31a68ccd#a67ab901e197ce13948ff7d00aa6e07e31a68ccd"
|
||||
dependencies = [
|
||||
"ab_glyph",
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
"ecolor",
|
||||
"emath 0.31.1 (git+https://github.com/damus-io/egui?rev=041d4d18b16cf8be97e0d7ef5892c87436352dfc)",
|
||||
"emath 0.31.1 (git+https://github.com/damus-io/egui?rev=a67ab901e197ce13948ff7d00aa6e07e31a68ccd)",
|
||||
"epaint_default_fonts",
|
||||
"log",
|
||||
"nohash-hasher",
|
||||
@@ -1704,7 +1732,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "epaint_default_fonts"
|
||||
version = "0.31.1"
|
||||
source = "git+https://github.com/damus-io/egui?rev=041d4d18b16cf8be97e0d7ef5892c87436352dfc#041d4d18b16cf8be97e0d7ef5892c87436352dfc"
|
||||
source = "git+https://github.com/damus-io/egui?rev=a67ab901e197ce13948ff7d00aa6e07e31a68ccd#a67ab901e197ce13948ff7d00aa6e07e31a68ccd"
|
||||
|
||||
[[package]]
|
||||
name = "equator"
|
||||
@@ -2280,7 +2308,7 @@ checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"gpu-descriptor-types",
|
||||
"hashbrown",
|
||||
"hashbrown 0.15.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2302,6 +2330,18 @@ dependencies = [
|
||||
"crunchy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.4"
|
||||
@@ -2346,6 +2386,17 @@ dependencies = [
|
||||
"arrayvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hex_color"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d37f101bf4c633f7ca2e4b5e136050314503dd198e78e325ea602c327c484ef0"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hex_lit"
|
||||
version = "0.1.1"
|
||||
@@ -2507,6 +2558,16 @@ dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "icrate"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fb69199826926eb864697bddd27f73d9fddcffc004f5733131e15b465e30642"
|
||||
dependencies = [
|
||||
"block2 0.4.0",
|
||||
"objc2 0.5.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "icu_collections"
|
||||
version = "2.0.0"
|
||||
@@ -2665,6 +2726,17 @@ version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown 0.12.3",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.9.0"
|
||||
@@ -2672,7 +2744,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
"hashbrown 0.15.4",
|
||||
"serde",
|
||||
]
|
||||
|
||||
@@ -2744,25 +2816,6 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-docker"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-wsl"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5"
|
||||
dependencies = [
|
||||
"is-docker",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.5"
|
||||
@@ -2879,6 +2932,19 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jsoncanvas"
|
||||
version = "0.1.6"
|
||||
source = "git+https://github.com/jb55/jsoncanvas?rev=ae60f96e4d022cf037e086b793cacc3225bc14e5#ae60f96e4d022cf037e086b793cacc3225bc14e5"
|
||||
dependencies = [
|
||||
"hex_color",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"thiserror 1.0.69",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "khronos-egl"
|
||||
version = "6.0.0"
|
||||
@@ -3004,6 +3070,22 @@ version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
|
||||
|
||||
[[package]]
|
||||
name = "lnsocket"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a373bcde8b65d6db11a0cd0f70dd4a24af854dd7a112b0a51258593c65f48ff"
|
||||
dependencies = [
|
||||
"bitcoin",
|
||||
"hashbrown 0.13.2",
|
||||
"hex",
|
||||
"lightning-types",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.13"
|
||||
@@ -3201,7 +3283,7 @@ dependencies = [
|
||||
"cfg_aliases",
|
||||
"codespan-reporting",
|
||||
"hexf-parse",
|
||||
"indexmap",
|
||||
"indexmap 2.9.0",
|
||||
"log",
|
||||
"rustc-hash 1.1.0",
|
||||
"spirv",
|
||||
@@ -3418,21 +3500,25 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "notedeck"
|
||||
version = "0.5.8"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"base32",
|
||||
"bech32",
|
||||
"bincode",
|
||||
"bitflags 2.9.1",
|
||||
"blurhash",
|
||||
"chrono",
|
||||
"dirs",
|
||||
"eframe",
|
||||
"egui",
|
||||
"egui-winit",
|
||||
"egui_extras",
|
||||
"ehttp",
|
||||
"enostr",
|
||||
"fluent",
|
||||
"fluent-langneg",
|
||||
"fluent-resmgr",
|
||||
"hashbrown",
|
||||
"hashbrown 0.15.4",
|
||||
"hex",
|
||||
"image",
|
||||
"jni 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -3466,8 +3552,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "notedeck_chrome"
|
||||
version = "0.5.8"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"eframe",
|
||||
"egui",
|
||||
"egui-winit",
|
||||
@@ -3475,8 +3562,10 @@ dependencies = [
|
||||
"egui_tabs",
|
||||
"nostrdb",
|
||||
"notedeck",
|
||||
"notedeck_clndash",
|
||||
"notedeck_columns",
|
||||
"notedeck_dave",
|
||||
"notedeck_notebook",
|
||||
"notedeck_ui",
|
||||
"profiling",
|
||||
"puffin",
|
||||
@@ -3493,9 +3582,23 @@ dependencies = [
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notedeck_clndash"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"eframe",
|
||||
"egui",
|
||||
"lnsocket",
|
||||
"notedeck",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notedeck_columns"
|
||||
version = "0.5.8"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bech32",
|
||||
@@ -3510,16 +3613,15 @@ dependencies = [
|
||||
"egui_virtual_list",
|
||||
"ehttp",
|
||||
"enostr",
|
||||
"hashbrown",
|
||||
"hashbrown 0.15.4",
|
||||
"hex",
|
||||
"human_format",
|
||||
"image",
|
||||
"indexmap",
|
||||
"indexmap 2.9.0",
|
||||
"nostrdb",
|
||||
"notedeck",
|
||||
"notedeck_ui",
|
||||
"oot_bitset",
|
||||
"open",
|
||||
"opener",
|
||||
"poll-promise",
|
||||
"pretty_assertions",
|
||||
@@ -3528,6 +3630,7 @@ dependencies = [
|
||||
"puffin_egui",
|
||||
"rfd",
|
||||
"rmpv",
|
||||
"robius-open",
|
||||
"security-framework 2.11.1",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
@@ -3549,7 +3652,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "notedeck_dave"
|
||||
version = "0.5.8"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"async-openai",
|
||||
"bytemuck",
|
||||
@@ -3557,6 +3660,7 @@ dependencies = [
|
||||
"eframe",
|
||||
"egui",
|
||||
"egui-wgpu",
|
||||
"egui_extras",
|
||||
"enostr",
|
||||
"futures",
|
||||
"hex",
|
||||
@@ -3571,19 +3675,27 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notedeck_notebook"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"egui",
|
||||
"jsoncanvas",
|
||||
"notedeck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notedeck_ui"
|
||||
version = "0.5.8"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"blurhash",
|
||||
"eframe",
|
||||
"egui",
|
||||
"egui-winit",
|
||||
"egui_extras",
|
||||
"ehttp",
|
||||
"enostr",
|
||||
"hashbrown",
|
||||
"hashbrown 0.15.4",
|
||||
"image",
|
||||
"nostrdb",
|
||||
"notedeck",
|
||||
@@ -4012,17 +4124,6 @@ version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
|
||||
|
||||
[[package]]
|
||||
name = "open"
|
||||
version = "5.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2483562e62ea94312f3576a7aca397306df7990b8d89033e18766744377ef95"
|
||||
dependencies = [
|
||||
"is-wsl",
|
||||
"libc",
|
||||
"pathdiff",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "opener"
|
||||
version = "0.8.2"
|
||||
@@ -4135,12 +4236,6 @@ version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||
|
||||
[[package]]
|
||||
name = "pathdiff"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
|
||||
|
||||
[[package]]
|
||||
name = "pbkdf2"
|
||||
version = "0.12.2"
|
||||
@@ -4429,7 +4524,7 @@ source = "git+https://github.com/jb55/puffin?rev=c6a6242adaf90b6292c0f462d2acd34
|
||||
dependencies = [
|
||||
"egui",
|
||||
"egui_extras",
|
||||
"indexmap",
|
||||
"indexmap 2.9.0",
|
||||
"natord",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
@@ -4757,6 +4852,26 @@ dependencies = [
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ref-cast"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf"
|
||||
dependencies = [
|
||||
"ref-cast-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ref-cast-impl"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.11.1"
|
||||
@@ -4948,6 +5063,30 @@ dependencies = [
|
||||
"rmp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "robius-android-env"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "087fcb3061ccc432658a605cb868edd44e0efb08e7a159b486f02804a7616bef"
|
||||
dependencies = [
|
||||
"jni 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ndk-context",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "robius-open"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "243e2abbc8c1ca8ddc283056d4675b67e452fd527c3741c5318642da37840ff3"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"icrate",
|
||||
"jni 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"objc2 0.5.2",
|
||||
"robius-android-env",
|
||||
"windows 0.54.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "roxmltree"
|
||||
version = "0.19.0"
|
||||
@@ -5094,6 +5233,30 @@ dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schemars"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f"
|
||||
dependencies = [
|
||||
"dyn-clone",
|
||||
"ref-cast",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schemars"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0"
|
||||
dependencies = [
|
||||
"dyn-clone",
|
||||
"ref-cast",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scoped-tls"
|
||||
version = "1.0.1"
|
||||
@@ -5247,7 +5410,7 @@ version = "1.0.140"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"indexmap 2.9.0",
|
||||
"itoa",
|
||||
"memchr",
|
||||
"ryu",
|
||||
@@ -5286,6 +5449,38 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_with"
|
||||
version = "3.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"chrono",
|
||||
"hex",
|
||||
"indexmap 1.9.3",
|
||||
"indexmap 2.9.0",
|
||||
"schemars 0.9.0",
|
||||
"schemars 1.0.4",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"serde_with_macros",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_with_macros"
|
||||
version = "3.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de90945e6565ce0d9a25098082ed4ee4002e047cb59892c318d66821e14bb30f"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.104",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1"
|
||||
version = "0.10.6"
|
||||
@@ -5347,6 +5542,12 @@ dependencies = [
|
||||
"quote",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "similar"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
|
||||
|
||||
[[package]]
|
||||
name = "simplecss"
|
||||
version = "0.2.2"
|
||||
@@ -5880,7 +6081,7 @@ version = "0.22.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"indexmap 2.9.0",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
@@ -6663,7 +6864,7 @@ dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"cfg_aliases",
|
||||
"document-features",
|
||||
"indexmap",
|
||||
"indexmap 2.9.0",
|
||||
"log",
|
||||
"naga",
|
||||
"once_cell",
|
||||
@@ -6784,6 +6985,16 @@ dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.54.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49"
|
||||
dependencies = [
|
||||
"windows-core 0.54.0",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.58.0"
|
||||
@@ -6803,6 +7014,16 @@ dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.54.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65"
|
||||
dependencies = [
|
||||
"windows-result 0.1.2",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.58.0"
|
||||
@@ -6879,6 +7100,15 @@ version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.2.0"
|
||||
|
||||
+17
-10
@@ -1,18 +1,21 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
package.version = "0.5.8"
|
||||
package.version = "0.6.0"
|
||||
members = [
|
||||
"crates/notedeck",
|
||||
"crates/notedeck_chrome",
|
||||
"crates/notedeck_columns",
|
||||
"crates/notedeck_dave",
|
||||
"crates/notedeck_notebook",
|
||||
"crates/notedeck_ui",
|
||||
"crates/notedeck_clndash",
|
||||
|
||||
"crates/enostr", "crates/tokenator", "crates/notedeck_dave", "crates/notedeck_ui",
|
||||
"crates/enostr", "crates/tokenator", "crates/notedeck_dave", "crates/notedeck_ui", "crates/notedeck_clndash",
|
||||
]
|
||||
|
||||
[workspace.dependencies]
|
||||
opener = "0.8.2"
|
||||
chrono = "0.4.40"
|
||||
base32 = "0.4.0"
|
||||
base64 = "0.22.1"
|
||||
rmpv = "1.3.0"
|
||||
@@ -24,7 +27,7 @@ egui = { version = "0.31.1", features = ["serde"] }
|
||||
egui-wgpu = "0.31.1"
|
||||
egui_extras = { version = "0.31.1", features = ["all_loaders"] }
|
||||
egui-winit = { version = "0.31.1", features = ["android-game-activity", "clipboard"] }
|
||||
egui_nav = { git = "https://github.com/damus-io/egui-nav", rev = "3c67eb6298edbff36d46546897cfac33df4f04db" }
|
||||
egui_nav = { git = "https://github.com/damus-io/egui-nav", rev = "de6e2d51892478fdd516df166f866e64dedbae07" }
|
||||
egui_tabs = { git = "https://github.com/damus-io/egui-tabs", rev = "6eb91740577b374a8a6658c09c9a4181299734d0" }
|
||||
#egui_virtual_list = "0.6.0"
|
||||
egui_virtual_list = { git = "https://github.com/jb55/hello_egui", rev = "a66b6794f5e707a2f4109633770e02b02fb722e1" }
|
||||
@@ -46,12 +49,14 @@ nostrdb = { git = "https://github.com/damus-io/nostrdb-rs", rev = "2b2e5e43c019b
|
||||
#nostrdb = "0.6.1"
|
||||
notedeck = { path = "crates/notedeck" }
|
||||
notedeck_chrome = { path = "crates/notedeck_chrome" }
|
||||
notedeck_clndash = { path = "crates/notedeck_clndash" }
|
||||
notedeck_columns = { path = "crates/notedeck_columns" }
|
||||
notedeck_dave = { path = "crates/notedeck_dave" }
|
||||
notedeck_notebook = { path = "crates/notedeck_notebook" }
|
||||
notedeck_ui = { path = "crates/notedeck_ui" }
|
||||
tokenator = { path = "crates/tokenator" }
|
||||
once_cell = "1.19.0"
|
||||
open = "5.3.0"
|
||||
robius-open = "0.1"
|
||||
poll-promise = { version = "0.3.0", features = ["tokio"] }
|
||||
puffin = { git = "https://github.com/jb55/puffin", package = "puffin", rev = "c6a6242adaf90b6292c0f462d2acd34d96d224d2" }
|
||||
puffin_egui = { git = "https://github.com/jb55/puffin", package = "puffin_egui", rev = "c6a6242adaf90b6292c0f462d2acd34d96d224d2" }
|
||||
@@ -82,6 +87,8 @@ hashbrown = "0.15.2"
|
||||
openai-api-rs = "6.0.3"
|
||||
re_memory = "0.23.4"
|
||||
oot_bitset = "0.1.1"
|
||||
blurhash = "0.2.3"
|
||||
|
||||
|
||||
[profile.small]
|
||||
inherits = 'release'
|
||||
@@ -99,12 +106,12 @@ strip = true # Strip symbols from binary*
|
||||
#egui_extras = { path = "/home/jb55/dev/github/emilk/egui/crates/egui_extras" }
|
||||
#epaint = { path = "/home/jb55/dev/github/emilk/egui/crates/epaint" }
|
||||
|
||||
egui = { git = "https://github.com/damus-io/egui", rev = "041d4d18b16cf8be97e0d7ef5892c87436352dfc" }
|
||||
eframe = { git = "https://github.com/damus-io/egui", rev = "041d4d18b16cf8be97e0d7ef5892c87436352dfc" }
|
||||
egui-winit = { git = "https://github.com/damus-io/egui", rev = "041d4d18b16cf8be97e0d7ef5892c87436352dfc" }
|
||||
egui-wgpu = { git = "https://github.com/damus-io/egui", rev = "041d4d18b16cf8be97e0d7ef5892c87436352dfc" }
|
||||
egui_extras = { git = "https://github.com/damus-io/egui", rev = "041d4d18b16cf8be97e0d7ef5892c87436352dfc" }
|
||||
epaint = { git = "https://github.com/damus-io/egui", rev = "041d4d18b16cf8be97e0d7ef5892c87436352dfc" }
|
||||
egui = { git = "https://github.com/damus-io/egui", rev = "a67ab901e197ce13948ff7d00aa6e07e31a68ccd" }
|
||||
eframe = { git = "https://github.com/damus-io/egui", rev = "a67ab901e197ce13948ff7d00aa6e07e31a68ccd" }
|
||||
egui-winit = { git = "https://github.com/damus-io/egui", rev = "a67ab901e197ce13948ff7d00aa6e07e31a68ccd" }
|
||||
egui-wgpu = { git = "https://github.com/damus-io/egui", rev = "a67ab901e197ce13948ff7d00aa6e07e31a68ccd" }
|
||||
egui_extras = { git = "https://github.com/damus-io/egui", rev = "a67ab901e197ce13948ff7d00aa6e07e31a68ccd" }
|
||||
epaint = { git = "https://github.com/damus-io/egui", rev = "a67ab901e197ce13948ff7d00aa6e07e31a68ccd" }
|
||||
puffin = { git = "https://github.com/jb55/puffin", package = "puffin", rev = "c6a6242adaf90b6292c0f462d2acd34d96d224d2" }
|
||||
puffin_egui = { git = "https://github.com/jb55/puffin", package = "puffin_egui", rev = "c6a6242adaf90b6292c0f462d2acd34d96d224d2" }
|
||||
#winit = { git = "https://github.com/damus-io/winit", rev = "14d61a74bee0c9863abe7ef28efae2c4d8bd3743" }
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="256mm"
|
||||
height="256mm"
|
||||
viewBox="0 0 256 256"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
||||
sodipodi:docname="clnlogo.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:zoom="1.078823"
|
||||
inkscape:cx="396.72867"
|
||||
inkscape:cy="561.25984"
|
||||
inkscape:window-width="2020"
|
||||
inkscape:window-height="1420"
|
||||
inkscape:window-x="270"
|
||||
inkscape:window-y="20"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs1" />
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="matrix(1.0800571,0,0,1.0347966,-2.6149197,-3.0116377)"
|
||||
style="display:inline">
|
||||
<g
|
||||
id="g4"
|
||||
transform="matrix(0.43515072,0,0,0.43515072,68.289343,9.0200629)">
|
||||
<path
|
||||
class="st1"
|
||||
d="M 214.6,0 2.2,285.8 246.4,222.3 100.1,222.4 Z"
|
||||
id="path3"
|
||||
style="fill:#f0d003" />
|
||||
<path
|
||||
fill="#fffae6"
|
||||
d="M 31.8,550.7 244.1,264.9 0,328.4 146.3,328.3 Z"
|
||||
id="path4" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -45,6 +45,8 @@ Algo_2452 = Algorithmus
|
||||
Algorithmic_feeds_to_aid_in_note_discovery_d344 = Algorithmische Feeds zur Hilfe bei der Entdeckung von Notizen
|
||||
# Label for zap amount input field
|
||||
Amount_70f0 = Menge
|
||||
# Label for appearance settings section
|
||||
Appearance_4c7f = Darstellung
|
||||
# Button to send message to Dave AI assistant
|
||||
Ask_b7f4 = Fragen
|
||||
# Placeholder text for Dave AI input field
|
||||
@@ -59,10 +61,18 @@ Broadcast_fe43 = Senden
|
||||
Broadcast_Local_7e50 = Lokal senden
|
||||
# Button label to cancel an action
|
||||
Cancel_ed3b = Abbrechen
|
||||
# Label for cancel clear cache, Storage settings section
|
||||
Cancel_fd8b = Abbrechen
|
||||
# Label for clear cache button, Storage settings section
|
||||
Clear_cache_dccb = Zwischenspeicher leeren
|
||||
# Hover text for editable zap amount
|
||||
Click_to_edit_0414 = Zum Bearbeiten anklicken
|
||||
# Column title for note composition
|
||||
Compose_Note_c094 = Notiz erstellen
|
||||
# Label for configure relays, settings section
|
||||
Configure_relays_d156 = Relays konfigurieren
|
||||
# Label for confirm clear cache, Storage settings section
|
||||
Confirm_9d9d = Bestätigen
|
||||
# Button label to confirm an action
|
||||
Confirm_f8a6 = Bestätigen
|
||||
# Status label for connected relay
|
||||
@@ -88,19 +98,19 @@ Copy_Pubkey_9cc4 = Pubkey kopieren
|
||||
# Copy the text content of the note to clipboard
|
||||
Copy_Text_f81c = Text kopieren
|
||||
# Relative time in days
|
||||
count_d_b9be = { $count }Tg.
|
||||
count_d_b9be = { $count }T
|
||||
# Relative time in hours
|
||||
count_h_3ecb = { $count }Std.
|
||||
count_h_3ecb = { $count }h
|
||||
# Relative time in minutes
|
||||
count_m_b41e = { $count }Min.
|
||||
count_m_b41e = { $count }min
|
||||
# Relative time in months
|
||||
count_mo_7aba = { $count }Mon.
|
||||
count_mo_7aba = { $count }M
|
||||
# Relative time in seconds
|
||||
count_s_aa26 = { $count }Sek.
|
||||
count_s_aa26 = { $count }s
|
||||
# Relative time in weeks
|
||||
count_w_7468 = { $count }Wo.
|
||||
count_w_7468 = { $count }W
|
||||
# Relative time in years
|
||||
count_y_9408 = { $count }J.
|
||||
count_y_9408 = { $count }J
|
||||
# Button to create a new account
|
||||
Create_Account_6994 = Konto erstellen
|
||||
# Button label to create a new deck
|
||||
@@ -111,6 +121,8 @@ Custom_a69e = Benutzerdefiniert
|
||||
Customize_Zap_Amount_cfc4 = Zap-Betrag anpassen
|
||||
# Column title for support page
|
||||
Damus_Support_27c0 = Damus Support
|
||||
# Label for Theme Dark, Appearance settings section
|
||||
Dark_85fe = Dunkel
|
||||
# Label for deck name input field
|
||||
Deck_name_cd32 = Deck-Name
|
||||
# Label for decks section in side panel
|
||||
@@ -151,12 +163,16 @@ Enter_your_public_key__npub___nostr_address__e_g___address____or_private_key__ns
|
||||
Für das Veröffentlichen von Beiträgen und andere Aktionen ist dein privater Schlüssel erforderlich.
|
||||
# Label for find user button
|
||||
Find_User_bd12 = Profil finden
|
||||
# Label for font size, Appearance settings section
|
||||
Font_size_dd73 = Schriftgröße:
|
||||
# Title for hashtags column
|
||||
Hashtags_f8e0 = Hashtags
|
||||
# Title for Home column
|
||||
Home_8c19 = Startseite
|
||||
# Label for deck icon selection
|
||||
Icon_b0ab = Symbol
|
||||
# Label for Image cache size, Storage settings section
|
||||
Image_cache_size_3004 = Bildcache Größe:
|
||||
# Title for individual user column
|
||||
Individual_b776 = Individuell
|
||||
# Error message for invalid zap amount
|
||||
@@ -177,8 +193,12 @@ k_50K_c2dc = 50K
|
||||
k_5K_f7e6 = 5K
|
||||
# Description for your notes column
|
||||
Keep_track_of_your_notes___replies_a334 = Behalte den Überblick über deine Notizen & Antworten
|
||||
# Label for language, Appearance settings section
|
||||
Language_e264 = Sprache:
|
||||
# Title for last note per user column
|
||||
Last_Note_per_User_17ad = Letzte Notiz pro Profil
|
||||
# Label for Theme Light, Appearance settings section
|
||||
Light_7475 = Hell
|
||||
# Bitcoin Lightning network address field label
|
||||
Lightning_network_address__lud16_ea51 = Lightning-Netzwerkadresse (lud16)
|
||||
# Login page title
|
||||
@@ -216,11 +236,15 @@ Notifications_d673 = Benachrichtigungen
|
||||
# Title for notifications column
|
||||
Notifications_ef56 = Benachrichtigungen
|
||||
# Relative time for very recent events (less than 3 seconds)
|
||||
now_2181 = Jetzt
|
||||
now_2181 = Gerade eben
|
||||
# Setting to turn on sorting replies so that the newest are shown first
|
||||
On_f412 = An
|
||||
# Button label to open email client
|
||||
Open_Email_25e9 = E-Mail öffnen
|
||||
# Instruction to open email client
|
||||
Open_your_default_email_client_to_get_help_from_the_Damus_team_68dc = Öffne deinen Standard-E-Mail-Client, um Hilfe vom Damus-Team zu erhalten
|
||||
# Label for others settings section
|
||||
Others_7267 = Andere
|
||||
# Placeholder text for NWC URI input
|
||||
Paste_your_NWC_URI_here_b471 = Füge hier deine NWC-URI ein...
|
||||
# Error message for missing deck name
|
||||
@@ -267,6 +291,10 @@ replying_to_a_note_e0bc = Antwort auf eine Notiz
|
||||
Repost_this_note_8e56 = Diese Notiz teilen
|
||||
# Label for reposted notes
|
||||
Reposted_61c8 = Teilen
|
||||
# Label for reset note body font size, Appearance settings section
|
||||
Reset_4e60 = Zurücksetzen
|
||||
# Label for reset zoom level, Appearance settings section
|
||||
Reset_62d4 = Zurücksetzen
|
||||
# Heading for support section
|
||||
Running_into_a_bug_1796 = Ein Fehler aufgetreten?
|
||||
# Label for satoshis (Bitcoin unit) for custom zap amount input field
|
||||
@@ -289,6 +317,8 @@ See_notes_from_your_contacts_ac16 = Notizen von deinen Kontakten ansehen
|
||||
See_the_whole_nostr_universe_7694 = Sieh dir das ganze Nostr-Universum an
|
||||
# Button label to send a zap
|
||||
Send_1ea4 = Senden
|
||||
# Column title for app settings
|
||||
Settings_7a4f = Einstellungen
|
||||
# Description for last note per user column
|
||||
Show_the_last_note_for_each_user_from_a_list_50e7 = Zeige die letzte Notiz für jedes Profil aus einer Liste
|
||||
# Button label to sign out of account
|
||||
@@ -297,6 +327,8 @@ Sign_out_337b = Abmelden
|
||||
Someone_else_s_Notes_7e5f = Notizen anderer Profile
|
||||
# Title for someone else's notifications column
|
||||
Someone_else_s_Notifications_82e6 = Mitteilungen anderer Profile
|
||||
# Label for Sort replies newest first, others settings section
|
||||
Sort_replies_newest_first_b6c3 = Neueste Antworten zuerst sortieren:
|
||||
# Description for contact list column
|
||||
Source_the_last_note_for_each_user_in_your_contact_list_e157 = Die letzte Notiz für jedes Profil aus deiner Kontaktliste anzeigen
|
||||
# Description for hashtags column
|
||||
@@ -315,10 +347,14 @@ Stay_up_to_date_with_your_notifications_and_mentions_e73e = Bleib bei deinen Ben
|
||||
Step_1_8656 = Schritt 1
|
||||
# Step 2 label in support instructions
|
||||
Step_2_d08d = Schritt 2
|
||||
# Label for storage settings section
|
||||
Storage_ed65 = Speicher
|
||||
# Column title for subscribing to external user
|
||||
Subscribe_to_someone_else_s_notes_d1e9 = Abonniere die Notizen eines anderen
|
||||
# Column title for subscribing to individual user
|
||||
Subscribe_to_someone_s_notes_b3c8 = Abonniere die Notizen von jemandem
|
||||
# Support email address
|
||||
Support_email_44d9 = E-Mail Support:
|
||||
# Hover text for dark mode toggle button
|
||||
Switch_to_dark_mode_4dec = Zum Dunkelmodus wechseln
|
||||
# Hover text for light mode toggle button
|
||||
@@ -327,6 +363,8 @@ Switch_to_light_mode_72ce = Zum Hellmodus wechseln
|
||||
Tap_to_Load_4b05 = Zum Laden antippen
|
||||
# Message shown when Dave trial period has ended
|
||||
The_Dave_Nostr_AI_assistant_trial_has_ended_____Thanks_for_testing__Zap-enabled_Dave_coming_soon_c6c7 = Die Testphase des Dave Nostr KI-Assistenten ist beendet :(. Vielen Dank fürs Ausprobieren! Zap-fähiger Dave kommt bald!
|
||||
# Label for theme, Appearance settings section
|
||||
Theme_4aac = Design:
|
||||
# Column title for note thread view
|
||||
Thread_0f20 = Unterhaltung
|
||||
# Link text for thread references
|
||||
@@ -341,6 +379,8 @@ Use_this_wallet_for_the_current_account_only_61dc = Diese Wallet nur für das ak
|
||||
username___at___domain___will_be_used_for_identification_a4fd = "{ $username }" bei "{ $domain }" wird für die Identifikation verwendet werden
|
||||
# Profile username field label
|
||||
Username_daa7 = Benutzername
|
||||
# Label for view folder button, Storage settings section
|
||||
View_folder_9742 = Ordner anzeigen
|
||||
# Column title for wallet management
|
||||
Wallet_5e50 = Wallet
|
||||
# Hint for deck name input field
|
||||
@@ -359,6 +399,8 @@ Your_Notifications_080d = Deine Benachrichtigungen
|
||||
Zap_16b4 = Zap
|
||||
# Hover text for zap button
|
||||
Zap_this_note_42b2 = Zappe diese Notiz
|
||||
# Label for zoom level, Appearance settings section
|
||||
Zoom_Level_29a8 = Zoomstufe:
|
||||
|
||||
# Pluralized strings
|
||||
|
||||
|
||||
@@ -79,9 +79,6 @@ Banner_52ef = Banner
|
||||
# Beta version label
|
||||
BETA_8e5d = BETA
|
||||
|
||||
# Option in settings section to show the source client label at the bottom of the note
|
||||
Bottom_33c8 = Bottom
|
||||
|
||||
# Broadcast the note to all connected relays
|
||||
Broadcast_fe43 = Broadcast
|
||||
|
||||
@@ -241,12 +238,12 @@ Enter_your_public_key__npub___nostr_address__e_g___address____or_private_key__ns
|
||||
# Label for find user button
|
||||
Find_User_bd12 = Find User
|
||||
|
||||
# Label for font size, Appearance settings section
|
||||
Font_size_dd73 = Font size:
|
||||
|
||||
# Title for hashtags column
|
||||
Hashtags_f8e0 = Hashtags
|
||||
|
||||
# Option in settings section to hide the source client label in note display
|
||||
Hide_281d = Hide
|
||||
|
||||
# Title for Home column
|
||||
Home_8c19 = Home
|
||||
|
||||
@@ -352,6 +349,9 @@ Notifications_ef56 = Notifications
|
||||
# Relative time for very recent events (less than 3 seconds)
|
||||
now_2181 = now
|
||||
|
||||
# Setting to turn on sorting replies so that the newest are shown first
|
||||
On_f412 = On
|
||||
|
||||
# Button label to open email client
|
||||
Open_Email_25e9 = Open Email
|
||||
|
||||
@@ -430,6 +430,9 @@ Repost_this_note_8e56 = Repost this note
|
||||
# Label for reposted notes
|
||||
Reposted_61c8 = Reposted
|
||||
|
||||
# Label for reset note body font size, Appearance settings section
|
||||
Reset_4e60 = Reset
|
||||
|
||||
# Label for reset zoom level, Appearance settings section
|
||||
Reset_62d4 = Reset
|
||||
|
||||
@@ -469,9 +472,6 @@ Send_1ea4 = Send
|
||||
# Column title for app settings
|
||||
Settings_7a4f = Settings
|
||||
|
||||
# Label for Show source client, others settings section
|
||||
Show_source_client_9e31 = Show source client
|
||||
|
||||
# Description for last note per user column
|
||||
Show_the_last_note_for_each_user_from_a_list_50e7 = Show the last note for each user from a list
|
||||
|
||||
@@ -484,6 +484,9 @@ Someone_else_s_Notes_7e5f = Someone else's Notes
|
||||
# Title for someone else's notifications column
|
||||
Someone_else_s_Notifications_82e6 = Someone else's Notifications
|
||||
|
||||
# Label for Sort replies newest first, others settings section
|
||||
Sort_replies_newest_first_b6c3 = Sort replies newest first:
|
||||
|
||||
# Description for contact list column
|
||||
Source_the_last_note_for_each_user_in_your_contact_list_e157 = Source the last note for each user in your contact list
|
||||
|
||||
@@ -520,6 +523,9 @@ Subscribe_to_someone_else_s_notes_d1e9 = Subscribe to someone else's notes
|
||||
# Column title for subscribing to individual user
|
||||
Subscribe_to_someone_s_notes_b3c8 = Subscribe to someone's notes
|
||||
|
||||
# Support email address
|
||||
Support_email_44d9 = Support email:
|
||||
|
||||
# Hover text for dark mode toggle button
|
||||
Switch_to_dark_mode_4dec = Switch to dark mode
|
||||
|
||||
@@ -541,9 +547,6 @@ Thread_0f20 = Thread
|
||||
# Link text for thread references
|
||||
thread_ad1f = thread
|
||||
|
||||
# Option in settings section to show the source client label at the top of the note
|
||||
Top_6aeb = Top
|
||||
|
||||
# Title for universe column
|
||||
Universe_e01e = Universe
|
||||
|
||||
@@ -560,7 +563,7 @@ username___at___domain___will_be_used_for_identification_a4fd = "{$username}" at
|
||||
Username_daa7 = Username
|
||||
|
||||
# Label for view folder button, Storage settings section
|
||||
View_folder_9742 = View folder:
|
||||
View_folder_9742 = View folder
|
||||
|
||||
# Column title for wallet management
|
||||
Wallet_5e50 = Wallet
|
||||
|
||||
@@ -79,9 +79,6 @@ Banner_52ef = {"["}Bàññér{"]"}
|
||||
# Beta version label
|
||||
BETA_8e5d = {"["}BÉTÀ{"]"}
|
||||
|
||||
# Option in settings section to show the source client label at the bottom of the note
|
||||
Bottom_33c8 = {"["}Bóttóm{"]"}
|
||||
|
||||
# Broadcast the note to all connected relays
|
||||
Broadcast_fe43 = {"["}Bróàdçàst{"]"}
|
||||
|
||||
@@ -241,12 +238,12 @@ Enter_your_public_key__npub___nostr_address__e_g___address____or_private_key__ns
|
||||
# Label for find user button
|
||||
Find_User_bd12 = {"["}Fíñd Úsér{"]"}
|
||||
|
||||
# Label for font size, Appearance settings section
|
||||
Font_size_dd73 = {"["}Fóñt sízé:{"]"}
|
||||
|
||||
# Title for hashtags column
|
||||
Hashtags_f8e0 = {"["}Hàshtàgs{"]"}
|
||||
|
||||
# Option in settings section to hide the source client label in note display
|
||||
Hide_281d = {"["}Hídé{"]"}
|
||||
|
||||
# Title for Home column
|
||||
Home_8c19 = {"["}Hómé{"]"}
|
||||
|
||||
@@ -352,6 +349,9 @@ Notifications_ef56 = {"["}Ñótífíçàtíóñs{"]"}
|
||||
# Relative time for very recent events (less than 3 seconds)
|
||||
now_2181 = {"["}ñów{"]"}
|
||||
|
||||
# Setting to turn on sorting replies so that the newest are shown first
|
||||
On_f412 = {"["}Óñ{"]"}
|
||||
|
||||
# Button label to open email client
|
||||
Open_Email_25e9 = {"["}Ópéñ Émàíl{"]"}
|
||||
|
||||
@@ -430,6 +430,9 @@ Repost_this_note_8e56 = {"["}Répóst thís ñóté{"]"}
|
||||
# Label for reposted notes
|
||||
Reposted_61c8 = {"["}Répóstéd{"]"}
|
||||
|
||||
# Label for reset note body font size, Appearance settings section
|
||||
Reset_4e60 = {"["}Rését{"]"}
|
||||
|
||||
# Label for reset zoom level, Appearance settings section
|
||||
Reset_62d4 = {"["}Rését{"]"}
|
||||
|
||||
@@ -469,9 +472,6 @@ Send_1ea4 = {"["}Séñd{"]"}
|
||||
# Column title for app settings
|
||||
Settings_7a4f = {"["}Séttíñgs{"]"}
|
||||
|
||||
# Label for Show source client, others settings section
|
||||
Show_source_client_9e31 = {"["}Shów sóúrçé çlíéñt{"]"}
|
||||
|
||||
# Description for last note per user column
|
||||
Show_the_last_note_for_each_user_from_a_list_50e7 = {"["}Shów thé làst ñóté fór éàçh úsér fróm à líst{"]"}
|
||||
|
||||
@@ -484,6 +484,9 @@ Someone_else_s_Notes_7e5f = {"["}Sóméóñé élsé's Ñótés{"]"}
|
||||
# Title for someone else's notifications column
|
||||
Someone_else_s_Notifications_82e6 = {"["}Sóméóñé élsé's Ñótífíçàtíóñs{"]"}
|
||||
|
||||
# Label for Sort replies newest first, others settings section
|
||||
Sort_replies_newest_first_b6c3 = {"["}Sórt réplíés ñéwést fírst:{"]"}
|
||||
|
||||
# Description for contact list column
|
||||
Source_the_last_note_for_each_user_in_your_contact_list_e157 = {"["}Sóúrçé thé làst ñóté fór éàçh úsér íñ yóúr çóñtàçt líst{"]"}
|
||||
|
||||
@@ -520,6 +523,9 @@ Subscribe_to_someone_else_s_notes_d1e9 = {"["}Súbsçríbé tó sóméóñé él
|
||||
# Column title for subscribing to individual user
|
||||
Subscribe_to_someone_s_notes_b3c8 = {"["}Súbsçríbé tó sóméóñé's ñótés{"]"}
|
||||
|
||||
# Support email address
|
||||
Support_email_44d9 = {"["}Súppórt émàíl:{"]"}
|
||||
|
||||
# Hover text for dark mode toggle button
|
||||
Switch_to_dark_mode_4dec = {"["}Swítçh tó dàrk módé{"]"}
|
||||
|
||||
@@ -541,9 +547,6 @@ Thread_0f20 = {"["}Thréàd{"]"}
|
||||
# Link text for thread references
|
||||
thread_ad1f = {"["}thréàd{"]"}
|
||||
|
||||
# Option in settings section to show the source client label at the top of the note
|
||||
Top_6aeb = {"["}Tóp{"]"}
|
||||
|
||||
# Title for universe column
|
||||
Universe_e01e = {"["}Úñívérsé{"]"}
|
||||
|
||||
@@ -560,7 +563,7 @@ username___at___domain___will_be_used_for_identification_a4fd = {"["}"{$username
|
||||
Username_daa7 = {"["}Úsérñàmé{"]"}
|
||||
|
||||
# Label for view folder button, Storage settings section
|
||||
View_folder_9742 = {"["}Víéw fóldér:{"]"}
|
||||
View_folder_9742 = {"["}Víéw fóldér{"]"}
|
||||
|
||||
# Column title for wallet management
|
||||
Wallet_5e50 = {"["}Wàllét{"]"}
|
||||
|
||||
@@ -45,6 +45,8 @@ Algo_2452 = Algo
|
||||
Algorithmic_feeds_to_aid_in_note_discovery_d344 = Feeds algorítmicos para ayudar en el descubrimiento de notas
|
||||
# Label for zap amount input field
|
||||
Amount_70f0 = Cantidad
|
||||
# Label for appearance settings section
|
||||
Appearance_4c7f = Aspecto
|
||||
# Button to send message to Dave AI assistant
|
||||
Ask_b7f4 = Preguntar
|
||||
# Placeholder text for Dave AI input field
|
||||
@@ -59,10 +61,18 @@ Broadcast_fe43 = Transmitir
|
||||
Broadcast_Local_7e50 = Transmitir localmente
|
||||
# Button label to cancel an action
|
||||
Cancel_ed3b = Cancelar
|
||||
# Label for cancel clear cache, Storage settings section
|
||||
Cancel_fd8b = Cancelar
|
||||
# Label for clear cache button, Storage settings section
|
||||
Clear_cache_dccb = Limpiar caché
|
||||
# Hover text for editable zap amount
|
||||
Click_to_edit_0414 = Haz clic para editar
|
||||
# Column title for note composition
|
||||
Compose_Note_c094 = Redactar nota
|
||||
# Label for configure relays, settings section
|
||||
Configure_relays_d156 = Configurar relés
|
||||
# Label for confirm clear cache, Storage settings section
|
||||
Confirm_9d9d = Confirmar
|
||||
# Button label to confirm an action
|
||||
Confirm_f8a6 = Confirmar
|
||||
# Status label for connected relay
|
||||
@@ -111,6 +121,8 @@ Custom_a69e = Personalizado
|
||||
Customize_Zap_Amount_cfc4 = Personalizar cantidad de zap
|
||||
# Column title for support page
|
||||
Damus_Support_27c0 = Ayuda de Damus
|
||||
# Label for Theme Dark, Appearance settings section
|
||||
Dark_85fe = Oscuro
|
||||
# Label for deck name input field
|
||||
Deck_name_cd32 = Nombre del deck
|
||||
# Label for decks section in side panel
|
||||
@@ -149,12 +161,16 @@ Enter_your_key_0fca = Ingresa tu clave
|
||||
Enter_your_public_key__npub___nostr_address__e_g___address____or_private_key__nsec___You_must_enter_your_private_key_to_be_able_to_post__reply__etc_48e9 = Ingresa tu clave pública (npub), dirección de Nostr (por ejemplo, { $address }) o clave privada (nsec). Debes ingresar tu clave privada para poder publicar, responder, etc.
|
||||
# Label for find user button
|
||||
Find_User_bd12 = Buscar usuario
|
||||
# Label for font size, Appearance settings section
|
||||
Font_size_dd73 = Font size:
|
||||
# Title for hashtags column
|
||||
Hashtags_f8e0 = Hashtags
|
||||
# Title for Home column
|
||||
Home_8c19 = Inicio
|
||||
# Label for deck icon selection
|
||||
Icon_b0ab = Ícono
|
||||
# Label for Image cache size, Storage settings section
|
||||
Image_cache_size_3004 = Tamaño de caché de imágenes:
|
||||
# Title for individual user column
|
||||
Individual_b776 = Individual
|
||||
# Error message for invalid zap amount
|
||||
@@ -175,8 +191,12 @@ k_50K_c2dc = 50.000
|
||||
k_5K_f7e6 = 5.000
|
||||
# Description for your notes column
|
||||
Keep_track_of_your_notes___replies_a334 = Haz seguimiento de tus notas y respuestas
|
||||
# Label for language, Appearance settings section
|
||||
Language_e264 = Idioma:
|
||||
# Title for last note per user column
|
||||
Last_Note_per_User_17ad = Última nota por usuario
|
||||
# Label for Theme Light, Appearance settings section
|
||||
Light_7475 = Claro
|
||||
# Bitcoin Lightning network address field label
|
||||
Lightning_network_address__lud16_ea51 = Dirección de la red Lightning (lud16)
|
||||
# Login page title
|
||||
@@ -215,10 +235,14 @@ Notifications_d673 = Notificaciones
|
||||
Notifications_ef56 = Notificaciones
|
||||
# Relative time for very recent events (less than 3 seconds)
|
||||
now_2181 = ahora
|
||||
# Setting to turn on sorting replies so that the newest are shown first
|
||||
On_f412 = On
|
||||
# Button label to open email client
|
||||
Open_Email_25e9 = Abrir correo electrónico
|
||||
# Instruction to open email client
|
||||
Open_your_default_email_client_to_get_help_from_the_Damus_team_68dc = Abre tu cliente de correo predeterminado para recibir ayuda del equipo de Damus
|
||||
# Label for others settings section
|
||||
Others_7267 = Otros
|
||||
# Placeholder text for NWC URI input
|
||||
Paste_your_NWC_URI_here_b471 = Pega tu NWC URI aquí...
|
||||
# Error message for missing deck name
|
||||
@@ -265,6 +289,10 @@ replying_to_a_note_e0bc = respondiendo a una nota
|
||||
Repost_this_note_8e56 = Volver a publicar esta nota
|
||||
# Label for reposted notes
|
||||
Reposted_61c8 = Publicadas de nuevo
|
||||
# Label for reset note body font size, Appearance settings section
|
||||
Reset_4e60 = Reset
|
||||
# Label for reset zoom level, Appearance settings section
|
||||
Reset_62d4 = Restablecer
|
||||
# Heading for support section
|
||||
Running_into_a_bug_1796 = ¿Encontraste un error?
|
||||
# Label for satoshis (Bitcoin unit) for custom zap amount input field
|
||||
@@ -287,6 +315,8 @@ See_notes_from_your_contacts_ac16 = Ver notas de tus contactos
|
||||
See_the_whole_nostr_universe_7694 = Ver todo el universo de nostr
|
||||
# Button label to send a zap
|
||||
Send_1ea4 = Enviar
|
||||
# Column title for app settings
|
||||
Settings_7a4f = Configuración
|
||||
# Description for last note per user column
|
||||
Show_the_last_note_for_each_user_from_a_list_50e7 = Mostrar la última nota para cada usuario de una lista
|
||||
# Button label to sign out of account
|
||||
@@ -295,6 +325,8 @@ Sign_out_337b = Cerrar sesión
|
||||
Someone_else_s_Notes_7e5f = Notas de otra persona
|
||||
# Title for someone else's notifications column
|
||||
Someone_else_s_Notifications_82e6 = Notificaciones de otra persona
|
||||
# Label for Sort replies newest first, others settings section
|
||||
Sort_replies_newest_first_b6c3 = Sort replies newest first:
|
||||
# Description for contact list column
|
||||
Source_the_last_note_for_each_user_in_your_contact_list_e157 = Busca la última nota de cada usuario en tu lista de contactos
|
||||
# Description for hashtags column
|
||||
@@ -313,10 +345,14 @@ Stay_up_to_date_with_your_notifications_and_mentions_e73e = Mantente al día con
|
||||
Step_1_8656 = Paso 1
|
||||
# Step 2 label in support instructions
|
||||
Step_2_d08d = Paso 2
|
||||
# Label for storage settings section
|
||||
Storage_ed65 = Almacenamiento
|
||||
# Column title for subscribing to external user
|
||||
Subscribe_to_someone_else_s_notes_d1e9 = Suscribirse a las notas de otra persona
|
||||
# Column title for subscribing to individual user
|
||||
Subscribe_to_someone_s_notes_b3c8 = Suscribirse a las notas de alguien
|
||||
# Support email address
|
||||
Support_email_44d9 = Support email:
|
||||
# Hover text for dark mode toggle button
|
||||
Switch_to_dark_mode_4dec = Cambiar a modo oscuro
|
||||
# Hover text for light mode toggle button
|
||||
@@ -325,6 +361,8 @@ Switch_to_light_mode_72ce = Cambiar a modo claro
|
||||
Tap_to_Load_4b05 = Toca para cargar
|
||||
# Message shown when Dave trial period has ended
|
||||
The_Dave_Nostr_AI_assistant_trial_has_ended_____Thanks_for_testing__Zap-enabled_Dave_coming_soon_c6c7 = La prueba del asistente de IA Dave de Nostr finalizó :(. ¡Gracias por probarlo! ¡Dave con zaps estará disponible muy pronto!
|
||||
# Label for theme, Appearance settings section
|
||||
Theme_4aac = Tema:
|
||||
# Column title for note thread view
|
||||
Thread_0f20 = Conversación
|
||||
# Link text for thread references
|
||||
@@ -339,6 +377,8 @@ Use_this_wallet_for_the_current_account_only_61dc = Usar esta billetera solo par
|
||||
username___at___domain___will_be_used_for_identification_a4fd = Se utilizará "{ $username }" en "{ $domain }" para la identificación
|
||||
# Profile username field label
|
||||
Username_daa7 = Nombre de usuario
|
||||
# Label for view folder button, Storage settings section
|
||||
View_folder_9742 = Ver carpeta
|
||||
# Column title for wallet management
|
||||
Wallet_5e50 = Billetera
|
||||
# Hint for deck name input field
|
||||
@@ -357,6 +397,8 @@ Your_Notifications_080d = Tus notificaciones
|
||||
Zap_16b4 = Zap
|
||||
# Hover text for zap button
|
||||
Zap_this_note_42b2 = Enviar un zap a esta nota
|
||||
# Label for zoom level, Appearance settings section
|
||||
Zoom_Level_29a8 = Nivel de zoom:
|
||||
|
||||
# Pluralized strings
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ Algo_2452 = Algo
|
||||
Algorithmic_feeds_to_aid_in_note_discovery_d344 = Feeds algorítmicos para ayudar en el descubrimiento de notas
|
||||
# Label for zap amount input field
|
||||
Amount_70f0 = Cantidad
|
||||
# Label for appearance settings section
|
||||
Appearance_4c7f = Aspecto
|
||||
# Button to send message to Dave AI assistant
|
||||
Ask_b7f4 = Preguntar
|
||||
# Placeholder text for Dave AI input field
|
||||
@@ -59,10 +61,18 @@ Broadcast_fe43 = Transmitir
|
||||
Broadcast_Local_7e50 = Transmitir localmente
|
||||
# Button label to cancel an action
|
||||
Cancel_ed3b = Cancelar
|
||||
# Label for cancel clear cache, Storage settings section
|
||||
Cancel_fd8b = Cancelar
|
||||
# Label for clear cache button, Storage settings section
|
||||
Clear_cache_dccb = Limpiar caché
|
||||
# Hover text for editable zap amount
|
||||
Click_to_edit_0414 = Haz clic para editar
|
||||
# Column title for note composition
|
||||
Compose_Note_c094 = Redactar nota
|
||||
# Label for configure relays, settings section
|
||||
Configure_relays_d156 = Configurar relés
|
||||
# Label for confirm clear cache, Storage settings section
|
||||
Confirm_9d9d = Confirmar
|
||||
# Button label to confirm an action
|
||||
Confirm_f8a6 = Confirmar
|
||||
# Status label for connected relay
|
||||
@@ -111,6 +121,8 @@ Custom_a69e = Personalizado
|
||||
Customize_Zap_Amount_cfc4 = Personalizar cantidad de zap
|
||||
# Column title for support page
|
||||
Damus_Support_27c0 = Ayuda de Damus
|
||||
# Label for Theme Dark, Appearance settings section
|
||||
Dark_85fe = Oscuro
|
||||
# Label for deck name input field
|
||||
Deck_name_cd32 = Nombre del deck
|
||||
# Label for decks section in side panel
|
||||
@@ -149,12 +161,16 @@ Enter_your_key_0fca = Ingresa tu clave
|
||||
Enter_your_public_key__npub___nostr_address__e_g___address____or_private_key__nsec___You_must_enter_your_private_key_to_be_able_to_post__reply__etc_48e9 = Ingresa tu clave pública (npub), dirección de Nostr (por ejemplo, { $address }) o clave privada (nsec). Debes ingresar tu clave privada para poder publicar, responder, etc.
|
||||
# Label for find user button
|
||||
Find_User_bd12 = Buscar usuario
|
||||
# Label for font size, Appearance settings section
|
||||
Font_size_dd73 = Font size:
|
||||
# Title for hashtags column
|
||||
Hashtags_f8e0 = Hashtags
|
||||
# Title for Home column
|
||||
Home_8c19 = Inicio
|
||||
# Label for deck icon selection
|
||||
Icon_b0ab = Icono
|
||||
# Label for Image cache size, Storage settings section
|
||||
Image_cache_size_3004 = Tamaño de caché de imágenes:
|
||||
# Title for individual user column
|
||||
Individual_b776 = Individual
|
||||
# Error message for invalid zap amount
|
||||
@@ -175,8 +191,12 @@ k_50K_c2dc = 50.000
|
||||
k_5K_f7e6 = 5.000
|
||||
# Description for your notes column
|
||||
Keep_track_of_your_notes___replies_a334 = Haz seguimiento de tus notas y respuestas
|
||||
# Label for language, Appearance settings section
|
||||
Language_e264 = Idioma:
|
||||
# Title for last note per user column
|
||||
Last_Note_per_User_17ad = Última nota por usuario
|
||||
# Label for Theme Light, Appearance settings section
|
||||
Light_7475 = Claro
|
||||
# Bitcoin Lightning network address field label
|
||||
Lightning_network_address__lud16_ea51 = Dirección de la red Lightning (lud16)
|
||||
# Login page title
|
||||
@@ -215,10 +235,14 @@ Notifications_d673 = Notificaciones
|
||||
Notifications_ef56 = Notificaciones
|
||||
# Relative time for very recent events (less than 3 seconds)
|
||||
now_2181 = ahora
|
||||
# Setting to turn on sorting replies so that the newest are shown first
|
||||
On_f412 = On
|
||||
# Button label to open email client
|
||||
Open_Email_25e9 = Abrir correo electrónico
|
||||
# Instruction to open email client
|
||||
Open_your_default_email_client_to_get_help_from_the_Damus_team_68dc = Abre tu cliente de correo predeterminado para recibir ayuda del equipo de Damus
|
||||
# Label for others settings section
|
||||
Others_7267 = Otros
|
||||
# Placeholder text for NWC URI input
|
||||
Paste_your_NWC_URI_here_b471 = Pega tu NWC URI aquí...
|
||||
# Error message for missing deck name
|
||||
@@ -265,6 +289,10 @@ replying_to_a_note_e0bc = respondiendo a una nota
|
||||
Repost_this_note_8e56 = Volver a publicar esta nota
|
||||
# Label for reposted notes
|
||||
Reposted_61c8 = Publicadas de nuevo
|
||||
# Label for reset note body font size, Appearance settings section
|
||||
Reset_4e60 = Reset
|
||||
# Label for reset zoom level, Appearance settings section
|
||||
Reset_62d4 = Restablecer
|
||||
# Heading for support section
|
||||
Running_into_a_bug_1796 = ¿Has encontrado un error?
|
||||
# Label for satoshis (Bitcoin unit) for custom zap amount input field
|
||||
@@ -287,6 +315,8 @@ See_notes_from_your_contacts_ac16 = Ver notas de tus contactos
|
||||
See_the_whole_nostr_universe_7694 = Ver todo el universo de nostr
|
||||
# Button label to send a zap
|
||||
Send_1ea4 = Enviar
|
||||
# Column title for app settings
|
||||
Settings_7a4f = Configuración
|
||||
# Description for last note per user column
|
||||
Show_the_last_note_for_each_user_from_a_list_50e7 = Mostrar la última nota para cada usuario de una lista
|
||||
# Button label to sign out of account
|
||||
@@ -295,6 +325,8 @@ Sign_out_337b = Cerrar sesión
|
||||
Someone_else_s_Notes_7e5f = Notas de otra persona
|
||||
# Title for someone else's notifications column
|
||||
Someone_else_s_Notifications_82e6 = Notificaciones de otra persona
|
||||
# Label for Sort replies newest first, others settings section
|
||||
Sort_replies_newest_first_b6c3 = Sort replies newest first:
|
||||
# Description for contact list column
|
||||
Source_the_last_note_for_each_user_in_your_contact_list_e157 = Busca la última nota de cada usuario en tu lista de contactos
|
||||
# Description for hashtags column
|
||||
@@ -313,10 +345,14 @@ Stay_up_to_date_with_your_notifications_and_mentions_e73e = Mantente al día con
|
||||
Step_1_8656 = Paso 1
|
||||
# Step 2 label in support instructions
|
||||
Step_2_d08d = Paso 2
|
||||
# Label for storage settings section
|
||||
Storage_ed65 = Almacenamiento
|
||||
# Column title for subscribing to external user
|
||||
Subscribe_to_someone_else_s_notes_d1e9 = Suscribirse a las notas de otra persona
|
||||
# Column title for subscribing to individual user
|
||||
Subscribe_to_someone_s_notes_b3c8 = Suscribirse a las notas de alguien
|
||||
# Support email address
|
||||
Support_email_44d9 = Support email:
|
||||
# Hover text for dark mode toggle button
|
||||
Switch_to_dark_mode_4dec = Cambiar a modo oscuro
|
||||
# Hover text for light mode toggle button
|
||||
@@ -325,6 +361,8 @@ Switch_to_light_mode_72ce = Cambiar a modo claro
|
||||
Tap_to_Load_4b05 = Toca para cargar
|
||||
# Message shown when Dave trial period has ended
|
||||
The_Dave_Nostr_AI_assistant_trial_has_ended_____Thanks_for_testing__Zap-enabled_Dave_coming_soon_c6c7 = La prueba del asistente de IA Dave de Nostr ha finalizado :(. ¡Gracias por probarlo! ¡Dave con zaps estará disponible muy pronto!
|
||||
# Label for theme, Appearance settings section
|
||||
Theme_4aac = Tema:
|
||||
# Column title for note thread view
|
||||
Thread_0f20 = Conversación
|
||||
# Link text for thread references
|
||||
@@ -339,6 +377,8 @@ Use_this_wallet_for_the_current_account_only_61dc = Usar este monedero solo para
|
||||
username___at___domain___will_be_used_for_identification_a4fd = Se utilizará "{ $username }" en "{ $domain }" para la identificación
|
||||
# Profile username field label
|
||||
Username_daa7 = Nombre de usuario
|
||||
# Label for view folder button, Storage settings section
|
||||
View_folder_9742 = Ver carpeta
|
||||
# Column title for wallet management
|
||||
Wallet_5e50 = Monedero
|
||||
# Hint for deck name input field
|
||||
@@ -357,6 +397,8 @@ Your_Notifications_080d = Tus notificaciones
|
||||
Zap_16b4 = Zap
|
||||
# Hover text for zap button
|
||||
Zap_this_note_42b2 = Enviar un zap a esta nota
|
||||
# Label for zoom level, Appearance settings section
|
||||
Zoom_Level_29a8 = Nivel de zoom:
|
||||
|
||||
# Pluralized strings
|
||||
|
||||
|
||||
@@ -55,8 +55,6 @@ Ask_dave_anything_33d1 = Demandez à Dave n'importe quoi...
|
||||
Banner_52ef = Bannière
|
||||
# Beta version label
|
||||
BETA_8e5d = BETA
|
||||
# Option in settings section to show the source client label at the bottom of the note
|
||||
Bottom_33c8 = En bas
|
||||
# Broadcast the note to all connected relays
|
||||
Broadcast_fe43 = Diffusion
|
||||
# Broadcast the note only to local network relays
|
||||
@@ -163,10 +161,10 @@ Enter_your_key_0fca = Entrez votre clé
|
||||
Enter_your_public_key__npub___nostr_address__e_g___address____or_private_key__nsec___You_must_enter_your_private_key_to_be_able_to_post__reply__etc_48e9 = Entrez votre clé publique (npub), votre adresse nostr (par exemple { $address }), ou votre clé privée (nsec). Vous devez entrer votre clé privée pour pouvoir poster, répondre, etc.
|
||||
# Label for find user button
|
||||
Find_User_bd12 = Trouver un utilisateur
|
||||
# Label for font size, Appearance settings section
|
||||
Font_size_dd73 = Taille du texte :
|
||||
# Title for hashtags column
|
||||
Hashtags_f8e0 = Hashtags
|
||||
# Option in settings section to hide the source client label in note display
|
||||
Hide_281d = Masquer
|
||||
# Title for Home column
|
||||
Home_8c19 = Accueil
|
||||
# Label for deck icon selection
|
||||
@@ -237,6 +235,8 @@ Notifications_d673 = Notifications
|
||||
Notifications_ef56 = Notifications
|
||||
# Relative time for very recent events (less than 3 seconds)
|
||||
now_2181 = maintenant
|
||||
# Setting to turn on sorting replies so that the newest are shown first
|
||||
On_f412 = Activé
|
||||
# Button label to open email client
|
||||
Open_Email_25e9 = Ouvrir Email
|
||||
# Instruction to open email client
|
||||
@@ -289,6 +289,8 @@ replying_to_a_note_e0bc = répondre à une note
|
||||
Repost_this_note_8e56 = Republier cette note
|
||||
# Label for reposted notes
|
||||
Reposted_61c8 = Republier
|
||||
# Label for reset note body font size, Appearance settings section
|
||||
Reset_4e60 = Réinitialiser
|
||||
# Label for reset zoom level, Appearance settings section
|
||||
Reset_62d4 = Réinitialiser
|
||||
# Heading for support section
|
||||
@@ -315,8 +317,6 @@ See_the_whole_nostr_universe_7694 = Voir l'ensemble de l'univers nostr
|
||||
Send_1ea4 = Envoyer
|
||||
# Column title for app settings
|
||||
Settings_7a4f = Paramètres
|
||||
# Label for Show source client, others settings section
|
||||
Show_source_client_9e31 = Afficher le client source
|
||||
# Description for last note per user column
|
||||
Show_the_last_note_for_each_user_from_a_list_50e7 = Afficher la dernière note de chaque utilisateur à partir d'une liste
|
||||
# Button label to sign out of account
|
||||
@@ -325,6 +325,8 @@ Sign_out_337b = Se déconnecter
|
||||
Someone_else_s_Notes_7e5f = Notes de quelqu'un d'autre
|
||||
# Title for someone else's notifications column
|
||||
Someone_else_s_Notifications_82e6 = Notifications de quelqu'un d'autre
|
||||
# Label for Sort replies newest first, others settings section
|
||||
Sort_replies_newest_first_b6c3 = Trier les réponses les plus récentes en premier :
|
||||
# Description for contact list column
|
||||
Source_the_last_note_for_each_user_in_your_contact_list_e157 = Source de la dernière note pour chaque utilisateur de votre liste de contacts
|
||||
# Description for hashtags column
|
||||
@@ -349,6 +351,8 @@ Storage_ed65 = Stockage
|
||||
Subscribe_to_someone_else_s_notes_d1e9 = S'abonner aux notes de quelqu'un d'autre
|
||||
# Column title for subscribing to individual user
|
||||
Subscribe_to_someone_s_notes_b3c8 = S'abonner aux notes de quelqu'un
|
||||
# Support email address
|
||||
Support_email_44d9 = Adresse email de l'assistance :
|
||||
# Hover text for dark mode toggle button
|
||||
Switch_to_dark_mode_4dec = Passer en mode sombre
|
||||
# Hover text for light mode toggle button
|
||||
@@ -363,8 +367,6 @@ Theme_4aac = Thème :
|
||||
Thread_0f20 = Fil
|
||||
# Link text for thread references
|
||||
thread_ad1f = fil
|
||||
# Option in settings section to show the source client label at the top of the note
|
||||
Top_6aeb = En haut
|
||||
# Title for universe column
|
||||
Universe_e01e = Universel
|
||||
# Column title for universe feed
|
||||
@@ -376,7 +378,7 @@ username___at___domain___will_be_used_for_identification_a4fd = "{ $username }"
|
||||
# Profile username field label
|
||||
Username_daa7 = Nom d'utilisateur
|
||||
# Label for view folder button, Storage settings section
|
||||
View_folder_9742 = Voir le dossier :
|
||||
View_folder_9742 = Voir le dossier
|
||||
# Column title for wallet management
|
||||
Wallet_5e50 = Portefeuille
|
||||
# Hint for deck name input field
|
||||
|
||||
@@ -0,0 +1,410 @@
|
||||
# Main translation file for Notedeck
|
||||
# This file contains common UI strings used throughout the application
|
||||
# Auto-generated by extract_i18n.py - DO NOT EDIT MANUALLY
|
||||
|
||||
|
||||
# Regular strings
|
||||
|
||||
# Profile about/bio field label
|
||||
About_00c0 = 概要
|
||||
# Column title for account management
|
||||
Accounts_f018 = アカウント
|
||||
# Button label to add a relay
|
||||
Add_269d = 追加
|
||||
# Label for add column button
|
||||
Add_47df = 追加
|
||||
# Button label to add a different wallet
|
||||
Add_a_different_wallet_that_will_only_be_used_for_this_account_de8d = このアカウントでのみ使用される別のウォレットを追加
|
||||
# Error message for missing wallet
|
||||
Add_a_wallet_to_continue_d170 = 続行するにはウォレットを追加してください
|
||||
# Button label to add a new account
|
||||
Add_account_1cfc = アカウントを追加
|
||||
# Column title for adding new account
|
||||
Add_Account_d06c = アカウントの追加
|
||||
# Column title for adding algorithm column
|
||||
Add_Algo_Column_0d75 = アルゴカラムの追加
|
||||
# Column title for adding new column
|
||||
Add_Column_c764 = カラムの追加
|
||||
# Column title for adding new deck
|
||||
Add_Deck_fabf = デッキの追加
|
||||
# Column title for adding external notifications column
|
||||
Add_External_Notifications_Column_41ae = 外部通知カラムの追加
|
||||
# Column title for adding hashtag column
|
||||
Add_Hashtag_Column_ebf4 = ハッシュタグカラムの追加
|
||||
# Column title for adding last notes column
|
||||
Add_Last_Notes_Column_bbad = 最後の投稿カラムの追加
|
||||
# Column title for adding notifications column
|
||||
Add_Notifications_Column_79f8 = 外部通知カラムの追加
|
||||
# Button label to add a relay
|
||||
Add_relay_269d = リレーを追加
|
||||
# Button label to add a wallet
|
||||
Add_Wallet_d1be = ウォレットを追加
|
||||
# Title for algorithmic feeds column
|
||||
Algo_2452 = アルゴ
|
||||
# Description for algorithmic feeds column
|
||||
Algorithmic_feeds_to_aid_in_note_discovery_d344 = 投稿の発見に役立つアルゴリズムフィードです
|
||||
# Label for zap amount input field
|
||||
Amount_70f0 = 金額
|
||||
# Label for appearance settings section
|
||||
Appearance_4c7f = 外観
|
||||
# Button to send message to Dave AI assistant
|
||||
Ask_b7f4 = 質問
|
||||
# Placeholder text for Dave AI input field
|
||||
Ask_dave_anything_33d1 = Dave に何でも質問してみましょう…
|
||||
# Profile banner URL field label
|
||||
Banner_52ef = バナー
|
||||
# Beta version label
|
||||
BETA_8e5d = ベータ
|
||||
# Broadcast the note to all connected relays
|
||||
Broadcast_fe43 = ブロードキャスト
|
||||
# Broadcast the note only to local network relays
|
||||
Broadcast_Local_7e50 = ローカルにブロードキャスト
|
||||
# Button label to cancel an action
|
||||
Cancel_ed3b = キャンセル
|
||||
# Label for cancel clear cache, Storage settings section
|
||||
Cancel_fd8b = キャンセル
|
||||
# Label for clear cache button, Storage settings section
|
||||
Clear_cache_dccb = キャッシュを消去
|
||||
# Hover text for editable zap amount
|
||||
Click_to_edit_0414 = クリックして編集
|
||||
# Column title for note composition
|
||||
Compose_Note_c094 = メモの作成
|
||||
# Label for configure relays, settings section
|
||||
Configure_relays_d156 = リレーを設定
|
||||
# Label for confirm clear cache, Storage settings section
|
||||
Confirm_9d9d = 決定
|
||||
# Button label to confirm an action
|
||||
Confirm_f8a6 = 決定
|
||||
# Status label for connected relay
|
||||
Connected_f8cc = 接続済
|
||||
# Status label for connecting relay
|
||||
Connecting_6b7e = 接続中…
|
||||
# Title for contact list column
|
||||
Contact_List_f85a = フォロイーリスト
|
||||
# Column title for contact lists
|
||||
Contacts_7533 = フォロー
|
||||
# Column title for last notes per contact
|
||||
Contacts__last_notes_3f84 = フォロー (最後の投稿)
|
||||
# Button label to copy logs
|
||||
Copy_a688 = コピー
|
||||
# Button to copy media link to clipboard
|
||||
Copy_Link_dc7c = リンクをコピー
|
||||
# Copy the unique note identifier to clipboard
|
||||
Copy_Note_ID_6b45 = 投稿 ID をコピー
|
||||
# Copy the raw note data in JSON format to clipboard
|
||||
Copy_Note_JSON_9e4e = 投稿の JSON をコピー
|
||||
# Copy the author's public key to clipboard
|
||||
Copy_Pubkey_9cc4 = 公開鍵をコピー
|
||||
# Copy the text content of the note to clipboard
|
||||
Copy_Text_f81c = テキストをコピー
|
||||
# Relative time in days
|
||||
count_d_b9be = { $count }日
|
||||
# Relative time in hours
|
||||
count_h_3ecb = { $count }時間
|
||||
# Relative time in minutes
|
||||
count_m_b41e = { $count }分
|
||||
# Relative time in months
|
||||
count_mo_7aba = { $count }ヶ月
|
||||
# Relative time in seconds
|
||||
count_s_aa26 = { $count }秒
|
||||
# Relative time in weeks
|
||||
count_w_7468 = { $count }週間
|
||||
# Relative time in years
|
||||
count_y_9408 = { $count }年
|
||||
# Button to create a new account
|
||||
Create_Account_6994 = アカウントを作成
|
||||
# Button label to create a new deck
|
||||
Create_Deck_16b7 = デッキを作成
|
||||
# Column title for custom timelines
|
||||
Custom_a69e = カスタマイズ
|
||||
# Column title for zap amount customization
|
||||
Customize_Zap_Amount_cfc4 = Zap 金額をカスタマイズ
|
||||
# Column title for support page
|
||||
Damus_Support_27c0 = Damus サポート
|
||||
# Label for Theme Dark, Appearance settings section
|
||||
Dark_85fe = ダーク
|
||||
# Label for deck name input field
|
||||
Deck_name_cd32 = デッキ名
|
||||
# Label for decks section in side panel
|
||||
DECKS_1fad = デッキ
|
||||
# Label for default zap amount input
|
||||
Default_amount_per_zap_399d = Zap ごとのデフォルトの金額:
|
||||
# Name of the default deck feed
|
||||
Default_Deck_fcca = 既定のデッキ
|
||||
# Button label to delete a deck
|
||||
Delete_Deck_bb29 = デッキを削除
|
||||
# Tooltip for deleting a column
|
||||
Delete_this_column_8d5a = このカラムを削除します
|
||||
# Button label to delete a wallet
|
||||
Delete_Wallet_d1d4 = ウォレットを削除
|
||||
# Profile display name field label
|
||||
Display_name_f9d9 = 表示名
|
||||
# Domain identification message
|
||||
domain___will_be_used_for_identification_b67e = "{ $domain }" が識別に使用されます
|
||||
# Column title for editing deck
|
||||
Edit_Deck_4018 = デッキの編集
|
||||
# Button label to edit a deck
|
||||
Edit_Deck_fd93 = デッキを編集
|
||||
# Button label to edit user profile
|
||||
Edit_Profile_49e6 = プロファイルを編集
|
||||
# Column title for profile editing
|
||||
Edit_Profile_8ad4 = プロファイルの編集
|
||||
# Placeholder for hashtag input field
|
||||
Enter_the_desired_hashtags_here__for_multiple_space-separated_7a69 = 必要なハッシュタグをここに入力してください (複数スペースで区切る場合)
|
||||
# Placeholder for relay input field
|
||||
Enter_the_relay_here_1c8b = ここにリレーを入力してください
|
||||
# Hint text to prompt entering the user's public key.
|
||||
Enter_the_user_s_key__npub__hex__nip05__here_650c = ユーザーの鍵 (npub, hex, nip05) を入力してください...
|
||||
# Label for key input field. Key can be public key (npub), private key (nsec), or Nostr address (NIP-05).
|
||||
Enter_your_key_0fca = 鍵を入力してください
|
||||
# Instructions for entering Nostr credentials
|
||||
Enter_your_public_key__npub___nostr_address__e_g___address____or_private_key__nsec___You_must_enter_your_private_key_to_be_able_to_post__reply__etc_48e9 = 公開鍵 (npub)、nostr アドレス (例: { $address })、秘密鍵 (nsec) を入力してください。 投稿、返信などを行うには秘密鍵を入力する必要があります。
|
||||
# Label for find user button
|
||||
Find_User_bd12 = ユーザーを探す
|
||||
# Label for font size, Appearance settings section
|
||||
Font_size_dd73 = フォントサイズ:
|
||||
# Title for hashtags column
|
||||
Hashtags_f8e0 = ハッシュタグ
|
||||
# Title for Home column
|
||||
Home_8c19 = ホーム
|
||||
# Label for deck icon selection
|
||||
Icon_b0ab = アイコン
|
||||
# Label for Image cache size, Storage settings section
|
||||
Image_cache_size_3004 = 画像キャッシュのサイズ:
|
||||
# Title for individual user column
|
||||
Individual_b776 = 個人用
|
||||
# Error message for invalid zap amount
|
||||
Invalid_amount_6630 = 無効な金額です
|
||||
# Error message for invalid key input
|
||||
Invalid_key_4726 = 無効な鍵です。
|
||||
# Error message for invalid Nostr Wallet Connect URI
|
||||
Invalid_NWC_URI_031b = 無効な NWC URI です
|
||||
# Zap amount button for 100000 sats. Abbreviated because the button is too small to display the full amount.
|
||||
k_100K_686c = 100K
|
||||
# Zap amount button for 10000 sats. Abbreviated because the button is too small to display the full amount.
|
||||
k_10K_f7e6 = 10K
|
||||
# Zap amount button for 20000 sats. Abbreviated because the button is too small to display the full amount.
|
||||
k_20K_4977 = 20K
|
||||
# Zap amount button for 50000 sats. Abbreviated because the button is too small to display the full amount.
|
||||
k_50K_c2dc = 50K
|
||||
# Zap amount button for 5000 sats. Abbreviated because the button is too small to display the full amount.
|
||||
k_5K_f7e6 = 5K
|
||||
# Description for your notes column
|
||||
Keep_track_of_your_notes___replies_a334 = 投稿と返信を記録します
|
||||
# Label for language, Appearance settings section
|
||||
Language_e264 = 言語:
|
||||
# Title for last note per user column
|
||||
Last_Note_per_User_17ad = ユーザーごとの最後の投稿
|
||||
# Label for Theme Light, Appearance settings section
|
||||
Light_7475 = ライト
|
||||
# Bitcoin Lightning network address field label
|
||||
Lightning_network_address__lud16_ea51 = ライトニングネットワークアドレス (lud16)
|
||||
# Login page title
|
||||
Login_9eef = ログイン
|
||||
# Login button text
|
||||
Login_now___let_s_do_this_5630 = 今すぐログイン — レッツゴー!
|
||||
# Text shown on blurred media from unfollowed users
|
||||
Media_from_someone_you_don_t_follow_5611 = フォローしていない人のメディアです
|
||||
# Tooltip for moving a column
|
||||
Moves_this_column_to_another_position_0d4b = このカラムを別の位置に移動します
|
||||
# Title for the user's deck
|
||||
My_Deck_4ac5 = あなたのデッキ
|
||||
# Label asking if the user is new to Nostr. Underneath this label is a button to create an account.
|
||||
New_to_Nostr_a2fd = Nostr は初めてですか?
|
||||
# NIP-05 identity field label
|
||||
Nostr_address__NIP-05_identity_74a2 = Nostr アドレス (NIP-05)
|
||||
# Default username when profile is not available
|
||||
nostrich_df29 = ノス民
|
||||
# Status label for disconnected relay
|
||||
Not_Connected_6292 = 未接続
|
||||
# Link text for note references
|
||||
note_cad6 = 投稿
|
||||
# Beta product warning message
|
||||
Notedeck_is_a_beta_product__Expect_bugs_and_contact_us_when_you_run_into_issues_a671 = Notedeck はベータ製品です。問題が発生した場合はサポートに問い合わせてください。
|
||||
# Filter label for notes only view
|
||||
Notes_03fb = 投稿
|
||||
# Label for notes-only filter
|
||||
Notes_60d2 = 投稿
|
||||
# Filter label for notes and replies view
|
||||
Notes___Replies_1ec2 = 投稿 & 返信
|
||||
# Label for notes and replies filter
|
||||
Notes___Replies_6e3b = 投稿 & 返信
|
||||
# Column title for notifications
|
||||
Notifications_d673 = 通知
|
||||
# Title for notifications column
|
||||
Notifications_ef56 = 通知
|
||||
# Relative time for very recent events (less than 3 seconds)
|
||||
now_2181 = たった今
|
||||
# Setting to turn on sorting replies so that the newest are shown first
|
||||
On_f412 = 有効
|
||||
# Button label to open email client
|
||||
Open_Email_25e9 = メールを開く
|
||||
# Instruction to open email client
|
||||
Open_your_default_email_client_to_get_help_from_the_Damus_team_68dc = デフォルトのメールクライアントを開いて、Damus チームのヘルプを表示しましょう。
|
||||
# Label for others settings section
|
||||
Others_7267 = その他
|
||||
# Placeholder text for NWC URI input
|
||||
Paste_your_NWC_URI_here_b471 = ここに NWC の URI を貼り付けてください...
|
||||
# Error message for missing deck name
|
||||
Please_create_a_name_for_the_deck_38e7 = デッキの名前を作成してください。
|
||||
# Error message for missing deck name and icon
|
||||
Please_create_a_name_for_the_deck_and_select_an_icon_0add = デッキの名前を作成してアイコンを選択してください。
|
||||
# Error message for missing deck icon
|
||||
Please_select_an_icon_655b = アイコンを選択してください。
|
||||
# Button label to post a note
|
||||
Post_now_8a49 = すぐに投稿
|
||||
# Instruction for copying logs
|
||||
Press_the_button_below_to_copy_your_most_recent_logs_to_your_system_s_clipboard__Then_paste_it_into_your_email_322e = 下のボタンを押して、最新のログをシステムのクリップボードにコピーします。その後、メールに貼り付けてください。
|
||||
# Profile picture URL field label
|
||||
Profile_picture_81ff = プロフィール写真
|
||||
# Column title for quote composition
|
||||
Quote_475c = 引用
|
||||
# Error message when quote note cannot be found
|
||||
Quote_of_unknown_note_e4f0 = 不明な投稿の引用です
|
||||
# Label for read-only profile mode
|
||||
Read_only_82ff = 読み取り専用
|
||||
# Column title for relay management
|
||||
Relays_9d89 = リレー
|
||||
# Label for relay list section
|
||||
Relays_ad5e = リレー
|
||||
# Column title for reply composition
|
||||
Reply_3bf1 = 返信
|
||||
# Hover text for reply button
|
||||
Reply_to_this_note_f5de = この投稿に返信
|
||||
# Error message when reply note cannot be found
|
||||
Reply_to_unknown_note_4401 = 不明な投稿に返信しています
|
||||
# Fallback template for replying to user
|
||||
replying_to__user_15ab = { $user } に返信
|
||||
# Template for replying to user in unknown thread
|
||||
replying_to__user__in_someone_s_thread_e148 = 誰かのスレッドで { $user } に返信
|
||||
# Template for replying to note in different user's thread
|
||||
replying_to__user__s__note__in__thread_user__s__thread_daa8 = { $user }の { $note } の { $thread_user }の { $thread } に返信
|
||||
# Template for replying to user's note
|
||||
replying_to__user__s__note_ccba = { $user }の { $note } に返信
|
||||
# Template for replying to root thread
|
||||
replying_to__user__s__thread_444d = { $user }の { $thread } に返信
|
||||
# Fallback text when reply note is not found
|
||||
replying_to_a_note_e0bc = 投稿に返信
|
||||
# Hover text for repost button
|
||||
Repost_this_note_8e56 = このメモを再投稿
|
||||
# Label for reposted notes
|
||||
Reposted_61c8 = 再投稿
|
||||
# Label for reset note body font size, Appearance settings section
|
||||
Reset_4e60 = リセット
|
||||
# Label for reset zoom level, Appearance settings section
|
||||
Reset_62d4 = リセット
|
||||
# Heading for support section
|
||||
Running_into_a_bug_1796 = バグに遭遇しましたか?
|
||||
# Label for satoshis (Bitcoin unit) for custom zap amount input field
|
||||
SATS_45d7 = SATS
|
||||
# Unit label for satoshis (Bitcoin unit) for configuring default zap amount in wallet settings.
|
||||
sats_e5ec = sats
|
||||
# Button to save default zap amount
|
||||
Save_6f7c = 保存
|
||||
# Button label to save profile changes
|
||||
Save_changes_00db = 変更を保存
|
||||
# Column title for search page
|
||||
Search_c573 = 検索
|
||||
# Placeholder for search notes input field
|
||||
Search_notes_42a6 = 投稿を検索しましょう...
|
||||
# Search in progress message
|
||||
Searching_for___query_5d18 = 「{ $query }」を検索中
|
||||
# Description for Home column
|
||||
See_notes_from_your_contacts_ac16 = フォローしている人の投稿を表示
|
||||
# Description for universe column
|
||||
See_the_whole_nostr_universe_7694 = 全ユニバースを表示します
|
||||
# Button label to send a zap
|
||||
Send_1ea4 = 送信
|
||||
# Column title for app settings
|
||||
Settings_7a4f = 設定
|
||||
# Description for last note per user column
|
||||
Show_the_last_note_for_each_user_from_a_list_50e7 = 一覧から各ユーザーの最後の投稿を表示する
|
||||
# Button label to sign out of account
|
||||
Sign_out_337b = サインアウト
|
||||
# Title for someone else's notes column
|
||||
Someone_else_s_Notes_7e5f = 他の人の投稿
|
||||
# Title for someone else's notifications column
|
||||
Someone_else_s_Notifications_82e6 = 他の人の通知
|
||||
# Label for Sort replies newest first, others settings section
|
||||
Sort_replies_newest_first_b6c3 = 最新の返信を最初に並べ替え:
|
||||
# Description for contact list column
|
||||
Source_the_last_note_for_each_user_in_your_contact_list_e157 = フォローリストにある各ユーザーの最後の投稿を取得します
|
||||
# Description for hashtags column
|
||||
Stay_up_to_date_with_a_certain_hashtag_88e3 = 特定のハッシュタグで最新の情報を受け取ります
|
||||
# Description for notifications column
|
||||
Stay_up_to_date_with_notifications_and_mentions_6f4e = 通知とメンションの最新の情報を受け取ります
|
||||
# Description for someone else's notes column
|
||||
Stay_up_to_date_with_someone_else_s_notes___replies_464c = 他のユーザーの投稿と返信の最新の情報を受け取ります
|
||||
# Description for someone else's notifications column
|
||||
Stay_up_to_date_with_someone_else_s_notifications_and_mentions_3473 = 他のユーザーの投稿と返信の最新の情報を受け取ります
|
||||
# Description for individual user column
|
||||
Stay_up_to_date_with_someone_s_notes___replies_aa78 = 投稿と返信の最新の情報を受け取ります
|
||||
# Description for your notifications column
|
||||
Stay_up_to_date_with_your_notifications_and_mentions_e73e = あなたの通知とメンションの最新の情報を受け取ります
|
||||
# Step 1 label in support instructions
|
||||
Step_1_8656 = ステップ 1
|
||||
# Step 2 label in support instructions
|
||||
Step_2_d08d = ステップ 2
|
||||
# Label for storage settings section
|
||||
Storage_ed65 = ストレージ
|
||||
# Column title for subscribing to external user
|
||||
Subscribe_to_someone_else_s_notes_d1e9 = 他のユーザー投稿の購読
|
||||
# Column title for subscribing to individual user
|
||||
Subscribe_to_someone_s_notes_b3c8 = 投稿の購読
|
||||
# Support email address
|
||||
Support_email_44d9 = サポートメール:
|
||||
# Hover text for dark mode toggle button
|
||||
Switch_to_dark_mode_4dec = ダークモードに切り替える
|
||||
# Hover text for light mode toggle button
|
||||
Switch_to_light_mode_72ce = ライトモードに切り替える
|
||||
# Button text to load blurred media
|
||||
Tap_to_Load_4b05 = タップして読み込む
|
||||
# Message shown when Dave trial period has ended
|
||||
The_Dave_Nostr_AI_assistant_trial_has_ended_____Thanks_for_testing__Zap-enabled_Dave_coming_soon_c6c7 = Dave Nostr AI アシスタントトライアルが終了しました: (テストしていただきありがとうございます! Zap 対応デイブは近日公開予定です!
|
||||
# Label for theme, Appearance settings section
|
||||
Theme_4aac = テーマ:
|
||||
# Column title for note thread view
|
||||
Thread_0f20 = スレッド
|
||||
# Link text for thread references
|
||||
thread_ad1f = スレッド
|
||||
# Title for universe column
|
||||
Universe_e01e = ユニバース
|
||||
# Column title for universe feed
|
||||
Universe_ffaa = ユニバース
|
||||
# Checkbox label for using wallet only for current account
|
||||
Use_this_wallet_for_the_current_account_only_61dc = このウォレットを現在のアカウントにのみ使用する
|
||||
# Username and domain identification message
|
||||
username___at___domain___will_be_used_for_identification_a4fd = "{ $domain }" の "{ $username }" が識別に使用されます
|
||||
# Profile username field label
|
||||
Username_daa7 = ユーザー名
|
||||
# Label for view folder button, Storage settings section
|
||||
View_folder_9742 = フォルダを表示
|
||||
# Column title for wallet management
|
||||
Wallet_5e50 = ウォレット
|
||||
# Hint for deck name input field
|
||||
We_recommend_short_names_083e = 短い名前を推奨しています
|
||||
# Profile website field label
|
||||
Website_7980 = Web サイト
|
||||
# Placeholder for note input field
|
||||
Write_a_banger_note_here_bad2 = アツい一言をどうぞ...
|
||||
# Placeholder text for key input field
|
||||
Your_key_here_81bd = ここに鍵を入力...
|
||||
# Title for your notes column
|
||||
Your_Notes_f6db = 投稿
|
||||
# Title for your notifications column
|
||||
Your_Notifications_080d = 通知
|
||||
# Heading for zap (tip) action
|
||||
Zap_16b4 = Zap
|
||||
# Hover text for zap button
|
||||
Zap_this_note_42b2 = この投稿に Zap
|
||||
# Label for zoom level, Appearance settings section
|
||||
Zoom_Level_29a8 = 拡大率:
|
||||
|
||||
# Pluralized strings
|
||||
|
||||
# Search results count
|
||||
Got__count__results_for___query_85fb =
|
||||
{ $count ->
|
||||
[one] { $query } の結果を '{ $count }' 件取得しました
|
||||
*[other] ' { $query } の結果を '{ $count }' 件取得しました
|
||||
}
|
||||
@@ -55,8 +55,6 @@ Ask_dave_anything_33d1 = Perguntar ao Dave
|
||||
Banner_52ef = Destaque
|
||||
# Beta version label
|
||||
BETA_8e5d = Beta
|
||||
# Option in settings section to show the source client label at the bottom of the note
|
||||
Bottom_33c8 = Abaixo
|
||||
# Broadcast the note to all connected relays
|
||||
Broadcast_fe43 = Encaminhar
|
||||
# Broadcast the note only to local network relays
|
||||
@@ -163,10 +161,10 @@ Enter_your_key_0fca = Sua chave aqui
|
||||
Enter_your_public_key__npub___nostr_address__e_g___address____or_private_key__nsec___You_must_enter_your_private_key_to_be_able_to_post__reply__etc_48e9 = Insira sua chave pública (npub), endereço do Nostr (e.g. { $address }), ou chave privada (nsec). Você deve digitar sua chave privada para conseguir publicar, responder, etc.
|
||||
# Label for find user button
|
||||
Find_User_bd12 = Pesquisar usuário
|
||||
# Label for font size, Appearance settings section
|
||||
Font_size_dd73 = Tamanho da letra
|
||||
# Title for hashtags column
|
||||
Hashtags_f8e0 = #
|
||||
# Option in settings section to hide the source client label in note display
|
||||
Hide_281d = Ocultar
|
||||
# Title for Home column
|
||||
Home_8c19 = Início
|
||||
# Label for deck icon selection
|
||||
@@ -237,6 +235,8 @@ Notifications_d673 = Notificações
|
||||
Notifications_ef56 = Notificações
|
||||
# Relative time for very recent events (less than 3 seconds)
|
||||
now_2181 = Agora
|
||||
# Setting to turn on sorting replies so that the newest are shown first
|
||||
On_f412 = Ligar
|
||||
# Button label to open email client
|
||||
Open_Email_25e9 = Abrir E-mail
|
||||
# Instruction to open email client
|
||||
@@ -289,6 +289,8 @@ replying_to_a_note_e0bc = Respondendo nota
|
||||
Repost_this_note_8e56 = Republicar nota
|
||||
# Label for reposted notes
|
||||
Reposted_61c8 = Publicada
|
||||
# Label for reset note body font size, Appearance settings section
|
||||
Reset_4e60 = Redefinir
|
||||
# Label for reset zoom level, Appearance settings section
|
||||
Reset_62d4 = Resetar
|
||||
# Heading for support section
|
||||
@@ -315,8 +317,6 @@ See_the_whole_nostr_universe_7694 = Veja todo o universo Nostr
|
||||
Send_1ea4 = Enviar
|
||||
# Column title for app settings
|
||||
Settings_7a4f = Configurações
|
||||
# Label for Show source client, others settings section
|
||||
Show_source_client_9e31 = Mostrar cliente de origem
|
||||
# Description for last note per user column
|
||||
Show_the_last_note_for_each_user_from_a_list_50e7 = Mostrar a última nota para cada usuário de uma lista
|
||||
# Button label to sign out of account
|
||||
@@ -325,6 +325,8 @@ Sign_out_337b = Sair
|
||||
Someone_else_s_Notes_7e5f = Notas de outra pessoa
|
||||
# Title for someone else's notifications column
|
||||
Someone_else_s_Notifications_82e6 = Notificações de outra pessoa
|
||||
# Label for Sort replies newest first, others settings section
|
||||
Sort_replies_newest_first_b6c3 = Ordenar respostas mais recentes primeiro:
|
||||
# Description for contact list column
|
||||
Source_the_last_note_for_each_user_in_your_contact_list_e157 = Fonte da última nota para cada usuário em sua lista de contatos
|
||||
# Description for hashtags column
|
||||
@@ -349,6 +351,8 @@ Storage_ed65 = Armazenamento
|
||||
Subscribe_to_someone_else_s_notes_d1e9 = Inscrever-se em notas de outra pessoa
|
||||
# Column title for subscribing to individual user
|
||||
Subscribe_to_someone_s_notes_b3c8 = Inscrever-se nas notas de alguém
|
||||
# Support email address
|
||||
Support_email_44d9 = E-mail de suporte
|
||||
# Hover text for dark mode toggle button
|
||||
Switch_to_dark_mode_4dec = Mudar para modo escuro
|
||||
# Hover text for light mode toggle button
|
||||
@@ -363,8 +367,6 @@ Theme_4aac = Tema:
|
||||
Thread_0f20 = Fio
|
||||
# Link text for thread references
|
||||
thread_ad1f = Fio
|
||||
# Option in settings section to show the source client label at the top of the note
|
||||
Top_6aeb = Topo
|
||||
# Title for universe column
|
||||
Universe_e01e = Universo
|
||||
# Column title for universe feed
|
||||
@@ -376,7 +378,7 @@ username___at___domain___will_be_used_for_identification_a4fd = d = "{ $username
|
||||
# Profile username field label
|
||||
Username_daa7 = Usuário
|
||||
# Label for view folder button, Storage settings section
|
||||
View_folder_9742 = Visualizar pasta:
|
||||
View_folder_9742 = Visualizar pasta
|
||||
# Column title for wallet management
|
||||
Wallet_5e50 = Carteira
|
||||
# Hint for deck name input field
|
||||
|
||||
@@ -0,0 +1,410 @@
|
||||
# Main translation file for Notedeck
|
||||
# This file contains common UI strings used throughout the application
|
||||
# Auto-generated by extract_i18n.py - DO NOT EDIT MANUALLY
|
||||
|
||||
|
||||
# Regular strings
|
||||
|
||||
# Profile about/bio field label
|
||||
About_00c0 = Sobre
|
||||
# Column title for account management
|
||||
Accounts_f018 = Contas
|
||||
# Button label to add a relay
|
||||
Add_269d = Adicionar
|
||||
# Label for add column button
|
||||
Add_47df = Adicionar
|
||||
# Button label to add a different wallet
|
||||
Add_a_different_wallet_that_will_only_be_used_for_this_account_de8d = Adicionar uma carteira diferente que será usada apenas para esta conta
|
||||
# Error message for missing wallet
|
||||
Add_a_wallet_to_continue_d170 = Adicionar uma carteira para continuar
|
||||
# Button label to add a new account
|
||||
Add_account_1cfc = Adicionar conta
|
||||
# Column title for adding new account
|
||||
Add_Account_d06c = Adicionar conta
|
||||
# Column title for adding algorithm column
|
||||
Add_Algo_Column_0d75 = Adicionar coluna de algoritmo
|
||||
# Column title for adding new column
|
||||
Add_Column_c764 = Adicionar coluna
|
||||
# Column title for adding new deck
|
||||
Add_Deck_fabf = Adicionar aba
|
||||
# Column title for adding external notifications column
|
||||
Add_External_Notifications_Column_41ae = Adicionar coluna de notificações externas
|
||||
# Column title for adding hashtag column
|
||||
Add_Hashtag_Column_ebf4 = Adicionar coluna de marcadores
|
||||
# Column title for adding last notes column
|
||||
Add_Last_Notes_Column_bbad = Adicionar coluna de últimas notas
|
||||
# Column title for adding notifications column
|
||||
Add_Notifications_Column_79f8 = Adicionar coluna de notificações
|
||||
# Button label to add a relay
|
||||
Add_relay_269d = Adicionar relay
|
||||
# Button label to add a wallet
|
||||
Add_Wallet_d1be = Adicionar carteira
|
||||
# Title for algorithmic feeds column
|
||||
Algo_2452 = Algoritmo
|
||||
# Description for algorithmic feeds column
|
||||
Algorithmic_feeds_to_aid_in_note_discovery_d344 = Fontes de algoritmo para ajudar na descoberta de notas
|
||||
# Label for zap amount input field
|
||||
Amount_70f0 = Quantia
|
||||
# Label for appearance settings section
|
||||
Appearance_4c7f = Aparência
|
||||
# Button to send message to Dave AI assistant
|
||||
Ask_b7f4 = Perguntar
|
||||
# Placeholder text for Dave AI input field
|
||||
Ask_dave_anything_33d1 = Perguntar qualquer coisa...
|
||||
# Profile banner URL field label
|
||||
Banner_52ef = Faixa
|
||||
# Beta version label
|
||||
BETA_8e5d = BETA
|
||||
# Broadcast the note to all connected relays
|
||||
Broadcast_fe43 = Transmissão
|
||||
# Broadcast the note only to local network relays
|
||||
Broadcast_Local_7e50 = Transmissão local
|
||||
# Button label to cancel an action
|
||||
Cancel_ed3b = Cancelar
|
||||
# Label for cancel clear cache, Storage settings section
|
||||
Cancel_fd8b = Cancelar
|
||||
# Label for clear cache button, Storage settings section
|
||||
Clear_cache_dccb = Limpar cache
|
||||
# Hover text for editable zap amount
|
||||
Click_to_edit_0414 = Clica para editar
|
||||
# Column title for note composition
|
||||
Compose_Note_c094 = Compor nota
|
||||
# Label for configure relays, settings section
|
||||
Configure_relays_d156 = Configurar relays
|
||||
# Label for confirm clear cache, Storage settings section
|
||||
Confirm_9d9d = Confirmar
|
||||
# Button label to confirm an action
|
||||
Confirm_f8a6 = Confirmar
|
||||
# Status label for connected relay
|
||||
Connected_f8cc = Conectado
|
||||
# Status label for connecting relay
|
||||
Connecting_6b7e = A conectar...
|
||||
# Title for contact list column
|
||||
Contact_List_f85a = Lista de contactos
|
||||
# Column title for contact lists
|
||||
Contacts_7533 = Contactos
|
||||
# Column title for last notes per contact
|
||||
Contacts__last_notes_3f84 = Contactos (últimas notas)
|
||||
# Button label to copy logs
|
||||
Copy_a688 = Copiar
|
||||
# Button to copy media link to clipboard
|
||||
Copy_Link_dc7c = Copiar link
|
||||
# Copy the unique note identifier to clipboard
|
||||
Copy_Note_ID_6b45 = Copiar ID da nota
|
||||
# Copy the raw note data in JSON format to clipboard
|
||||
Copy_Note_JSON_9e4e = Copiar JSON da nota
|
||||
# Copy the author's public key to clipboard
|
||||
Copy_Pubkey_9cc4 = Copiar chave pública
|
||||
# Copy the text content of the note to clipboard
|
||||
Copy_Text_f81c = Copiar texto
|
||||
# Relative time in days
|
||||
count_d_b9be = { $count }d
|
||||
# Relative time in hours
|
||||
count_h_3ecb = { $count }h
|
||||
# Relative time in minutes
|
||||
count_m_b41e = { $count }m
|
||||
# Relative time in months
|
||||
count_mo_7aba = { $count } mês(es)
|
||||
# Relative time in seconds
|
||||
count_s_aa26 = { $count } s
|
||||
# Relative time in weeks
|
||||
count_w_7468 = { $count } semana(s)
|
||||
# Relative time in years
|
||||
count_y_9408 = { $count } ano(s)
|
||||
# Button to create a new account
|
||||
Create_Account_6994 = Criar conta
|
||||
# Button label to create a new deck
|
||||
Create_Deck_16b7 = Criar aba
|
||||
# Column title for custom timelines
|
||||
Custom_a69e = Personalizadas
|
||||
# Column title for zap amount customization
|
||||
Customize_Zap_Amount_cfc4 = Personalizar valor do zap
|
||||
# Column title for support page
|
||||
Damus_Support_27c0 = Suporte Damus
|
||||
# Label for Theme Dark, Appearance settings section
|
||||
Dark_85fe = Modo escuro
|
||||
# Label for deck name input field
|
||||
Deck_name_cd32 = Nome da aba
|
||||
# Label for decks section in side panel
|
||||
DECKS_1fad = ABAS
|
||||
# Label for default zap amount input
|
||||
Default_amount_per_zap_399d = Valor padrão por zap:
|
||||
# Name of the default deck feed
|
||||
Default_Deck_fcca = Aba padrão
|
||||
# Button label to delete a deck
|
||||
Delete_Deck_bb29 = Excluir aba
|
||||
# Tooltip for deleting a column
|
||||
Delete_this_column_8d5a = Apagar esta coluna
|
||||
# Button label to delete a wallet
|
||||
Delete_Wallet_d1d4 = Eliminar carteira
|
||||
# Profile display name field label
|
||||
Display_name_f9d9 = Nome a mostrar
|
||||
# Domain identification message
|
||||
domain___will_be_used_for_identification_b67e = "{ $domain }" será usado para identificação
|
||||
# Column title for editing deck
|
||||
Edit_Deck_4018 = Editar aba
|
||||
# Button label to edit a deck
|
||||
Edit_Deck_fd93 = Editar aba
|
||||
# Button label to edit user profile
|
||||
Edit_Profile_49e6 = Editar perfil
|
||||
# Column title for profile editing
|
||||
Edit_Profile_8ad4 = Editar perfil
|
||||
# Placeholder for hashtag input field
|
||||
Enter_the_desired_hashtags_here__for_multiple_space-separated_7a69 = Insere aqui os marcadores desejados (para múltiplos com espaços separados)
|
||||
# Placeholder for relay input field
|
||||
Enter_the_relay_here_1c8b = Insere aqui o relay
|
||||
# Hint text to prompt entering the user's public key.
|
||||
Enter_the_user_s_key__npub__hex__nip05__here_650c = Insere aqui a chave de utilizador (npub, hex, nip05)
|
||||
# Label for key input field. Key can be public key (npub), private key (nsec), or Nostr address (NIP-05).
|
||||
Enter_your_key_0fca = Insere a tua chave
|
||||
# Instructions for entering Nostr credentials
|
||||
Enter_your_public_key__npub___nostr_address__e_g___address____or_private_key__nsec___You_must_enter_your_private_key_to_be_able_to_post__reply__etc_48e9 = Insere a tua chave públca (npub), endereço nostr (por exemplo { $address }), ou chave privada (nsec). Tens de inserir a tua chave pública para publicar, responder, etc.
|
||||
# Label for find user button
|
||||
Find_User_bd12 = Encontrar utilizador
|
||||
# Label for font size, Appearance settings section
|
||||
Font_size_dd73 = Tamanho da letra:
|
||||
# Title for hashtags column
|
||||
Hashtags_f8e0 = Marcadores
|
||||
# Title for Home column
|
||||
Home_8c19 = Início
|
||||
# Label for deck icon selection
|
||||
Icon_b0ab = Ícone
|
||||
# Label for Image cache size, Storage settings section
|
||||
Image_cache_size_3004 = Tamanho do cache da imagem:
|
||||
# Title for individual user column
|
||||
Individual_b776 = Individual
|
||||
# Error message for invalid zap amount
|
||||
Invalid_amount_6630 = Quantia inválida
|
||||
# Error message for invalid key input
|
||||
Invalid_key_4726 = Chave inválida.
|
||||
# Error message for invalid Nostr Wallet Connect URI
|
||||
Invalid_NWC_URI_031b = NWC URI inválido.
|
||||
# Zap amount button for 100000 sats. Abbreviated because the button is too small to display the full amount.
|
||||
k_100K_686c = 100K
|
||||
# Zap amount button for 10000 sats. Abbreviated because the button is too small to display the full amount.
|
||||
k_10K_f7e6 = 10K
|
||||
# Zap amount button for 20000 sats. Abbreviated because the button is too small to display the full amount.
|
||||
k_20K_4977 = 20K
|
||||
# Zap amount button for 50000 sats. Abbreviated because the button is too small to display the full amount.
|
||||
k_50K_c2dc = 50K
|
||||
# Zap amount button for 5000 sats. Abbreviated because the button is too small to display the full amount.
|
||||
k_5K_f7e6 = 5K
|
||||
# Description for your notes column
|
||||
Keep_track_of_your_notes___replies_a334 = Acompanha as tuas notas e respostas
|
||||
# Label for language, Appearance settings section
|
||||
Language_e264 = Idioma:
|
||||
# Title for last note per user column
|
||||
Last_Note_per_User_17ad = Última nota por utilizador
|
||||
# Label for Theme Light, Appearance settings section
|
||||
Light_7475 = Modo claro
|
||||
# Bitcoin Lightning network address field label
|
||||
Lightning_network_address__lud16_ea51 = Endereço da rede Lightning (lud16)
|
||||
# Login page title
|
||||
Login_9eef = Iniciar sessão
|
||||
# Login button text
|
||||
Login_now___let_s_do_this_5630 = Entra agora — vamos fazer isto!
|
||||
# Text shown on blurred media from unfollowed users
|
||||
Media_from_someone_you_don_t_follow_5611 = Conteúdo de alguém que não segues
|
||||
# Tooltip for moving a column
|
||||
Moves_this_column_to_another_position_0d4b = Mover esta coluna para outra posição
|
||||
# Title for the user's deck
|
||||
My_Deck_4ac5 = Minha aba
|
||||
# Label asking if the user is new to Nostr. Underneath this label is a button to create an account.
|
||||
New_to_Nostr_a2fd = Nov@ no Nostr?
|
||||
# NIP-05 identity field label
|
||||
Nostr_address__NIP-05_identity_74a2 = Endereço Nostr (identificação NIP-05)
|
||||
# Default username when profile is not available
|
||||
nostrich_df29 = nostrich
|
||||
# Status label for disconnected relay
|
||||
Not_Connected_6292 = Não conectado
|
||||
# Link text for note references
|
||||
note_cad6 = nota
|
||||
# Beta product warning message
|
||||
Notedeck_is_a_beta_product__Expect_bugs_and_contact_us_when_you_run_into_issues_a671 = Notedeck é um produto beta. Espere bugs e contacte-nos quando tiver problemas.
|
||||
# Filter label for notes only view
|
||||
Notes_03fb = Notas
|
||||
# Label for notes-only filter
|
||||
Notes_60d2 = Notas
|
||||
# Filter label for notes and replies view
|
||||
Notes___Replies_1ec2 = Notas e respostas
|
||||
# Label for notes and replies filter
|
||||
Notes___Replies_6e3b = Notas e respostas
|
||||
# Column title for notifications
|
||||
Notifications_d673 = Notificações
|
||||
# Title for notifications column
|
||||
Notifications_ef56 = Notificações
|
||||
# Relative time for very recent events (less than 3 seconds)
|
||||
now_2181 = agora
|
||||
# Setting to turn on sorting replies so that the newest are shown first
|
||||
On_f412 = Ativado
|
||||
# Button label to open email client
|
||||
Open_Email_25e9 = Abrir e-mail
|
||||
# Instruction to open email client
|
||||
Open_your_default_email_client_to_get_help_from_the_Damus_team_68dc = Abre o teu cliente de e-mail padrão para obteres ajuda da equipa Damus
|
||||
# Label for others settings section
|
||||
Others_7267 = Outros
|
||||
# Placeholder text for NWC URI input
|
||||
Paste_your_NWC_URI_here_b471 = Cola o teu NWC URI aqui...
|
||||
# Error message for missing deck name
|
||||
Please_create_a_name_for_the_deck_38e7 = Cria um nome para a aba.
|
||||
# Error message for missing deck name and icon
|
||||
Please_create_a_name_for_the_deck_and_select_an_icon_0add = Cria um nome para a aba e seleciona um ícone.
|
||||
# Error message for missing deck icon
|
||||
Please_select_an_icon_655b = Seleciona um ícone.
|
||||
# Button label to post a note
|
||||
Post_now_8a49 = Publicar agora
|
||||
# Instruction for copying logs
|
||||
Press_the_button_below_to_copy_your_most_recent_logs_to_your_system_s_clipboard__Then_paste_it_into_your_email_322e = Prime o botão abaixo para copiar os teus registos mais recentes para a área de transferência do teu sistema. Depois cola-os no teu e-mail.
|
||||
# Profile picture URL field label
|
||||
Profile_picture_81ff = Foto de perfil
|
||||
# Column title for quote composition
|
||||
Quote_475c = Citação
|
||||
# Error message when quote note cannot be found
|
||||
Quote_of_unknown_note_e4f0 = Citação de nota desconhecida
|
||||
# Label for read-only profile mode
|
||||
Read_only_82ff = Somente leitura
|
||||
# Column title for relay management
|
||||
Relays_9d89 = Relays
|
||||
# Label for relay list section
|
||||
Relays_ad5e = Relays
|
||||
# Column title for reply composition
|
||||
Reply_3bf1 = Responder
|
||||
# Hover text for reply button
|
||||
Reply_to_this_note_f5de = Responder a esta nota
|
||||
# Error message when reply note cannot be found
|
||||
Reply_to_unknown_note_4401 = Responder a nota desconhecida
|
||||
# Fallback template for replying to user
|
||||
replying_to__user_15ab = responder a { $user }
|
||||
# Template for replying to user in unknown thread
|
||||
replying_to__user__in_someone_s_thread_e148 = responder a { $user } no tópico de alguém
|
||||
# Template for replying to note in different user's thread
|
||||
replying_to__user__s__note__in__thread_user__s__thread_daa8 = respondendo à { $note } de { $user } no { $thread } de { $thread_user }
|
||||
# Template for replying to user's note
|
||||
replying_to__user__s__note_ccba = respondendo à { $note } de { $user }
|
||||
# Template for replying to root thread
|
||||
replying_to__user__s__thread_444d = respondendo ao { $thread } de { $user }
|
||||
# Fallback text when reply note is not found
|
||||
replying_to_a_note_e0bc = respondendo a uma nota
|
||||
# Hover text for repost button
|
||||
Repost_this_note_8e56 = Republicar esta nota
|
||||
# Label for reposted notes
|
||||
Reposted_61c8 = Republicado
|
||||
# Label for reset note body font size, Appearance settings section
|
||||
Reset_4e60 = Redefinir
|
||||
# Label for reset zoom level, Appearance settings section
|
||||
Reset_62d4 = Redefinir
|
||||
# Heading for support section
|
||||
Running_into_a_bug_1796 = Encontraste um bug?
|
||||
# Label for satoshis (Bitcoin unit) for custom zap amount input field
|
||||
SATS_45d7 = SATS
|
||||
# Unit label for satoshis (Bitcoin unit) for configuring default zap amount in wallet settings.
|
||||
sats_e5ec = sats
|
||||
# Button to save default zap amount
|
||||
Save_6f7c = Guardar
|
||||
# Button label to save profile changes
|
||||
Save_changes_00db = Guardar alterações
|
||||
# Column title for search page
|
||||
Search_c573 = Procurar
|
||||
# Placeholder for search notes input field
|
||||
Search_notes_42a6 = Procurar notas...
|
||||
# Search in progress message
|
||||
Searching_for___query_5d18 = Procurando por '{ $query }'
|
||||
# Description for Home column
|
||||
See_notes_from_your_contacts_ac16 = Ver notas dos meus contactos
|
||||
# Description for universe column
|
||||
See_the_whole_nostr_universe_7694 = Ver notas de todo o universo nostr
|
||||
# Button label to send a zap
|
||||
Send_1ea4 = Enviar
|
||||
# Column title for app settings
|
||||
Settings_7a4f = Configurações
|
||||
# Description for last note per user column
|
||||
Show_the_last_note_for_each_user_from_a_list_50e7 = Mostrar a última nota para cada utilizador a partir de uma lista
|
||||
# Button label to sign out of account
|
||||
Sign_out_337b = Terminar sessão
|
||||
# Title for someone else's notes column
|
||||
Someone_else_s_Notes_7e5f = Notas de outra pessoa
|
||||
# Title for someone else's notifications column
|
||||
Someone_else_s_Notifications_82e6 = Notificações de outra pessoa
|
||||
# Label for Sort replies newest first, others settings section
|
||||
Sort_replies_newest_first_b6c3 = Ordenar respostas mais recentes antes:
|
||||
# Description for contact list column
|
||||
Source_the_last_note_for_each_user_in_your_contact_list_e157 = Origem da última nota para cada utilizador na minha lista
|
||||
# Description for hashtags column
|
||||
Stay_up_to_date_with_a_certain_hashtag_88e3 = Atualizações com um dado marcador
|
||||
# Description for notifications column
|
||||
Stay_up_to_date_with_notifications_and_mentions_6f4e = Atualizações com notificações e menções
|
||||
# Description for someone else's notes column
|
||||
Stay_up_to_date_with_someone_else_s_notes___replies_464c = Atualizar-me de notas e respostas de outra pessoa
|
||||
# Description for someone else's notifications column
|
||||
Stay_up_to_date_with_someone_else_s_notifications_and_mentions_3473 = Atualizar-me de notificações e menções de outra pessoa
|
||||
# Description for individual user column
|
||||
Stay_up_to_date_with_someone_s_notes___replies_aa78 = Atualizar-me de notas e respostas de outra pessoa
|
||||
# Description for your notifications column
|
||||
Stay_up_to_date_with_your_notifications_and_mentions_e73e = Atualizar-me de notificações e menções
|
||||
# Step 1 label in support instructions
|
||||
Step_1_8656 = Passo 1
|
||||
# Step 2 label in support instructions
|
||||
Step_2_d08d = Passo 2
|
||||
# Label for storage settings section
|
||||
Storage_ed65 = Armazenamento
|
||||
# Column title for subscribing to external user
|
||||
Subscribe_to_someone_else_s_notes_d1e9 = Subscrever as notas de outra pessoa
|
||||
# Column title for subscribing to individual user
|
||||
Subscribe_to_someone_s_notes_b3c8 = Subscrever as notas de alguém
|
||||
# Support email address
|
||||
Support_email_44d9 = E-mail de suporte:
|
||||
# Hover text for dark mode toggle button
|
||||
Switch_to_dark_mode_4dec = Mudar para o modo escuro
|
||||
# Hover text for light mode toggle button
|
||||
Switch_to_light_mode_72ce = Mudar para o modo claro
|
||||
# Button text to load blurred media
|
||||
Tap_to_Load_4b05 = Toca para carregar
|
||||
# Message shown when Dave trial period has ended
|
||||
The_Dave_Nostr_AI_assistant_trial_has_ended_____Thanks_for_testing__Zap-enabled_Dave_coming_soon_c6c7 = O teste do assistente de IA Dave Nost terminou :(. Obrigado por testares! Dave com ativação de ZAPS em breve!
|
||||
# Label for theme, Appearance settings section
|
||||
Theme_4aac = Tema:
|
||||
# Column title for note thread view
|
||||
Thread_0f20 = Tópico
|
||||
# Link text for thread references
|
||||
thread_ad1f = tópico
|
||||
# Title for universe column
|
||||
Universe_e01e = Universo
|
||||
# Column title for universe feed
|
||||
Universe_ffaa = Universo
|
||||
# Checkbox label for using wallet only for current account
|
||||
Use_this_wallet_for_the_current_account_only_61dc = Usar esta carteira apenas para a conta atual
|
||||
# Username and domain identification message
|
||||
username___at___domain___will_be_used_for_identification_a4fd = "{ $username }" em "{ $domain }" será usado para identificação
|
||||
# Profile username field label
|
||||
Username_daa7 = Nome de utilizador
|
||||
# Label for view folder button, Storage settings section
|
||||
View_folder_9742 = Ver pasta
|
||||
# Column title for wallet management
|
||||
Wallet_5e50 = Carteira
|
||||
# Hint for deck name input field
|
||||
We_recommend_short_names_083e = Recomendamos nomes curtos
|
||||
# Profile website field label
|
||||
Website_7980 = Website
|
||||
# Placeholder for note input field
|
||||
Write_a_banger_note_here_bad2 = Escreve uma nota sonante aqui...
|
||||
# Placeholder text for key input field
|
||||
Your_key_here_81bd = A tua chave aqui...
|
||||
# Title for your notes column
|
||||
Your_Notes_f6db = Minhas notas
|
||||
# Title for your notifications column
|
||||
Your_Notifications_080d = Minhas notificações
|
||||
# Heading for zap (tip) action
|
||||
Zap_16b4 = Zap
|
||||
# Hover text for zap button
|
||||
Zap_this_note_42b2 = Enviar zaps a esta nota
|
||||
# Label for zoom level, Appearance settings section
|
||||
Zoom_Level_29a8 = Nível de zoom:
|
||||
|
||||
# Pluralized strings
|
||||
|
||||
# Search results count
|
||||
Got__count__results_for___query_85fb =
|
||||
{ $count ->
|
||||
[one] { $count } resultado obtido para '{ $query }'
|
||||
*[other] { $count } resultados obtidos para '{ $query }'
|
||||
}
|
||||
@@ -55,8 +55,6 @@ Ask_dave_anything_33d1 = ถามเดฟได้ทุกเรื่อง.
|
||||
Banner_52ef = ภาพปก
|
||||
# Beta version label
|
||||
BETA_8e5d = เบต้า
|
||||
# Option in settings section to show the source client label at the bottom of the note
|
||||
Bottom_33c8 = ด้านล่าง
|
||||
# Broadcast the note to all connected relays
|
||||
Broadcast_fe43 = เผยแพร่
|
||||
# Broadcast the note only to local network relays
|
||||
@@ -165,10 +163,10 @@ Enter_your_public_key__npub___nostr_address__e_g___address____or_private_key__ns
|
||||
คุณจำเป็นต้องใส่คีย์ส่วนตัวเพื่อทำการโพสต์, ตอบกลับ และอื่นๆ
|
||||
# Label for find user button
|
||||
Find_User_bd12 = ค้นหาผู้ใช้
|
||||
# Label for font size, Appearance settings section
|
||||
Font_size_dd73 = Font size:
|
||||
# Title for hashtags column
|
||||
Hashtags_f8e0 = แฮชแท็ก
|
||||
# Option in settings section to hide the source client label in note display
|
||||
Hide_281d = ซ่อน
|
||||
# Title for Home column
|
||||
Home_8c19 = หน้าแรก
|
||||
# Label for deck icon selection
|
||||
@@ -239,6 +237,8 @@ Notifications_d673 = การแจ้งเตือน
|
||||
Notifications_ef56 = การแจ้งเตือน
|
||||
# Relative time for very recent events (less than 3 seconds)
|
||||
now_2181 = เมื่อสักครู่
|
||||
# Setting to turn on sorting replies so that the newest are shown first
|
||||
On_f412 = On
|
||||
# Button label to open email client
|
||||
Open_Email_25e9 = เปิดอีเมล
|
||||
# Instruction to open email client
|
||||
@@ -291,6 +291,8 @@ replying_to_a_note_e0bc = ตอบกลับโน้ต
|
||||
Repost_this_note_8e56 = รีโพสต์โน้ตนี้
|
||||
# Label for reposted notes
|
||||
Reposted_61c8 = รีโพสต์แล้ว
|
||||
# Label for reset note body font size, Appearance settings section
|
||||
Reset_4e60 = Reset
|
||||
# Label for reset zoom level, Appearance settings section
|
||||
Reset_62d4 = รีเซ็ต
|
||||
# Heading for support section
|
||||
@@ -317,8 +319,6 @@ See_the_whole_nostr_universe_7694 = ท่องจักรวาล Nostr ท
|
||||
Send_1ea4 = ส่ง
|
||||
# Column title for app settings
|
||||
Settings_7a4f = การตั้งค่า
|
||||
# Label for Show source client, others settings section
|
||||
Show_source_client_9e31 = แสดงไคลเอนต์ต้นทาง
|
||||
# Description for last note per user column
|
||||
Show_the_last_note_for_each_user_from_a_list_50e7 = แสดงโน้ตล่าสุดของผู้ใช้แต่ละคนจากรายการ
|
||||
# Button label to sign out of account
|
||||
@@ -327,6 +327,8 @@ Sign_out_337b = ออกจากระบบ
|
||||
Someone_else_s_Notes_7e5f = โน้ตของผู้อื่น
|
||||
# Title for someone else's notifications column
|
||||
Someone_else_s_Notifications_82e6 = การแจ้งเตือนของผู้อื่น
|
||||
# Label for Sort replies newest first, others settings section
|
||||
Sort_replies_newest_first_b6c3 = Sort replies newest first:
|
||||
# Description for contact list column
|
||||
Source_the_last_note_for_each_user_in_your_contact_list_e157 = ดึงโน้ตล่าสุดของผู้ใช้แต่ละคนในรายชื่อผู้ติดต่อ
|
||||
# Description for hashtags column
|
||||
@@ -351,6 +353,8 @@ Storage_ed65 = พื้นที่จัดเก็บ
|
||||
Subscribe_to_someone_else_s_notes_d1e9 = ติดตามโน้ตของผู้อื่น
|
||||
# Column title for subscribing to individual user
|
||||
Subscribe_to_someone_s_notes_b3c8 = ติดตามโน้ตของผู้อื่น
|
||||
# Support email address
|
||||
Support_email_44d9 = Support email:
|
||||
# Hover text for dark mode toggle button
|
||||
Switch_to_dark_mode_4dec = เปลี่ยนเป็นโหมดมืด
|
||||
# Hover text for light mode toggle button
|
||||
@@ -365,8 +369,6 @@ Theme_4aac = ธีม:
|
||||
Thread_0f20 = เธรด
|
||||
# Link text for thread references
|
||||
thread_ad1f = เธรด
|
||||
# Option in settings section to show the source client label at the top of the note
|
||||
Top_6aeb = ด้านบน
|
||||
# Title for universe column
|
||||
Universe_e01e = จักรวาล
|
||||
# Column title for universe feed
|
||||
@@ -378,7 +380,7 @@ username___at___domain___will_be_used_for_identification_a4fd = "{ $username }"
|
||||
# Profile username field label
|
||||
Username_daa7 = ชื่อผู้ใช้
|
||||
# Label for view folder button, Storage settings section
|
||||
View_folder_9742 = ดูโฟลเดอร์:
|
||||
View_folder_9742 = ดูโฟลเดอร์
|
||||
# Column title for wallet management
|
||||
Wallet_5e50 = วอลเล็ต
|
||||
# Hint for deck name input field
|
||||
|
||||
@@ -55,8 +55,6 @@ Ask_dave_anything_33d1 = 向 Dave 提问任何问题…
|
||||
Banner_52ef = 横幅
|
||||
# Beta version label
|
||||
BETA_8e5d = BETA
|
||||
# Option in settings section to show the source client label at the bottom of the note
|
||||
Bottom_33c8 = 底部
|
||||
# Broadcast the note to all connected relays
|
||||
Broadcast_fe43 = 广播
|
||||
# Broadcast the note only to local network relays
|
||||
@@ -163,10 +161,10 @@ Enter_your_key_0fca = 请输入你的密钥
|
||||
Enter_your_public_key__npub___nostr_address__e_g___address____or_private_key__nsec___You_must_enter_your_private_key_to_be_able_to_post__reply__etc_48e9 = 请输入你的公钥(npub)、nostr 地址(如 { $address })、或私钥(nsec)。 你必须输入你的私钥才能发帖、回复等等。
|
||||
# Label for find user button
|
||||
Find_User_bd12 = 查找用户
|
||||
# Label for font size, Appearance settings section
|
||||
Font_size_dd73 = 字体大小:
|
||||
# Title for hashtags column
|
||||
Hashtags_f8e0 = 标签
|
||||
# Option in settings section to hide the source client label in note display
|
||||
Hide_281d = 隐藏
|
||||
# Title for Home column
|
||||
Home_8c19 = 主页
|
||||
# Label for deck icon selection
|
||||
@@ -237,6 +235,8 @@ Notifications_d673 = 通知
|
||||
Notifications_ef56 = 通知
|
||||
# Relative time for very recent events (less than 3 seconds)
|
||||
now_2181 = 刚刚
|
||||
# Setting to turn on sorting replies so that the newest are shown first
|
||||
On_f412 = 开启
|
||||
# Button label to open email client
|
||||
Open_Email_25e9 = 打开电子邮箱
|
||||
# Instruction to open email client
|
||||
@@ -289,6 +289,8 @@ replying_to_a_note_e0bc = 正在回复笔记
|
||||
Repost_this_note_8e56 = 转发此笔记
|
||||
# Label for reposted notes
|
||||
Reposted_61c8 = 已转发
|
||||
# Label for reset note body font size, Appearance settings section
|
||||
Reset_4e60 = 重置
|
||||
# Label for reset zoom level, Appearance settings section
|
||||
Reset_62d4 = 重置
|
||||
# Heading for support section
|
||||
@@ -315,8 +317,6 @@ See_the_whole_nostr_universe_7694 = 查看整个 nostr 宇宙
|
||||
Send_1ea4 = 发送
|
||||
# Column title for app settings
|
||||
Settings_7a4f = 设置
|
||||
# Label for Show source client, others settings section
|
||||
Show_source_client_9e31 = 显示来源客户端
|
||||
# Description for last note per user column
|
||||
Show_the_last_note_for_each_user_from_a_list_50e7 = 显示列表中每个用户的最新一条笔记
|
||||
# Button label to sign out of account
|
||||
@@ -325,6 +325,8 @@ Sign_out_337b = 登出
|
||||
Someone_else_s_Notes_7e5f = 其他人的笔记
|
||||
# Title for someone else's notifications column
|
||||
Someone_else_s_Notifications_82e6 = 其他人的通知
|
||||
# Label for Sort replies newest first, others settings section
|
||||
Sort_replies_newest_first_b6c3 = 按最新排序回复:
|
||||
# Description for contact list column
|
||||
Source_the_last_note_for_each_user_in_your_contact_list_e157 = 获取你的联系人列表中每个用户的最新一条笔记
|
||||
# Description for hashtags column
|
||||
@@ -349,6 +351,8 @@ Storage_ed65 = 存储
|
||||
Subscribe_to_someone_else_s_notes_d1e9 = 订阅他人的笔记
|
||||
# Column title for subscribing to individual user
|
||||
Subscribe_to_someone_s_notes_b3c8 = 订阅某人的笔记
|
||||
# Support email address
|
||||
Support_email_44d9 = 支持电子邮件:
|
||||
# Hover text for dark mode toggle button
|
||||
Switch_to_dark_mode_4dec = 切换到暗色模式
|
||||
# Hover text for light mode toggle button
|
||||
@@ -363,8 +367,6 @@ Theme_4aac = 主题:
|
||||
Thread_0f20 = 帖子
|
||||
# Link text for thread references
|
||||
thread_ad1f = 帖子
|
||||
# Option in settings section to show the source client label at the top of the note
|
||||
Top_6aeb = 顶部
|
||||
# Title for universe column
|
||||
Universe_e01e = 宇宙
|
||||
# Column title for universe feed
|
||||
@@ -376,7 +378,7 @@ username___at___domain___will_be_used_for_identification_a4fd = "{ $username }"
|
||||
# Profile username field label
|
||||
Username_daa7 = 用户名
|
||||
# Label for view folder button, Storage settings section
|
||||
View_folder_9742 = 查看文件夹:
|
||||
View_folder_9742 = 查看文件夹
|
||||
# Column title for wallet management
|
||||
Wallet_5e50 = 钱包
|
||||
# Hint for deck name input field
|
||||
|
||||
@@ -55,8 +55,6 @@ Ask_dave_anything_33d1 = 向 Dave 提問任何問題...
|
||||
Banner_52ef = 橫幅
|
||||
# Beta version label
|
||||
BETA_8e5d = 測試版
|
||||
# Option in settings section to show the source client label at the bottom of the note
|
||||
Bottom_33c8 = 底部
|
||||
# Broadcast the note to all connected relays
|
||||
Broadcast_fe43 = 廣播
|
||||
# Broadcast the note only to local network relays
|
||||
@@ -163,10 +161,10 @@ Enter_your_key_0fca = 請輸入你的密鑰
|
||||
Enter_your_public_key__npub___nostr_address__e_g___address____or_private_key__nsec___You_must_enter_your_private_key_to_be_able_to_post__reply__etc_48e9 = 請輸入你的公鑰(npub)、nostr 地址(如 { $address })、或私鑰(nsec)。你必須輸入你的私鑰才能發貼、回覆等等。
|
||||
# Label for find user button
|
||||
Find_User_bd12 = 查找用戶
|
||||
# Label for font size, Appearance settings section
|
||||
Font_size_dd73 = 字體大小:
|
||||
# Title for hashtags column
|
||||
Hashtags_f8e0 = 標籤
|
||||
# Option in settings section to hide the source client label in note display
|
||||
Hide_281d = 隱藏
|
||||
# Title for Home column
|
||||
Home_8c19 = 主頁
|
||||
# Label for deck icon selection
|
||||
@@ -237,6 +235,8 @@ Notifications_d673 = 通知
|
||||
Notifications_ef56 = 通知
|
||||
# Relative time for very recent events (less than 3 seconds)
|
||||
now_2181 = 剛剛
|
||||
# Setting to turn on sorting replies so that the newest are shown first
|
||||
On_f412 = 開啟
|
||||
# Button label to open email client
|
||||
Open_Email_25e9 = 打開電子郵箱
|
||||
# Instruction to open email client
|
||||
@@ -289,6 +289,8 @@ replying_to_a_note_e0bc = 正在回覆筆記
|
||||
Repost_this_note_8e56 = 轉發此筆記
|
||||
# Label for reposted notes
|
||||
Reposted_61c8 = 已轉發
|
||||
# Label for reset note body font size, Appearance settings section
|
||||
Reset_4e60 = 重置
|
||||
# Label for reset zoom level, Appearance settings section
|
||||
Reset_62d4 = 重置
|
||||
# Heading for support section
|
||||
@@ -315,8 +317,6 @@ See_the_whole_nostr_universe_7694 = 查看整個 nostr 宇宙
|
||||
Send_1ea4 = 發送
|
||||
# Column title for app settings
|
||||
Settings_7a4f = 設置
|
||||
# Label for Show source client, others settings section
|
||||
Show_source_client_9e31 = 顯示來源客戶端
|
||||
# Description for last note per user column
|
||||
Show_the_last_note_for_each_user_from_a_list_50e7 = 顯示列表中每個用戶的最後一條筆記
|
||||
# Button label to sign out of account
|
||||
@@ -325,6 +325,8 @@ Sign_out_337b = 登出
|
||||
Someone_else_s_Notes_7e5f = 其他人的筆記
|
||||
# Title for someone else's notifications column
|
||||
Someone_else_s_Notifications_82e6 = 其他人的通知
|
||||
# Label for Sort replies newest first, others settings section
|
||||
Sort_replies_newest_first_b6c3 = 按最新排序回覆:
|
||||
# Description for contact list column
|
||||
Source_the_last_note_for_each_user_in_your_contact_list_e157 = 獲取你的聯繫人列表中每個用戶的最新一條筆記
|
||||
# Description for hashtags column
|
||||
@@ -349,6 +351,8 @@ Storage_ed65 = 儲存
|
||||
Subscribe_to_someone_else_s_notes_d1e9 = 訂閱他人的筆記
|
||||
# Column title for subscribing to individual user
|
||||
Subscribe_to_someone_s_notes_b3c8 = 訂閱某人的筆記
|
||||
# Support email address
|
||||
Support_email_44d9 = 支持電子郵件:
|
||||
# Hover text for dark mode toggle button
|
||||
Switch_to_dark_mode_4dec = 切換到暗色模式
|
||||
# Hover text for light mode toggle button
|
||||
@@ -363,8 +367,6 @@ Theme_4aac = 主題:
|
||||
Thread_0f20 = 串文
|
||||
# Link text for thread references
|
||||
thread_ad1f = 串文
|
||||
# Option in settings section to show the source client label at the top of the note
|
||||
Top_6aeb = 頂部
|
||||
# Title for universe column
|
||||
Universe_e01e = 宇宙
|
||||
# Column title for universe feed
|
||||
@@ -376,7 +378,7 @@ username___at___domain___will_be_used_for_identification_a4fd = "{ $username }"
|
||||
# Profile username field label
|
||||
Username_daa7 = 用戶名
|
||||
# Label for view folder button, Storage settings section
|
||||
View_folder_9742 = 查看文件夾:
|
||||
View_folder_9742 = 查看文件夾
|
||||
# Column title for wallet management
|
||||
Wallet_5e50 = 錢包
|
||||
# Hint for deck name input field
|
||||
|
||||
@@ -135,7 +135,7 @@ pub fn setup_multicast_relay(
|
||||
std::thread::spawn(move || {
|
||||
let mut events = Events::with_capacity(1);
|
||||
loop {
|
||||
if let Err(err) = poll.poll(&mut events, Some(Duration::from_millis(100))) {
|
||||
if let Err(err) = poll.poll(&mut events, None) {
|
||||
error!("multicast socket poll error: {err}. ending multicast poller.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,13 @@ nostrdb = { workspace = true }
|
||||
jni = { workspace = true }
|
||||
url = { workspace = true }
|
||||
strum = { workspace = true }
|
||||
blurhash = { workspace = true }
|
||||
strum_macros = { workspace = true }
|
||||
dirs = { workspace = true }
|
||||
enostr = { workspace = true }
|
||||
nostr = { workspace = true }
|
||||
egui = { workspace = true }
|
||||
egui_extras = { workspace = true }
|
||||
eframe = { workspace = true }
|
||||
image = { workspace = true }
|
||||
base32 = { workspace = true }
|
||||
@@ -45,7 +47,9 @@ fluent-langneg = { workspace = true }
|
||||
unic-langid = { workspace = true }
|
||||
once_cell = { workspace = true }
|
||||
md5 = { workspace = true }
|
||||
bitflags = { workspace = true }
|
||||
regex = "1"
|
||||
chrono = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = { workspace = true }
|
||||
|
||||
+79
-21
@@ -1,13 +1,14 @@
|
||||
use crate::account::FALLBACK_PUBKEY;
|
||||
use crate::i18n::Localization;
|
||||
use crate::persist::{AppSizeHandler, ZoomHandler};
|
||||
use crate::persist::{AppSizeHandler, SettingsHandler};
|
||||
use crate::wallet::GlobalWallet;
|
||||
use crate::zaps::Zaps;
|
||||
use crate::Error;
|
||||
use crate::JobPool;
|
||||
use crate::NotedeckOptions;
|
||||
use crate::{
|
||||
frame_history::FrameHistory, AccountStorage, Accounts, AppContext, Args, DataPath,
|
||||
DataPathType, Directory, Images, NoteAction, NoteCache, RelayDebugView, ThemeHandler,
|
||||
UnknownIds,
|
||||
DataPathType, Directory, Images, NoteAction, NoteCache, RelayDebugView, UnknownIds,
|
||||
};
|
||||
use egui::Margin;
|
||||
use egui::ThemePreference;
|
||||
@@ -19,6 +20,7 @@ use std::collections::BTreeSet;
|
||||
use std::path::Path;
|
||||
use std::rc::Rc;
|
||||
use tracing::{error, info};
|
||||
use unic_langid::{LanguageIdentifier, LanguageIdentifierError};
|
||||
|
||||
pub enum AppAction {
|
||||
Note(NoteAction),
|
||||
@@ -40,9 +42,8 @@ pub struct Notedeck {
|
||||
global_wallet: GlobalWallet,
|
||||
path: DataPath,
|
||||
args: Args,
|
||||
theme: ThemeHandler,
|
||||
settings: SettingsHandler,
|
||||
app: Option<Rc<RefCell<dyn App>>>,
|
||||
zoom: ZoomHandler,
|
||||
app_size: AppSizeHandler,
|
||||
unrecognized_args: BTreeSet<String>,
|
||||
clipboard: Clipboard,
|
||||
@@ -99,10 +100,18 @@ impl eframe::App for Notedeck {
|
||||
|
||||
render_notedeck(self, ctx);
|
||||
|
||||
self.zoom.try_save_zoom_factor(ctx);
|
||||
self.settings.update_batch(|settings| {
|
||||
settings.zoom_factor = ctx.zoom_factor();
|
||||
settings.locale = self.i18n.get_current_locale().to_string();
|
||||
settings.theme = if ctx.style().visuals.dark_mode {
|
||||
ThemePreference::Dark
|
||||
} else {
|
||||
ThemePreference::Light
|
||||
};
|
||||
});
|
||||
self.app_size.try_save_app_size(ctx);
|
||||
|
||||
if self.args.relay_debug {
|
||||
if self.args.options.contains(NotedeckOptions::RelayDebug) {
|
||||
if self.pool.debug.is_none() {
|
||||
self.pool.use_debug();
|
||||
}
|
||||
@@ -159,10 +168,11 @@ impl Notedeck {
|
||||
1024usize * 1024usize * 1024usize * 1024usize
|
||||
};
|
||||
|
||||
let theme = ThemeHandler::new(&path);
|
||||
let settings = SettingsHandler::new(&path).load();
|
||||
|
||||
let config = Config::new().set_ingester_threads(2).set_mapsize(map_size);
|
||||
|
||||
let keystore = if parsed_args.use_keystore {
|
||||
let keystore = if parsed_args.options.contains(NotedeckOptions::UseKeystore) {
|
||||
let keys_path = path.path(DataPathType::Keys);
|
||||
let selected_key_path = path.path(DataPathType::SelectedKey);
|
||||
Some(AccountStorage::new(
|
||||
@@ -213,12 +223,8 @@ impl Notedeck {
|
||||
|
||||
let img_cache = Images::new(img_cache_dir);
|
||||
let note_cache = NoteCache::default();
|
||||
let zoom = ZoomHandler::new(&path);
|
||||
let app_size = AppSizeHandler::new(&path);
|
||||
|
||||
if let Some(z) = zoom.get_zoom_factor() {
|
||||
ctx.set_zoom_factor(z);
|
||||
}
|
||||
let app_size = AppSizeHandler::new(&path);
|
||||
|
||||
// migrate
|
||||
if let Err(e) = img_cache.migrate_v0() {
|
||||
@@ -231,15 +237,22 @@ impl Notedeck {
|
||||
|
||||
// Initialize localization
|
||||
let mut i18n = Localization::new();
|
||||
|
||||
let setting_locale: Result<LanguageIdentifier, LanguageIdentifierError> =
|
||||
settings.locale().parse();
|
||||
|
||||
if setting_locale.is_ok() {
|
||||
if let Err(err) = i18n.set_locale(setting_locale.unwrap()) {
|
||||
error!("{err}");
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(locale) = &parsed_args.locale {
|
||||
if let Err(err) = i18n.set_locale(locale.to_owned()) {
|
||||
error!("{err}");
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize global i18n context
|
||||
//crate::i18n::init_global_i18n(i18n.clone());
|
||||
|
||||
Self {
|
||||
ndb,
|
||||
img_cache,
|
||||
@@ -250,9 +263,8 @@ impl Notedeck {
|
||||
global_wallet,
|
||||
path: path.clone(),
|
||||
args: parsed_args,
|
||||
theme,
|
||||
settings,
|
||||
app: None,
|
||||
zoom,
|
||||
app_size,
|
||||
unrecognized_args,
|
||||
frame_history: FrameHistory::default(),
|
||||
@@ -263,6 +275,44 @@ impl Notedeck {
|
||||
}
|
||||
}
|
||||
|
||||
/// Setup egui context
|
||||
pub fn setup(&self, ctx: &egui::Context) {
|
||||
// Initialize global i18n context
|
||||
//crate::i18n::init_global_i18n(i18n.clone());
|
||||
crate::setup::setup_egui_context(
|
||||
ctx,
|
||||
self.args.options,
|
||||
self.theme(),
|
||||
self.note_body_font_size(),
|
||||
self.zoom_factor(),
|
||||
);
|
||||
}
|
||||
|
||||
/// ensure we recognized all the arguments
|
||||
pub fn check_args(&self, other_app_args: &BTreeSet<String>) -> Result<(), Error> {
|
||||
let completely_unrecognized: Vec<String> = self
|
||||
.unrecognized_args()
|
||||
.intersection(other_app_args)
|
||||
.cloned()
|
||||
.collect();
|
||||
if !completely_unrecognized.is_empty() {
|
||||
let err = format!("Unrecognized arguments: {completely_unrecognized:?}");
|
||||
tracing::error!("{}", &err);
|
||||
return Err(Error::Generic(err));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn options(&self) -> NotedeckOptions {
|
||||
self.args.options
|
||||
}
|
||||
|
||||
pub fn has_option(&self, option: NotedeckOptions) -> bool {
|
||||
self.options().contains(option)
|
||||
}
|
||||
|
||||
pub fn app<A: App + 'static>(mut self, app: A) -> Self {
|
||||
self.set_app(app);
|
||||
self
|
||||
@@ -279,7 +329,7 @@ impl Notedeck {
|
||||
global_wallet: &mut self.global_wallet,
|
||||
path: &self.path,
|
||||
args: &self.args,
|
||||
theme: &mut self.theme,
|
||||
settings: &mut self.settings,
|
||||
clipboard: &mut self.clipboard,
|
||||
zaps: &mut self.zaps,
|
||||
frame_history: &mut self.frame_history,
|
||||
@@ -297,7 +347,15 @@ impl Notedeck {
|
||||
}
|
||||
|
||||
pub fn theme(&self) -> ThemePreference {
|
||||
self.theme.load()
|
||||
self.settings.theme()
|
||||
}
|
||||
|
||||
pub fn note_body_font_size(&self) -> f32 {
|
||||
self.settings.note_body_font_size()
|
||||
}
|
||||
|
||||
pub fn zoom_factor(&self) -> f32 {
|
||||
self.settings.zoom_factor()
|
||||
}
|
||||
|
||||
pub fn unrecognized_args(&self) -> &BTreeSet<String> {
|
||||
|
||||
+14
-26
@@ -1,23 +1,15 @@
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
use crate::NotedeckOptions;
|
||||
use enostr::{Keypair, Pubkey, SecretKey};
|
||||
use tracing::error;
|
||||
use unic_langid::{LanguageIdentifier, LanguageIdentifierError};
|
||||
|
||||
pub struct Args {
|
||||
pub relays: Vec<String>,
|
||||
pub is_mobile: Option<bool>,
|
||||
pub locale: Option<LanguageIdentifier>,
|
||||
pub show_note_client: bool,
|
||||
pub keys: Vec<Keypair>,
|
||||
pub light: bool,
|
||||
pub debug: bool,
|
||||
pub relay_debug: bool,
|
||||
|
||||
/// Enable when running tests so we don't panic on app startup
|
||||
pub tests: bool,
|
||||
|
||||
pub use_keystore: bool,
|
||||
pub options: NotedeckOptions,
|
||||
pub dbpath: Option<String>,
|
||||
pub datapath: Option<String>,
|
||||
}
|
||||
@@ -28,14 +20,8 @@ impl Args {
|
||||
let mut unrecognized_args = BTreeSet::new();
|
||||
let mut res = Args {
|
||||
relays: vec![],
|
||||
is_mobile: None,
|
||||
keys: vec![],
|
||||
light: false,
|
||||
show_note_client: false,
|
||||
debug: false,
|
||||
relay_debug: false,
|
||||
tests: false,
|
||||
use_keystore: true,
|
||||
options: NotedeckOptions::default(),
|
||||
dbpath: None,
|
||||
datapath: None,
|
||||
locale: None,
|
||||
@@ -47,9 +33,9 @@ impl Args {
|
||||
let arg = &args[i];
|
||||
|
||||
if arg == "--mobile" {
|
||||
res.is_mobile = Some(true);
|
||||
res.options.set(NotedeckOptions::Mobile, true);
|
||||
} else if arg == "--light" {
|
||||
res.light = true;
|
||||
res.options.set(NotedeckOptions::LightTheme, true);
|
||||
} else if arg == "--locale" {
|
||||
i += 1;
|
||||
let Some(locale) = args.get(i) else {
|
||||
@@ -68,11 +54,11 @@ impl Args {
|
||||
}
|
||||
}
|
||||
} else if arg == "--dark" {
|
||||
res.light = false;
|
||||
res.options.set(NotedeckOptions::LightTheme, false);
|
||||
} else if arg == "--debug" {
|
||||
res.debug = true;
|
||||
res.options.set(NotedeckOptions::Debug, true);
|
||||
} else if arg == "--testrunner" {
|
||||
res.tests = true;
|
||||
res.options.set(NotedeckOptions::Tests, true);
|
||||
} else if arg == "--pub" || arg == "--npub" {
|
||||
i += 1;
|
||||
let pubstr = if let Some(next_arg) = args.get(i) {
|
||||
@@ -135,11 +121,13 @@ impl Args {
|
||||
};
|
||||
res.relays.push(relay.clone());
|
||||
} else if arg == "--no-keystore" {
|
||||
res.use_keystore = false;
|
||||
res.options.set(NotedeckOptions::UseKeystore, true);
|
||||
} else if arg == "--relay-debug" {
|
||||
res.relay_debug = true;
|
||||
} else if arg == "--show-note-client" {
|
||||
res.show_note_client = true;
|
||||
res.options.set(NotedeckOptions::RelayDebug, true);
|
||||
} else if arg == "--notebook" {
|
||||
res.options.set(NotedeckOptions::FeatureNotebook, true);
|
||||
} else if arg == "--clndash" {
|
||||
res.options.set(NotedeckOptions::FeatureClnDash, true);
|
||||
} else {
|
||||
unrecognized_args.insert(arg.clone());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
account::accounts::Accounts, frame_history::FrameHistory, i18n::Localization,
|
||||
wallet::GlobalWallet, zaps::Zaps, Args, DataPath, Images, JobPool, NoteCache, ThemeHandler,
|
||||
wallet::GlobalWallet, zaps::Zaps, Args, DataPath, Images, JobPool, NoteCache, SettingsHandler,
|
||||
UnknownIds,
|
||||
};
|
||||
use egui_winit::clipboard::Clipboard;
|
||||
@@ -20,7 +20,7 @@ pub struct AppContext<'a> {
|
||||
pub global_wallet: &'a mut GlobalWallet,
|
||||
pub path: &'a DataPath,
|
||||
pub args: &'a Args,
|
||||
pub theme: &'a mut ThemeHandler,
|
||||
pub settings: &'a mut SettingsHandler,
|
||||
pub clipboard: &'a mut Clipboard,
|
||||
pub zaps: &'a mut Zaps,
|
||||
pub frame_history: &'a mut FrameHistory,
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
use crate::{ui, NotedeckTextStyle};
|
||||
use egui::FontData;
|
||||
use egui::FontDefinitions;
|
||||
use egui::FontTweak;
|
||||
use std::collections::BTreeMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub enum NamedFontFamily {
|
||||
Medium,
|
||||
@@ -31,6 +36,7 @@ pub fn desktop_font_size(text_style: &NotedeckTextStyle) -> f32 {
|
||||
NotedeckTextStyle::Button => 13.0,
|
||||
NotedeckTextStyle::Small => 12.0,
|
||||
NotedeckTextStyle::Tiny => 10.0,
|
||||
NotedeckTextStyle::NoteBody => 16.0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +52,7 @@ pub fn mobile_font_size(text_style: &NotedeckTextStyle) -> f32 {
|
||||
NotedeckTextStyle::Button => 13.0,
|
||||
NotedeckTextStyle::Small => 12.0,
|
||||
NotedeckTextStyle::Tiny => 10.0,
|
||||
NotedeckTextStyle::NoteBody => 13.0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,3 +63,148 @@ pub fn get_font_size(ctx: &egui::Context, text_style: &NotedeckTextStyle) -> f32
|
||||
desktop_font_size(text_style)
|
||||
}
|
||||
}
|
||||
|
||||
// Use gossip's approach to font loading. This includes japanese fonts
|
||||
// for rending stuff from japanese users.
|
||||
pub fn setup_fonts(ctx: &egui::Context) {
|
||||
let mut font_data: BTreeMap<String, Arc<FontData>> = BTreeMap::new();
|
||||
let mut families = BTreeMap::new();
|
||||
|
||||
font_data.insert(
|
||||
"Onest".to_owned(),
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/onest/OnestRegular1602-hint.ttf"
|
||||
))),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"OnestMedium".to_owned(),
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/onest/OnestMedium1602-hint.ttf"
|
||||
))),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"DejaVuSans".to_owned(),
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/DejaVuSansSansEmoji.ttf"
|
||||
))),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"OnestBold".to_owned(),
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/onest/OnestBold1602-hint.ttf"
|
||||
))),
|
||||
);
|
||||
|
||||
/*
|
||||
font_data.insert(
|
||||
"DejaVuSansBold".to_owned(),
|
||||
FontData::from_static(include_bytes!(
|
||||
"../assets/fonts/DejaVuSans-Bold-SansEmoji.ttf"
|
||||
)),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"DejaVuSans".to_owned(),
|
||||
FontData::from_static(include_bytes!("../assets/fonts/DejaVuSansSansEmoji.ttf")),
|
||||
);
|
||||
font_data.insert(
|
||||
"DejaVuSansBold".to_owned(),
|
||||
FontData::from_static(include_bytes!(
|
||||
"../assets/fonts/DejaVuSans-Bold-SansEmoji.ttf"
|
||||
)),
|
||||
);
|
||||
*/
|
||||
|
||||
font_data.insert(
|
||||
"Inconsolata".to_owned(),
|
||||
Arc::new(
|
||||
FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/Inconsolata-Regular.ttf"
|
||||
))
|
||||
.tweak(FontTweak {
|
||||
scale: 1.22, // This font is smaller than DejaVuSans
|
||||
y_offset_factor: -0.18, // and too low
|
||||
y_offset: 0.0,
|
||||
baseline_offset_factor: 0.0,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"NotoSansCJK".to_owned(),
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/NotoSansCJK-Regular.ttc"
|
||||
))),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"NotoSansThai".to_owned(),
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/NotoSansThai-Regular.ttf"
|
||||
))),
|
||||
);
|
||||
|
||||
// Some good looking emojis. Use as first priority:
|
||||
font_data.insert(
|
||||
"NotoEmoji".to_owned(),
|
||||
Arc::new(
|
||||
FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/NotoEmoji-Regular.ttf"
|
||||
))
|
||||
.tweak(FontTweak {
|
||||
scale: 1.1, // make them a touch larger
|
||||
y_offset_factor: 0.0,
|
||||
y_offset: 0.0,
|
||||
baseline_offset_factor: 0.0,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
let base_fonts = vec![
|
||||
"DejaVuSans".to_owned(),
|
||||
"NotoEmoji".to_owned(),
|
||||
"NotoSansCJK".to_owned(),
|
||||
"NotoSansThai".to_owned(),
|
||||
];
|
||||
|
||||
let mut proportional = vec!["Onest".to_owned()];
|
||||
proportional.extend(base_fonts.clone());
|
||||
|
||||
let mut medium = vec!["OnestMedium".to_owned()];
|
||||
medium.extend(base_fonts.clone());
|
||||
|
||||
let mut mono = vec!["Inconsolata".to_owned()];
|
||||
mono.extend(base_fonts.clone());
|
||||
|
||||
let mut bold = vec!["OnestBold".to_owned()];
|
||||
bold.extend(base_fonts.clone());
|
||||
|
||||
let emoji = vec!["NotoEmoji".to_owned()];
|
||||
|
||||
families.insert(egui::FontFamily::Proportional, proportional);
|
||||
families.insert(egui::FontFamily::Monospace, mono);
|
||||
families.insert(
|
||||
egui::FontFamily::Name(NamedFontFamily::Medium.as_str().into()),
|
||||
medium,
|
||||
);
|
||||
families.insert(
|
||||
egui::FontFamily::Name(NamedFontFamily::Bold.as_str().into()),
|
||||
bold,
|
||||
);
|
||||
families.insert(
|
||||
egui::FontFamily::Name(NamedFontFamily::Emoji.as_str().into()),
|
||||
emoji,
|
||||
);
|
||||
|
||||
tracing::debug!("fonts: {:?}", families);
|
||||
|
||||
let defs = FontDefinitions {
|
||||
font_data,
|
||||
families,
|
||||
};
|
||||
|
||||
ctx.set_fonts(defs);
|
||||
}
|
||||
|
||||
@@ -11,11 +11,13 @@ const DE: LanguageIdentifier = langid!("de");
|
||||
const ES_419: LanguageIdentifier = langid!("es-419");
|
||||
const ES_ES: LanguageIdentifier = langid!("es-ES");
|
||||
const FR: LanguageIdentifier = langid!("fr");
|
||||
const JA: LanguageIdentifier = langid!("ja");
|
||||
const PT_BR: LanguageIdentifier = langid!("pt-BR");
|
||||
const PT_PT: LanguageIdentifier = langid!("pt-PT");
|
||||
const TH: LanguageIdentifier = langid!("th");
|
||||
const ZH_CN: LanguageIdentifier = langid!("zh-CN");
|
||||
const ZH_TW: LanguageIdentifier = langid!("zh-TW");
|
||||
const NUM_FTLS: usize = 10;
|
||||
const NUM_FTLS: usize = 12;
|
||||
|
||||
const EN_US_NATIVE_NAME: &str = "English (US)";
|
||||
const EN_XA_NATIVE_NAME: &str = "Éñglísh (Pséúdólóçàlé)";
|
||||
@@ -23,7 +25,9 @@ const DE_NATIVE_NAME: &str = "Deutsch";
|
||||
const ES_419_NATIVE_NAME: &str = "Español (Latinoamérica)";
|
||||
const ES_ES_NATIVE_NAME: &str = "Español (España)";
|
||||
const FR_NATIVE_NAME: &str = "Français";
|
||||
const JA_NATIVE_NAME: &str = "日本語";
|
||||
const PT_BR_NATIVE_NAME: &str = "Português (Brasil)";
|
||||
const PT_PT_NATIVE_NAME: &str = "Português (Portugal)";
|
||||
const TH_NATIVE_NAME: &str = "ภาษาไทย";
|
||||
const ZH_CN_NATIVE_NAME: &str = "简体中文";
|
||||
const ZH_TW_NATIVE_NAME: &str = "繁體中文";
|
||||
@@ -58,10 +62,18 @@ const FTLS: [StaticBundle; NUM_FTLS] = [
|
||||
identifier: FR,
|
||||
ftl: include_str!("../../../../assets/translations/fr/main.ftl"),
|
||||
},
|
||||
StaticBundle {
|
||||
identifier: JA,
|
||||
ftl: include_str!("../../../../assets/translations/ja/main.ftl"),
|
||||
},
|
||||
StaticBundle {
|
||||
identifier: PT_BR,
|
||||
ftl: include_str!("../../../../assets/translations/pt-BR/main.ftl"),
|
||||
},
|
||||
StaticBundle {
|
||||
identifier: PT_PT,
|
||||
ftl: include_str!("../../../../assets/translations/pt-PT/main.ftl"),
|
||||
},
|
||||
StaticBundle {
|
||||
identifier: TH,
|
||||
ftl: include_str!("../../../../assets/translations/th/main.ftl"),
|
||||
@@ -113,7 +125,9 @@ impl Default for Localization {
|
||||
ES_419.clone(),
|
||||
ES_ES.clone(),
|
||||
FR.clone(),
|
||||
JA.clone(),
|
||||
PT_BR.clone(),
|
||||
PT_PT.clone(),
|
||||
TH.clone(),
|
||||
ZH_CN.clone(),
|
||||
ZH_TW.clone(),
|
||||
@@ -126,7 +140,9 @@ impl Default for Localization {
|
||||
(ES_419, ES_419_NATIVE_NAME.to_owned()),
|
||||
(ES_ES, ES_ES_NATIVE_NAME.to_owned()),
|
||||
(FR, FR_NATIVE_NAME.to_owned()),
|
||||
(JA, JA_NATIVE_NAME.to_owned()),
|
||||
(PT_BR, PT_BR_NATIVE_NAME.to_owned()),
|
||||
(PT_PT, PT_PT_NATIVE_NAME.to_owned()),
|
||||
(TH, TH_NATIVE_NAME.to_owned()),
|
||||
(ZH_CN, ZH_CN_NATIVE_NAME.to_owned()),
|
||||
(ZH_TW, ZH_TW_NATIVE_NAME.to_owned()),
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
use crate::media::gif::ensure_latest_texture_from_cache;
|
||||
use crate::media::images::ImageType;
|
||||
use crate::media::AnimationMode;
|
||||
use crate::urls::{UrlCache, UrlMimes};
|
||||
use crate::ImageMetadata;
|
||||
use crate::ObfuscationType;
|
||||
use crate::RenderableMedia;
|
||||
use crate::Result;
|
||||
use egui::TextureHandle;
|
||||
use image::{Delay, Frame};
|
||||
@@ -21,7 +27,7 @@ use tracing::warn;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct TexturesCache {
|
||||
cache: hashbrown::HashMap<String, TextureStateInternal>,
|
||||
pub cache: hashbrown::HashMap<String, TextureStateInternal>,
|
||||
}
|
||||
|
||||
impl TexturesCache {
|
||||
@@ -141,6 +147,12 @@ pub enum TextureState<'a> {
|
||||
Loaded(&'a mut TexturedImage),
|
||||
}
|
||||
|
||||
impl<'a> TextureState<'a> {
|
||||
pub fn is_loaded(&self) -> bool {
|
||||
matches!(self, Self::Loaded(_))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a mut TextureStateInternal> for TextureState<'a> {
|
||||
fn from(value: &'a mut TextureStateInternal) -> Self {
|
||||
match value {
|
||||
@@ -402,6 +414,8 @@ pub struct Images {
|
||||
pub static_imgs: MediaCache,
|
||||
pub gifs: MediaCache,
|
||||
pub urls: UrlMimes,
|
||||
/// cached imeta data
|
||||
pub metadata: HashMap<String, ImageMetadata>,
|
||||
pub gif_states: GifStateMap,
|
||||
}
|
||||
|
||||
@@ -414,6 +428,7 @@ impl Images {
|
||||
gifs: MediaCache::new(&path, MediaCacheType::Gif),
|
||||
urls: UrlMimes::new(UrlCache::new(path.join(UrlCache::rel_dir()))),
|
||||
gif_states: Default::default(),
|
||||
metadata: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,6 +437,65 @@ impl Images {
|
||||
self.gifs.migrate_v0()
|
||||
}
|
||||
|
||||
pub fn get_renderable_media(&mut self, url: &str) -> Option<RenderableMedia> {
|
||||
Self::find_renderable_media(&mut self.urls, &self.metadata, url)
|
||||
}
|
||||
|
||||
pub fn find_renderable_media(
|
||||
urls: &mut UrlMimes,
|
||||
imeta: &HashMap<String, ImageMetadata>,
|
||||
url: &str,
|
||||
) -> Option<RenderableMedia> {
|
||||
let media_type = crate::urls::supported_mime_hosted_at_url(urls, url)?;
|
||||
|
||||
let obfuscation_type = match imeta.get(url) {
|
||||
Some(blur) => ObfuscationType::Blurhash(blur.clone()),
|
||||
None => ObfuscationType::Default,
|
||||
};
|
||||
|
||||
Some(RenderableMedia {
|
||||
url: url.to_string(),
|
||||
media_type,
|
||||
obfuscation_type,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn latest_texture(
|
||||
&mut self,
|
||||
ui: &mut egui::Ui,
|
||||
url: &str,
|
||||
img_type: ImageType,
|
||||
animation_mode: AnimationMode,
|
||||
) -> Option<TextureHandle> {
|
||||
let cache_type = crate::urls::supported_mime_hosted_at_url(&mut self.urls, url)?;
|
||||
|
||||
let cache_dir = self.get_cache(cache_type).cache_dir.clone();
|
||||
let is_loaded = self
|
||||
.get_cache_mut(cache_type)
|
||||
.textures_cache
|
||||
.handle_and_get_or_insert(url, || {
|
||||
crate::media::images::fetch_img(&cache_dir, ui.ctx(), url, img_type, cache_type)
|
||||
})
|
||||
.is_loaded();
|
||||
|
||||
if !is_loaded {
|
||||
return None;
|
||||
}
|
||||
|
||||
let cache = match cache_type {
|
||||
MediaCacheType::Image => &mut self.static_imgs,
|
||||
MediaCacheType::Gif => &mut self.gifs,
|
||||
};
|
||||
|
||||
ensure_latest_texture_from_cache(
|
||||
ui,
|
||||
url,
|
||||
&mut self.gif_states,
|
||||
&mut cache.textures_cache,
|
||||
animation_mode,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_cache(&self, cache_type: MediaCacheType) -> &MediaCache {
|
||||
match cache_type {
|
||||
MediaCacheType::Image => &self.static_imgs,
|
||||
@@ -465,3 +539,35 @@ pub struct GifState {
|
||||
pub next_frame_time: Option<SystemTime>,
|
||||
pub last_frame_index: usize,
|
||||
}
|
||||
|
||||
pub struct LatestTexture {
|
||||
pub texture: TextureHandle,
|
||||
pub request_next_repaint: Option<SystemTime>,
|
||||
}
|
||||
|
||||
pub fn get_render_state<'a>(
|
||||
ctx: &egui::Context,
|
||||
images: &'a mut Images,
|
||||
cache_type: MediaCacheType,
|
||||
url: &str,
|
||||
img_type: ImageType,
|
||||
) -> RenderState<'a> {
|
||||
let cache = match cache_type {
|
||||
MediaCacheType::Image => &mut images.static_imgs,
|
||||
MediaCacheType::Gif => &mut images.gifs,
|
||||
};
|
||||
|
||||
let texture_state = cache.textures_cache.handle_and_get_or_insert(url, || {
|
||||
crate::media::images::fetch_img(&cache.cache_dir, ctx, url, img_type, cache_type)
|
||||
});
|
||||
|
||||
RenderState {
|
||||
texture_state,
|
||||
gifs: &mut images.gif_states,
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RenderState<'a> {
|
||||
pub texture_state: TextureState<'a>,
|
||||
pub gifs: &'a mut GifStateMap,
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ impl JobPool {
|
||||
pub fn new(num_threads: usize) -> Self {
|
||||
let (tx, rx) = mpsc::channel::<Job>();
|
||||
|
||||
// TODO(jb55) why not mpmc here !???
|
||||
let arc_rx = Arc::new(Mutex::new(rx));
|
||||
for _ in 0..num_threads {
|
||||
let arc_rx_clone = arc_rx.clone();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::JobPool;
|
||||
use egui::TextureHandle;
|
||||
use hashbrown::{hash_map::RawEntryMut, HashMap};
|
||||
use notedeck::JobPool;
|
||||
use poll_promise::Promise;
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -12,16 +12,20 @@ mod frame_history;
|
||||
pub mod i18n;
|
||||
mod imgcache;
|
||||
mod job_pool;
|
||||
mod jobs;
|
||||
pub mod media;
|
||||
mod muted;
|
||||
pub mod name;
|
||||
pub mod note;
|
||||
mod notecache;
|
||||
mod options;
|
||||
mod persist;
|
||||
pub mod platform;
|
||||
pub mod profile;
|
||||
pub mod relay_debug;
|
||||
pub mod relayspec;
|
||||
mod result;
|
||||
mod setup;
|
||||
pub mod storage;
|
||||
mod style;
|
||||
pub mod theme;
|
||||
@@ -47,10 +51,18 @@ pub use filter::{FilterState, FilterStates, UnifiedSubscription};
|
||||
pub use fonts::NamedFontFamily;
|
||||
pub use i18n::{CacheStats, FluentArgs, FluentValue, LanguageIdentifier, Localization};
|
||||
pub use imgcache::{
|
||||
Animation, GifState, GifStateMap, ImageFrame, Images, LoadableTextureState, MediaCache,
|
||||
MediaCacheType, TextureFrame, TextureState, TexturedImage, TexturesCache,
|
||||
get_render_state, Animation, GifState, GifStateMap, ImageFrame, Images, LatestTexture,
|
||||
LoadableTextureState, MediaCache, MediaCacheType, RenderState, TextureFrame, TextureState,
|
||||
TexturedImage, TexturesCache,
|
||||
};
|
||||
pub use job_pool::JobPool;
|
||||
pub use jobs::{
|
||||
BlurhashParams, Job, JobError, JobId, JobParams, JobParamsOwned, JobState, JobsCache,
|
||||
};
|
||||
pub use media::{
|
||||
compute_blurhash, update_imeta_blurhashes, ImageMetadata, ImageType, MediaAction,
|
||||
ObfuscationType, PixelDimensions, PointDimensions, RenderableMedia,
|
||||
};
|
||||
pub use muted::{MuteFun, Muted};
|
||||
pub use name::NostrName;
|
||||
pub use note::{
|
||||
@@ -58,6 +70,7 @@ pub use note::{
|
||||
RootIdError, RootNoteId, RootNoteIdBuf, ScrollInfo, ZapAction,
|
||||
};
|
||||
pub use notecache::{CachedNote, NoteCache};
|
||||
pub use options::NotedeckOptions;
|
||||
pub use persist::*;
|
||||
pub use profile::get_profile_url;
|
||||
pub use relay_debug::RelayDebugView;
|
||||
@@ -67,6 +80,7 @@ pub use storage::{AccountStorage, DataPath, DataPathType, Directory};
|
||||
pub use style::NotedeckTextStyle;
|
||||
pub use theme::ColorTheme;
|
||||
pub use time::time_ago_since;
|
||||
pub use time::time_format;
|
||||
pub use timecache::TimeCached;
|
||||
pub use unknowns::{get_unknown_note_ids, NoteRefsUnkIdAction, SingleUnkIdAction, UnknownIds};
|
||||
pub use urls::{supported_mime_hosted_at_url, SupportedMimeType, UrlMimes};
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
use crate::{Images, MediaCacheType, TexturedImage};
|
||||
use poll_promise::Promise;
|
||||
|
||||
/// Tracks where media was on the screen so that
|
||||
/// we can do fun animations when opening the
|
||||
/// Media Viewer
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct MediaInfo {
|
||||
/// The original screen position where it
|
||||
/// was rendered from. This is not where
|
||||
/// it should be rendered in the scene.
|
||||
pub original_position: egui::Rect,
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
/// Contains various information for when a user
|
||||
/// clicks a piece of media. It contains the current
|
||||
/// location on screen for each piece of media.
|
||||
///
|
||||
/// Viewers can use this to smoothly transition from
|
||||
/// the timeline to the viewer
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct ViewMediaInfo {
|
||||
pub clicked_index: usize,
|
||||
pub medias: Vec<MediaInfo>,
|
||||
}
|
||||
|
||||
impl ViewMediaInfo {
|
||||
pub fn clicked_media(&self) -> &MediaInfo {
|
||||
&self.medias[self.clicked_index]
|
||||
}
|
||||
}
|
||||
|
||||
/// Actions generated by media ui interactions
|
||||
pub enum MediaAction {
|
||||
/// An image was clicked on in a carousel, we have
|
||||
/// the opportunity to open into a fullscreen media viewer
|
||||
/// with a list of url values
|
||||
ViewMedias(ViewMediaInfo),
|
||||
|
||||
FetchImage {
|
||||
url: String,
|
||||
cache_type: MediaCacheType,
|
||||
no_pfp_promise: Promise<Option<Result<TexturedImage, crate::Error>>>,
|
||||
},
|
||||
DoneLoading {
|
||||
url: String,
|
||||
cache_type: MediaCacheType,
|
||||
},
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for MediaAction {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::ViewMedias(ViewMediaInfo {
|
||||
clicked_index,
|
||||
medias,
|
||||
}) => f
|
||||
.debug_struct("ViewMedias")
|
||||
.field("clicked_index", clicked_index)
|
||||
.field("media", medias)
|
||||
.finish(),
|
||||
Self::FetchImage {
|
||||
url,
|
||||
cache_type,
|
||||
no_pfp_promise,
|
||||
} => f
|
||||
.debug_struct("FetchNoPfpImage")
|
||||
.field("url", url)
|
||||
.field("cache_type", cache_type)
|
||||
.field("no_pfp_promise ready", &no_pfp_promise.ready().is_some())
|
||||
.finish(),
|
||||
Self::DoneLoading { url, cache_type } => f
|
||||
.debug_struct("DoneLoading")
|
||||
.field("url", url)
|
||||
.field("cache_type", cache_type)
|
||||
.finish(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MediaAction {
|
||||
/// Handle view media actions
|
||||
pub fn on_view_media(&self, handler: impl FnOnce(&ViewMediaInfo)) {
|
||||
if let MediaAction::ViewMedias(view_medias) = self {
|
||||
handler(view_medias)
|
||||
}
|
||||
}
|
||||
|
||||
/// Default processing logic for Media Actions. We don't handle ViewMedias here since
|
||||
/// this may be app specific ?
|
||||
pub fn process_default_media_actions(self, images: &mut Images) {
|
||||
match self {
|
||||
MediaAction::ViewMedias(_urls) => {
|
||||
// NOTE(jb55): don't assume we want to show a fullscreen
|
||||
// media viewer we can use on_view_media for that. We
|
||||
// also don't want to have a notedeck_ui dependency in
|
||||
// the notedeck lib (MediaViewerState)
|
||||
//
|
||||
// In general our notedeck crate should be pretty
|
||||
// agnostic to functionallity in general unless it low
|
||||
// level like image rendering.
|
||||
//
|
||||
//mview_state.set_urls(urls);
|
||||
}
|
||||
|
||||
MediaAction::FetchImage {
|
||||
url,
|
||||
cache_type,
|
||||
no_pfp_promise: promise,
|
||||
} => {
|
||||
images
|
||||
.get_cache_mut(cache_type)
|
||||
.textures_cache
|
||||
.insert_pending(&url, promise);
|
||||
}
|
||||
MediaAction::DoneLoading { url, cache_type } => {
|
||||
let cache = match cache_type {
|
||||
MediaCacheType::Image => &mut images.static_imgs,
|
||||
MediaCacheType::Gif => &mut images.gifs,
|
||||
};
|
||||
|
||||
cache.textures_cache.move_to_loaded(&url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ use nostrdb::Note;
|
||||
use crate::jobs::{Job, JobError, JobParamsOwned};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Blur<'a> {
|
||||
pub blurhash: &'a str,
|
||||
pub struct ImageMetadata {
|
||||
pub blurhash: String,
|
||||
pub dimensions: Option<PixelDimensions>, // width and height in pixels
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ impl PointDimensions {
|
||||
}
|
||||
}
|
||||
|
||||
impl Blur<'_> {
|
||||
impl ImageMetadata {
|
||||
pub fn scaled_pixel_dimensions(
|
||||
&self,
|
||||
ui: &egui::Ui,
|
||||
@@ -75,9 +75,8 @@ impl Blur<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn imeta_blurhashes<'a>(note: &'a Note) -> HashMap<&'a str, Blur<'a>> {
|
||||
let mut blurs = HashMap::new();
|
||||
|
||||
/// Find blurhashes in image metadata and update our cache
|
||||
pub fn update_imeta_blurhashes(note: &Note, blurs: &mut HashMap<String, ImageMetadata>) {
|
||||
for tag in note.tags() {
|
||||
let mut tag_iter = tag.into_iter();
|
||||
if tag_iter
|
||||
@@ -93,13 +92,11 @@ pub fn imeta_blurhashes<'a>(note: &'a Note) -> HashMap<&'a str, Blur<'a>> {
|
||||
continue;
|
||||
};
|
||||
|
||||
blurs.insert(url, blur);
|
||||
blurs.insert(url.to_string(), blur);
|
||||
}
|
||||
|
||||
blurs
|
||||
}
|
||||
|
||||
fn find_blur(tag_iter: nostrdb::TagIter) -> Option<(&str, Blur)> {
|
||||
fn find_blur(tag_iter: nostrdb::TagIter<'_>) -> Option<(String, ImageMetadata)> {
|
||||
let mut url = None;
|
||||
let mut blurhash = None;
|
||||
let mut dims = None;
|
||||
@@ -138,21 +135,21 @@ fn find_blur(tag_iter: nostrdb::TagIter) -> Option<(&str, Blur)> {
|
||||
});
|
||||
|
||||
Some((
|
||||
url,
|
||||
Blur {
|
||||
blurhash,
|
||||
url.to_string(),
|
||||
ImageMetadata {
|
||||
blurhash: blurhash.to_string(),
|
||||
dimensions,
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum ObfuscationType<'a> {
|
||||
Blurhash(Blur<'a>),
|
||||
pub enum ObfuscationType {
|
||||
Blurhash(ImageMetadata),
|
||||
Default,
|
||||
}
|
||||
|
||||
pub(crate) fn compute_blurhash(
|
||||
pub fn compute_blurhash(
|
||||
params: Option<JobParamsOwned>,
|
||||
dims: PixelDimensions,
|
||||
) -> Result<Job, JobError> {
|
||||
@@ -185,9 +182,9 @@ fn generate_blurhash_texturehandle(
|
||||
url: &str,
|
||||
width: u32,
|
||||
height: u32,
|
||||
) -> notedeck::Result<egui::TextureHandle> {
|
||||
) -> Result<egui::TextureHandle, crate::Error> {
|
||||
let bytes = blurhash::decode(blurhash, width, height, 1.0)
|
||||
.map_err(|e| notedeck::Error::Generic(e.to_string()))?;
|
||||
.map_err(|e| crate::Error::Generic(e.to_string()))?;
|
||||
|
||||
let img = egui::ColorImage::from_rgba_unmultiplied([width as usize, height as usize], &bytes);
|
||||
Ok(ctx.load_texture(url, img, Default::default()))
|
||||
@@ -0,0 +1,164 @@
|
||||
use std::{
|
||||
sync::mpsc::TryRecvError,
|
||||
time::{Instant, SystemTime},
|
||||
};
|
||||
|
||||
use crate::media::AnimationMode;
|
||||
use crate::Animation;
|
||||
use crate::{GifState, GifStateMap, TextureState, TexturedImage, TexturesCache};
|
||||
use egui::TextureHandle;
|
||||
use std::time::Duration;
|
||||
|
||||
pub fn ensure_latest_texture_from_cache(
|
||||
ui: &egui::Ui,
|
||||
url: &str,
|
||||
gifs: &mut GifStateMap,
|
||||
textures: &mut TexturesCache,
|
||||
animation_mode: AnimationMode,
|
||||
) -> Option<TextureHandle> {
|
||||
let tstate = textures.cache.get_mut(url)?;
|
||||
|
||||
let TextureState::Loaded(img) = tstate.into() else {
|
||||
return None;
|
||||
};
|
||||
|
||||
Some(ensure_latest_texture(ui, url, gifs, img, animation_mode))
|
||||
}
|
||||
|
||||
struct ProcessedGifFrame {
|
||||
texture: TextureHandle,
|
||||
maybe_new_state: Option<GifState>,
|
||||
repaint_at: Option<SystemTime>,
|
||||
}
|
||||
|
||||
/// Process a gif state frame, and optionally present a new
|
||||
/// state and when to repaint it
|
||||
fn process_gif_frame(
|
||||
animation: &Animation,
|
||||
frame_state: Option<&GifState>,
|
||||
animation_mode: AnimationMode,
|
||||
) -> ProcessedGifFrame {
|
||||
let now = Instant::now();
|
||||
|
||||
match frame_state {
|
||||
Some(prev_state) => {
|
||||
let should_advance = animation_mode.can_animate()
|
||||
&& (now - prev_state.last_frame_rendered >= prev_state.last_frame_duration);
|
||||
|
||||
if should_advance {
|
||||
let maybe_new_index = if animation.receiver.is_some()
|
||||
|| prev_state.last_frame_index < animation.num_frames() - 1
|
||||
{
|
||||
prev_state.last_frame_index + 1
|
||||
} else {
|
||||
0
|
||||
};
|
||||
|
||||
match animation.get_frame(maybe_new_index) {
|
||||
Some(frame) => {
|
||||
let next_frame_time = match animation_mode {
|
||||
AnimationMode::Continuous { fps } => match fps {
|
||||
Some(fps) => {
|
||||
let max_delay_ms = Duration::from_millis((1000.0 / fps) as u64);
|
||||
SystemTime::now().checked_add(frame.delay.max(max_delay_ms))
|
||||
}
|
||||
None => SystemTime::now().checked_add(frame.delay),
|
||||
},
|
||||
|
||||
AnimationMode::NoAnimation | AnimationMode::Reactive => None,
|
||||
};
|
||||
|
||||
ProcessedGifFrame {
|
||||
texture: frame.texture.clone(),
|
||||
maybe_new_state: Some(GifState {
|
||||
last_frame_rendered: now,
|
||||
last_frame_duration: frame.delay,
|
||||
next_frame_time,
|
||||
last_frame_index: maybe_new_index,
|
||||
}),
|
||||
repaint_at: next_frame_time,
|
||||
}
|
||||
}
|
||||
None => {
|
||||
let (texture, maybe_new_state) =
|
||||
match animation.get_frame(prev_state.last_frame_index) {
|
||||
Some(frame) => (frame.texture.clone(), None),
|
||||
None => (animation.first_frame.texture.clone(), None),
|
||||
};
|
||||
|
||||
ProcessedGifFrame {
|
||||
texture,
|
||||
maybe_new_state,
|
||||
repaint_at: prev_state.next_frame_time,
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let (texture, maybe_new_state) =
|
||||
match animation.get_frame(prev_state.last_frame_index) {
|
||||
Some(frame) => (frame.texture.clone(), None),
|
||||
None => (animation.first_frame.texture.clone(), None),
|
||||
};
|
||||
|
||||
ProcessedGifFrame {
|
||||
texture,
|
||||
maybe_new_state,
|
||||
repaint_at: prev_state.next_frame_time,
|
||||
}
|
||||
}
|
||||
}
|
||||
None => ProcessedGifFrame {
|
||||
texture: animation.first_frame.texture.clone(),
|
||||
maybe_new_state: Some(GifState {
|
||||
last_frame_rendered: now,
|
||||
last_frame_duration: animation.first_frame.delay,
|
||||
next_frame_time: None,
|
||||
last_frame_index: 0,
|
||||
}),
|
||||
repaint_at: None,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ensure_latest_texture(
|
||||
ui: &egui::Ui,
|
||||
url: &str,
|
||||
gifs: &mut GifStateMap,
|
||||
img: &mut TexturedImage,
|
||||
animation_mode: AnimationMode,
|
||||
) -> TextureHandle {
|
||||
match img {
|
||||
TexturedImage::Static(handle) => handle.clone(),
|
||||
TexturedImage::Animated(animation) => {
|
||||
if let Some(receiver) = &animation.receiver {
|
||||
loop {
|
||||
match receiver.try_recv() {
|
||||
Ok(frame) => animation.other_frames.push(frame),
|
||||
Err(TryRecvError::Empty) => {
|
||||
break;
|
||||
}
|
||||
Err(TryRecvError::Disconnected) => {
|
||||
animation.receiver = None;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let next_state = process_gif_frame(animation, gifs.get(url), animation_mode);
|
||||
|
||||
if let Some(new_state) = next_state.maybe_new_state {
|
||||
gifs.insert(url.to_owned(), new_state);
|
||||
}
|
||||
|
||||
if let Some(repaint) = next_state.repaint_at {
|
||||
tracing::trace!("requesting repaint for {url} after {repaint:?}");
|
||||
if let Ok(dur) = repaint.duration_since(SystemTime::now()) {
|
||||
ui.ctx().request_repaint_after(dur);
|
||||
}
|
||||
}
|
||||
|
||||
next_state.texture
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,475 @@
|
||||
use crate::{Animation, ImageFrame, MediaCache, MediaCacheType, TextureFrame, TexturedImage};
|
||||
use egui::{pos2, Color32, ColorImage, Context, Rect, Sense, SizeHint};
|
||||
use image::codecs::gif::GifDecoder;
|
||||
use image::imageops::FilterType;
|
||||
use image::{AnimationDecoder, DynamicImage, FlatSamples, Frame};
|
||||
use poll_promise::Promise;
|
||||
use std::collections::VecDeque;
|
||||
use std::io::Cursor;
|
||||
use std::path::PathBuf;
|
||||
use std::path::{self, Path};
|
||||
use std::sync::mpsc;
|
||||
use std::sync::mpsc::SyncSender;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use tokio::fs;
|
||||
|
||||
// NOTE(jb55): chatgpt wrote this because I was too dumb to
|
||||
pub fn aspect_fill(
|
||||
ui: &mut egui::Ui,
|
||||
sense: Sense,
|
||||
texture_id: egui::TextureId,
|
||||
aspect_ratio: f32,
|
||||
) -> egui::Response {
|
||||
let frame = ui.available_rect_before_wrap(); // Get the available frame space in the current layout
|
||||
let frame_ratio = frame.width() / frame.height();
|
||||
|
||||
let (width, height) = if frame_ratio > aspect_ratio {
|
||||
// Frame is wider than the content
|
||||
(frame.width(), frame.width() / aspect_ratio)
|
||||
} else {
|
||||
// Frame is taller than the content
|
||||
(frame.height() * aspect_ratio, frame.height())
|
||||
};
|
||||
|
||||
let content_rect = Rect::from_min_size(
|
||||
frame.min
|
||||
+ egui::vec2(
|
||||
(frame.width() - width) / 2.0,
|
||||
(frame.height() - height) / 2.0,
|
||||
),
|
||||
egui::vec2(width, height),
|
||||
);
|
||||
|
||||
// Set the clipping rectangle to the frame
|
||||
//let clip_rect = ui.clip_rect(); // Preserve the original clipping rectangle
|
||||
//ui.set_clip_rect(frame);
|
||||
|
||||
let uv = Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0));
|
||||
|
||||
let (response, painter) = ui.allocate_painter(ui.available_size(), sense);
|
||||
|
||||
// Draw the texture within the calculated rect, potentially clipping it
|
||||
painter.rect_filled(content_rect, 0.0, ui.ctx().style().visuals.window_fill());
|
||||
painter.image(texture_id, content_rect, uv, Color32::WHITE);
|
||||
|
||||
// Restore the original clipping rectangle
|
||||
//ui.set_clip_rect(clip_rect);
|
||||
response
|
||||
}
|
||||
|
||||
#[profiling::function]
|
||||
pub fn round_image(image: &mut ColorImage) {
|
||||
// The radius to the edge of of the avatar circle
|
||||
let edge_radius = image.size[0] as f32 / 2.0;
|
||||
let edge_radius_squared = edge_radius * edge_radius;
|
||||
|
||||
for (pixnum, pixel) in image.pixels.iter_mut().enumerate() {
|
||||
// y coordinate
|
||||
let uy = pixnum / image.size[0];
|
||||
let y = uy as f32;
|
||||
let y_offset = edge_radius - y;
|
||||
|
||||
// x coordinate
|
||||
let ux = pixnum % image.size[0];
|
||||
let x = ux as f32;
|
||||
let x_offset = edge_radius - x;
|
||||
|
||||
// The radius to this pixel (may be inside or outside the circle)
|
||||
let pixel_radius_squared: f32 = x_offset * x_offset + y_offset * y_offset;
|
||||
|
||||
// If inside of the avatar circle
|
||||
if pixel_radius_squared <= edge_radius_squared {
|
||||
// squareroot to find how many pixels we are from the edge
|
||||
let pixel_radius: f32 = pixel_radius_squared.sqrt();
|
||||
let distance = edge_radius - pixel_radius;
|
||||
|
||||
// If we are within 1 pixel of the edge, we should fade, to
|
||||
// antialias the edge of the circle. 1 pixel from the edge should
|
||||
// be 100% of the original color, and right on the edge should be
|
||||
// 0% of the original color.
|
||||
if distance <= 1.0 {
|
||||
*pixel = Color32::from_rgba_premultiplied(
|
||||
(pixel.r() as f32 * distance) as u8,
|
||||
(pixel.g() as f32 * distance) as u8,
|
||||
(pixel.b() as f32 * distance) as u8,
|
||||
(pixel.a() as f32 * distance) as u8,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Outside of the avatar circle
|
||||
*pixel = Color32::TRANSPARENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// If the image's longest dimension is greater than max_edge, downscale
|
||||
fn resize_image_if_too_big(
|
||||
image: image::DynamicImage,
|
||||
max_edge: u32,
|
||||
filter: FilterType,
|
||||
) -> image::DynamicImage {
|
||||
// if we have no size hint, resize to something reasonable
|
||||
let w = image.width();
|
||||
let h = image.height();
|
||||
let long = w.max(h);
|
||||
|
||||
if long > max_edge {
|
||||
let scale = max_edge as f32 / long as f32;
|
||||
let new_w = (w as f32 * scale).round() as u32;
|
||||
let new_h = (h as f32 * scale).round() as u32;
|
||||
|
||||
image.resize(new_w, new_h, filter)
|
||||
} else {
|
||||
image
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Process an image, resizing so we don't blow up video memory or even crash
|
||||
///
|
||||
/// For profile pictures, make them round and small to fit the size hint
|
||||
/// For everything else, either:
|
||||
///
|
||||
/// - resize to the size hint
|
||||
/// - keep the size if the longest dimension is less than MAX_IMG_LENGTH
|
||||
/// - resize if any larger, using [`resize_image_if_too_big`]
|
||||
///
|
||||
#[profiling::function]
|
||||
fn process_image(imgtyp: ImageType, mut image: image::DynamicImage) -> ColorImage {
|
||||
const MAX_IMG_LENGTH: u32 = 2048;
|
||||
const FILTER_TYPE: FilterType = FilterType::CatmullRom;
|
||||
|
||||
match imgtyp {
|
||||
ImageType::Content(size_hint) => {
|
||||
let image = match size_hint {
|
||||
None => resize_image_if_too_big(image, MAX_IMG_LENGTH, FILTER_TYPE),
|
||||
Some((w, h)) => image.resize(w, h, FILTER_TYPE),
|
||||
};
|
||||
|
||||
let image_buffer = image.into_rgba8();
|
||||
ColorImage::from_rgba_unmultiplied(
|
||||
[
|
||||
image_buffer.width() as usize,
|
||||
image_buffer.height() as usize,
|
||||
],
|
||||
image_buffer.as_flat_samples().as_slice(),
|
||||
)
|
||||
}
|
||||
ImageType::Profile(size) => {
|
||||
// Crop square
|
||||
let smaller = image.width().min(image.height());
|
||||
|
||||
if image.width() > smaller {
|
||||
let excess = image.width() - smaller;
|
||||
image = image.crop_imm(excess / 2, 0, image.width() - excess, image.height());
|
||||
} else if image.height() > smaller {
|
||||
let excess = image.height() - smaller;
|
||||
image = image.crop_imm(0, excess / 2, image.width(), image.height() - excess);
|
||||
}
|
||||
let image = image.resize(size, size, FilterType::CatmullRom); // DynamicImage
|
||||
let image_buffer = image.into_rgba8(); // RgbaImage (ImageBuffer)
|
||||
let mut color_image = ColorImage::from_rgba_unmultiplied(
|
||||
[
|
||||
image_buffer.width() as usize,
|
||||
image_buffer.height() as usize,
|
||||
],
|
||||
image_buffer.as_flat_samples().as_slice(),
|
||||
);
|
||||
round_image(&mut color_image);
|
||||
color_image
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[profiling::function]
|
||||
fn parse_img_response(
|
||||
response: ehttp::Response,
|
||||
imgtyp: ImageType,
|
||||
) -> Result<ColorImage, crate::Error> {
|
||||
let content_type = response.content_type().unwrap_or_default();
|
||||
let size_hint = match imgtyp {
|
||||
ImageType::Profile(size) => SizeHint::Size(size, size),
|
||||
ImageType::Content(Some((w, h))) => SizeHint::Size(w, h),
|
||||
ImageType::Content(None) => SizeHint::default(),
|
||||
};
|
||||
|
||||
if content_type.starts_with("image/svg") {
|
||||
profiling::scope!("load_svg");
|
||||
|
||||
let mut color_image =
|
||||
egui_extras::image::load_svg_bytes_with_size(&response.bytes, Some(size_hint))?;
|
||||
round_image(&mut color_image);
|
||||
Ok(color_image)
|
||||
} else if content_type.starts_with("image/") {
|
||||
profiling::scope!("load_from_memory");
|
||||
let dyn_image = image::load_from_memory(&response.bytes)?;
|
||||
Ok(process_image(imgtyp, dyn_image))
|
||||
} else {
|
||||
Err(format!("Expected image, found content-type {content_type:?}").into())
|
||||
}
|
||||
}
|
||||
|
||||
fn fetch_img_from_disk(
|
||||
ctx: &egui::Context,
|
||||
url: &str,
|
||||
path: &path::Path,
|
||||
cache_type: MediaCacheType,
|
||||
) -> Promise<Option<Result<TexturedImage, crate::Error>>> {
|
||||
let ctx = ctx.clone();
|
||||
let url = url.to_owned();
|
||||
let path = path.to_owned();
|
||||
|
||||
Promise::spawn_async(async move {
|
||||
Some(async_fetch_img_from_disk(ctx, url, &path, cache_type).await)
|
||||
})
|
||||
}
|
||||
|
||||
async fn async_fetch_img_from_disk(
|
||||
ctx: egui::Context,
|
||||
url: String,
|
||||
path: &path::Path,
|
||||
cache_type: MediaCacheType,
|
||||
) -> Result<TexturedImage, crate::Error> {
|
||||
match cache_type {
|
||||
MediaCacheType::Image => {
|
||||
let data = fs::read(path).await?;
|
||||
let image_buffer = image::load_from_memory(&data).map_err(crate::Error::Image)?;
|
||||
|
||||
let img = buffer_to_color_image(
|
||||
image_buffer.as_flat_samples_u8(),
|
||||
image_buffer.width(),
|
||||
image_buffer.height(),
|
||||
);
|
||||
Ok(TexturedImage::Static(ctx.load_texture(
|
||||
&url,
|
||||
img,
|
||||
Default::default(),
|
||||
)))
|
||||
}
|
||||
MediaCacheType::Gif => {
|
||||
let gif_bytes = fs::read(path).await?; // Read entire file into a Vec<u8>
|
||||
generate_gif(ctx, url, path, gif_bytes, false, |i| {
|
||||
buffer_to_color_image(i.as_flat_samples_u8(), i.width(), i.height())
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn generate_gif(
|
||||
ctx: egui::Context,
|
||||
url: String,
|
||||
path: &path::Path,
|
||||
data: Vec<u8>,
|
||||
write_to_disk: bool,
|
||||
process_to_egui: impl Fn(DynamicImage) -> ColorImage + Send + Copy + 'static,
|
||||
) -> Result<TexturedImage, crate::Error> {
|
||||
let decoder = {
|
||||
let reader = Cursor::new(data.as_slice());
|
||||
GifDecoder::new(reader)?
|
||||
};
|
||||
let (tex_input, tex_output) = mpsc::sync_channel(4);
|
||||
let (maybe_encoder_input, maybe_encoder_output) = if write_to_disk {
|
||||
let (inp, out) = mpsc::sync_channel(4);
|
||||
(Some(inp), Some(out))
|
||||
} else {
|
||||
(None, None)
|
||||
};
|
||||
|
||||
let mut frames: VecDeque<Frame> = decoder
|
||||
.into_frames()
|
||||
.collect::<std::result::Result<VecDeque<_>, image::ImageError>>()
|
||||
.map_err(|e| crate::Error::Generic(e.to_string()))?;
|
||||
|
||||
let first_frame = frames.pop_front().map(|frame| {
|
||||
generate_animation_frame(
|
||||
&ctx,
|
||||
&url,
|
||||
0,
|
||||
frame,
|
||||
maybe_encoder_input.as_ref(),
|
||||
process_to_egui,
|
||||
)
|
||||
});
|
||||
|
||||
let cur_url = url.clone();
|
||||
thread::spawn(move || {
|
||||
for (index, frame) in frames.into_iter().enumerate() {
|
||||
let texture_frame = generate_animation_frame(
|
||||
&ctx,
|
||||
&cur_url,
|
||||
index,
|
||||
frame,
|
||||
maybe_encoder_input.as_ref(),
|
||||
process_to_egui,
|
||||
);
|
||||
|
||||
if tex_input.send(texture_frame).is_err() {
|
||||
tracing::debug!("AnimationTextureFrame mpsc stopped abruptly");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if let Some(encoder_output) = maybe_encoder_output {
|
||||
let path = path.to_owned();
|
||||
|
||||
thread::spawn(move || {
|
||||
let mut imgs = Vec::new();
|
||||
while let Ok(img) = encoder_output.recv() {
|
||||
imgs.push(img);
|
||||
}
|
||||
|
||||
if let Err(e) = MediaCache::write_gif(&path, &url, imgs) {
|
||||
tracing::error!("Could not write gif to disk: {e}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
first_frame.map_or_else(
|
||||
|| {
|
||||
Err(crate::Error::Generic(
|
||||
"first frame not found for gif".to_owned(),
|
||||
))
|
||||
},
|
||||
|first_frame| {
|
||||
Ok(TexturedImage::Animated(Animation {
|
||||
other_frames: Default::default(),
|
||||
receiver: Some(tex_output),
|
||||
first_frame,
|
||||
}))
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
fn generate_animation_frame(
|
||||
ctx: &egui::Context,
|
||||
url: &str,
|
||||
index: usize,
|
||||
frame: image::Frame,
|
||||
maybe_encoder_input: Option<&SyncSender<ImageFrame>>,
|
||||
process_to_egui: impl Fn(DynamicImage) -> ColorImage + Send + 'static,
|
||||
) -> TextureFrame {
|
||||
let delay = Duration::from(frame.delay());
|
||||
let img = DynamicImage::ImageRgba8(frame.into_buffer());
|
||||
let color_img = process_to_egui(img);
|
||||
|
||||
if let Some(sender) = maybe_encoder_input {
|
||||
if let Err(e) = sender.send(ImageFrame {
|
||||
delay,
|
||||
image: color_img.clone(),
|
||||
}) {
|
||||
tracing::error!("ImageFrame mpsc unexpectedly closed: {e}");
|
||||
}
|
||||
}
|
||||
|
||||
TextureFrame {
|
||||
delay,
|
||||
texture: ctx.load_texture(format!("{url}{index}"), color_img, Default::default()),
|
||||
}
|
||||
}
|
||||
|
||||
fn buffer_to_color_image(
|
||||
samples: Option<FlatSamples<&[u8]>>,
|
||||
width: u32,
|
||||
height: u32,
|
||||
) -> ColorImage {
|
||||
// TODO(jb55): remove unwrap here
|
||||
let flat_samples = samples.unwrap();
|
||||
ColorImage::from_rgba_unmultiplied([width as usize, height as usize], flat_samples.as_slice())
|
||||
}
|
||||
|
||||
pub fn fetch_binary_from_disk(path: PathBuf) -> Result<Vec<u8>, crate::Error> {
|
||||
std::fs::read(path).map_err(|e| crate::Error::Generic(e.to_string()))
|
||||
}
|
||||
|
||||
/// Controls type-specific handling
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum ImageType {
|
||||
/// Profile Image (size)
|
||||
Profile(u32),
|
||||
/// Content Image with optional size hint
|
||||
Content(Option<(u32, u32)>),
|
||||
}
|
||||
|
||||
pub fn fetch_img(
|
||||
img_cache_path: &Path,
|
||||
ctx: &egui::Context,
|
||||
url: &str,
|
||||
imgtyp: ImageType,
|
||||
cache_type: MediaCacheType,
|
||||
) -> Promise<Option<Result<TexturedImage, crate::Error>>> {
|
||||
let key = MediaCache::key(url);
|
||||
let path = img_cache_path.join(key);
|
||||
|
||||
if path.exists() {
|
||||
fetch_img_from_disk(ctx, url, &path, cache_type)
|
||||
} else {
|
||||
fetch_img_from_net(img_cache_path, ctx, url, imgtyp, cache_type)
|
||||
}
|
||||
|
||||
// TODO: fetch image from local cache
|
||||
}
|
||||
|
||||
fn fetch_img_from_net(
|
||||
cache_path: &path::Path,
|
||||
ctx: &egui::Context,
|
||||
url: &str,
|
||||
imgtyp: ImageType,
|
||||
cache_type: MediaCacheType,
|
||||
) -> Promise<Option<Result<TexturedImage, crate::Error>>> {
|
||||
let (sender, promise) = Promise::new();
|
||||
let request = ehttp::Request::get(url);
|
||||
let ctx = ctx.clone();
|
||||
let cloned_url = url.to_owned();
|
||||
let cache_path = cache_path.to_owned();
|
||||
ehttp::fetch(request, move |response| {
|
||||
let handle = response.map_err(crate::Error::Generic).and_then(|resp| {
|
||||
match cache_type {
|
||||
MediaCacheType::Image => {
|
||||
let img = parse_img_response(resp, imgtyp);
|
||||
img.map(|img| {
|
||||
let texture_handle =
|
||||
ctx.load_texture(&cloned_url, img.clone(), Default::default());
|
||||
|
||||
// write to disk
|
||||
std::thread::spawn(move || {
|
||||
MediaCache::write(&cache_path, &cloned_url, img)
|
||||
});
|
||||
|
||||
TexturedImage::Static(texture_handle)
|
||||
})
|
||||
}
|
||||
MediaCacheType::Gif => {
|
||||
let gif_bytes = resp.bytes;
|
||||
generate_gif(
|
||||
ctx.clone(),
|
||||
cloned_url,
|
||||
&cache_path,
|
||||
gif_bytes,
|
||||
true,
|
||||
move |img| process_image(imgtyp, img),
|
||||
)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sender.send(Some(handle)); // send the results back to the UI thread.
|
||||
ctx.request_repaint();
|
||||
});
|
||||
|
||||
promise
|
||||
}
|
||||
|
||||
pub fn fetch_no_pfp_promise(
|
||||
ctx: &Context,
|
||||
cache: &MediaCache,
|
||||
) -> Promise<Option<Result<TexturedImage, crate::Error>>> {
|
||||
crate::media::images::fetch_img(
|
||||
&cache.cache_dir,
|
||||
ctx,
|
||||
crate::profile::no_pfp_url(),
|
||||
ImageType::Profile(128),
|
||||
MediaCacheType::Image,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
pub mod action;
|
||||
pub mod blur;
|
||||
pub mod gif;
|
||||
pub mod images;
|
||||
pub mod imeta;
|
||||
pub mod renderable;
|
||||
|
||||
pub use action::{MediaAction, MediaInfo, ViewMediaInfo};
|
||||
pub use blur::{
|
||||
compute_blurhash, update_imeta_blurhashes, ImageMetadata, ObfuscationType, PixelDimensions,
|
||||
PointDimensions,
|
||||
};
|
||||
pub use images::ImageType;
|
||||
pub use renderable::RenderableMedia;
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum AnimationMode {
|
||||
/// Only render when scrolling, network activity, etc
|
||||
Reactive,
|
||||
|
||||
/// Continuous with an optional target fps
|
||||
Continuous { fps: Option<f32> },
|
||||
|
||||
/// Disable animation
|
||||
NoAnimation,
|
||||
}
|
||||
|
||||
impl AnimationMode {
|
||||
pub fn can_animate(&self) -> bool {
|
||||
!matches!(self, Self::NoAnimation)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
use super::ObfuscationType;
|
||||
use crate::MediaCacheType;
|
||||
|
||||
/// Media that is prepared for rendering. Use [`Images::get_renderable_media`] to get these
|
||||
pub struct RenderableMedia {
|
||||
pub url: String,
|
||||
pub media_type: MediaCacheType,
|
||||
pub obfuscation_type: ObfuscationType,
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
use super::context::ContextSelection;
|
||||
use crate::{zaps::NoteZapTargetOwned, Images, MediaCacheType, TexturedImage};
|
||||
use crate::{zaps::NoteZapTargetOwned, MediaAction};
|
||||
use egui::Vec2;
|
||||
use enostr::{NoteId, Pubkey};
|
||||
use poll_promise::Promise;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ScrollInfo {
|
||||
@@ -25,7 +24,11 @@ pub enum NoteAction {
|
||||
Profile(Pubkey),
|
||||
|
||||
/// User has clicked a note link
|
||||
Note { note_id: NoteId, preview: bool },
|
||||
Note {
|
||||
note_id: NoteId,
|
||||
preview: bool,
|
||||
scroll_offset: f32,
|
||||
},
|
||||
|
||||
/// User has selected some context option
|
||||
Context(ContextSelection),
|
||||
@@ -45,6 +48,7 @@ impl NoteAction {
|
||||
NoteAction::Note {
|
||||
note_id: id,
|
||||
preview: false,
|
||||
scroll_offset: 0.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,62 +65,3 @@ pub struct ZapTargetAmount {
|
||||
pub target: NoteZapTargetOwned,
|
||||
pub specified_msats: Option<u64>, // if None use default amount
|
||||
}
|
||||
|
||||
pub enum MediaAction {
|
||||
FetchImage {
|
||||
url: String,
|
||||
cache_type: MediaCacheType,
|
||||
no_pfp_promise: Promise<Option<Result<TexturedImage, crate::Error>>>,
|
||||
},
|
||||
DoneLoading {
|
||||
url: String,
|
||||
cache_type: MediaCacheType,
|
||||
},
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for MediaAction {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::FetchImage {
|
||||
url,
|
||||
cache_type,
|
||||
no_pfp_promise,
|
||||
} => f
|
||||
.debug_struct("FetchNoPfpImage")
|
||||
.field("url", url)
|
||||
.field("cache_type", cache_type)
|
||||
.field("no_pfp_promise ready", &no_pfp_promise.ready().is_some())
|
||||
.finish(),
|
||||
Self::DoneLoading { url, cache_type } => f
|
||||
.debug_struct("DoneLoading")
|
||||
.field("url", url)
|
||||
.field("cache_type", cache_type)
|
||||
.finish(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MediaAction {
|
||||
pub fn process(self, images: &mut Images) {
|
||||
match self {
|
||||
MediaAction::FetchImage {
|
||||
url,
|
||||
cache_type,
|
||||
no_pfp_promise: promise,
|
||||
} => {
|
||||
images
|
||||
.get_cache_mut(cache_type)
|
||||
.textures_cache
|
||||
.insert_pending(&url, promise);
|
||||
}
|
||||
MediaAction::DoneLoading { url, cache_type } => {
|
||||
let cache = match cache_type {
|
||||
MediaCacheType::Image => &mut images.static_imgs,
|
||||
MediaCacheType::Gif => &mut images.gifs,
|
||||
};
|
||||
|
||||
cache.textures_cache.move_to_loaded(&url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
mod action;
|
||||
mod context;
|
||||
|
||||
pub use action::{MediaAction, NoteAction, ScrollInfo, ZapAction, ZapTargetAmount};
|
||||
pub use action::{NoteAction, ScrollInfo, ZapAction, ZapTargetAmount};
|
||||
pub use context::{BroadcastContext, ContextSelection, NoteContextSelection};
|
||||
|
||||
use crate::Accounts;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
use bitflags::bitflags;
|
||||
|
||||
bitflags! {
|
||||
#[repr(transparent)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct NotedeckOptions: u64 {
|
||||
// ===== Settings ======
|
||||
/// Are we on light theme?
|
||||
const LightTheme = 1 << 0;
|
||||
|
||||
/// Debug controls, fps stats
|
||||
const Debug = 1 << 1;
|
||||
|
||||
/// Show relay debug window?
|
||||
const RelayDebug = 1 << 2;
|
||||
|
||||
/// Are we running as tests?
|
||||
const Tests = 1 << 3;
|
||||
|
||||
/// Use keystore?
|
||||
const UseKeystore = 1 << 4;
|
||||
|
||||
/// Simulate is_compiled_as_mobile ?
|
||||
const Mobile = 1 << 6;
|
||||
|
||||
// ===== Feature Flags ======
|
||||
/// Is notebook enabled?
|
||||
const FeatureNotebook = 1 << 32;
|
||||
|
||||
/// Is clndash enabled?
|
||||
const FeatureClnDash = 1 << 33;
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for NotedeckOptions {
|
||||
fn default() -> Self {
|
||||
NotedeckOptions::UseKeystore
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
mod app_size;
|
||||
mod theme_handler;
|
||||
mod settings_handler;
|
||||
mod token_handler;
|
||||
mod zoom;
|
||||
|
||||
pub use app_size::AppSizeHandler;
|
||||
pub use theme_handler::ThemeHandler;
|
||||
pub use settings_handler::Settings;
|
||||
pub use settings_handler::SettingsHandler;
|
||||
pub use settings_handler::DEFAULT_NOTE_BODY_FONT_SIZE;
|
||||
pub use token_handler::TokenHandler;
|
||||
pub use zoom::ZoomHandler;
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
use crate::{
|
||||
storage::delete_file, timed_serializer::TimedSerializer, DataPath, DataPathType, Directory,
|
||||
};
|
||||
use egui::ThemePreference;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::{error, info};
|
||||
|
||||
const THEME_FILE: &str = "theme.txt";
|
||||
const ZOOM_FACTOR_FILE: &str = "zoom_level.json";
|
||||
const SETTINGS_FILE: &str = "settings.json";
|
||||
|
||||
const DEFAULT_THEME: ThemePreference = ThemePreference::Dark;
|
||||
const DEFAULT_LOCALE: &str = "en-US";
|
||||
const DEFAULT_ZOOM_FACTOR: f32 = 1.0;
|
||||
const DEFAULT_SHOW_SOURCE_CLIENT: &str = "hide";
|
||||
const DEFAULT_SHOW_REPLIES_NEWEST_FIRST: bool = false;
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
pub const DEFAULT_NOTE_BODY_FONT_SIZE: f32 = 13.0;
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
pub const DEFAULT_NOTE_BODY_FONT_SIZE: f32 = 16.0;
|
||||
|
||||
fn deserialize_theme(serialized_theme: &str) -> Option<ThemePreference> {
|
||||
match serialized_theme {
|
||||
"dark" => Some(ThemePreference::Dark),
|
||||
"light" => Some(ThemePreference::Light),
|
||||
"system" => Some(ThemePreference::System),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Clone)]
|
||||
pub struct Settings {
|
||||
pub theme: ThemePreference,
|
||||
pub locale: String,
|
||||
pub zoom_factor: f32,
|
||||
pub show_source_client: String,
|
||||
pub show_replies_newest_first: bool,
|
||||
pub note_body_font_size: f32,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
theme: DEFAULT_THEME,
|
||||
locale: DEFAULT_LOCALE.to_string(),
|
||||
zoom_factor: DEFAULT_ZOOM_FACTOR,
|
||||
show_source_client: DEFAULT_SHOW_SOURCE_CLIENT.to_string(),
|
||||
show_replies_newest_first: DEFAULT_SHOW_REPLIES_NEWEST_FIRST,
|
||||
note_body_font_size: DEFAULT_NOTE_BODY_FONT_SIZE,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SettingsHandler {
|
||||
directory: Directory,
|
||||
serializer: TimedSerializer<Settings>,
|
||||
current_settings: Option<Settings>,
|
||||
}
|
||||
|
||||
impl SettingsHandler {
|
||||
fn read_from_theme_file(&self) -> Option<ThemePreference> {
|
||||
match self.directory.get_file(THEME_FILE.to_string()) {
|
||||
Ok(contents) => deserialize_theme(contents.trim()),
|
||||
Err(_) => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn read_from_zomfactor_file(&self) -> Option<f32> {
|
||||
match self.directory.get_file(ZOOM_FACTOR_FILE.to_string()) {
|
||||
Ok(contents) => serde_json::from_str::<f32>(&contents).ok(),
|
||||
Err(_) => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn migrate_to_settings_file(&mut self) -> bool {
|
||||
let mut settings = Settings::default();
|
||||
let mut migrated = false;
|
||||
// if theme.txt exists migrate
|
||||
if let Some(theme_from_file) = self.read_from_theme_file() {
|
||||
info!("migrating theme preference from theme.txt file");
|
||||
_ = delete_file(&self.directory.file_path, THEME_FILE.to_string());
|
||||
|
||||
settings.theme = theme_from_file;
|
||||
migrated = true;
|
||||
} else {
|
||||
info!("theme.txt file not found, using default theme");
|
||||
};
|
||||
|
||||
// if zoom_factor.txt exists migrate
|
||||
if let Some(zom_factor) = self.read_from_zomfactor_file() {
|
||||
info!("migrating theme preference from zom_factor file");
|
||||
_ = delete_file(&self.directory.file_path, ZOOM_FACTOR_FILE.to_string());
|
||||
|
||||
settings.zoom_factor = zom_factor;
|
||||
migrated = true;
|
||||
} else {
|
||||
info!("zoom_factor.txt exists migrate file not found, using default zoom factor");
|
||||
};
|
||||
|
||||
if migrated {
|
||||
self.current_settings = Some(settings);
|
||||
self.try_save_settings();
|
||||
}
|
||||
migrated
|
||||
}
|
||||
|
||||
pub fn new(path: &DataPath) -> Self {
|
||||
let directory = Directory::new(path.path(DataPathType::Setting));
|
||||
let serializer =
|
||||
TimedSerializer::new(path, DataPathType::Setting, "settings.json".to_owned());
|
||||
|
||||
Self {
|
||||
directory,
|
||||
serializer,
|
||||
current_settings: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load(mut self) -> Self {
|
||||
if self.migrate_to_settings_file() {
|
||||
return self;
|
||||
}
|
||||
|
||||
match self.directory.get_file(SETTINGS_FILE.to_string()) {
|
||||
Ok(contents_str) => {
|
||||
// Parse JSON content
|
||||
match serde_json::from_str::<Settings>(&contents_str) {
|
||||
Ok(settings) => {
|
||||
self.current_settings = Some(settings);
|
||||
}
|
||||
Err(_) => {
|
||||
error!("Invalid settings format. Using defaults");
|
||||
self.current_settings = Some(Settings::default());
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
error!("Could not read settings. Using defaults");
|
||||
self.current_settings = Some(Settings::default());
|
||||
}
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
pub(crate) fn try_save_settings(&mut self) {
|
||||
let settings = self.get_settings_mut().clone();
|
||||
self.serializer.try_save(settings);
|
||||
}
|
||||
|
||||
pub fn get_settings_mut(&mut self) -> &mut Settings {
|
||||
if self.current_settings.is_none() {
|
||||
self.current_settings = Some(Settings::default());
|
||||
}
|
||||
self.current_settings.as_mut().unwrap()
|
||||
}
|
||||
|
||||
pub fn set_theme(&mut self, theme: ThemePreference) {
|
||||
self.get_settings_mut().theme = theme;
|
||||
self.try_save_settings();
|
||||
}
|
||||
|
||||
pub fn set_locale<S>(&mut self, locale: S)
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.get_settings_mut().locale = locale.into();
|
||||
self.try_save_settings();
|
||||
}
|
||||
|
||||
pub fn set_zoom_factor(&mut self, zoom_factor: f32) {
|
||||
self.get_settings_mut().zoom_factor = zoom_factor;
|
||||
self.try_save_settings();
|
||||
}
|
||||
|
||||
pub fn set_show_source_client<S>(&mut self, option: S)
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.get_settings_mut().show_source_client = option.into();
|
||||
self.try_save_settings();
|
||||
}
|
||||
|
||||
pub fn set_show_replies_newest_first(&mut self, value: bool) {
|
||||
self.get_settings_mut().show_replies_newest_first = value;
|
||||
self.try_save_settings();
|
||||
}
|
||||
|
||||
pub fn set_note_body_font_size(&mut self, value: f32) {
|
||||
self.get_settings_mut().note_body_font_size = value;
|
||||
self.try_save_settings();
|
||||
}
|
||||
|
||||
pub fn update_batch<F>(&mut self, update_fn: F)
|
||||
where
|
||||
F: FnOnce(&mut Settings),
|
||||
{
|
||||
let settings = self.get_settings_mut();
|
||||
update_fn(settings);
|
||||
self.try_save_settings();
|
||||
}
|
||||
|
||||
pub fn update_settings(&mut self, new_settings: Settings) {
|
||||
self.current_settings = Some(new_settings);
|
||||
self.try_save_settings();
|
||||
}
|
||||
|
||||
pub fn theme(&self) -> ThemePreference {
|
||||
self.current_settings
|
||||
.as_ref()
|
||||
.map(|s| s.theme)
|
||||
.unwrap_or(DEFAULT_THEME)
|
||||
}
|
||||
|
||||
pub fn locale(&self) -> String {
|
||||
self.current_settings
|
||||
.as_ref()
|
||||
.map(|s| s.locale.clone())
|
||||
.unwrap_or_else(|| DEFAULT_LOCALE.to_string())
|
||||
}
|
||||
|
||||
pub fn zoom_factor(&self) -> f32 {
|
||||
self.current_settings
|
||||
.as_ref()
|
||||
.map(|s| s.zoom_factor)
|
||||
.unwrap_or(DEFAULT_ZOOM_FACTOR)
|
||||
}
|
||||
|
||||
pub fn show_source_client(&self) -> String {
|
||||
self.current_settings
|
||||
.as_ref()
|
||||
.map(|s| s.show_source_client.to_string())
|
||||
.unwrap_or(DEFAULT_SHOW_SOURCE_CLIENT.to_string())
|
||||
}
|
||||
|
||||
pub fn show_replies_newest_first(&self) -> bool {
|
||||
self.current_settings
|
||||
.as_ref()
|
||||
.map(|s| s.show_replies_newest_first)
|
||||
.unwrap_or(DEFAULT_SHOW_REPLIES_NEWEST_FIRST)
|
||||
}
|
||||
|
||||
pub fn is_loaded(&self) -> bool {
|
||||
self.current_settings.is_some()
|
||||
}
|
||||
|
||||
pub fn note_body_font_size(&self) -> f32 {
|
||||
self.current_settings
|
||||
.as_ref()
|
||||
.map(|s| s.note_body_font_size)
|
||||
.unwrap_or(DEFAULT_NOTE_BODY_FONT_SIZE)
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
use egui::ThemePreference;
|
||||
use tracing::{error, info};
|
||||
|
||||
use crate::{storage, DataPath, DataPathType, Directory};
|
||||
|
||||
pub struct ThemeHandler {
|
||||
directory: Directory,
|
||||
fallback_theme: ThemePreference,
|
||||
}
|
||||
|
||||
const THEME_FILE: &str = "theme.txt";
|
||||
|
||||
impl ThemeHandler {
|
||||
pub fn new(path: &DataPath) -> Self {
|
||||
let directory = Directory::new(path.path(DataPathType::Setting));
|
||||
let fallback_theme = ThemePreference::Dark;
|
||||
Self {
|
||||
directory,
|
||||
fallback_theme,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load(&self) -> ThemePreference {
|
||||
match self.directory.get_file(THEME_FILE.to_owned()) {
|
||||
Ok(contents) => match deserialize_theme(contents) {
|
||||
Some(theme) => theme,
|
||||
None => {
|
||||
error!(
|
||||
"Could not deserialize theme. Using fallback {:?} instead",
|
||||
self.fallback_theme
|
||||
);
|
||||
self.fallback_theme
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
error!(
|
||||
"Could not read {} file: {:?}\nUsing fallback {:?} instead",
|
||||
THEME_FILE, e, self.fallback_theme
|
||||
);
|
||||
self.fallback_theme
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn save(&self, theme: ThemePreference) {
|
||||
match storage::write_file(
|
||||
&self.directory.file_path,
|
||||
THEME_FILE.to_owned(),
|
||||
&theme_to_serialized(&theme),
|
||||
) {
|
||||
Ok(_) => info!(
|
||||
"Successfully saved {:?} theme change to {}",
|
||||
theme, THEME_FILE
|
||||
),
|
||||
Err(_) => error!("Could not save {:?} theme change to {}", theme, THEME_FILE),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn theme_to_serialized(theme: &ThemePreference) -> String {
|
||||
match theme {
|
||||
ThemePreference::Dark => "dark",
|
||||
ThemePreference::Light => "light",
|
||||
ThemePreference::System => "system",
|
||||
}
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
fn deserialize_theme(serialized_theme: String) -> Option<ThemePreference> {
|
||||
match serialized_theme.as_str() {
|
||||
"dark" => Some(ThemePreference::Dark),
|
||||
"light" => Some(ThemePreference::Light),
|
||||
"system" => Some(ThemePreference::System),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
use crate::{DataPath, DataPathType};
|
||||
use egui::Context;
|
||||
|
||||
use crate::timed_serializer::TimedSerializer;
|
||||
|
||||
pub struct ZoomHandler {
|
||||
serializer: TimedSerializer<f32>,
|
||||
}
|
||||
|
||||
impl ZoomHandler {
|
||||
pub fn new(path: &DataPath) -> Self {
|
||||
let serializer =
|
||||
TimedSerializer::new(path, DataPathType::Setting, "zoom_level.json".to_owned());
|
||||
|
||||
Self { serializer }
|
||||
}
|
||||
|
||||
pub fn try_save_zoom_factor(&mut self, ctx: &Context) {
|
||||
let cur_zoom_level = ctx.zoom_factor();
|
||||
self.serializer.try_save(cur_zoom_level);
|
||||
}
|
||||
|
||||
pub fn get_zoom_factor(&self) -> Option<f32> {
|
||||
self.serializer.get_item()
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ pub extern "C" fn Java_com_damus_notedeck_KeyboardHeightHelper_nativeKeyboardHei
|
||||
debug!("updating virtual keyboard height {}", height);
|
||||
|
||||
// Convert and store atomically
|
||||
KEYBOARD_HEIGHT.store(height as i32, Ordering::SeqCst);
|
||||
KEYBOARD_HEIGHT.store(height, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
/// Gets the current Android virtual keyboard height. Useful for transforming
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
#[cfg(target_os = "android")]
|
||||
pub mod android;
|
||||
|
||||
const VIRT_HEIGHT: i32 = 400;
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
pub fn virtual_keyboard_height() -> i32 {
|
||||
android::virtual_keyboard_height()
|
||||
pub fn virtual_keyboard_height(virt: bool) -> i32 {
|
||||
if virt {
|
||||
VIRT_HEIGHT
|
||||
} else {
|
||||
android::virtual_keyboard_height()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
pub fn virtual_keyboard_height() -> i32 {
|
||||
0
|
||||
pub fn virtual_keyboard_height(virt: bool) -> i32 {
|
||||
if virt {
|
||||
VIRT_HEIGHT
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
use crate::fonts;
|
||||
use crate::theme;
|
||||
use crate::NotedeckOptions;
|
||||
use crate::NotedeckTextStyle;
|
||||
use egui::FontId;
|
||||
use egui::ThemePreference;
|
||||
|
||||
pub fn setup_egui_context(
|
||||
ctx: &egui::Context,
|
||||
options: NotedeckOptions,
|
||||
theme: ThemePreference,
|
||||
note_body_font_size: f32,
|
||||
zoom_factor: f32,
|
||||
) {
|
||||
let is_mobile = options.contains(NotedeckOptions::Mobile) || crate::ui::is_compiled_as_mobile();
|
||||
let is_oled = crate::ui::is_oled(is_mobile);
|
||||
|
||||
ctx.options_mut(|o| {
|
||||
tracing::info!("Loaded theme {:?} from disk", theme);
|
||||
o.theme_preference = theme;
|
||||
});
|
||||
ctx.set_visuals_of(egui::Theme::Dark, theme::dark_mode(is_oled));
|
||||
ctx.set_visuals_of(egui::Theme::Light, theme::light_mode());
|
||||
|
||||
fonts::setup_fonts(ctx);
|
||||
|
||||
if crate::ui::is_compiled_as_mobile() {
|
||||
ctx.set_pixels_per_point(ctx.pixels_per_point() + 0.2);
|
||||
}
|
||||
|
||||
egui_extras::install_image_loaders(ctx);
|
||||
|
||||
ctx.options_mut(|o| {
|
||||
o.input_options.max_click_duration = 0.4;
|
||||
});
|
||||
ctx.all_styles_mut(|style| crate::theme::add_custom_style(is_mobile, style));
|
||||
|
||||
ctx.set_zoom_factor(zoom_factor);
|
||||
|
||||
let mut style = (*ctx.style()).clone();
|
||||
style.text_styles.insert(
|
||||
NotedeckTextStyle::NoteBody.text_style(),
|
||||
FontId::proportional(note_body_font_size),
|
||||
);
|
||||
ctx.set_style(style);
|
||||
}
|
||||
@@ -15,6 +15,7 @@ pub enum NotedeckTextStyle {
|
||||
Button,
|
||||
Small,
|
||||
Tiny,
|
||||
NoteBody,
|
||||
}
|
||||
|
||||
impl NotedeckTextStyle {
|
||||
@@ -29,6 +30,7 @@ impl NotedeckTextStyle {
|
||||
Self::Button => TextStyle::Button,
|
||||
Self::Small => TextStyle::Small,
|
||||
Self::Tiny => TextStyle::Name("Tiny".into()),
|
||||
Self::NoteBody => TextStyle::Name("NoteBody".into()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +45,7 @@ impl NotedeckTextStyle {
|
||||
Self::Button => FontFamily::Proportional,
|
||||
Self::Small => FontFamily::Proportional,
|
||||
Self::Tiny => FontFamily::Proportional,
|
||||
Self::NoteBody => FontFamily::Proportional,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,35 @@
|
||||
use egui::{
|
||||
style::{Selection, WidgetVisuals, Widgets},
|
||||
Color32, CornerRadius, Stroke, Visuals,
|
||||
};
|
||||
use crate::{fonts, NotedeckTextStyle};
|
||||
use egui::style::Interaction;
|
||||
use egui::style::Selection;
|
||||
use egui::style::WidgetVisuals;
|
||||
use egui::style::Widgets;
|
||||
use egui::Color32;
|
||||
use egui::CornerRadius;
|
||||
use egui::FontId;
|
||||
use egui::Stroke;
|
||||
use egui::Style;
|
||||
use egui::Visuals;
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
pub const PURPLE: Color32 = Color32::from_rgb(0xCC, 0x43, 0xC5);
|
||||
const PURPLE_ALT: Color32 = Color32::from_rgb(0x82, 0x56, 0xDD);
|
||||
//pub const DARK_BG: Color32 = egui::Color32::from_rgb(40, 44, 52);
|
||||
pub const GRAY_SECONDARY: Color32 = Color32::from_rgb(0x8A, 0x8A, 0x8A);
|
||||
const BLACK: Color32 = Color32::from_rgb(0x00, 0x00, 0x00);
|
||||
const RED_700: Color32 = Color32::from_rgb(0xC7, 0x37, 0x5A);
|
||||
const ORANGE_700: Color32 = Color32::from_rgb(0xF6, 0xB1, 0x4A);
|
||||
|
||||
// BACKGROUNDS
|
||||
const SEMI_DARKER_BG: Color32 = Color32::from_rgb(0x39, 0x39, 0x39);
|
||||
const DARKER_BG: Color32 = Color32::from_rgb(0x1F, 0x1F, 0x1F);
|
||||
const DARK_BG: Color32 = Color32::from_rgb(0x2C, 0x2C, 0x2C);
|
||||
const DARK_ISH_BG: Color32 = Color32::from_rgb(0x25, 0x25, 0x25);
|
||||
const SEMI_DARK_BG: Color32 = Color32::from_rgb(0x44, 0x44, 0x44);
|
||||
|
||||
const LIGHTER_GRAY: Color32 = Color32::from_rgb(0xf8, 0xf8, 0xf8);
|
||||
const LIGHT_GRAY: Color32 = Color32::from_rgb(0xc8, 0xc8, 0xc8); // 78%
|
||||
const DARKER_GRAY: Color32 = Color32::from_rgb(0xa5, 0xa5, 0xa5); // 65%
|
||||
const EVEN_DARKER_GRAY: Color32 = Color32::from_rgb(0x89, 0x89, 0x89); // 54%
|
||||
|
||||
pub struct ColorTheme {
|
||||
// VISUALS
|
||||
@@ -86,3 +114,131 @@ pub fn create_themed_visuals(theme: ColorTheme, default: Visuals) -> Visuals {
|
||||
..default
|
||||
}
|
||||
}
|
||||
|
||||
pub fn desktop_dark_color_theme() -> ColorTheme {
|
||||
ColorTheme {
|
||||
// VISUALS
|
||||
panel_fill: DARKER_BG,
|
||||
extreme_bg_color: DARK_ISH_BG,
|
||||
text_color: Color32::WHITE,
|
||||
err_fg_color: RED_700,
|
||||
warn_fg_color: ORANGE_700,
|
||||
hyperlink_color: PURPLE,
|
||||
selection_color: PURPLE_ALT,
|
||||
|
||||
// WINDOW
|
||||
window_fill: DARK_ISH_BG,
|
||||
window_stroke_color: DARK_BG,
|
||||
|
||||
// NONINTERACTIVE WIDGET
|
||||
noninteractive_bg_fill: DARK_ISH_BG,
|
||||
noninteractive_weak_bg_fill: DARK_BG,
|
||||
noninteractive_bg_stroke_color: SEMI_DARKER_BG,
|
||||
noninteractive_fg_stroke_color: GRAY_SECONDARY,
|
||||
|
||||
// INACTIVE WIDGET
|
||||
inactive_bg_stroke_color: SEMI_DARKER_BG,
|
||||
inactive_bg_fill: Color32::from_rgb(0x25, 0x25, 0x25),
|
||||
inactive_weak_bg_fill: SEMI_DARK_BG,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mobile_dark_color_theme() -> ColorTheme {
|
||||
ColorTheme {
|
||||
panel_fill: Color32::BLACK,
|
||||
noninteractive_weak_bg_fill: Color32::from_rgb(0x1F, 0x1F, 0x1F),
|
||||
..desktop_dark_color_theme()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn light_color_theme() -> ColorTheme {
|
||||
ColorTheme {
|
||||
// VISUALS
|
||||
panel_fill: Color32::WHITE,
|
||||
extreme_bg_color: LIGHTER_GRAY,
|
||||
text_color: BLACK,
|
||||
err_fg_color: RED_700,
|
||||
warn_fg_color: ORANGE_700,
|
||||
hyperlink_color: PURPLE,
|
||||
selection_color: PURPLE_ALT,
|
||||
|
||||
// WINDOW
|
||||
window_fill: Color32::WHITE,
|
||||
window_stroke_color: DARKER_GRAY,
|
||||
|
||||
// NONINTERACTIVE WIDGET
|
||||
noninteractive_bg_fill: Color32::WHITE,
|
||||
noninteractive_weak_bg_fill: LIGHTER_GRAY,
|
||||
noninteractive_bg_stroke_color: LIGHT_GRAY,
|
||||
noninteractive_fg_stroke_color: GRAY_SECONDARY,
|
||||
|
||||
// INACTIVE WIDGET
|
||||
inactive_bg_stroke_color: EVEN_DARKER_GRAY,
|
||||
inactive_bg_fill: LIGHTER_GRAY,
|
||||
inactive_weak_bg_fill: LIGHTER_GRAY,
|
||||
}
|
||||
}
|
||||
|
||||
/// Create custom text sizes for any FontSizes
|
||||
pub fn add_custom_style(is_mobile: bool, style: &mut Style) {
|
||||
let font_size = if is_mobile {
|
||||
fonts::mobile_font_size
|
||||
} else {
|
||||
fonts::desktop_font_size
|
||||
};
|
||||
|
||||
style.text_styles = NotedeckTextStyle::iter()
|
||||
.map(|text_style| {
|
||||
(
|
||||
text_style.text_style(),
|
||||
FontId::new(font_size(&text_style), text_style.font_family()),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
style.interaction = Interaction {
|
||||
tooltip_delay: 0.1,
|
||||
show_tooltips_only_when_still: false,
|
||||
..Interaction::default()
|
||||
};
|
||||
|
||||
// debug: show callstack for the current widget on hover if all
|
||||
// modifier keys are pressed down.
|
||||
/*
|
||||
#[cfg(feature = "debug-widget-callstack")]
|
||||
{
|
||||
#[cfg(not(debug_assertions))]
|
||||
compile_error!(
|
||||
"The `debug-widget-callstack` feature requires a debug build, \
|
||||
release builds are unsupported."
|
||||
);
|
||||
style.debug.debug_on_hover_with_all_modifiers = true;
|
||||
}
|
||||
|
||||
// debug: show an overlay on all interactive widgets
|
||||
#[cfg(feature = "debug-interactive-widgets")]
|
||||
{
|
||||
#[cfg(not(debug_assertions))]
|
||||
compile_error!(
|
||||
"The `debug-interactive-widgets` feature requires a debug build, \
|
||||
release builds are unsupported."
|
||||
);
|
||||
style.debug.show_interactive_widgets = true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
pub fn light_mode() -> Visuals {
|
||||
create_themed_visuals(crate::theme::light_color_theme(), Visuals::light())
|
||||
}
|
||||
|
||||
pub fn dark_mode(is_oled: bool) -> Visuals {
|
||||
create_themed_visuals(
|
||||
if is_oled {
|
||||
mobile_dark_color_theme()
|
||||
} else {
|
||||
desktop_dark_color_theme()
|
||||
},
|
||||
Visuals::dark(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use crate::{tr, Localization};
|
||||
use chrono::DateTime;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
// Time duration constants in seconds
|
||||
@@ -83,6 +84,14 @@ fn time_ago_between(i18n: &mut Localization, timestamp: u64, now: u64) -> String
|
||||
}
|
||||
}
|
||||
|
||||
pub fn time_format(_i18n: &mut Localization, timestamp: u64) -> String {
|
||||
// TODO: format this using the selected locale
|
||||
DateTime::from_timestamp(timestamp as i64, 0)
|
||||
.unwrap()
|
||||
.format("%l:%M %p %b %d, %Y")
|
||||
.to_string()
|
||||
}
|
||||
|
||||
pub fn time_ago_since(i18n: &mut Localization, timestamp: u64) -> String {
|
||||
let now = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
|
||||
@@ -2,16 +2,16 @@ use crate::debouncer::Debouncer;
|
||||
use crate::{storage, DataPath, DataPathType, Directory};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::time::Duration;
|
||||
use tracing::info; // Adjust this import path as needed
|
||||
use tracing::info;
|
||||
|
||||
pub struct TimedSerializer<T: PartialEq + Copy + Serialize + for<'de> Deserialize<'de>> {
|
||||
pub struct TimedSerializer<T: PartialEq + Clone + Serialize + for<'de> Deserialize<'de>> {
|
||||
directory: Directory,
|
||||
file_name: String,
|
||||
debouncer: Debouncer,
|
||||
saved_item: Option<T>,
|
||||
}
|
||||
|
||||
impl<T: PartialEq + Copy + Serialize + for<'de> Deserialize<'de>> TimedSerializer<T> {
|
||||
impl<T: PartialEq + Clone + Serialize + for<'de> Deserialize<'de>> TimedSerializer<T> {
|
||||
pub fn new(path: &DataPath, path_type: DataPathType, file_name: String) -> Self {
|
||||
let directory = Directory::new(path.path(path_type));
|
||||
let delay = Duration::from_millis(1000);
|
||||
@@ -30,11 +30,11 @@ impl<T: PartialEq + Copy + Serialize + for<'de> Deserialize<'de>> TimedSerialize
|
||||
self
|
||||
}
|
||||
|
||||
// returns whether successful
|
||||
/// Returns whether it actually wrote the new value
|
||||
pub fn try_save(&mut self, cur_item: T) -> bool {
|
||||
if self.debouncer.should_act() {
|
||||
if let Some(saved_item) = self.saved_item {
|
||||
if saved_item != cur_item {
|
||||
if let Some(ref saved_item) = self.saved_item {
|
||||
if *saved_item != cur_item {
|
||||
return self.save(cur_item);
|
||||
}
|
||||
} else {
|
||||
@@ -45,8 +45,8 @@ impl<T: PartialEq + Copy + Serialize + for<'de> Deserialize<'de>> TimedSerialize
|
||||
}
|
||||
|
||||
pub fn get_item(&self) -> Option<T> {
|
||||
if self.saved_item.is_some() {
|
||||
return self.saved_item;
|
||||
if let Some(ref item) = self.saved_item {
|
||||
return Some(item.clone());
|
||||
}
|
||||
if let Ok(file_contents) = self.directory.get_file(self.file_name.clone()) {
|
||||
if let Ok(item) = serde_json::from_str::<T>(&file_contents) {
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
use crate::NotedeckTextStyle;
|
||||
|
||||
pub const NARROW_SCREEN_WIDTH: f32 = 550.0;
|
||||
|
||||
pub fn richtext_small<S>(text: S) -> egui::RichText
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
egui::RichText::new(text).text_style(NotedeckTextStyle::Small.text_style())
|
||||
}
|
||||
|
||||
/// Determine if the screen is narrow. This is useful for detecting mobile
|
||||
/// contexts, but with the nuance that we may also have a wide android tablet.
|
||||
pub fn is_narrow(ctx: &egui::Context) -> bool {
|
||||
let screen_size = ctx.input(|c| c.screen_rect().size());
|
||||
screen_size.x < 550.0
|
||||
screen_size.x < NARROW_SCREEN_WIDTH
|
||||
}
|
||||
|
||||
pub fn is_oled() -> bool {
|
||||
is_compiled_as_mobile()
|
||||
pub fn is_oled(is_mobile_override: bool) -> bool {
|
||||
is_mobile_override || is_compiled_as_mobile()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
@@ -9,6 +9,7 @@ license = "GPLv3"
|
||||
description = "The nostr browser"
|
||||
|
||||
[dependencies]
|
||||
bitflags = { workspace = true }
|
||||
eframe = { workspace = true }
|
||||
egui_tabs = { workspace = true }
|
||||
egui_extras = { workspace = true }
|
||||
@@ -16,6 +17,8 @@ egui = { workspace = true }
|
||||
notedeck_columns = { workspace = true }
|
||||
notedeck_ui = { workspace = true }
|
||||
notedeck_dave = { workspace = true }
|
||||
notedeck_notebook = { workspace = true }
|
||||
notedeck_clndash = { workspace = true }
|
||||
notedeck = { workspace = true }
|
||||
nostrdb = { workspace = true }
|
||||
puffin = { workspace = true, optional = true }
|
||||
@@ -63,6 +66,12 @@ short_description = "The nostr browser"
|
||||
identifier = "com.damus.notedeck"
|
||||
icon = ["assets/app_icon.icns"]
|
||||
|
||||
[package.metadata.android.manifest.queries]
|
||||
intent = [
|
||||
{ action = ["android.intent.action.MAIN"] },
|
||||
]
|
||||
|
||||
|
||||
[package.metadata.android]
|
||||
package = "com.damus.app"
|
||||
apk_name = "Notedeck"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
android:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
|
||||
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|uiMode|fontScale|smallestScreenSize"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
>
|
||||
@@ -23,11 +23,18 @@
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
<uses-feature android:name="android.hardware.vulkan.level"
|
||||
android:required="true"
|
||||
android:version="1" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
</manifest>
|
||||
</manifest>
|
||||
@@ -2,13 +2,9 @@
|
||||
//use egui_android::run_android;
|
||||
|
||||
use egui_winit::winit::platform::android::activity::AndroidApp;
|
||||
use notedeck::enostr::Error;
|
||||
use notedeck_columns::Damus;
|
||||
use notedeck_dave::Dave;
|
||||
|
||||
use crate::{app::NotedeckApp, chrome::Chrome, setup::setup_chrome};
|
||||
use crate::chrome::Chrome;
|
||||
use notedeck::Notedeck;
|
||||
use tracing::error;
|
||||
|
||||
#[no_mangle]
|
||||
#[tokio::main]
|
||||
@@ -69,30 +65,8 @@ pub async fn android_main(app: AndroidApp) {
|
||||
Box::new(move |cc| {
|
||||
let ctx = &cc.egui_ctx;
|
||||
let mut notedeck = Notedeck::new(ctx, path, &app_args);
|
||||
setup_chrome(ctx, ¬edeck.args(), notedeck.theme());
|
||||
|
||||
let context = &mut notedeck.app_context();
|
||||
let dave = Dave::new(cc.wgpu_render_state.as_ref());
|
||||
let columns = Damus::new(context, &app_args);
|
||||
let mut chrome = Chrome::new();
|
||||
|
||||
// ensure we recognized all the arguments
|
||||
let completely_unrecognized: Vec<String> = notedeck
|
||||
.unrecognized_args()
|
||||
.intersection(columns.unrecognized_args())
|
||||
.cloned()
|
||||
.collect();
|
||||
if !completely_unrecognized.is_empty() {
|
||||
error!("Unrecognized arguments: {:?}", completely_unrecognized);
|
||||
return Err(Error::Empty.into());
|
||||
}
|
||||
|
||||
chrome.add_app(NotedeckApp::Columns(columns));
|
||||
chrome.add_app(NotedeckApp::Dave(dave));
|
||||
|
||||
// test dav
|
||||
chrome.set_active(0);
|
||||
|
||||
notedeck.setup(ctx);
|
||||
let chrome = Chrome::new_with_apps(cc, &app_args, &mut notedeck)?;
|
||||
notedeck.set_app(chrome);
|
||||
|
||||
Ok(Box::new(notedeck))
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
use notedeck::{AppAction, AppContext};
|
||||
use notedeck_clndash::ClnDash;
|
||||
use notedeck_columns::Damus;
|
||||
use notedeck_dave::Dave;
|
||||
use notedeck_notebook::Notebook;
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum NotedeckApp {
|
||||
Dave(Dave),
|
||||
Columns(Damus),
|
||||
Dave(Box<Dave>),
|
||||
Columns(Box<Damus>),
|
||||
Notebook(Box<Notebook>),
|
||||
ClnDash(Box<ClnDash>),
|
||||
Other(Box<dyn notedeck::App>),
|
||||
}
|
||||
|
||||
@@ -14,6 +18,8 @@ impl notedeck::App for NotedeckApp {
|
||||
match self {
|
||||
NotedeckApp::Dave(dave) => dave.update(ctx, ui),
|
||||
NotedeckApp::Columns(columns) => columns.update(ctx, ui),
|
||||
NotedeckApp::Notebook(notebook) => notebook.update(ctx, ui),
|
||||
NotedeckApp::ClnDash(clndash) => clndash.update(ctx, ui),
|
||||
NotedeckApp::Other(other) => other.update(ctx, ui),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,44 +2,35 @@
|
||||
//#[cfg(target_arch = "wasm32")]
|
||||
//use wasm_bindgen::prelude::*;
|
||||
use crate::app::NotedeckApp;
|
||||
use crate::ChromeOptions;
|
||||
use eframe::CreationContext;
|
||||
use egui::{vec2, Button, Color32, Label, Layout, Rect, RichText, ThemePreference, Widget};
|
||||
use egui_extras::{Size, StripBuilder};
|
||||
use nostrdb::{ProfileRecord, Transaction};
|
||||
use notedeck::Error;
|
||||
use notedeck::{
|
||||
tr, App, AppAction, AppContext, Localization, NotedeckTextStyle, UserAccount, WalletType,
|
||||
tr, App, AppAction, AppContext, Localization, Notedeck, NotedeckOptions, NotedeckTextStyle,
|
||||
UserAccount, WalletType,
|
||||
};
|
||||
use notedeck_columns::{
|
||||
column::SelectionResult, timeline::kind::ListKind, timeline::TimelineKind, Damus,
|
||||
column::SelectionResult,
|
||||
timeline::{kind::ListKind, TimelineKind},
|
||||
Damus,
|
||||
};
|
||||
use notedeck_dave::{Dave, DaveAvatar};
|
||||
use notedeck_ui::{app_images, AnimationHelper, ProfilePic};
|
||||
use std::collections::HashMap;
|
||||
|
||||
static ICON_WIDTH: f32 = 40.0;
|
||||
pub static ICON_EXPANSION_MULTIPLE: f32 = 1.2;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Chrome {
|
||||
active: i32,
|
||||
open: bool,
|
||||
tab_selected: i32,
|
||||
options: ChromeOptions,
|
||||
apps: Vec<NotedeckApp>,
|
||||
|
||||
#[cfg(feature = "memory")]
|
||||
show_memory_debug: bool,
|
||||
}
|
||||
|
||||
impl Default for Chrome {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
active: 0,
|
||||
tab_selected: 0,
|
||||
// sidemenu is not open by default on mobile/narrow uis
|
||||
open: !notedeck::ui::is_compiled_as_mobile(),
|
||||
apps: vec![],
|
||||
|
||||
#[cfg(feature = "memory")]
|
||||
show_memory_debug: false,
|
||||
}
|
||||
}
|
||||
pub repaint_causes: HashMap<egui::RepaintCause, u64>,
|
||||
}
|
||||
|
||||
/// When you click the toolbar button, these actions
|
||||
@@ -112,10 +103,8 @@ impl ChromePanelAction {
|
||||
fn process(&self, ctx: &mut AppContext, chrome: &mut Chrome, ui: &mut egui::Ui) {
|
||||
match self {
|
||||
Self::SaveTheme(theme) => {
|
||||
ui.ctx().options_mut(|o| {
|
||||
o.theme_preference = *theme;
|
||||
});
|
||||
ctx.theme.save(*theme);
|
||||
ui.ctx().set_theme(*theme);
|
||||
ctx.settings.set_theme(*theme);
|
||||
}
|
||||
|
||||
Self::Toolbar(toolbar_action) => match toolbar_action {
|
||||
@@ -168,13 +157,57 @@ impl ChromePanelAction {
|
||||
}
|
||||
}
|
||||
|
||||
/// Some people have been running notedeck in debug, let's catch that!
|
||||
fn stop_debug_mode(options: NotedeckOptions) {
|
||||
if !options.contains(NotedeckOptions::Tests)
|
||||
&& cfg!(debug_assertions)
|
||||
&& !options.contains(NotedeckOptions::Debug)
|
||||
{
|
||||
println!("--- WELCOME TO DAMUS NOTEDECK! ---");
|
||||
println!(
|
||||
"It looks like are running notedeck in debug mode, unless you are a developer, this is not likely what you want."
|
||||
);
|
||||
println!("If you are a developer, run `cargo run -- --debug` to skip this message.");
|
||||
println!("For everyone else, try again with `cargo run --release`. Enjoy!");
|
||||
println!("---------------------------------");
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
|
||||
impl Chrome {
|
||||
pub fn new() -> Self {
|
||||
Chrome::default()
|
||||
/// Create a new chrome with the default app setup
|
||||
pub fn new_with_apps(
|
||||
cc: &CreationContext,
|
||||
app_args: &[String],
|
||||
notedeck: &mut Notedeck,
|
||||
) -> Result<Self, Error> {
|
||||
stop_debug_mode(notedeck.options());
|
||||
|
||||
let context = &mut notedeck.app_context();
|
||||
let dave = Dave::new(cc.wgpu_render_state.as_ref());
|
||||
let columns = Damus::new(context, app_args);
|
||||
let mut chrome = Chrome::default();
|
||||
|
||||
notedeck.check_args(columns.unrecognized_args())?;
|
||||
|
||||
chrome.add_app(NotedeckApp::Columns(Box::new(columns)));
|
||||
chrome.add_app(NotedeckApp::Dave(Box::new(dave)));
|
||||
|
||||
if notedeck.has_option(NotedeckOptions::FeatureNotebook) {
|
||||
chrome.add_app(NotedeckApp::Notebook(Box::default()));
|
||||
}
|
||||
|
||||
if notedeck.has_option(NotedeckOptions::FeatureClnDash) {
|
||||
chrome.add_app(NotedeckApp::ClnDash(Box::default()));
|
||||
}
|
||||
|
||||
chrome.set_active(0);
|
||||
|
||||
Ok(chrome)
|
||||
}
|
||||
|
||||
pub fn toggle(&mut self) {
|
||||
self.open = !self.open;
|
||||
self.options.toggle(ChromeOptions::IsOpen);
|
||||
}
|
||||
|
||||
pub fn add_app(&mut self, app: NotedeckApp) {
|
||||
@@ -299,7 +332,9 @@ impl Chrome {
|
||||
fn amount_open(&self, ui: &mut egui::Ui) -> f32 {
|
||||
let open_id = egui::Id::new("chrome_open");
|
||||
let side_panel_width: f32 = 74.0;
|
||||
ui.ctx().animate_bool(open_id, self.open) * side_panel_width
|
||||
ui.ctx()
|
||||
.animate_bool(open_id, self.options.contains(ChromeOptions::IsOpen))
|
||||
* side_panel_width
|
||||
}
|
||||
|
||||
fn toolbar_height() -> f32 {
|
||||
@@ -325,7 +360,12 @@ impl Chrome {
|
||||
});
|
||||
|
||||
strip.cell(|ui| {
|
||||
if let Some(action) = self.toolbar(ui) {
|
||||
let pk = ctx.accounts.get_selected_account().key.pubkey;
|
||||
|
||||
let unseen_notification =
|
||||
unseen_notification(self.get_columns_app(), ctx.ndb, pk);
|
||||
|
||||
if let Some(action) = self.toolbar(ui, unseen_notification) {
|
||||
got_action = Some(ChromePanelAction::Toolbar(action))
|
||||
}
|
||||
});
|
||||
@@ -334,7 +374,7 @@ impl Chrome {
|
||||
got_action
|
||||
}
|
||||
|
||||
fn toolbar(&mut self, ui: &mut egui::Ui) -> Option<ToolbarAction> {
|
||||
fn toolbar(&mut self, ui: &mut egui::Ui, unseen_notification: bool) -> Option<ToolbarAction> {
|
||||
use egui_tabs::{TabColor, Tabs};
|
||||
|
||||
let rect = ui.available_rect_before_wrap();
|
||||
@@ -378,7 +418,9 @@ impl Chrome {
|
||||
action = Some(ToolbarAction::Dave);
|
||||
}
|
||||
}
|
||||
} else if index == 2 && notifications_button(ui, btn_size).clicked() {
|
||||
} else if index == 2
|
||||
&& notifications_button(ui, btn_size, unseen_notification).clicked()
|
||||
{
|
||||
action = Some(ToolbarAction::Notifications);
|
||||
}
|
||||
|
||||
@@ -403,12 +445,25 @@ impl Chrome {
|
||||
fn show(&mut self, ctx: &mut AppContext, ui: &mut egui::Ui) -> Option<ChromePanelAction> {
|
||||
ui.spacing_mut().item_spacing.x = 0.0;
|
||||
|
||||
if notedeck::ui::is_narrow(ui.ctx()) {
|
||||
if ctx.args.options.contains(NotedeckOptions::Debug)
|
||||
&& ui.ctx().input(|i| i.key_pressed(egui::Key::Backtick))
|
||||
{
|
||||
self.options.toggle(ChromeOptions::VirtualKeyboard);
|
||||
}
|
||||
|
||||
let r = if notedeck::ui::is_narrow(ui.ctx()) {
|
||||
self.toolbar_chrome(ctx, ui)
|
||||
} else {
|
||||
let amt_open = self.amount_open(ui);
|
||||
self.panel(ctx, StripBuilder::new(ui), amt_open)
|
||||
};
|
||||
|
||||
// virtual keyboard
|
||||
if self.options.contains(ChromeOptions::VirtualKeyboard) {
|
||||
virtual_keyboard_ui(ui);
|
||||
}
|
||||
|
||||
r
|
||||
}
|
||||
|
||||
fn topdown_sidebar(&mut self, ui: &mut egui::Ui, i18n: &mut Localization) {
|
||||
@@ -423,34 +478,74 @@ impl Chrome {
|
||||
|
||||
if ui.add(expand_side_panel_button()).clicked() {
|
||||
//self.active = (self.active + 1) % (self.apps.len() as i32);
|
||||
self.open = !self.open;
|
||||
self.options.toggle(ChromeOptions::IsOpen);
|
||||
}
|
||||
|
||||
ui.add_space(4.0);
|
||||
ui.add(milestone_name(i18n));
|
||||
ui.add_space(16.0);
|
||||
//let dark_mode = ui.ctx().style().visuals.dark_mode;
|
||||
{
|
||||
if columns_button(ui)
|
||||
.on_hover_cursor(egui::CursorIcon::PointingHand)
|
||||
.clicked()
|
||||
{
|
||||
self.active = 0;
|
||||
}
|
||||
}
|
||||
ui.add_space(32.0);
|
||||
|
||||
if let Some(dave) = self.get_dave() {
|
||||
let rect = dave_sidebar_rect(ui);
|
||||
let dave_resp = dave_button(dave.avatar_mut(), ui, rect)
|
||||
.on_hover_cursor(egui::CursorIcon::PointingHand);
|
||||
if dave_resp.clicked() {
|
||||
self.switch_to_dave();
|
||||
for (i, app) in self.apps.iter_mut().enumerate() {
|
||||
let r = match app {
|
||||
NotedeckApp::Columns(_columns_app) => columns_button(ui),
|
||||
|
||||
NotedeckApp::Dave(dave) => {
|
||||
ui.add_space(24.0);
|
||||
let rect = dave_sidebar_rect(ui);
|
||||
dave_button(dave.avatar_mut(), ui, rect)
|
||||
}
|
||||
|
||||
NotedeckApp::ClnDash(_clndash) => clndash_button(ui),
|
||||
|
||||
NotedeckApp::Notebook(_notebook) => notebook_button(ui),
|
||||
|
||||
NotedeckApp::Other(_other) => {
|
||||
// app provides its own button rendering ui?
|
||||
panic!("TODO: implement other apps")
|
||||
}
|
||||
};
|
||||
|
||||
ui.add_space(4.0);
|
||||
|
||||
if r.on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
|
||||
self.active = i as i32;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn unseen_notification(
|
||||
columns: Option<&mut Damus>,
|
||||
ndb: &nostrdb::Ndb,
|
||||
current_pk: notedeck::enostr::Pubkey,
|
||||
) -> bool {
|
||||
let Some(columns) = columns else {
|
||||
return false;
|
||||
};
|
||||
|
||||
let Some(tl) = columns
|
||||
.timeline_cache
|
||||
.get_mut(&TimelineKind::Notifications(current_pk))
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
|
||||
let freshness = &mut tl.current_view_mut().freshness;
|
||||
freshness.update(|timestamp_last_viewed| {
|
||||
let filter = notedeck_columns::timeline::kind::notifications_filter(¤t_pk)
|
||||
.since_mut(timestamp_last_viewed);
|
||||
let txn = Transaction::new(ndb).expect("txn");
|
||||
|
||||
let Some(res) = ndb.query(&txn, &[filter], 1).ok() else {
|
||||
return false;
|
||||
};
|
||||
|
||||
!res.is_empty()
|
||||
});
|
||||
|
||||
freshness.has_unseen()
|
||||
}
|
||||
|
||||
impl notedeck::App for Chrome {
|
||||
fn update(&mut self, ctx: &mut notedeck::AppContext, ui: &mut egui::Ui) -> Option<AppAction> {
|
||||
if let Some(action) = self.show(ctx, ui) {
|
||||
@@ -504,6 +599,7 @@ fn expanding_button(
|
||||
light_img: egui::Image,
|
||||
dark_img: egui::Image,
|
||||
ui: &mut egui::Ui,
|
||||
unseen_indicator: bool,
|
||||
) -> egui::Response {
|
||||
let max_size = ICON_WIDTH * ICON_EXPANSION_MULTIPLE; // max size of the widget
|
||||
let img = if ui.visuals().dark_mode {
|
||||
@@ -515,16 +611,34 @@ fn expanding_button(
|
||||
let helper = AnimationHelper::new(ui, name, egui::vec2(max_size, max_size));
|
||||
|
||||
let cur_img_size = helper.scale_1d_pos(img_size);
|
||||
img.paint_at(
|
||||
ui,
|
||||
helper
|
||||
.get_animation_rect()
|
||||
.shrink((max_size - cur_img_size) / 2.0),
|
||||
);
|
||||
|
||||
let paint_rect = helper
|
||||
.get_animation_rect()
|
||||
.shrink((max_size - cur_img_size) / 2.0);
|
||||
img.paint_at(ui, paint_rect);
|
||||
|
||||
if unseen_indicator {
|
||||
paint_unseen_indicator(ui, paint_rect, helper.scale_1d_pos(3.0));
|
||||
}
|
||||
|
||||
helper.take_animation_response()
|
||||
}
|
||||
|
||||
fn paint_unseen_indicator(ui: &mut egui::Ui, rect: egui::Rect, radius: f32) {
|
||||
let center = rect.center();
|
||||
let top_right = rect.right_top();
|
||||
let distance = center.distance(top_right);
|
||||
let midpoint = {
|
||||
let mut cur = center;
|
||||
cur.x += distance / 2.0;
|
||||
cur.y -= distance / 2.0;
|
||||
cur
|
||||
};
|
||||
|
||||
let painter = ui.painter_at(rect);
|
||||
painter.circle_filled(midpoint, radius, notedeck_ui::colors::PINK);
|
||||
}
|
||||
|
||||
fn support_button(ui: &mut egui::Ui) -> egui::Response {
|
||||
expanding_button(
|
||||
"help-button",
|
||||
@@ -532,6 +646,7 @@ fn support_button(ui: &mut egui::Ui) -> egui::Response {
|
||||
app_images::help_light_image(),
|
||||
app_images::help_dark_image(),
|
||||
ui,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -542,16 +657,18 @@ fn settings_button(ui: &mut egui::Ui) -> egui::Response {
|
||||
app_images::settings_light_image(),
|
||||
app_images::settings_dark_image(),
|
||||
ui,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
fn notifications_button(ui: &mut egui::Ui, size: f32) -> egui::Response {
|
||||
fn notifications_button(ui: &mut egui::Ui, size: f32, unseen_indicator: bool) -> egui::Response {
|
||||
expanding_button(
|
||||
"notifications-button",
|
||||
size,
|
||||
app_images::notifications_light_image(),
|
||||
app_images::notifications_dark_image(),
|
||||
ui,
|
||||
unseen_indicator,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -562,6 +679,7 @@ fn home_button(ui: &mut egui::Ui, size: f32) -> egui::Response {
|
||||
app_images::home_light_image(),
|
||||
app_images::home_dark_image(),
|
||||
ui,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -572,6 +690,7 @@ fn columns_button(ui: &mut egui::Ui) -> egui::Response {
|
||||
app_images::columns_image(),
|
||||
app_images::columns_image(),
|
||||
ui,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -582,6 +701,29 @@ fn accounts_button(ui: &mut egui::Ui) -> egui::Response {
|
||||
app_images::accounts_image().tint(ui.visuals().text_color()),
|
||||
app_images::accounts_image(),
|
||||
ui,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
fn clndash_button(ui: &mut egui::Ui) -> egui::Response {
|
||||
expanding_button(
|
||||
"clndash-button",
|
||||
24.0,
|
||||
app_images::cln_image(),
|
||||
app_images::cln_image(),
|
||||
ui,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
fn notebook_button(ui: &mut egui::Ui) -> egui::Response {
|
||||
expanding_button(
|
||||
"notebook-button",
|
||||
40.0,
|
||||
app_images::algo_image(),
|
||||
app_images::algo_image(),
|
||||
ui,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -695,6 +837,7 @@ fn chrome_handle_app_action(
|
||||
ctx.global_wallet,
|
||||
ctx.zaps,
|
||||
ctx.img_cache,
|
||||
&mut columns.view_state,
|
||||
ui,
|
||||
);
|
||||
|
||||
@@ -750,6 +893,7 @@ fn columns_route_to_profile(
|
||||
ctx.global_wallet,
|
||||
ctx.zaps,
|
||||
ctx.img_cache,
|
||||
&mut columns.view_state,
|
||||
ui,
|
||||
);
|
||||
|
||||
@@ -812,7 +956,7 @@ fn pfp_button(ctx: &mut AppContext, ui: &mut egui::Ui) -> egui::Response {
|
||||
/// The section of the chrome sidebar that starts at the
|
||||
/// bottom and goes up
|
||||
fn bottomup_sidebar(
|
||||
_chrome: &mut Chrome,
|
||||
chrome: &mut Chrome,
|
||||
ctx: &mut AppContext,
|
||||
ui: &mut egui::Ui,
|
||||
) -> Option<ChromePanelAction> {
|
||||
@@ -861,12 +1005,31 @@ fn bottomup_sidebar(
|
||||
.add(wallet_button())
|
||||
.on_hover_cursor(egui::CursorIcon::PointingHand);
|
||||
|
||||
if ctx.args.debug {
|
||||
ui.weak(format!("{}", ctx.frame_history.fps() as i32));
|
||||
ui.weak(format!(
|
||||
"{:10.1}",
|
||||
ctx.frame_history.mean_frame_time() * 1e3
|
||||
));
|
||||
if ctx.args.options.contains(NotedeckOptions::Debug) {
|
||||
let r = ui
|
||||
.weak(format!("{}", ctx.frame_history.fps() as i32))
|
||||
.union(ui.weak(format!(
|
||||
"{:10.1}",
|
||||
ctx.frame_history.mean_frame_time() * 1e3
|
||||
)))
|
||||
.on_hover_cursor(egui::CursorIcon::PointingHand);
|
||||
|
||||
if r.clicked() {
|
||||
chrome.options.toggle(ChromeOptions::RepaintDebug);
|
||||
}
|
||||
|
||||
if chrome.options.contains(ChromeOptions::RepaintDebug) {
|
||||
for cause in ui.ctx().repaint_causes() {
|
||||
chrome
|
||||
.repaint_causes
|
||||
.entry(cause)
|
||||
.and_modify(|rc| {
|
||||
*rc += 1;
|
||||
})
|
||||
.or_insert(1);
|
||||
}
|
||||
repaint_causes_window(ui, &chrome.repaint_causes)
|
||||
}
|
||||
|
||||
#[cfg(feature = "memory")]
|
||||
{
|
||||
@@ -877,14 +1040,14 @@ fn bottomup_sidebar(
|
||||
.on_hover_cursor(egui::CursorIcon::PointingHand)
|
||||
.clicked()
|
||||
{
|
||||
_chrome.show_memory_debug = !_chrome.show_memory_debug;
|
||||
chrome.show_memory_debug = !chrome.show_memory_debug;
|
||||
}
|
||||
}
|
||||
if let Some(resident) = mem_use.resident {
|
||||
ui.weak(format!("{}", format_bytes(resident as f64)));
|
||||
}
|
||||
|
||||
if _chrome.show_memory_debug {
|
||||
if chrome.show_memory_debug {
|
||||
egui::Window::new("Memory Debug").show(ui.ctx(), memory_debug_ui);
|
||||
}
|
||||
}
|
||||
@@ -1004,3 +1167,64 @@ pub fn format_bytes(number_of_bytes: f64) -> String {
|
||||
format!("{:.*} GiB", decimals, number_of_bytes / 30.0_f64.exp2())
|
||||
}
|
||||
}
|
||||
|
||||
fn repaint_causes_window(ui: &mut egui::Ui, causes: &HashMap<egui::RepaintCause, u64>) {
|
||||
egui::Window::new("Repaint Causes").show(ui.ctx(), |ui| {
|
||||
use egui_extras::{Column, TableBuilder};
|
||||
TableBuilder::new(ui)
|
||||
.column(Column::auto().at_least(600.0).resizable(true))
|
||||
.column(Column::auto().at_least(50.0).resizable(true))
|
||||
.column(Column::auto().at_least(50.0).resizable(true))
|
||||
.column(Column::remainder())
|
||||
.header(20.0, |mut header| {
|
||||
header.col(|ui| {
|
||||
ui.heading("file");
|
||||
});
|
||||
header.col(|ui| {
|
||||
ui.heading("line");
|
||||
});
|
||||
header.col(|ui| {
|
||||
ui.heading("count");
|
||||
});
|
||||
header.col(|ui| {
|
||||
ui.heading("reason");
|
||||
});
|
||||
})
|
||||
.body(|mut body| {
|
||||
for (cause, hits) in causes.iter() {
|
||||
body.row(30.0, |mut row| {
|
||||
row.col(|ui| {
|
||||
ui.label(cause.file.to_string());
|
||||
});
|
||||
row.col(|ui| {
|
||||
ui.label(format!("{}", cause.line));
|
||||
});
|
||||
row.col(|ui| {
|
||||
ui.label(format!("{hits}"));
|
||||
});
|
||||
row.col(|ui| {
|
||||
ui.label(format!("{}", &cause.reason));
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fn virtual_keyboard_ui(ui: &mut egui::Ui) {
|
||||
let height = notedeck::platform::virtual_keyboard_height(true);
|
||||
let screen_rect = ui.ctx().screen_rect();
|
||||
|
||||
let min = egui::Pos2::new(0.0, screen_rect.max.y - height as f32);
|
||||
let rect = Rect::from_min_max(min, screen_rect.max);
|
||||
let painter = ui.painter_at(rect);
|
||||
|
||||
painter.rect_filled(rect, 0.0, Color32::from_black_alpha(200));
|
||||
|
||||
ui.put(rect, |ui: &mut egui::Ui| {
|
||||
ui.centered_and_justified(|ui| {
|
||||
ui.label("This is a keyboard");
|
||||
})
|
||||
.response
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
use egui::{FontData, FontDefinitions, FontTweak};
|
||||
use std::collections::BTreeMap;
|
||||
use std::sync::Arc;
|
||||
use tracing::debug;
|
||||
|
||||
use notedeck::fonts::NamedFontFamily;
|
||||
|
||||
// Use gossip's approach to font loading. This includes japanese fonts
|
||||
// for rending stuff from japanese users.
|
||||
pub fn setup_fonts(ctx: &egui::Context) {
|
||||
let mut font_data: BTreeMap<String, Arc<FontData>> = BTreeMap::new();
|
||||
let mut families = BTreeMap::new();
|
||||
|
||||
font_data.insert(
|
||||
"Onest".to_owned(),
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/onest/OnestRegular1602-hint.ttf"
|
||||
))),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"OnestMedium".to_owned(),
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/onest/OnestMedium1602-hint.ttf"
|
||||
))),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"DejaVuSans".to_owned(),
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/DejaVuSansSansEmoji.ttf"
|
||||
))),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"OnestBold".to_owned(),
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/onest/OnestBold1602-hint.ttf"
|
||||
))),
|
||||
);
|
||||
|
||||
/*
|
||||
font_data.insert(
|
||||
"DejaVuSansBold".to_owned(),
|
||||
FontData::from_static(include_bytes!(
|
||||
"../assets/fonts/DejaVuSans-Bold-SansEmoji.ttf"
|
||||
)),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"DejaVuSans".to_owned(),
|
||||
FontData::from_static(include_bytes!("../assets/fonts/DejaVuSansSansEmoji.ttf")),
|
||||
);
|
||||
font_data.insert(
|
||||
"DejaVuSansBold".to_owned(),
|
||||
FontData::from_static(include_bytes!(
|
||||
"../assets/fonts/DejaVuSans-Bold-SansEmoji.ttf"
|
||||
)),
|
||||
);
|
||||
*/
|
||||
|
||||
font_data.insert(
|
||||
"Inconsolata".to_owned(),
|
||||
Arc::new(
|
||||
FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/Inconsolata-Regular.ttf"
|
||||
))
|
||||
.tweak(FontTweak {
|
||||
scale: 1.22, // This font is smaller than DejaVuSans
|
||||
y_offset_factor: -0.18, // and too low
|
||||
y_offset: 0.0,
|
||||
baseline_offset_factor: 0.0,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"NotoSansCJK".to_owned(),
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/NotoSansCJK-Regular.ttc"
|
||||
))),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"NotoSansThai".to_owned(),
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/NotoSansThai-Regular.ttf"
|
||||
))),
|
||||
);
|
||||
|
||||
// Some good looking emojis. Use as first priority:
|
||||
font_data.insert(
|
||||
"NotoEmoji".to_owned(),
|
||||
Arc::new(
|
||||
FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/NotoEmoji-Regular.ttf"
|
||||
))
|
||||
.tweak(FontTweak {
|
||||
scale: 1.1, // make them a touch larger
|
||||
y_offset_factor: 0.0,
|
||||
y_offset: 0.0,
|
||||
baseline_offset_factor: 0.0,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
let base_fonts = vec![
|
||||
"DejaVuSans".to_owned(),
|
||||
"NotoEmoji".to_owned(),
|
||||
"NotoSansCJK".to_owned(),
|
||||
"NotoSansThai".to_owned(),
|
||||
];
|
||||
|
||||
let mut proportional = vec!["Onest".to_owned()];
|
||||
proportional.extend(base_fonts.clone());
|
||||
|
||||
let mut medium = vec!["OnestMedium".to_owned()];
|
||||
medium.extend(base_fonts.clone());
|
||||
|
||||
let mut mono = vec!["Inconsolata".to_owned()];
|
||||
mono.extend(base_fonts.clone());
|
||||
|
||||
let mut bold = vec!["OnestBold".to_owned()];
|
||||
bold.extend(base_fonts.clone());
|
||||
|
||||
let emoji = vec!["NotoEmoji".to_owned()];
|
||||
|
||||
families.insert(egui::FontFamily::Proportional, proportional);
|
||||
families.insert(egui::FontFamily::Monospace, mono);
|
||||
families.insert(
|
||||
egui::FontFamily::Name(NamedFontFamily::Medium.as_str().into()),
|
||||
medium,
|
||||
);
|
||||
families.insert(
|
||||
egui::FontFamily::Name(NamedFontFamily::Bold.as_str().into()),
|
||||
bold,
|
||||
);
|
||||
families.insert(
|
||||
egui::FontFamily::Name(NamedFontFamily::Emoji.as_str().into()),
|
||||
emoji,
|
||||
);
|
||||
|
||||
debug!("fonts: {:?}", families);
|
||||
|
||||
let defs = FontDefinitions {
|
||||
font_data,
|
||||
families,
|
||||
};
|
||||
|
||||
ctx.set_fonts(defs);
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
pub mod fonts;
|
||||
pub mod setup;
|
||||
pub mod theme;
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
mod android;
|
||||
|
||||
mod app;
|
||||
mod chrome;
|
||||
mod options;
|
||||
|
||||
pub use app::NotedeckApp;
|
||||
pub use chrome::Chrome;
|
||||
pub use options::ChromeOptions;
|
||||
|
||||
@@ -9,15 +9,8 @@ use re_memory::AccountingAllocator;
|
||||
static GLOBAL: AccountingAllocator<std::alloc::System> =
|
||||
AccountingAllocator::new(std::alloc::System);
|
||||
|
||||
use notedeck::enostr::Error;
|
||||
use notedeck::{DataPath, DataPathType, Notedeck};
|
||||
use notedeck_chrome::{
|
||||
setup::{generate_native_options, setup_chrome},
|
||||
Chrome, NotedeckApp,
|
||||
};
|
||||
use notedeck_columns::Damus;
|
||||
use notedeck_dave::Dave;
|
||||
use tracing::error;
|
||||
use notedeck_chrome::{setup::generate_native_options, Chrome};
|
||||
use tracing_appender::non_blocking::WorkerGuard;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
@@ -93,29 +86,8 @@ async fn main() {
|
||||
let ctx = &cc.egui_ctx;
|
||||
|
||||
let mut notedeck = Notedeck::new(ctx, base_path, &args);
|
||||
|
||||
let mut chrome = Chrome::new();
|
||||
let columns = Damus::new(&mut notedeck.app_context(), &args);
|
||||
let dave = Dave::new(cc.wgpu_render_state.as_ref());
|
||||
|
||||
setup_chrome(ctx, notedeck.args(), notedeck.theme());
|
||||
|
||||
// ensure we recognized all the arguments
|
||||
let completely_unrecognized: Vec<String> = notedeck
|
||||
.unrecognized_args()
|
||||
.intersection(columns.unrecognized_args())
|
||||
.cloned()
|
||||
.collect();
|
||||
if !completely_unrecognized.is_empty() {
|
||||
error!("Unrecognized arguments: {:?}", completely_unrecognized);
|
||||
return Err(Error::Empty.into());
|
||||
}
|
||||
|
||||
chrome.add_app(NotedeckApp::Columns(columns));
|
||||
chrome.add_app(NotedeckApp::Dave(dave));
|
||||
|
||||
chrome.set_active(0);
|
||||
|
||||
notedeck.setup(ctx);
|
||||
let chrome = Chrome::new_with_apps(cc, &args, &mut notedeck)?;
|
||||
notedeck.set_app(chrome);
|
||||
|
||||
Ok(Box::new(notedeck))
|
||||
@@ -149,7 +121,8 @@ pub fn main() {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Damus, Notedeck};
|
||||
use super::Notedeck;
|
||||
use notedeck_columns::Damus;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
fn create_tmp_dir() -> PathBuf {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
use bitflags::bitflags;
|
||||
|
||||
bitflags! {
|
||||
#[repr(transparent)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct ChromeOptions: u64 {
|
||||
/// Is the chrome currently open?
|
||||
const NoOptions = 0;
|
||||
|
||||
/// Is the chrome currently open?
|
||||
const IsOpen = 1 << 0;
|
||||
|
||||
/// Are we simulating a virtual keyboard? This is mostly for debugging
|
||||
/// if we are too lazy to open up a real mobile device with soft
|
||||
/// keyboard
|
||||
const VirtualKeyboard = 1 << 1;
|
||||
|
||||
/// Are we showing the memory debug window?
|
||||
const MemoryDebug = 1 << 2;
|
||||
|
||||
/// Repaint debug
|
||||
const RepaintDebug = 1 << 3;
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ChromeOptions {
|
||||
fn default() -> Self {
|
||||
let mut options = ChromeOptions::NoOptions;
|
||||
options.set(
|
||||
ChromeOptions::IsOpen,
|
||||
!notedeck::ui::is_compiled_as_mobile(),
|
||||
);
|
||||
options
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,13 @@ impl PreviewRunner {
|
||||
"unrecognized args: {:?}",
|
||||
notedeck.unrecognized_args()
|
||||
);
|
||||
setup_chrome(ctx, notedeck.args(), notedeck.theme());
|
||||
setup_chrome(
|
||||
ctx,
|
||||
notedeck.args(),
|
||||
notedeck.theme(),
|
||||
notedeck.note_body_font_size(),
|
||||
notedeck.zoom_factor(),
|
||||
);
|
||||
|
||||
notedeck.set_app(PreviewApp::new(preview));
|
||||
|
||||
|
||||
@@ -1,57 +1,6 @@
|
||||
use crate::{fonts, theme};
|
||||
|
||||
use eframe::NativeOptions;
|
||||
use egui::ThemePreference;
|
||||
use notedeck::{AppSizeHandler, DataPath};
|
||||
use notedeck_ui::app_images;
|
||||
use tracing::info;
|
||||
|
||||
pub fn setup_chrome(ctx: &egui::Context, args: ¬edeck::Args, theme: ThemePreference) {
|
||||
let is_mobile = args
|
||||
.is_mobile
|
||||
.unwrap_or(notedeck::ui::is_compiled_as_mobile());
|
||||
|
||||
let is_oled = notedeck::ui::is_oled();
|
||||
|
||||
// Some people have been running notedeck in debug, let's catch that!
|
||||
if !args.tests && cfg!(debug_assertions) && !args.debug {
|
||||
println!("--- WELCOME TO DAMUS NOTEDECK! ---");
|
||||
println!("It looks like are running notedeck in debug mode, unless you are a developer, this is not likely what you want.");
|
||||
println!("If you are a developer, run `cargo run -- --debug` to skip this message.");
|
||||
println!("For everyone else, try again with `cargo run --release`. Enjoy!");
|
||||
println!("---------------------------------");
|
||||
panic!();
|
||||
}
|
||||
|
||||
ctx.options_mut(|o| {
|
||||
info!("Loaded theme {:?} from disk", theme);
|
||||
o.theme_preference = theme;
|
||||
});
|
||||
ctx.set_visuals_of(egui::Theme::Dark, theme::dark_mode(is_oled));
|
||||
ctx.set_visuals_of(egui::Theme::Light, theme::light_mode());
|
||||
|
||||
setup_cc(ctx, is_mobile);
|
||||
}
|
||||
|
||||
pub fn setup_cc(ctx: &egui::Context, is_mobile: bool) {
|
||||
fonts::setup_fonts(ctx);
|
||||
|
||||
if notedeck::ui::is_compiled_as_mobile() {
|
||||
ctx.set_pixels_per_point(ctx.pixels_per_point() + 0.2);
|
||||
}
|
||||
|
||||
//ctx.set_pixels_per_point(1.0);
|
||||
//
|
||||
//
|
||||
//ctx.tessellation_options_mut(|to| to.feathering = false);
|
||||
|
||||
egui_extras::install_image_loaders(ctx);
|
||||
|
||||
ctx.options_mut(|o| {
|
||||
o.input_options.max_click_duration = 0.4;
|
||||
});
|
||||
ctx.all_styles_mut(|style| theme::add_custom_style(is_mobile, style));
|
||||
}
|
||||
|
||||
pub fn generate_native_options(paths: DataPath) -> NativeOptions {
|
||||
let window_builder = Box::new(move |builder: egui::ViewportBuilder| {
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
use egui::{style::Interaction, Color32, FontId, Style, Visuals};
|
||||
use notedeck::{ColorTheme, NotedeckTextStyle};
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
pub const PURPLE: Color32 = Color32::from_rgb(0xCC, 0x43, 0xC5);
|
||||
const PURPLE_ALT: Color32 = Color32::from_rgb(0x82, 0x56, 0xDD);
|
||||
//pub const DARK_BG: Color32 = egui::Color32::from_rgb(40, 44, 52);
|
||||
pub const GRAY_SECONDARY: Color32 = Color32::from_rgb(0x8A, 0x8A, 0x8A);
|
||||
const BLACK: Color32 = Color32::from_rgb(0x00, 0x00, 0x00);
|
||||
const RED_700: Color32 = Color32::from_rgb(0xC7, 0x37, 0x5A);
|
||||
const ORANGE_700: Color32 = Color32::from_rgb(0xF6, 0xB1, 0x4A);
|
||||
|
||||
// BACKGROUNDS
|
||||
const SEMI_DARKER_BG: Color32 = Color32::from_rgb(0x39, 0x39, 0x39);
|
||||
const DARKER_BG: Color32 = Color32::from_rgb(0x1F, 0x1F, 0x1F);
|
||||
const DARK_BG: Color32 = Color32::from_rgb(0x2C, 0x2C, 0x2C);
|
||||
const DARK_ISH_BG: Color32 = Color32::from_rgb(0x25, 0x25, 0x25);
|
||||
const SEMI_DARK_BG: Color32 = Color32::from_rgb(0x44, 0x44, 0x44);
|
||||
|
||||
const LIGHTER_GRAY: Color32 = Color32::from_rgb(0xf8, 0xf8, 0xf8);
|
||||
const LIGHT_GRAY: Color32 = Color32::from_rgb(0xc8, 0xc8, 0xc8); // 78%
|
||||
const DARKER_GRAY: Color32 = Color32::from_rgb(0xa5, 0xa5, 0xa5); // 65%
|
||||
const EVEN_DARKER_GRAY: Color32 = Color32::from_rgb(0x89, 0x89, 0x89); // 54%
|
||||
|
||||
pub fn desktop_dark_color_theme() -> ColorTheme {
|
||||
ColorTheme {
|
||||
// VISUALS
|
||||
panel_fill: DARKER_BG,
|
||||
extreme_bg_color: DARK_ISH_BG,
|
||||
text_color: Color32::WHITE,
|
||||
err_fg_color: RED_700,
|
||||
warn_fg_color: ORANGE_700,
|
||||
hyperlink_color: PURPLE,
|
||||
selection_color: PURPLE_ALT,
|
||||
|
||||
// WINDOW
|
||||
window_fill: DARK_ISH_BG,
|
||||
window_stroke_color: DARK_BG,
|
||||
|
||||
// NONINTERACTIVE WIDGET
|
||||
noninteractive_bg_fill: DARK_ISH_BG,
|
||||
noninteractive_weak_bg_fill: DARK_BG,
|
||||
noninteractive_bg_stroke_color: SEMI_DARKER_BG,
|
||||
noninteractive_fg_stroke_color: GRAY_SECONDARY,
|
||||
|
||||
// INACTIVE WIDGET
|
||||
inactive_bg_stroke_color: SEMI_DARKER_BG,
|
||||
inactive_bg_fill: Color32::from_rgb(0x25, 0x25, 0x25),
|
||||
inactive_weak_bg_fill: SEMI_DARK_BG,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mobile_dark_color_theme() -> ColorTheme {
|
||||
ColorTheme {
|
||||
panel_fill: Color32::BLACK,
|
||||
noninteractive_weak_bg_fill: Color32::from_rgb(0x1F, 0x1F, 0x1F),
|
||||
..desktop_dark_color_theme()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn light_color_theme() -> ColorTheme {
|
||||
ColorTheme {
|
||||
// VISUALS
|
||||
panel_fill: Color32::WHITE,
|
||||
extreme_bg_color: LIGHTER_GRAY,
|
||||
text_color: BLACK,
|
||||
err_fg_color: RED_700,
|
||||
warn_fg_color: ORANGE_700,
|
||||
hyperlink_color: PURPLE,
|
||||
selection_color: PURPLE_ALT,
|
||||
|
||||
// WINDOW
|
||||
window_fill: Color32::WHITE,
|
||||
window_stroke_color: DARKER_GRAY,
|
||||
|
||||
// NONINTERACTIVE WIDGET
|
||||
noninteractive_bg_fill: Color32::WHITE,
|
||||
noninteractive_weak_bg_fill: LIGHTER_GRAY,
|
||||
noninteractive_bg_stroke_color: LIGHT_GRAY,
|
||||
noninteractive_fg_stroke_color: GRAY_SECONDARY,
|
||||
|
||||
// INACTIVE WIDGET
|
||||
inactive_bg_stroke_color: EVEN_DARKER_GRAY,
|
||||
inactive_bg_fill: LIGHTER_GRAY,
|
||||
inactive_weak_bg_fill: LIGHTER_GRAY,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn light_mode() -> Visuals {
|
||||
notedeck::theme::create_themed_visuals(light_color_theme(), Visuals::light())
|
||||
}
|
||||
|
||||
pub fn dark_mode(is_oled: bool) -> Visuals {
|
||||
notedeck::theme::create_themed_visuals(
|
||||
if is_oled {
|
||||
mobile_dark_color_theme()
|
||||
} else {
|
||||
desktop_dark_color_theme()
|
||||
},
|
||||
Visuals::dark(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Create custom text sizes for any FontSizes
|
||||
pub fn add_custom_style(is_mobile: bool, style: &mut Style) {
|
||||
let font_size = if is_mobile {
|
||||
notedeck::fonts::mobile_font_size
|
||||
} else {
|
||||
notedeck::fonts::desktop_font_size
|
||||
};
|
||||
|
||||
style.text_styles = NotedeckTextStyle::iter()
|
||||
.map(|text_style| {
|
||||
(
|
||||
text_style.text_style(),
|
||||
FontId::new(font_size(&text_style), text_style.font_family()),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
style.interaction = Interaction {
|
||||
tooltip_delay: 0.1,
|
||||
show_tooltips_only_when_still: false,
|
||||
..Interaction::default()
|
||||
};
|
||||
|
||||
// debug: show callstack for the current widget on hover if all
|
||||
// modifier keys are pressed down.
|
||||
#[cfg(feature = "debug-widget-callstack")]
|
||||
{
|
||||
#[cfg(not(debug_assertions))]
|
||||
compile_error!(
|
||||
"The `debug-widget-callstack` feature requires a debug build, \
|
||||
release builds are unsupported."
|
||||
);
|
||||
style.debug.debug_on_hover_with_all_modifiers = true;
|
||||
}
|
||||
|
||||
// debug: show an overlay on all interactive widgets
|
||||
#[cfg(feature = "debug-interactive-widgets")]
|
||||
{
|
||||
#[cfg(not(debug_assertions))]
|
||||
compile_error!(
|
||||
"The `debug-interactive-widgets` feature requires a debug build, \
|
||||
release builds are unsupported."
|
||||
);
|
||||
style.debug.show_interactive_widgets = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "notedeck_clndash"
|
||||
edition = "2024"
|
||||
version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
egui = { workspace = true }
|
||||
notedeck = { workspace = true }
|
||||
#notedeck_ui = { workspace = true }
|
||||
eframe = { workspace = true }
|
||||
lnsocket = "0.4.0"
|
||||
tracing = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
@@ -0,0 +1,526 @@
|
||||
use egui::{Color32, Label, RichText};
|
||||
use lnsocket::bitcoin::secp256k1::{PublicKey, SecretKey, rand};
|
||||
use lnsocket::{CommandoClient, LNSocket};
|
||||
use notedeck::{AppAction, AppContext};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
use std::str::FromStr;
|
||||
use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender, unbounded_channel};
|
||||
|
||||
struct Channel {
|
||||
to_us: i64,
|
||||
to_them: i64,
|
||||
original: ListPeerChannel,
|
||||
}
|
||||
|
||||
struct Channels {
|
||||
max_total_msat: i64,
|
||||
avail_in: i64,
|
||||
avail_out: i64,
|
||||
channels: Vec<Channel>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct ClnDash {
|
||||
initialized: bool,
|
||||
connection_state: ConnectionState,
|
||||
get_info: Option<String>,
|
||||
channels: Option<Result<Channels, lnsocket::Error>>,
|
||||
channel: Option<CommChannel>,
|
||||
last_summary: Option<Summary>,
|
||||
}
|
||||
|
||||
impl Default for ConnectionState {
|
||||
fn default() -> Self {
|
||||
ConnectionState::Dead("uninitialized".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
struct CommChannel {
|
||||
req_tx: UnboundedSender<Request>,
|
||||
event_rx: UnboundedReceiver<Event>,
|
||||
}
|
||||
|
||||
/// Responses from the socket
|
||||
enum ClnResponse {
|
||||
GetInfo(Value),
|
||||
ListPeerChannels(Result<Channels, lnsocket::Error>),
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
struct ListPeerChannel {
|
||||
short_channel_id: String,
|
||||
our_reserve_msat: i64,
|
||||
to_us_msat: i64,
|
||||
total_msat: i64,
|
||||
their_reserve_msat: i64,
|
||||
}
|
||||
|
||||
enum ConnectionState {
|
||||
Dead(String),
|
||||
Connecting,
|
||||
Active,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug)]
|
||||
enum Request {
|
||||
GetInfo,
|
||||
ListPeerChannels,
|
||||
}
|
||||
|
||||
enum Event {
|
||||
/// We lost the socket somehow
|
||||
Ended {
|
||||
reason: String,
|
||||
},
|
||||
|
||||
Connected,
|
||||
|
||||
Response(ClnResponse),
|
||||
}
|
||||
|
||||
impl notedeck::App for ClnDash {
|
||||
fn update(&mut self, _ctx: &mut AppContext<'_>, ui: &mut egui::Ui) -> Option<AppAction> {
|
||||
if !self.initialized {
|
||||
self.connection_state = ConnectionState::Connecting;
|
||||
|
||||
self.setup_connection();
|
||||
self.initialized = true;
|
||||
}
|
||||
|
||||
self.process_events();
|
||||
|
||||
self.show(ui);
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn connection_state_ui(ui: &mut egui::Ui, state: &ConnectionState) {
|
||||
match state {
|
||||
ConnectionState::Active => {
|
||||
ui.add(Label::new(RichText::new("Connected").color(Color32::GREEN)));
|
||||
}
|
||||
|
||||
ConnectionState::Connecting => {
|
||||
ui.add(Label::new(
|
||||
RichText::new("Connecting").color(Color32::YELLOW),
|
||||
));
|
||||
}
|
||||
|
||||
ConnectionState::Dead(reason) => {
|
||||
ui.add(Label::new(
|
||||
RichText::new(format!("Disconnected: {reason}")).color(Color32::RED),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ClnDash {
|
||||
fn show(&mut self, ui: &mut egui::Ui) {
|
||||
egui::Frame::new()
|
||||
.inner_margin(egui::Margin::same(20))
|
||||
.show(ui, |ui| {
|
||||
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||
connection_state_ui(ui, &self.connection_state);
|
||||
if let Some(Ok(ch)) = self.channels.as_ref() {
|
||||
let summary = compute_summary(ch);
|
||||
summary_cards_ui(ui, &summary, self.last_summary.as_ref());
|
||||
ui.add_space(8.0);
|
||||
}
|
||||
channels_ui(ui, &self.channels);
|
||||
|
||||
if let Some(info) = self.get_info.as_ref() {
|
||||
get_info_ui(ui, info);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fn setup_connection(&mut self) {
|
||||
let (req_tx, mut req_rx) = unbounded_channel::<Request>();
|
||||
let (event_tx, event_rx) = unbounded_channel::<Event>();
|
||||
self.channel = Some(CommChannel { req_tx, event_rx });
|
||||
|
||||
tokio::spawn(async move {
|
||||
let key = SecretKey::new(&mut rand::thread_rng());
|
||||
let their_pubkey = PublicKey::from_str(
|
||||
"03f3c108ccd536b8526841f0a5c58212bb9e6584a1eb493080e7c1cc34f82dad71",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let lnsocket =
|
||||
match LNSocket::connect_and_init(key, their_pubkey, "ln.damus.io:9735").await {
|
||||
Err(err) => {
|
||||
let _ = event_tx.send(Event::Ended {
|
||||
reason: err.to_string(),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Ok(lnsocket) => {
|
||||
let _ = event_tx.send(Event::Connected);
|
||||
lnsocket
|
||||
}
|
||||
};
|
||||
|
||||
let rune = std::env::var("RUNE").unwrap_or(
|
||||
"Vns1Zxvidr4J8pP2ZCg3Wjp2SyGyyf5RHgvFG8L36yM9MzMmbWV0aG9kPWdldGluZm8=".to_string(),
|
||||
);
|
||||
let commando = CommandoClient::spawn(lnsocket, &rune);
|
||||
|
||||
loop {
|
||||
match req_rx.recv().await {
|
||||
None => {
|
||||
let _ = event_tx.send(Event::Ended {
|
||||
reason: "channel dead?".to_string(),
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
Some(req) => {
|
||||
tracing::debug!("calling {req:?}");
|
||||
match req {
|
||||
Request::GetInfo => match commando.call("getinfo", json!({})).await {
|
||||
Ok(v) => {
|
||||
let _ = event_tx.send(Event::Response(ClnResponse::GetInfo(v)));
|
||||
}
|
||||
Err(err) => {
|
||||
tracing::error!("get_info error {}", err);
|
||||
}
|
||||
},
|
||||
|
||||
Request::ListPeerChannels => {
|
||||
let peer_channels =
|
||||
commando.call("listpeerchannels", json!({})).await;
|
||||
let channels = peer_channels.map(|v| {
|
||||
let peer_channels: Vec<ListPeerChannel> =
|
||||
serde_json::from_value(v["channels"].clone()).unwrap();
|
||||
to_channels(peer_channels)
|
||||
});
|
||||
let _ = event_tx
|
||||
.send(Event::Response(ClnResponse::ListPeerChannels(channels)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn process_events(&mut self) {
|
||||
let Some(channel) = &mut self.channel else {
|
||||
return;
|
||||
};
|
||||
|
||||
while let Ok(event) = channel.event_rx.try_recv() {
|
||||
match event {
|
||||
Event::Ended { reason } => {
|
||||
self.connection_state = ConnectionState::Dead(reason);
|
||||
}
|
||||
|
||||
Event::Connected => {
|
||||
self.connection_state = ConnectionState::Active;
|
||||
let _ = channel.req_tx.send(Request::GetInfo);
|
||||
let _ = channel.req_tx.send(Request::ListPeerChannels);
|
||||
}
|
||||
|
||||
Event::Response(resp) => match resp {
|
||||
ClnResponse::ListPeerChannels(chans) => {
|
||||
if let Some(Ok(prev)) = self.channels.as_ref() {
|
||||
self.last_summary = Some(compute_summary(prev));
|
||||
}
|
||||
self.channels = Some(chans);
|
||||
}
|
||||
|
||||
ClnResponse::GetInfo(value) => {
|
||||
if let Ok(s) = serde_json::to_string_pretty(&value) {
|
||||
self.get_info = Some(s);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_info_ui(ui: &mut egui::Ui, info: &str) {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.add(Label::new(info).wrap_mode(egui::TextWrapMode::Wrap));
|
||||
});
|
||||
}
|
||||
|
||||
fn channel_ui(ui: &mut egui::Ui, c: &Channel, max_total_msat: i64) {
|
||||
// ---------- numbers ----------
|
||||
let short_channel_id = &c.original.short_channel_id;
|
||||
|
||||
let cap_ratio = (c.original.total_msat as f32 / max_total_msat.max(1) as f32).clamp(0.0, 1.0);
|
||||
// Feel free to switch to log scaling if you have whales:
|
||||
//let cap_ratio = ((c.original.total_msat as f32 + 1.0).log10() / (max_total_msat as f32 + 1.0).log10()).clamp(0.0, 1.0);
|
||||
|
||||
// ---------- colors & style ----------
|
||||
let out_color = Color32::from_rgb(84, 69, 201); // blue
|
||||
let in_color = Color32::from_rgb(158, 56, 180); // purple
|
||||
|
||||
// Thickness scales with capacity, but keeps a nice minimum
|
||||
let thickness = 10.0 + cap_ratio * 22.0; // 10 → 32 px
|
||||
let row_h = thickness + 14.0;
|
||||
|
||||
// ---------- layout ----------
|
||||
let (rect, response) = ui.allocate_exact_size(
|
||||
egui::vec2(ui.available_width(), row_h),
|
||||
egui::Sense::hover(),
|
||||
);
|
||||
let painter = ui.painter_at(rect);
|
||||
|
||||
let bar_rect = egui::Rect::from_min_max(
|
||||
egui::pos2(rect.left(), rect.center().y - thickness * 0.5),
|
||||
egui::pos2(rect.right(), rect.center().y + thickness * 0.5),
|
||||
);
|
||||
let corner_radius = (thickness * 0.5) as u8;
|
||||
let out_radius = egui::CornerRadius {
|
||||
ne: 0,
|
||||
nw: corner_radius,
|
||||
sw: corner_radius,
|
||||
se: 0,
|
||||
};
|
||||
let in_radius = egui::CornerRadius {
|
||||
ne: corner_radius,
|
||||
nw: 0,
|
||||
sw: 0,
|
||||
se: corner_radius,
|
||||
};
|
||||
/*
|
||||
painter.rect_filled(bar_rect, rounding, track_color);
|
||||
painter.rect_stroke(bar_rect, rounding, track_stroke, egui::StrokeKind::Middle);
|
||||
*/
|
||||
|
||||
// Split widths
|
||||
let usable = (c.to_us + c.to_them).max(1) as f32;
|
||||
let out_w = (bar_rect.width() * (c.to_us as f32 / usable)).round();
|
||||
let split_x = bar_rect.left() + out_w;
|
||||
|
||||
// Outbound fill (left)
|
||||
let out_rect = egui::Rect::from_min_max(bar_rect.min, egui::pos2(split_x, bar_rect.max.y));
|
||||
if out_rect.width() > 0.5 {
|
||||
painter.rect_filled(out_rect, out_radius, out_color);
|
||||
}
|
||||
|
||||
// Inbound fill (right)
|
||||
let in_rect = egui::Rect::from_min_max(egui::pos2(split_x, bar_rect.min.y), bar_rect.max);
|
||||
if in_rect.width() > 0.5 {
|
||||
painter.rect_filled(in_rect, in_radius, in_color);
|
||||
}
|
||||
|
||||
// Tooltip
|
||||
response.on_hover_text_at_pointer(format!(
|
||||
"Channel ID {short_channel_id}\nOutbound (ours): {} sats\nInbound (theirs): {} sats\nCapacity: {} sats",
|
||||
human_sat(c.to_us),
|
||||
human_sat(c.to_them),
|
||||
human_sat(c.original.total_msat),
|
||||
));
|
||||
}
|
||||
|
||||
// ---------- helper ----------
|
||||
fn human_sat(msat: i64) -> String {
|
||||
let sats = msat / 1000;
|
||||
if sats >= 1_000_000 {
|
||||
format!("{:.1}M", sats as f64 / 1_000_000.0)
|
||||
} else if sats >= 1_000 {
|
||||
format!("{:.1}k", sats as f64 / 1_000.0)
|
||||
} else {
|
||||
sats.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
fn channels_ui(ui: &mut egui::Ui, channels: &Option<Result<Channels, lnsocket::Error>>) {
|
||||
match channels {
|
||||
Some(Ok(channels)) => {
|
||||
if channels.channels.is_empty() {
|
||||
ui.label("no channels yet...");
|
||||
return;
|
||||
}
|
||||
|
||||
for channel in &channels.channels {
|
||||
channel_ui(ui, channel, channels.max_total_msat);
|
||||
}
|
||||
|
||||
ui.label(format!("available out {}", human_sat(channels.avail_out)));
|
||||
ui.label(format!("available in {}", human_sat(channels.avail_in)));
|
||||
}
|
||||
Some(Err(err)) => {
|
||||
ui.label(format!("error fetching channels: {err}"));
|
||||
}
|
||||
None => {
|
||||
ui.label("no channels yet...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn to_channels(peer_channels: Vec<ListPeerChannel>) -> Channels {
|
||||
let mut avail_out: i64 = 0;
|
||||
let mut avail_in: i64 = 0;
|
||||
let mut max_total_msat: i64 = 0;
|
||||
|
||||
let mut channels: Vec<Channel> = peer_channels
|
||||
.into_iter()
|
||||
.map(|c| {
|
||||
let to_us = (c.to_us_msat - c.our_reserve_msat).max(0);
|
||||
let to_them_raw = (c.total_msat - c.to_us_msat).max(0);
|
||||
let to_them = (to_them_raw - c.their_reserve_msat).max(0);
|
||||
|
||||
avail_out += to_us;
|
||||
avail_in += to_them;
|
||||
if c.total_msat > max_total_msat {
|
||||
max_total_msat = c.total_msat; // <-- max, not sum
|
||||
}
|
||||
|
||||
Channel {
|
||||
to_us,
|
||||
to_them,
|
||||
original: c,
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
channels.sort_by(|a, b| {
|
||||
let a_capacity = a.to_them + a.to_us;
|
||||
let b_capacity = b.to_them + b.to_us;
|
||||
|
||||
a_capacity.partial_cmp(&b_capacity).unwrap().reverse()
|
||||
});
|
||||
|
||||
Channels {
|
||||
max_total_msat,
|
||||
avail_out,
|
||||
avail_in,
|
||||
channels,
|
||||
}
|
||||
}
|
||||
|
||||
fn summary_cards_ui(ui: &mut egui::Ui, s: &Summary, prev: Option<&Summary>) {
|
||||
let old = prev.cloned().unwrap_or_default();
|
||||
let items: [(&str, String, Option<String>); 6] = [
|
||||
(
|
||||
"Total capacity",
|
||||
human_sat(s.total_msat),
|
||||
prev.map(|_| delta_str(s.total_msat, old.total_msat)),
|
||||
),
|
||||
(
|
||||
"Avail out",
|
||||
human_sat(s.avail_out_msat),
|
||||
prev.map(|_| delta_str(s.avail_out_msat, old.avail_out_msat)),
|
||||
),
|
||||
(
|
||||
"Avail in",
|
||||
human_sat(s.avail_in_msat),
|
||||
prev.map(|_| delta_str(s.avail_in_msat, old.avail_in_msat)),
|
||||
),
|
||||
("# Channels", s.channel_count.to_string(), None),
|
||||
("Largest", human_sat(s.largest_msat), None),
|
||||
(
|
||||
"Outbound %",
|
||||
format!("{:.0}%", s.outbound_pct * 100.0),
|
||||
None,
|
||||
),
|
||||
];
|
||||
|
||||
// --- responsive columns ---
|
||||
let min_card = 160.0;
|
||||
let cols = ((ui.available_width() / min_card).floor() as usize).max(1);
|
||||
|
||||
egui::Grid::new("summary_grid")
|
||||
.num_columns(cols)
|
||||
.min_col_width(min_card)
|
||||
.spacing(egui::vec2(8.0, 8.0))
|
||||
.show(ui, |ui| {
|
||||
let items_len = items.len();
|
||||
for (i, (t, v, d)) in items.into_iter().enumerate() {
|
||||
card_cell(ui, t, v, d, min_card);
|
||||
|
||||
// End the row when we filled a row worth of cells
|
||||
if (i + 1) % cols == 0 {
|
||||
ui.end_row();
|
||||
}
|
||||
}
|
||||
|
||||
// If the last row wasn't full, close it anyway
|
||||
if items_len % cols != 0 {
|
||||
ui.end_row();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn card_cell(ui: &mut egui::Ui, title: &str, value: String, delta: Option<String>, min_card: f32) {
|
||||
let weak = ui.visuals().weak_text_color();
|
||||
egui::Frame::group(ui.style())
|
||||
.fill(ui.visuals().extreme_bg_color)
|
||||
.corner_radius(egui::CornerRadius::same(10))
|
||||
.inner_margin(egui::Margin::same(10))
|
||||
.stroke(ui.visuals().widgets.noninteractive.bg_stroke)
|
||||
.show(ui, |ui| {
|
||||
ui.set_min_width(min_card);
|
||||
ui.vertical(|ui| {
|
||||
ui.add(
|
||||
egui::Label::new(egui::RichText::new(title).small().color(weak))
|
||||
.wrap_mode(egui::TextWrapMode::Wrap),
|
||||
);
|
||||
ui.add_space(4.0);
|
||||
ui.add(
|
||||
egui::Label::new(egui::RichText::new(value).strong().size(18.0))
|
||||
.wrap_mode(egui::TextWrapMode::Wrap),
|
||||
);
|
||||
if let Some(d) = delta {
|
||||
ui.add_space(2.0);
|
||||
ui.add(
|
||||
egui::Label::new(egui::RichText::new(d).small().color(weak))
|
||||
.wrap_mode(egui::TextWrapMode::Wrap),
|
||||
);
|
||||
}
|
||||
});
|
||||
ui.set_min_height(20.0);
|
||||
});
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
struct Summary {
|
||||
total_msat: i64,
|
||||
avail_out_msat: i64,
|
||||
avail_in_msat: i64,
|
||||
channel_count: usize,
|
||||
largest_msat: i64,
|
||||
outbound_pct: f32, // fraction of total capacity
|
||||
}
|
||||
|
||||
fn compute_summary(ch: &Channels) -> Summary {
|
||||
let total_msat: i64 = ch.channels.iter().map(|c| c.original.total_msat).sum();
|
||||
let largest_msat: i64 = ch
|
||||
.channels
|
||||
.iter()
|
||||
.map(|c| c.original.total_msat)
|
||||
.max()
|
||||
.unwrap_or(0);
|
||||
let outbound_pct = if total_msat > 0 {
|
||||
ch.avail_out as f32 / total_msat as f32
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
|
||||
Summary {
|
||||
total_msat,
|
||||
avail_out_msat: ch.avail_out,
|
||||
avail_in_msat: ch.avail_in,
|
||||
channel_count: ch.channels.len(),
|
||||
largest_msat,
|
||||
outbound_pct,
|
||||
}
|
||||
}
|
||||
|
||||
fn delta_str(new: i64, old: i64) -> String {
|
||||
let d = new - old;
|
||||
match d.cmp(&0) {
|
||||
std::cmp::Ordering::Greater => format!("↑ {}", human_sat(d)),
|
||||
std::cmp::Ordering::Less => format!("↓ {}", human_sat(-d)),
|
||||
std::cmp::Ordering::Equal => "·".into(),
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ image = { workspace = true }
|
||||
indexmap = { workspace = true }
|
||||
nostrdb = { workspace = true }
|
||||
notedeck_ui = { workspace = true }
|
||||
open = { workspace = true }
|
||||
robius-open = { workspace = true }
|
||||
poll-promise = { workspace = true }
|
||||
puffin = { workspace = true, optional = true }
|
||||
puffin_egui = { workspace = true, optional = true }
|
||||
|
||||
@@ -8,6 +8,7 @@ use crate::{
|
||||
},
|
||||
ThreadSelection, TimelineCache, TimelineKind,
|
||||
},
|
||||
view_state::ViewState,
|
||||
};
|
||||
|
||||
use enostr::{NoteId, Pubkey, RelayPool};
|
||||
@@ -16,6 +17,7 @@ use notedeck::{
|
||||
get_wallet_for, note::ZapTargetAmount, Accounts, GlobalWallet, Images, NoteAction, NoteCache,
|
||||
NoteZapTargetOwned, UnknownIds, ZapAction, ZapTarget, ZappingError, Zaps,
|
||||
};
|
||||
use notedeck_ui::media::MediaViewerFlags;
|
||||
use tracing::error;
|
||||
|
||||
pub struct NewNotes {
|
||||
@@ -51,6 +53,7 @@ fn execute_note_action(
|
||||
global_wallet: &mut GlobalWallet,
|
||||
zaps: &mut Zaps,
|
||||
images: &mut Images,
|
||||
view_state: &mut ViewState,
|
||||
router_type: RouterType,
|
||||
ui: &mut egui::Ui,
|
||||
col: usize,
|
||||
@@ -78,7 +81,11 @@ fn execute_note_action(
|
||||
.open(ndb, note_cache, txn, pool, &kind)
|
||||
.map(NotesOpenResult::Timeline);
|
||||
}
|
||||
NoteAction::Note { note_id, preview } => 'ex: {
|
||||
NoteAction::Note {
|
||||
note_id,
|
||||
preview,
|
||||
scroll_offset,
|
||||
} => 'ex: {
|
||||
let Ok(thread_selection) = ThreadSelection::from_note_id(ndb, note_cache, txn, note_id)
|
||||
else {
|
||||
tracing::error!("No thread selection for {}?", hex::encode(note_id.bytes()));
|
||||
@@ -86,7 +93,15 @@ fn execute_note_action(
|
||||
};
|
||||
|
||||
timeline_res = threads
|
||||
.open(ndb, txn, pool, &thread_selection, preview, col)
|
||||
.open(
|
||||
ndb,
|
||||
txn,
|
||||
pool,
|
||||
&thread_selection,
|
||||
preview,
|
||||
col,
|
||||
scroll_offset,
|
||||
)
|
||||
.map(NotesOpenResult::Thread);
|
||||
|
||||
let route = Route::Thread(thread_selection);
|
||||
@@ -153,7 +168,16 @@ fn execute_note_action(
|
||||
}
|
||||
},
|
||||
NoteAction::Media(media_action) => {
|
||||
media_action.process(images);
|
||||
media_action.on_view_media(|medias| {
|
||||
view_state.media_viewer.media_info = medias.clone();
|
||||
tracing::debug!("on_view_media {:?}", &medias);
|
||||
view_state
|
||||
.media_viewer
|
||||
.flags
|
||||
.set(MediaViewerFlags::Open, true);
|
||||
});
|
||||
|
||||
media_action.process_default_media_actions(images)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,6 +204,7 @@ pub fn execute_and_process_note_action(
|
||||
global_wallet: &mut GlobalWallet,
|
||||
zaps: &mut Zaps,
|
||||
images: &mut Images,
|
||||
view_state: &mut ViewState,
|
||||
ui: &mut egui::Ui,
|
||||
) -> Option<RouterAction> {
|
||||
let router_type = {
|
||||
@@ -204,6 +229,7 @@ pub fn execute_and_process_note_action(
|
||||
global_wallet,
|
||||
zaps,
|
||||
images,
|
||||
view_state,
|
||||
router_type,
|
||||
ui,
|
||||
col,
|
||||
|
||||
@@ -14,18 +14,19 @@ use crate::{
|
||||
view_state::ViewState,
|
||||
Result,
|
||||
};
|
||||
|
||||
use egui_extras::{Size, StripBuilder};
|
||||
use enostr::{ClientMessage, PoolRelay, Pubkey, RelayEvent, RelayMessage, RelayPool};
|
||||
use nostrdb::Transaction;
|
||||
use notedeck::{
|
||||
tr, ui::is_narrow, Accounts, AppAction, AppContext, DataPath, DataPathType, FilterState,
|
||||
Localization, UnknownIds,
|
||||
Images, JobsCache, Localization, NotedeckOptions, SettingsHandler, UnknownIds,
|
||||
};
|
||||
use notedeck_ui::{
|
||||
media::{MediaViewer, MediaViewerFlags, MediaViewerState},
|
||||
NoteOptions,
|
||||
};
|
||||
use notedeck_ui::{jobs::JobsCache, NoteOptions};
|
||||
use std::collections::{BTreeSet, HashMap};
|
||||
use std::path::Path;
|
||||
use std::time::Duration;
|
||||
use tracing::{debug, error, info, trace, warn};
|
||||
use uuid::Uuid;
|
||||
|
||||
@@ -359,18 +360,54 @@ fn render_damus(
|
||||
app_ctx: &mut AppContext<'_>,
|
||||
ui: &mut egui::Ui,
|
||||
) -> Option<AppAction> {
|
||||
damus
|
||||
.note_options
|
||||
.set(NoteOptions::Wide, is_narrow(ui.ctx()));
|
||||
|
||||
let app_action = if notedeck::ui::is_narrow(ui.ctx()) {
|
||||
render_damus_mobile(damus, app_ctx, ui)
|
||||
} else {
|
||||
render_damus_desktop(damus, app_ctx, ui)
|
||||
};
|
||||
|
||||
fullscreen_media_viewer_ui(ui, &mut damus.view_state.media_viewer, app_ctx.img_cache);
|
||||
|
||||
// We use this for keeping timestamps and things up to date
|
||||
ui.ctx().request_repaint_after(Duration::from_secs(5));
|
||||
//ui.ctx().request_repaint_after(Duration::from_secs(5));
|
||||
|
||||
app_action
|
||||
}
|
||||
|
||||
/// Present a fullscreen media viewer if the FullscreenMedia AppOptions flag is set. This is
|
||||
/// typically set by image carousels using a MediaAction's on_view_media callback when
|
||||
/// an image is clicked
|
||||
fn fullscreen_media_viewer_ui(
|
||||
ui: &mut egui::Ui,
|
||||
state: &mut MediaViewerState,
|
||||
img_cache: &mut Images,
|
||||
) {
|
||||
if !state.should_show(ui) {
|
||||
if state.scene_rect.is_some() {
|
||||
// if we shouldn't show yet we will have a scene
|
||||
// rect, then we should clear it for next time
|
||||
tracing::debug!("fullscreen_media_viewer_ui: resetting scene rect");
|
||||
state.scene_rect = None;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let resp = MediaViewer::new(state).fullscreen(true).ui(img_cache, ui);
|
||||
|
||||
if resp.clicked() || ui.input(|i| i.key_pressed(egui::Key::Escape)) {
|
||||
fullscreen_media_close(state);
|
||||
}
|
||||
}
|
||||
|
||||
/// Close the fullscreen media player. This also resets the scene_rect state
|
||||
fn fullscreen_media_close(state: &mut MediaViewerState) {
|
||||
state.flags.set(MediaViewerFlags::Open, false);
|
||||
}
|
||||
|
||||
/*
|
||||
fn determine_key_storage_type() -> KeyStorageType {
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -404,6 +441,14 @@ impl Damus {
|
||||
let mut options = AppOptions::default();
|
||||
let tmp_columns = !parsed_args.columns.is_empty();
|
||||
options.set(AppOptions::TmpColumns, tmp_columns);
|
||||
options.set(
|
||||
AppOptions::Debug,
|
||||
app_context.args.options.contains(NotedeckOptions::Debug),
|
||||
);
|
||||
options.set(
|
||||
AppOptions::SinceOptimize,
|
||||
parsed_args.is_flag_set(ColumnsFlag::SinceOptimize),
|
||||
);
|
||||
|
||||
let decks_cache = if tmp_columns {
|
||||
info!("DecksCache: loading from command line arguments");
|
||||
@@ -450,35 +495,8 @@ impl Damus {
|
||||
};
|
||||
|
||||
let support = Support::new(app_context.path);
|
||||
let mut note_options = NoteOptions::default();
|
||||
note_options.set(
|
||||
NoteOptions::Textmode,
|
||||
parsed_args.is_flag_set(ColumnsFlag::Textmode),
|
||||
);
|
||||
note_options.set(
|
||||
NoteOptions::ScrambleText,
|
||||
parsed_args.is_flag_set(ColumnsFlag::Scramble),
|
||||
);
|
||||
note_options.set(
|
||||
NoteOptions::HideMedia,
|
||||
parsed_args.is_flag_set(ColumnsFlag::NoMedia),
|
||||
);
|
||||
note_options.set(
|
||||
NoteOptions::ShowNoteClientTop,
|
||||
parsed_args.is_flag_set(ColumnsFlag::ShowNoteClientTop),
|
||||
);
|
||||
note_options.set(
|
||||
NoteOptions::ShowNoteClientBottom,
|
||||
parsed_args.is_flag_set(ColumnsFlag::ShowNoteClientBottom),
|
||||
);
|
||||
options.set(AppOptions::Debug, app_context.args.debug);
|
||||
options.set(
|
||||
AppOptions::SinceOptimize,
|
||||
parsed_args.is_flag_set(ColumnsFlag::SinceOptimize),
|
||||
);
|
||||
|
||||
let note_options = get_note_options(parsed_args, app_context.settings);
|
||||
let jobs = JobsCache::default();
|
||||
|
||||
let threads = Threads::default();
|
||||
|
||||
Self {
|
||||
@@ -557,6 +575,28 @@ impl Damus {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_note_options(args: ColumnsArgs, settings_handler: &mut SettingsHandler) -> NoteOptions {
|
||||
let mut note_options = NoteOptions::default();
|
||||
|
||||
note_options.set(
|
||||
NoteOptions::Textmode,
|
||||
args.is_flag_set(ColumnsFlag::Textmode),
|
||||
);
|
||||
note_options.set(
|
||||
NoteOptions::ScrambleText,
|
||||
args.is_flag_set(ColumnsFlag::Scramble),
|
||||
);
|
||||
note_options.set(
|
||||
NoteOptions::HideMedia,
|
||||
args.is_flag_set(ColumnsFlag::NoMedia),
|
||||
);
|
||||
note_options.set(
|
||||
NoteOptions::RepliesNewestFirst,
|
||||
settings_handler.show_replies_newest_first(),
|
||||
);
|
||||
note_options
|
||||
}
|
||||
|
||||
/*
|
||||
fn circle_icon(ui: &mut egui::Ui, openness: f32, response: &egui::Response) {
|
||||
let stroke = ui.style().interact(&response).fg_stroke;
|
||||
@@ -578,6 +618,7 @@ fn render_damus_mobile(
|
||||
let mut app_action: Option<AppAction> = None;
|
||||
|
||||
let active_col = app.columns_mut(app_ctx.i18n, app_ctx.accounts).selected as usize;
|
||||
|
||||
if !app.columns(app_ctx.accounts).columns().is_empty() {
|
||||
let r = nav::render_nav(
|
||||
active_col,
|
||||
|
||||
@@ -11,8 +11,6 @@ pub enum ColumnsFlag {
|
||||
Textmode,
|
||||
Scramble,
|
||||
NoMedia,
|
||||
ShowNoteClientTop,
|
||||
ShowNoteClientBottom,
|
||||
}
|
||||
|
||||
pub struct ColumnsArgs {
|
||||
@@ -54,10 +52,6 @@ impl ColumnsArgs {
|
||||
res.clear_flag(ColumnsFlag::SinceOptimize);
|
||||
} else if arg == "--scramble" {
|
||||
res.set_flag(ColumnsFlag::Scramble);
|
||||
} else if arg == "--show-note-client=top" {
|
||||
res.set_flag(ColumnsFlag::ShowNoteClientTop);
|
||||
} else if arg == "--show-note-client=bottom" {
|
||||
res.set_flag(ColumnsFlag::ShowNoteClientBottom);
|
||||
} else if arg == "--no-media" {
|
||||
res.set_flag(ColumnsFlag::NoMedia);
|
||||
} else if arg == "--filter" {
|
||||
|
||||
@@ -11,7 +11,7 @@ use sha2::{Digest, Sha256};
|
||||
use url::Url;
|
||||
|
||||
use crate::Error;
|
||||
use notedeck_ui::images::fetch_binary_from_disk;
|
||||
use notedeck::media::images::fetch_binary_from_disk;
|
||||
|
||||
pub const NOSTR_BUILD_URL: fn() -> Url = || Url::parse("http://nostr.build").unwrap();
|
||||
const NIP96_WELL_KNOWN: &str = ".well-known/nostr/nip96.json";
|
||||
@@ -143,7 +143,7 @@ pub fn nip96_upload(
|
||||
Err(e) => {
|
||||
return Promise::from_ready(Err(Error::Generic(format!(
|
||||
"could not read contents of file to upload: {e}"
|
||||
))))
|
||||
))));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ use crate::{
|
||||
note::{custom_zap::CustomZapView, NewPostAction, PostAction, PostType, QuoteRepostView},
|
||||
profile::EditProfileView,
|
||||
search::{FocusState, SearchView},
|
||||
settings::{SettingsAction, ShowNoteClientOptions},
|
||||
settings::SettingsAction,
|
||||
support::SupportView,
|
||||
wallet::{get_default_zap_state, WalletAction, WalletState, WalletView},
|
||||
AccountsView, PostReplyView, PostView, ProfileView, RelayView, SettingsView, ThreadView,
|
||||
@@ -459,6 +459,7 @@ fn process_render_nav_action(
|
||||
ctx.global_wallet,
|
||||
ctx.zaps,
|
||||
ctx.img_cache,
|
||||
&mut app.view_state,
|
||||
ui,
|
||||
)
|
||||
}
|
||||
@@ -486,7 +487,7 @@ fn process_render_nav_action(
|
||||
None
|
||||
}
|
||||
RenderNavAction::SettingsAction(action) => {
|
||||
action.process_settings_action(app, ctx.theme, ctx.i18n, ctx.img_cache, ui.ctx())
|
||||
action.process_settings_action(app, ctx.settings, ctx.i18n, ctx.img_cache, ui.ctx())
|
||||
}
|
||||
};
|
||||
|
||||
@@ -545,6 +546,8 @@ fn render_nav_body(
|
||||
scroll_to_top,
|
||||
);
|
||||
|
||||
app.timeline_cache.set_fresh(kind);
|
||||
|
||||
// always clear the scroll_to_top request
|
||||
if scroll_to_top {
|
||||
app.options.remove(AppOptions::ScrollToTop);
|
||||
@@ -581,35 +584,15 @@ fn render_nav_body(
|
||||
.ui(ui)
|
||||
.map(RenderNavAction::RelayAction),
|
||||
|
||||
Route::Settings => {
|
||||
let mut show_note_client = if app.note_options.contains(NoteOptions::ShowNoteClientTop)
|
||||
{
|
||||
ShowNoteClientOptions::Top
|
||||
} else if app.note_options.contains(NoteOptions::ShowNoteClientBottom) {
|
||||
ShowNoteClientOptions::Bottom
|
||||
} else {
|
||||
ShowNoteClientOptions::Hide
|
||||
};
|
||||
Route::Settings => SettingsView::new(
|
||||
ctx.settings.get_settings_mut(),
|
||||
&mut note_context,
|
||||
&mut app.note_options,
|
||||
&mut app.jobs,
|
||||
)
|
||||
.ui(ui)
|
||||
.map(RenderNavAction::SettingsAction),
|
||||
|
||||
let mut theme: String = (if ui.visuals().dark_mode {
|
||||
"Dark"
|
||||
} else {
|
||||
"Light"
|
||||
})
|
||||
.into();
|
||||
|
||||
let mut selected_language: String = ctx.i18n.get_current_locale().to_string();
|
||||
|
||||
SettingsView::new(
|
||||
ctx.img_cache,
|
||||
&mut selected_language,
|
||||
&mut theme,
|
||||
&mut show_note_client,
|
||||
ctx.i18n,
|
||||
)
|
||||
.ui(ui)
|
||||
.map(RenderNavAction::SettingsAction)
|
||||
}
|
||||
Route::Reply(id) => {
|
||||
let txn = if let Ok(txn) = Transaction::new(ctx.ndb) {
|
||||
txn
|
||||
@@ -638,13 +621,16 @@ fn render_nav_body(
|
||||
let action = {
|
||||
let draft = app.drafts.reply_mut(note.id());
|
||||
|
||||
let mut options = app.note_options;
|
||||
options.set(NoteOptions::Wide, false);
|
||||
|
||||
let response = ui::PostReplyView::new(
|
||||
&mut note_context,
|
||||
poster,
|
||||
draft,
|
||||
¬e,
|
||||
inner_rect,
|
||||
app.note_options,
|
||||
options,
|
||||
&mut app.jobs,
|
||||
col,
|
||||
)
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
use egui::{text::LayoutJob, TextBuffer, TextFormat};
|
||||
use egui::{
|
||||
text::{CCursor, CCursorRange, LayoutJob},
|
||||
text_edit::TextEditOutput,
|
||||
TextBuffer, TextEdit, TextFormat,
|
||||
};
|
||||
use enostr::{FullKeypair, Pubkey};
|
||||
use nostrdb::{Note, NoteBuilder, NoteReply};
|
||||
use std::{
|
||||
@@ -18,11 +22,23 @@ pub struct NewPost {
|
||||
pub mentions: Vec<Pubkey>,
|
||||
}
|
||||
|
||||
fn client_variant() -> &'static str {
|
||||
#[cfg(target_os = "android")]
|
||||
{
|
||||
"Damus Android"
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
{
|
||||
"Damus Notedeck"
|
||||
}
|
||||
}
|
||||
|
||||
fn add_client_tag(builder: NoteBuilder<'_>) -> NoteBuilder<'_> {
|
||||
builder
|
||||
.start_tag()
|
||||
.tag_str("client")
|
||||
.tag_str("Damus Notedeck")
|
||||
.tag_str(client_variant())
|
||||
}
|
||||
|
||||
impl NewPost {
|
||||
@@ -270,6 +286,36 @@ impl Default for PostBuffer {
|
||||
}
|
||||
}
|
||||
|
||||
/// New cursor index (indexed by characters) after operation is performed
|
||||
#[must_use = "must call MentionSelectedResponse::process"]
|
||||
pub struct MentionSelectedResponse {
|
||||
pub next_cursor_index: usize,
|
||||
}
|
||||
|
||||
impl MentionSelectedResponse {
|
||||
pub fn process(&self, ctx: &egui::Context, text_edit_output: &TextEditOutput) {
|
||||
let text_edit_id = text_edit_output.response.id;
|
||||
let Some(mut before_state) = TextEdit::load_state(ctx, text_edit_id) else {
|
||||
return;
|
||||
};
|
||||
|
||||
let mut new_cursor = text_edit_output
|
||||
.galley
|
||||
.from_ccursor(CCursor::new(self.next_cursor_index));
|
||||
new_cursor.ccursor.prefer_next_row = true;
|
||||
|
||||
before_state
|
||||
.cursor
|
||||
.set_char_range(Some(CCursorRange::one(CCursor::new(
|
||||
self.next_cursor_index,
|
||||
))));
|
||||
|
||||
ctx.memory_mut(|mem| mem.request_focus(text_edit_id));
|
||||
|
||||
TextEdit::store_state(ctx, text_edit_id, before_state);
|
||||
}
|
||||
}
|
||||
|
||||
impl PostBuffer {
|
||||
pub fn get_new_mentions_key(&mut self) -> usize {
|
||||
let prev = self.mentions_key;
|
||||
@@ -319,15 +365,21 @@ impl PostBuffer {
|
||||
mention_key: usize,
|
||||
full_name: &str,
|
||||
pk: Pubkey,
|
||||
) {
|
||||
if let Some(info) = self.mentions.get(&mention_key) {
|
||||
let text_start_index = info.start_index + 1;
|
||||
self.delete_char_range(text_start_index..info.end_index);
|
||||
self.insert_text(full_name, text_start_index);
|
||||
self.select_full_mention(mention_key, pk);
|
||||
} else {
|
||||
) -> Option<MentionSelectedResponse> {
|
||||
let Some(info) = self.mentions.get(&mention_key) else {
|
||||
error!("Error selecting mention for index: {mention_key}. Have the following mentions: {:?}", self.mentions);
|
||||
}
|
||||
return None;
|
||||
};
|
||||
let text_start_index = info.start_index + 1; // increment by one to exclude the mention indicator, '@'
|
||||
self.delete_char_range(text_start_index..info.end_index);
|
||||
let text_chars_inserted = self.insert_text(full_name, text_start_index);
|
||||
self.select_full_mention(mention_key, pk);
|
||||
|
||||
let space_chars_inserted = self.insert_text(" ", text_start_index + text_chars_inserted);
|
||||
|
||||
Some(MentionSelectedResponse {
|
||||
next_cursor_index: text_start_index + text_chars_inserted + space_chars_inserted,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn delete_mention(&mut self, mention_key: usize) {
|
||||
@@ -917,9 +969,9 @@ mod tests {
|
||||
assert_eq!(buf.mentions.len(), 1);
|
||||
assert_eq!(buf.mentions.get(&0).unwrap().bounds(), 0..3);
|
||||
buf.select_mention_and_replace_name(0, "jb55", JB55());
|
||||
assert_eq!(buf.as_str(), "@jb55");
|
||||
assert_eq!(buf.as_str(), "@jb55 ");
|
||||
|
||||
buf.insert_text(" test", 5);
|
||||
buf.insert_text("test", 6);
|
||||
assert_eq!(buf.as_str(), "@jb55 test");
|
||||
|
||||
assert_eq!(buf.mentions.len(), 1);
|
||||
@@ -1201,16 +1253,20 @@ mod tests {
|
||||
|
||||
buf.insert_text("@jb", 0);
|
||||
buf.select_mention_and_replace_name(0, "jb55", JB55());
|
||||
buf.insert_text(" test ", 5);
|
||||
buf.insert_text("test ", 6);
|
||||
assert_eq!(buf.as_str(), "@jb55 test ");
|
||||
buf.insert_text("@kernel", 11);
|
||||
buf.select_mention_and_replace_name(1, "KernelKind", KK());
|
||||
buf.insert_text(" test", 22);
|
||||
assert_eq!(buf.as_str(), "@jb55 test @KernelKind ");
|
||||
|
||||
buf.insert_text("test", 23);
|
||||
assert_eq!(buf.as_str(), "@jb55 test @KernelKind test");
|
||||
|
||||
assert_eq!(buf.mentions.len(), 2);
|
||||
|
||||
buf.insert_text(" ", 5);
|
||||
buf.insert_text("@els", 6);
|
||||
assert_eq!(buf.as_str(), "@jb55 @elstest @KernelKind test");
|
||||
|
||||
assert_eq!(buf.mentions.len(), 3);
|
||||
assert_eq!(buf.mentions.get(&2).unwrap().bounds(), 6..10);
|
||||
buf.select_mention_and_replace_name(2, "elsat", JB55());
|
||||
|
||||
@@ -28,7 +28,7 @@ impl Support {
|
||||
}
|
||||
|
||||
static MAX_LOG_LINES: usize = 500;
|
||||
static SUPPORT_EMAIL: &str = "support@damus.io";
|
||||
pub static SUPPORT_EMAIL: &str = "support+notedeck@damus.io";
|
||||
static EMAIL_TEMPLATE: &str = concat!("version ", env!("CARGO_PKG_VERSION"), "\nCommit hash: ", env!("GIT_COMMIT_HASH"), "\n\nDescribe the bug you have encountered:\n<-- your statement here -->\n\n===== Paste your log below =====\n\n");
|
||||
|
||||
impl Support {
|
||||
|
||||
@@ -221,6 +221,14 @@ impl TimelineCache {
|
||||
pub fn num_timelines(&self) -> usize {
|
||||
self.timelines.len()
|
||||
}
|
||||
|
||||
pub fn set_fresh(&mut self, kind: &TimelineKind) {
|
||||
let Some(tl) = self.get_mut(kind) else {
|
||||
return;
|
||||
};
|
||||
|
||||
tl.current_view_mut().freshness.set_fresh();
|
||||
}
|
||||
}
|
||||
|
||||
/// Look for new thread notes since our last fetch
|
||||
|
||||
@@ -471,11 +471,9 @@ impl TimelineKind {
|
||||
},
|
||||
|
||||
// TODO: still need to update this to fetch likes, zaps, etc
|
||||
TimelineKind::Notifications(pubkey) => FilterState::ready(vec![Filter::new()
|
||||
.pubkeys([pubkey.bytes()])
|
||||
.kinds([1])
|
||||
.limit(default_limit())
|
||||
.build()]),
|
||||
TimelineKind::Notifications(pubkey) => {
|
||||
FilterState::ready(vec![notifications_filter(pubkey)])
|
||||
}
|
||||
|
||||
TimelineKind::Hashtag(hashtag) => {
|
||||
let filters = hashtag
|
||||
@@ -573,11 +571,7 @@ impl TimelineKind {
|
||||
)),
|
||||
|
||||
TimelineKind::Notifications(pk) => {
|
||||
let notifications_filter = Filter::new()
|
||||
.pubkeys([pk.bytes()])
|
||||
.kinds([1])
|
||||
.limit(default_limit())
|
||||
.build();
|
||||
let notifications_filter = notifications_filter(&pk);
|
||||
|
||||
Some(Timeline::new(
|
||||
TimelineKind::notifications(pk),
|
||||
@@ -628,6 +622,14 @@ impl TimelineKind {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn notifications_filter(pk: &Pubkey) -> Filter {
|
||||
Filter::new()
|
||||
.pubkeys([pk.bytes()])
|
||||
.kinds([1])
|
||||
.limit(default_limit())
|
||||
.build()
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TitleNeedsDb<'a> {
|
||||
kind: &'a TimelineKind,
|
||||
|
||||
@@ -8,6 +8,7 @@ use crate::{
|
||||
|
||||
use notedeck::{
|
||||
contacts::hybrid_contacts_filter,
|
||||
debouncer::Debouncer,
|
||||
filter::{self, HybridFilter},
|
||||
tr, Accounts, CachedNote, ContactState, FilterError, FilterState, FilterStates, Localization,
|
||||
NoteCache, NoteRef, UnknownIds,
|
||||
@@ -16,8 +17,11 @@ use notedeck::{
|
||||
use egui_virtual_list::VirtualList;
|
||||
use enostr::{PoolRelay, Pubkey, RelayPool};
|
||||
use nostrdb::{Filter, Ndb, Note, NoteKey, Transaction};
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
time::{Duration, UNIX_EPOCH},
|
||||
};
|
||||
use std::{rc::Rc, time::SystemTime};
|
||||
|
||||
use tracing::{debug, error, info, warn};
|
||||
|
||||
@@ -103,6 +107,7 @@ pub struct TimelineTab {
|
||||
pub selection: i32,
|
||||
pub filter: ViewFilter,
|
||||
pub list: Rc<RefCell<VirtualList>>,
|
||||
pub freshness: NotesFreshness,
|
||||
}
|
||||
|
||||
impl TimelineTab {
|
||||
@@ -138,6 +143,7 @@ impl TimelineTab {
|
||||
selection,
|
||||
filter,
|
||||
list,
|
||||
freshness: NotesFreshness::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -780,3 +786,101 @@ pub fn is_timeline_ready(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct NotesFreshness {
|
||||
debouncer: Debouncer,
|
||||
state: NotesFreshnessState,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum NotesFreshnessState {
|
||||
Fresh {
|
||||
timestamp_viewed: u64,
|
||||
},
|
||||
Stale {
|
||||
have_unseen: bool,
|
||||
timestamp_last_viewed: u64,
|
||||
},
|
||||
}
|
||||
|
||||
impl Default for NotesFreshness {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
debouncer: Debouncer::new(Duration::from_secs(2)),
|
||||
state: NotesFreshnessState::Stale {
|
||||
have_unseen: true,
|
||||
timestamp_last_viewed: 0,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl NotesFreshness {
|
||||
pub fn set_fresh(&mut self) {
|
||||
if !self.debouncer.should_act() {
|
||||
return;
|
||||
}
|
||||
self.state = NotesFreshnessState::Fresh {
|
||||
timestamp_viewed: timestamp_now(),
|
||||
};
|
||||
self.debouncer.bounce();
|
||||
}
|
||||
|
||||
pub fn update(&mut self, check_have_unseen: impl FnOnce(u64) -> bool) {
|
||||
if !self.debouncer.should_act() {
|
||||
return;
|
||||
}
|
||||
|
||||
match &self.state {
|
||||
NotesFreshnessState::Fresh { timestamp_viewed } => {
|
||||
let Ok(dur) = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH + Duration::from_secs(*timestamp_viewed))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
if dur > Duration::from_secs(2) {
|
||||
self.state = NotesFreshnessState::Stale {
|
||||
have_unseen: check_have_unseen(*timestamp_viewed),
|
||||
timestamp_last_viewed: *timestamp_viewed,
|
||||
};
|
||||
}
|
||||
}
|
||||
NotesFreshnessState::Stale {
|
||||
have_unseen,
|
||||
timestamp_last_viewed,
|
||||
} => {
|
||||
if *have_unseen {
|
||||
return;
|
||||
}
|
||||
|
||||
self.state = NotesFreshnessState::Stale {
|
||||
have_unseen: check_have_unseen(*timestamp_last_viewed),
|
||||
timestamp_last_viewed: *timestamp_last_viewed,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
self.debouncer.bounce();
|
||||
}
|
||||
|
||||
pub fn has_unseen(&self) -> bool {
|
||||
match &self.state {
|
||||
NotesFreshnessState::Fresh {
|
||||
timestamp_viewed: _,
|
||||
} => false,
|
||||
NotesFreshnessState::Stale {
|
||||
have_unseen,
|
||||
timestamp_last_viewed: _,
|
||||
} => *have_unseen,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn timestamp_now() -> u64 {
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap_or(Duration::ZERO)
|
||||
.as_secs()
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ use crate::{
|
||||
};
|
||||
|
||||
use enostr::Pubkey;
|
||||
use notedeck::NoteContext;
|
||||
use notedeck_ui::{jobs::JobsCache, NoteOptions};
|
||||
use notedeck::{JobsCache, NoteContext};
|
||||
use notedeck_ui::NoteOptions;
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn render_timeline_route(
|
||||
@@ -81,6 +81,9 @@ pub fn render_thread_route(
|
||||
// default truncated everywher eelse
|
||||
note_options.set(NoteOptions::Truncate, false);
|
||||
|
||||
// We need the reply lines in threads
|
||||
note_options.set(NoteOptions::Wide, false);
|
||||
|
||||
ui::ThreadView::new(
|
||||
threads,
|
||||
selection.selected_or_root(),
|
||||
|
||||
@@ -23,6 +23,7 @@ pub struct ThreadNode {
|
||||
pub prev: ParentState,
|
||||
pub have_all_ancestors: bool,
|
||||
pub list: VirtualList,
|
||||
pub set_scroll_offset: Option<f32>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -132,8 +133,14 @@ impl ThreadNode {
|
||||
prev: parent,
|
||||
have_all_ancestors: false,
|
||||
list: VirtualList::new(),
|
||||
set_scroll_offset: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_offset(mut self, offset: f32) -> Self {
|
||||
self.set_scroll_offset = Some(offset);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -147,6 +154,7 @@ pub struct Threads {
|
||||
impl Threads {
|
||||
/// Opening a thread.
|
||||
/// Similar to [[super::cache::TimelineCache::open]]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn open(
|
||||
&mut self,
|
||||
ndb: &mut Ndb,
|
||||
@@ -155,6 +163,7 @@ impl Threads {
|
||||
thread: &ThreadSelection,
|
||||
new_scope: bool,
|
||||
col: usize,
|
||||
scroll_offset: f32,
|
||||
) -> Option<NewThreadNotes> {
|
||||
tracing::info!("Opening thread: {:?}", thread);
|
||||
let local_sub_filter = if let Some(selected) = &thread.selected_note {
|
||||
@@ -184,7 +193,7 @@ impl Threads {
|
||||
RawEntryMut::Vacant(entry) => {
|
||||
let id = NoteId::new(*selected_note_id);
|
||||
|
||||
let node = ThreadNode::new(ParentState::Unknown);
|
||||
let node = ThreadNode::new(ParentState::Unknown).with_offset(scroll_offset);
|
||||
entry.insert(id, node);
|
||||
|
||||
&local_sub_filter
|
||||
|
||||
+27
-14
@@ -11,19 +11,21 @@ use notedeck_ui::{
|
||||
};
|
||||
use tracing::error;
|
||||
|
||||
pub struct SearchResultsView<'a> {
|
||||
/// Displays user profiles for the user to pick from.
|
||||
/// Useful for manually typing a username and selecting the profile desired
|
||||
pub struct MentionPickerView<'a> {
|
||||
ndb: &'a Ndb,
|
||||
txn: &'a Transaction,
|
||||
img_cache: &'a mut Images,
|
||||
results: &'a Vec<&'a [u8; 32]>,
|
||||
}
|
||||
|
||||
pub enum SearchResultsResponse {
|
||||
pub enum MentionPickerResponse {
|
||||
SelectResult(Option<usize>),
|
||||
DeleteMention,
|
||||
}
|
||||
|
||||
impl<'a> SearchResultsView<'a> {
|
||||
impl<'a> MentionPickerView<'a> {
|
||||
pub fn new(
|
||||
img_cache: &'a mut Images,
|
||||
ndb: &'a Ndb,
|
||||
@@ -38,8 +40,8 @@ impl<'a> SearchResultsView<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn show(&mut self, ui: &mut egui::Ui, width: f32) -> SearchResultsResponse {
|
||||
let mut search_results_selection = None;
|
||||
fn show(&mut self, ui: &mut egui::Ui, width: f32) -> MentionPickerResponse {
|
||||
let mut selection = None;
|
||||
ui.vertical(|ui| {
|
||||
for (i, res) in self.results.iter().enumerate() {
|
||||
let profile = match self.ndb.get_profile_by_pubkey(self.txn, res) {
|
||||
@@ -54,16 +56,16 @@ impl<'a> SearchResultsView<'a> {
|
||||
.add(user_result(&profile, self.img_cache, i, width))
|
||||
.clicked()
|
||||
{
|
||||
search_results_selection = Some(i)
|
||||
selection = Some(i)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SearchResultsResponse::SelectResult(search_results_selection)
|
||||
MentionPickerResponse::SelectResult(selection)
|
||||
}
|
||||
|
||||
pub fn show_in_rect(&mut self, rect: egui::Rect, ui: &mut egui::Ui) -> SearchResultsResponse {
|
||||
let widget_id = ui.id().with("search_results");
|
||||
pub fn show_in_rect(&mut self, rect: egui::Rect, ui: &mut egui::Ui) -> MentionPickerResponse {
|
||||
let widget_id = ui.id().with("mention_results");
|
||||
let area_resp = egui::Area::new(widget_id)
|
||||
.order(egui::Order::Foreground)
|
||||
.fixed_pos(rect.left_top())
|
||||
@@ -72,10 +74,10 @@ impl<'a> SearchResultsView<'a> {
|
||||
let inner_margin_size = 8.0;
|
||||
egui::Frame::NONE
|
||||
.fill(ui.visuals().panel_fill)
|
||||
.inner_margin(inner_margin_size)
|
||||
.show(ui, |ui| {
|
||||
let width = rect.width() - (2.0 * inner_margin_size);
|
||||
|
||||
ui.allocate_space(vec2(ui.available_width(), inner_margin_size));
|
||||
let close_button_resp = {
|
||||
let close_button_size = 16.0;
|
||||
let (close_section_rect, _) = ui.allocate_exact_size(
|
||||
@@ -95,16 +97,16 @@ impl<'a> SearchResultsView<'a> {
|
||||
.inner
|
||||
};
|
||||
|
||||
ui.add_space(8.0);
|
||||
ui.allocate_space(vec2(ui.available_width(), inner_margin_size));
|
||||
|
||||
let scroll_resp = ScrollArea::vertical()
|
||||
.max_width(width)
|
||||
.max_width(rect.width())
|
||||
.auto_shrink(Vec2b::FALSE)
|
||||
.show(ui, |ui| self.show(ui, width));
|
||||
ui.advance_cursor_after_rect(rect);
|
||||
|
||||
if close_button_resp {
|
||||
SearchResultsResponse::DeleteMention
|
||||
MentionPickerResponse::DeleteMention
|
||||
} else {
|
||||
scroll_resp.inner
|
||||
}
|
||||
@@ -128,7 +130,18 @@ fn user_result<'a>(
|
||||
let spacing = 8.0;
|
||||
let body_font_size = get_font_size(ui.ctx(), &NotedeckTextStyle::Body);
|
||||
|
||||
let helper = AnimationHelper::new(ui, ("user_result", index), vec2(width, max_image));
|
||||
let animation_rect = {
|
||||
let max_width = ui.available_width();
|
||||
let extra_width = (max_width - width) / 2.0;
|
||||
let left = ui.cursor().left();
|
||||
let (rect, _) =
|
||||
ui.allocate_exact_size(vec2(width + extra_width, max_image), egui::Sense::click());
|
||||
|
||||
let (_, right) = rect.split_left_right_at_x(left + extra_width);
|
||||
right
|
||||
};
|
||||
|
||||
let helper = AnimationHelper::new_from_rect(ui, ("user_result", index), animation_rect);
|
||||
|
||||
let icon_rect = {
|
||||
let r = helper.get_animation_rect();
|
||||
@@ -5,13 +5,13 @@ pub mod column;
|
||||
pub mod configure_deck;
|
||||
pub mod edit_deck;
|
||||
pub mod images;
|
||||
pub mod mentions_picker;
|
||||
pub mod note;
|
||||
pub mod post;
|
||||
pub mod preview;
|
||||
pub mod profile;
|
||||
pub mod relay;
|
||||
pub mod search;
|
||||
pub mod search_results;
|
||||
pub mod settings;
|
||||
pub mod side_panel;
|
||||
pub mod support;
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::draft::{Draft, Drafts, MentionHint};
|
||||
#[cfg(not(target_os = "android"))]
|
||||
use crate::media_upload::{nostrbuild_nip96_upload, MediaPath};
|
||||
use crate::post::{downcast_post_buffer, MentionType, NewPost};
|
||||
use crate::ui::search_results::SearchResultsView;
|
||||
use crate::ui::mentions_picker::MentionPickerView;
|
||||
use crate::ui::{self, Preview, PreviewConfig};
|
||||
use crate::Result;
|
||||
|
||||
@@ -14,13 +14,13 @@ use egui::{
|
||||
};
|
||||
use enostr::{FilledKeypair, FullKeypair, NoteId, Pubkey, RelayPool};
|
||||
use nostrdb::{Ndb, Transaction};
|
||||
use notedeck::media::gif::ensure_latest_texture;
|
||||
use notedeck::media::AnimationMode;
|
||||
use notedeck::{get_render_state, JobsCache, PixelDimensions, RenderState};
|
||||
|
||||
use notedeck_ui::{
|
||||
app_images,
|
||||
blur::PixelDimensions,
|
||||
context_menu::{input_context, PasteBehavior},
|
||||
gif::{handle_repaint, retrieve_latest_texture},
|
||||
images::{get_render_state, RenderState},
|
||||
jobs::JobsCache,
|
||||
note::render_note_preview,
|
||||
NoteOptions, ProfilePic,
|
||||
};
|
||||
@@ -38,6 +38,7 @@ pub struct PostView<'a, 'd> {
|
||||
inner_rect: egui::Rect,
|
||||
note_options: NoteOptions,
|
||||
jobs: &'a mut JobsCache,
|
||||
animation_mode: AnimationMode,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -111,6 +112,11 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
note_options: NoteOptions,
|
||||
jobs: &'a mut JobsCache,
|
||||
) -> Self {
|
||||
let animation_mode = if note_options.contains(NoteOptions::NoAnimations) {
|
||||
AnimationMode::NoAnimation
|
||||
} else {
|
||||
AnimationMode::Continuous { fps: None }
|
||||
};
|
||||
PostView {
|
||||
note_context,
|
||||
draft,
|
||||
@@ -118,6 +124,7 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
post_type,
|
||||
inner_rect,
|
||||
note_options,
|
||||
animation_mode,
|
||||
jobs,
|
||||
}
|
||||
}
|
||||
@@ -130,6 +137,11 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
PostView::id().with("scroll")
|
||||
}
|
||||
|
||||
pub fn animation_mode(mut self, animation_mode: AnimationMode) -> Self {
|
||||
self.animation_mode = animation_mode;
|
||||
self
|
||||
}
|
||||
|
||||
fn editbox(&mut self, txn: &nostrdb::Transaction, ui: &mut egui::Ui) -> egui::Response {
|
||||
ui.spacing_mut().item_spacing.x = 12.0;
|
||||
|
||||
@@ -219,6 +231,7 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
out.response
|
||||
}
|
||||
|
||||
// Displays the mention picker and handles when one is selected.
|
||||
fn show_mention_hints(
|
||||
&mut self,
|
||||
txn: &nostrdb::Transaction,
|
||||
@@ -274,7 +287,7 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
return;
|
||||
};
|
||||
|
||||
let resp = SearchResultsView::new(
|
||||
let resp = MentionPickerView::new(
|
||||
self.note_context.img_cache,
|
||||
self.note_context.ndb,
|
||||
txn,
|
||||
@@ -282,26 +295,35 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
)
|
||||
.show_in_rect(hint_rect, ui);
|
||||
|
||||
let mut selection_made = None;
|
||||
match resp {
|
||||
ui::search_results::SearchResultsResponse::SelectResult(selection) => {
|
||||
ui::mentions_picker::MentionPickerResponse::SelectResult(selection) => {
|
||||
if let Some(hint_index) = selection {
|
||||
if let Some(pk) = res.get(hint_index) {
|
||||
let record = self.note_context.ndb.get_profile_by_pubkey(txn, pk);
|
||||
|
||||
self.draft.buffer.select_mention_and_replace_name(
|
||||
mention.index,
|
||||
get_display_name(record.ok().as_ref()).name(),
|
||||
Pubkey::new(**pk),
|
||||
);
|
||||
if let Some(made_selection) =
|
||||
self.draft.buffer.select_mention_and_replace_name(
|
||||
mention.index,
|
||||
get_display_name(record.ok().as_ref()).name(),
|
||||
Pubkey::new(**pk),
|
||||
)
|
||||
{
|
||||
selection_made = Some(made_selection);
|
||||
}
|
||||
self.draft.cur_mention_hint = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ui::search_results::SearchResultsResponse::DeleteMention => {
|
||||
ui::mentions_picker::MentionPickerResponse::DeleteMention => {
|
||||
self.draft.buffer.delete_mention(mention.index)
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(selection) = selection_made {
|
||||
selection.process(ui.ctx(), textedit_output);
|
||||
}
|
||||
}
|
||||
|
||||
fn focused(&self, ui: &egui::Ui) -> bool {
|
||||
@@ -471,7 +493,7 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
self.note_context.img_cache,
|
||||
cache_type,
|
||||
url,
|
||||
notedeck_ui::images::ImageType::Content(Some((width, height))),
|
||||
notedeck::ImageType::Content(Some((width, height))),
|
||||
);
|
||||
|
||||
render_post_view_media(
|
||||
@@ -483,6 +505,7 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
height,
|
||||
cur_state,
|
||||
url,
|
||||
self.animation_mode,
|
||||
)
|
||||
}
|
||||
to_remove.reverse();
|
||||
@@ -573,6 +596,7 @@ fn render_post_view_media(
|
||||
height: u32,
|
||||
render_state: RenderState,
|
||||
url: &str,
|
||||
animation_mode: AnimationMode,
|
||||
) {
|
||||
match render_state.texture_state {
|
||||
notedeck::TextureState::Pending => {
|
||||
@@ -595,12 +619,10 @@ fn render_post_view_media(
|
||||
.to_points(ui.pixels_per_point())
|
||||
.to_vec();
|
||||
|
||||
let texture_handle = handle_repaint(
|
||||
ui,
|
||||
retrieve_latest_texture(url, render_state.gifs, renderable_media),
|
||||
);
|
||||
let texture_handle =
|
||||
ensure_latest_texture(ui, url, render_state.gifs, renderable_media, animation_mode);
|
||||
let img_resp = ui.add(
|
||||
egui::Image::new(texture_handle)
|
||||
egui::Image::new(&texture_handle)
|
||||
.max_size(size)
|
||||
.corner_radius(12.0),
|
||||
);
|
||||
|
||||
@@ -6,8 +6,8 @@ use crate::{
|
||||
|
||||
use egui::ScrollArea;
|
||||
use enostr::{FilledKeypair, NoteId};
|
||||
use notedeck::NoteContext;
|
||||
use notedeck_ui::{jobs::JobsCache, NoteOptions};
|
||||
use notedeck::{JobsCache, NoteContext};
|
||||
use notedeck_ui::NoteOptions;
|
||||
|
||||
pub struct QuoteRepostView<'a, 'd> {
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
|
||||
@@ -6,8 +6,7 @@ use crate::ui::{
|
||||
|
||||
use egui::{Rect, Response, ScrollArea, Ui};
|
||||
use enostr::{FilledKeypair, NoteId};
|
||||
use notedeck::NoteContext;
|
||||
use notedeck_ui::jobs::JobsCache;
|
||||
use notedeck::{JobsCache, NoteContext};
|
||||
use notedeck_ui::{NoteOptions, NoteView, ProfilePic};
|
||||
|
||||
pub struct PostReplyView<'a, 'd> {
|
||||
|
||||
@@ -6,6 +6,7 @@ use enostr::Pubkey;
|
||||
use nostrdb::{ProfileRecord, Transaction};
|
||||
use notedeck::{tr, Localization};
|
||||
use notedeck_ui::profile::follow_button;
|
||||
use robius_open::Uri;
|
||||
use tracing::error;
|
||||
|
||||
use crate::{
|
||||
@@ -13,12 +14,11 @@ use crate::{
|
||||
ui::timeline::{tabs_ui, TimelineTabView},
|
||||
};
|
||||
use notedeck::{
|
||||
name::get_display_name, profile::get_profile_url, IsFollowing, NoteAction, NoteContext,
|
||||
NotedeckTextStyle,
|
||||
name::get_display_name, profile::get_profile_url, IsFollowing, JobsCache, NoteAction,
|
||||
NoteContext, NotedeckTextStyle,
|
||||
};
|
||||
use notedeck_ui::{
|
||||
app_images,
|
||||
jobs::JobsCache,
|
||||
profile::{about_section_widget, banner, display_name_widget},
|
||||
NoteOptions, ProfilePic,
|
||||
};
|
||||
@@ -286,8 +286,8 @@ fn handle_link(ui: &mut egui::Ui, website_url: &str) {
|
||||
.interact(Sense::click())
|
||||
.clicked()
|
||||
{
|
||||
if let Err(e) = open::that(website_url) {
|
||||
error!("Failed to open URL {} because: {}", website_url, e);
|
||||
if let Err(e) = Uri::new(website_url).open() {
|
||||
error!("Failed to open URL {} because: {:?}", website_url, e);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ use state::TypingType;
|
||||
use crate::{timeline::TimelineTab, ui::timeline::TimelineTabView};
|
||||
use egui_winit::clipboard::Clipboard;
|
||||
use nostrdb::{Filter, Ndb, Transaction};
|
||||
use notedeck::{tr, tr_plural, Localization, NoteAction, NoteContext, NoteRef};
|
||||
use notedeck::{tr, tr_plural, JobsCache, Localization, NoteAction, NoteContext, NoteRef};
|
||||
|
||||
use notedeck_ui::{
|
||||
context_menu::{input_context, PasteBehavior},
|
||||
icons::search_icon,
|
||||
jobs::JobsCache,
|
||||
padding, NoteOptions,
|
||||
};
|
||||
use std::time::{Duration, Instant};
|
||||
@@ -19,7 +19,7 @@ mod state;
|
||||
|
||||
pub use state::{FocusState, SearchQueryState, SearchState};
|
||||
|
||||
use super::search_results::{SearchResultsResponse, SearchResultsView};
|
||||
use super::mentions_picker::{MentionPickerResponse, MentionPickerView};
|
||||
|
||||
pub struct SearchView<'a, 'd> {
|
||||
query: &'a mut SearchQueryState,
|
||||
@@ -76,7 +76,7 @@ impl<'a, 'd> SearchView<'a, 'd> {
|
||||
break 's;
|
||||
};
|
||||
|
||||
let search_res = SearchResultsView::new(
|
||||
let search_res = MentionPickerView::new(
|
||||
self.note_context.img_cache,
|
||||
self.note_context.ndb,
|
||||
self.txn,
|
||||
@@ -85,7 +85,7 @@ impl<'a, 'd> SearchView<'a, 'd> {
|
||||
.show_in_rect(ui.available_rect_before_wrap(), ui);
|
||||
|
||||
search_action = match search_res {
|
||||
SearchResultsResponse::SelectResult(Some(index)) => {
|
||||
MentionPickerResponse::SelectResult(Some(index)) => {
|
||||
let Some(pk_bytes) = results.get(index) else {
|
||||
break 's;
|
||||
};
|
||||
@@ -103,8 +103,8 @@ impl<'a, 'd> SearchView<'a, 'd> {
|
||||
new_search_text: format!("@{username}"),
|
||||
})
|
||||
}
|
||||
SearchResultsResponse::DeleteMention => Some(SearchAction::CloseMention),
|
||||
SearchResultsResponse::SelectResult(None) => break 's,
|
||||
MentionPickerResponse::DeleteMention => Some(SearchAction::CloseMention),
|
||||
MentionPickerResponse::SelectResult(None) => break 's,
|
||||
};
|
||||
}
|
||||
SearchState::PerformSearch(search_type) => {
|
||||
|
||||
@@ -1,22 +1,31 @@
|
||||
use egui::{vec2, Button, Color32, ComboBox, Frame, Margin, RichText, ThemePreference};
|
||||
use notedeck::{tr, Images, LanguageIdentifier, Localization, NotedeckTextStyle, ThemeHandler};
|
||||
use notedeck_ui::NoteOptions;
|
||||
use strum::Display;
|
||||
use egui::{
|
||||
vec2, Button, Color32, ComboBox, FontId, Frame, Margin, RichText, ScrollArea, ThemePreference,
|
||||
};
|
||||
use enostr::NoteId;
|
||||
use nostrdb::Transaction;
|
||||
use notedeck::{
|
||||
tr,
|
||||
ui::{is_narrow, richtext_small},
|
||||
Images, JobsCache, LanguageIdentifier, Localization, NoteContext, NotedeckTextStyle, Settings,
|
||||
SettingsHandler, DEFAULT_NOTE_BODY_FONT_SIZE,
|
||||
};
|
||||
use notedeck_ui::{NoteOptions, NoteView};
|
||||
|
||||
use crate::{nav::RouterAction, Damus, Route};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Display)]
|
||||
pub enum ShowNoteClientOptions {
|
||||
Hide,
|
||||
Top,
|
||||
Bottom,
|
||||
}
|
||||
const PREVIEW_NOTE_ID: &str = "note1edjc8ggj07hwv77g2405uh6j2jkk5aud22gktxrvc2wnre4vdwgqzlv2gw";
|
||||
|
||||
const MIN_ZOOM: f32 = 0.5;
|
||||
const MAX_ZOOM: f32 = 3.0;
|
||||
const ZOOM_STEP: f32 = 0.1;
|
||||
const RESET_ZOOM: f32 = 1.0;
|
||||
|
||||
pub enum SettingsAction {
|
||||
SetZoom(f32),
|
||||
SetZoomFactor(f32),
|
||||
SetTheme(ThemePreference),
|
||||
SetShowNoteClient(ShowNoteClientOptions),
|
||||
SetLocale(LanguageIdentifier),
|
||||
SetRepliestNewestFirst(bool),
|
||||
SetNoteBodyFontSize(f32),
|
||||
OpenRelays,
|
||||
OpenCacheFolder,
|
||||
ClearCacheFolder,
|
||||
@@ -26,7 +35,7 @@ impl SettingsAction {
|
||||
pub fn process_settings_action<'a>(
|
||||
self,
|
||||
app: &mut Damus,
|
||||
theme_handler: &'a mut ThemeHandler,
|
||||
settings: &'a mut SettingsHandler,
|
||||
i18n: &'a mut Localization,
|
||||
img_cache: &mut Images,
|
||||
ctx: &egui::Context,
|
||||
@@ -34,433 +43,484 @@ impl SettingsAction {
|
||||
let mut route_action: Option<RouterAction> = None;
|
||||
|
||||
match self {
|
||||
SettingsAction::OpenRelays => {
|
||||
Self::OpenRelays => {
|
||||
route_action = Some(RouterAction::route_to(Route::Relays));
|
||||
}
|
||||
SettingsAction::SetZoom(zoom_level) => {
|
||||
ctx.set_zoom_factor(zoom_level);
|
||||
Self::SetZoomFactor(zoom_factor) => {
|
||||
ctx.set_zoom_factor(zoom_factor);
|
||||
settings.set_zoom_factor(zoom_factor);
|
||||
}
|
||||
SettingsAction::SetShowNoteClient(newvalue) => match newvalue {
|
||||
ShowNoteClientOptions::Hide => {
|
||||
app.note_options.set(NoteOptions::ShowNoteClientTop, false);
|
||||
app.note_options
|
||||
.set(NoteOptions::ShowNoteClientBottom, false);
|
||||
}
|
||||
ShowNoteClientOptions::Bottom => {
|
||||
app.note_options.set(NoteOptions::ShowNoteClientTop, false);
|
||||
app.note_options
|
||||
.set(NoteOptions::ShowNoteClientBottom, true);
|
||||
}
|
||||
ShowNoteClientOptions::Top => {
|
||||
app.note_options.set(NoteOptions::ShowNoteClientTop, true);
|
||||
app.note_options
|
||||
.set(NoteOptions::ShowNoteClientBottom, false);
|
||||
}
|
||||
},
|
||||
SettingsAction::SetTheme(theme) => {
|
||||
ctx.options_mut(|o| {
|
||||
o.theme_preference = theme;
|
||||
});
|
||||
theme_handler.save(theme);
|
||||
Self::SetTheme(theme) => {
|
||||
ctx.set_theme(theme);
|
||||
settings.set_theme(theme);
|
||||
}
|
||||
SettingsAction::SetLocale(language) => {
|
||||
_ = i18n.set_locale(language);
|
||||
Self::SetLocale(language) => {
|
||||
if i18n.set_locale(language.clone()).is_ok() {
|
||||
settings.set_locale(language.to_string());
|
||||
}
|
||||
}
|
||||
SettingsAction::OpenCacheFolder => {
|
||||
Self::SetRepliestNewestFirst(value) => {
|
||||
app.note_options.set(NoteOptions::RepliesNewestFirst, value);
|
||||
settings.set_show_replies_newest_first(value);
|
||||
}
|
||||
Self::OpenCacheFolder => {
|
||||
use opener;
|
||||
let _ = opener::open(img_cache.base_path.clone());
|
||||
}
|
||||
SettingsAction::ClearCacheFolder => {
|
||||
Self::ClearCacheFolder => {
|
||||
let _ = img_cache.clear_folder_contents();
|
||||
}
|
||||
Self::SetNoteBodyFontSize(size) => {
|
||||
let mut style = (*ctx.style()).clone();
|
||||
style.text_styles.insert(
|
||||
NotedeckTextStyle::NoteBody.text_style(),
|
||||
FontId::proportional(size),
|
||||
);
|
||||
ctx.set_style(style);
|
||||
|
||||
settings.set_note_body_font_size(size);
|
||||
}
|
||||
}
|
||||
route_action
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SettingsView<'a> {
|
||||
theme: &'a mut String,
|
||||
selected_language: &'a mut String,
|
||||
show_note_client: &'a mut ShowNoteClientOptions,
|
||||
i18n: &'a mut Localization,
|
||||
img_cache: &'a mut Images,
|
||||
settings: &'a mut Settings,
|
||||
note_context: &'a mut NoteContext<'a>,
|
||||
note_options: &'a mut NoteOptions,
|
||||
jobs: &'a mut JobsCache,
|
||||
}
|
||||
|
||||
fn settings_group<S>(ui: &mut egui::Ui, title: S, contents: impl FnOnce(&mut egui::Ui))
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
Frame::group(ui.style())
|
||||
.fill(ui.style().visuals.widgets.open.bg_fill)
|
||||
.inner_margin(10.0)
|
||||
.show(ui, |ui| {
|
||||
ui.label(RichText::new(title).text_style(NotedeckTextStyle::Body.text_style()));
|
||||
ui.separator();
|
||||
|
||||
ui.vertical(|ui| {
|
||||
ui.spacing_mut().item_spacing = vec2(10.0, 10.0);
|
||||
|
||||
contents(ui)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
impl<'a> SettingsView<'a> {
|
||||
pub fn new(
|
||||
img_cache: &'a mut Images,
|
||||
selected_language: &'a mut String,
|
||||
theme: &'a mut String,
|
||||
show_note_client: &'a mut ShowNoteClientOptions,
|
||||
i18n: &'a mut Localization,
|
||||
settings: &'a mut Settings,
|
||||
note_context: &'a mut NoteContext<'a>,
|
||||
note_options: &'a mut NoteOptions,
|
||||
jobs: &'a mut JobsCache,
|
||||
) -> Self {
|
||||
Self {
|
||||
show_note_client,
|
||||
theme,
|
||||
img_cache,
|
||||
selected_language,
|
||||
i18n,
|
||||
settings,
|
||||
note_context,
|
||||
note_options,
|
||||
jobs,
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the localized name for a language identifier
|
||||
fn get_selected_language_name(&mut self) -> String {
|
||||
if let Ok(lang_id) = self.selected_language.parse::<LanguageIdentifier>() {
|
||||
self.i18n
|
||||
if let Ok(lang_id) = self.settings.locale.parse::<LanguageIdentifier>() {
|
||||
self.note_context
|
||||
.i18n
|
||||
.get_locale_native_name(&lang_id)
|
||||
.map(|s| s.to_owned())
|
||||
.unwrap_or_else(|| lang_id.to_string())
|
||||
} else {
|
||||
self.selected_language.clone()
|
||||
self.settings.locale.clone()
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the localized label for ShowNoteClientOptions
|
||||
fn get_show_note_client_label(&mut self, option: ShowNoteClientOptions) -> String {
|
||||
match option {
|
||||
ShowNoteClientOptions::Hide => tr!(
|
||||
self.i18n,
|
||||
"Hide",
|
||||
"Option in settings section to hide the source client label in note display"
|
||||
),
|
||||
ShowNoteClientOptions::Top => tr!(
|
||||
self.i18n,
|
||||
"Top",
|
||||
"Option in settings section to show the source client label at the top of the note"
|
||||
),
|
||||
ShowNoteClientOptions::Bottom => tr!(
|
||||
self.i18n,
|
||||
"Bottom",
|
||||
"Option in settings section to show the source client label at the bottom of the note"
|
||||
),
|
||||
}.to_string()
|
||||
}
|
||||
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui) -> Option<SettingsAction> {
|
||||
let id = ui.id();
|
||||
pub fn appearance_section(&mut self, ui: &mut egui::Ui) -> Option<SettingsAction> {
|
||||
let mut action = None;
|
||||
|
||||
Frame::default()
|
||||
.inner_margin(Margin::symmetric(10, 10))
|
||||
.show(ui, |ui| {
|
||||
Frame::group(ui.style())
|
||||
.fill(ui.style().visuals.widgets.open.bg_fill)
|
||||
.inner_margin(10.0)
|
||||
.show(ui, |ui| {
|
||||
ui.vertical(|ui| {
|
||||
ui.label(
|
||||
RichText::new(tr!(
|
||||
self.i18n,
|
||||
"Appearance",
|
||||
"Label for appearance settings section"
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Body.text_style()),
|
||||
);
|
||||
ui.separator();
|
||||
ui.spacing_mut().item_spacing = vec2(10.0, 10.0);
|
||||
|
||||
let current_zoom = ui.ctx().zoom_factor();
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(
|
||||
RichText::new(tr!(
|
||||
self.i18n,
|
||||
"Zoom Level:",
|
||||
"Label for zoom level, Appearance settings section"
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
);
|
||||
|
||||
if ui
|
||||
.button(
|
||||
RichText::new("-")
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
let new_zoom = (current_zoom - 0.1).max(0.1);
|
||||
action = Some(SettingsAction::SetZoom(new_zoom));
|
||||
};
|
||||
|
||||
ui.label(
|
||||
RichText::new(format!("{:.0}%", current_zoom * 100.0))
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
);
|
||||
|
||||
if ui
|
||||
.button(
|
||||
RichText::new("+")
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
let new_zoom = (current_zoom + 0.1).min(10.0);
|
||||
action = Some(SettingsAction::SetZoom(new_zoom));
|
||||
};
|
||||
|
||||
if ui
|
||||
.button(
|
||||
RichText::new(tr!(
|
||||
self.i18n,
|
||||
"Reset",
|
||||
"Label for reset zoom level, Appearance settings section"
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
action = Some(SettingsAction::SetZoom(1.0));
|
||||
}
|
||||
});
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(
|
||||
RichText::new(tr!(
|
||||
self.i18n,
|
||||
"Language:",
|
||||
"Label for language, Appearance settings section"
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
);
|
||||
ComboBox::from_label("")
|
||||
.selected_text(self.get_selected_language_name())
|
||||
.show_ui(ui, |ui| {
|
||||
for lang in self.i18n.get_available_locales() {
|
||||
let name = self.i18n
|
||||
.get_locale_native_name(lang)
|
||||
.map(|s| s.to_owned())
|
||||
.unwrap_or_else(|| lang.to_string());
|
||||
if ui
|
||||
.selectable_value(
|
||||
self.selected_language,
|
||||
lang.to_string(),
|
||||
&name,
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
action = Some(SettingsAction::SetLocale(lang.to_owned()))
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(
|
||||
RichText::new(tr!(
|
||||
self.i18n,
|
||||
"Theme:",
|
||||
"Label for theme, Appearance settings section"
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
);
|
||||
if ui
|
||||
.selectable_value(
|
||||
self.theme,
|
||||
"Light".into(),
|
||||
RichText::new(tr!(
|
||||
self.i18n,
|
||||
"Light",
|
||||
"Label for Theme Light, Appearance settings section"
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
action = Some(SettingsAction::SetTheme(ThemePreference::Light));
|
||||
}
|
||||
if ui
|
||||
.selectable_value(
|
||||
self.theme,
|
||||
"Dark".into(),
|
||||
RichText::new(tr!(
|
||||
self.i18n,
|
||||
"Dark",
|
||||
"Label for Theme Dark, Appearance settings section"
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
action = Some(SettingsAction::SetTheme(ThemePreference::Dark));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
ui.add_space(5.0);
|
||||
|
||||
Frame::group(ui.style())
|
||||
.fill(ui.style().visuals.widgets.open.bg_fill)
|
||||
.inner_margin(10.0)
|
||||
.show(ui, |ui| {
|
||||
ui.label(
|
||||
RichText::new(tr!(
|
||||
self.i18n,
|
||||
"Storage",
|
||||
"Label for storage settings section"
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Body.text_style()),
|
||||
);
|
||||
ui.separator();
|
||||
|
||||
ui.vertical(|ui| {
|
||||
ui.spacing_mut().item_spacing = vec2(10.0, 10.0);
|
||||
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
let static_imgs_size = self
|
||||
.img_cache
|
||||
.static_imgs
|
||||
.cache_size
|
||||
.lock()
|
||||
.unwrap();
|
||||
|
||||
let gifs_size = self.img_cache.gifs.cache_size.lock().unwrap();
|
||||
|
||||
ui.label(
|
||||
RichText::new(format!("{} {}",
|
||||
tr!(
|
||||
self.i18n,
|
||||
"Image cache size:",
|
||||
"Label for Image cache size, Storage settings section"
|
||||
),
|
||||
format_size(
|
||||
[static_imgs_size, gifs_size]
|
||||
.iter()
|
||||
.fold(0_u64, |acc, cur| acc
|
||||
+ cur.unwrap_or_default())
|
||||
)
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
);
|
||||
|
||||
ui.end_row();
|
||||
|
||||
if !notedeck::ui::is_compiled_as_mobile() &&
|
||||
ui.button(RichText::new(tr!(self.i18n, "View folder:", "Label for view folder button, Storage settings section"))
|
||||
.text_style(NotedeckTextStyle::Small.text_style())).clicked() {
|
||||
action = Some(SettingsAction::OpenCacheFolder);
|
||||
}
|
||||
|
||||
let clearcache_resp = ui.button(
|
||||
RichText::new(tr!(
|
||||
self.i18n,
|
||||
"Clear cache",
|
||||
"Label for clear cache button, Storage settings section"
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Small.text_style())
|
||||
.color(Color32::LIGHT_RED),
|
||||
);
|
||||
|
||||
let id_clearcache = id.with("clear_cache");
|
||||
if clearcache_resp.clicked() {
|
||||
ui.data_mut(|d| d.insert_temp(id_clearcache, true));
|
||||
}
|
||||
|
||||
if ui.data_mut(|d| *d.get_temp_mut_or_default(id_clearcache)) {
|
||||
let mut confirm_pressed = false;
|
||||
clearcache_resp.show_tooltip_ui(|ui| {
|
||||
let confirm_resp = ui.button(tr!(
|
||||
self.i18n,
|
||||
"Confirm",
|
||||
"Label for confirm clear cache, Storage settings section"
|
||||
));
|
||||
if confirm_resp.clicked() {
|
||||
confirm_pressed = true;
|
||||
}
|
||||
|
||||
if confirm_resp.clicked() || ui.button(tr!(
|
||||
self.i18n,
|
||||
"Cancel",
|
||||
"Label for cancel clear cache, Storage settings section"
|
||||
)).clicked() {
|
||||
ui.data_mut(|d| d.insert_temp(id_clearcache, false));
|
||||
}
|
||||
});
|
||||
|
||||
if confirm_pressed {
|
||||
action = Some(SettingsAction::ClearCacheFolder);
|
||||
} else if !confirm_pressed
|
||||
&& clearcache_resp.clicked_elsewhere()
|
||||
{
|
||||
ui.data_mut(|d| d.insert_temp(id_clearcache, false));
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
ui.add_space(5.0);
|
||||
|
||||
Frame::group(ui.style())
|
||||
.fill(ui.style().visuals.widgets.open.bg_fill)
|
||||
.inner_margin(10.0)
|
||||
.show(ui, |ui| {
|
||||
ui.label(
|
||||
RichText::new(tr!(
|
||||
self.i18n,
|
||||
"Others",
|
||||
"Label for others settings section"
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Body.text_style()),
|
||||
);
|
||||
ui.separator();
|
||||
ui.vertical(|ui| {
|
||||
ui.spacing_mut().item_spacing = vec2(10.0, 10.0);
|
||||
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.label(
|
||||
RichText::new(
|
||||
tr!(
|
||||
self.i18n,
|
||||
"Show source client",
|
||||
"Label for Show source client, others settings section"
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
);
|
||||
|
||||
for option in [
|
||||
ShowNoteClientOptions::Hide,
|
||||
ShowNoteClientOptions::Top,
|
||||
ShowNoteClientOptions::Bottom,
|
||||
] {
|
||||
let label = self.get_show_note_client_label(option);
|
||||
|
||||
if ui
|
||||
.selectable_value(
|
||||
self.show_note_client,
|
||||
option,
|
||||
RichText::new(label)
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
)
|
||||
.changed()
|
||||
{
|
||||
action = Some(SettingsAction::SetShowNoteClient(option));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
ui.add_space(10.0);
|
||||
let title = tr!(
|
||||
self.note_context.i18n,
|
||||
"Appearance",
|
||||
"Label for appearance settings section",
|
||||
);
|
||||
settings_group(ui, title, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(richtext_small(tr!(
|
||||
self.note_context.i18n,
|
||||
"Font size:",
|
||||
"Label for font size, Appearance settings section",
|
||||
)));
|
||||
|
||||
if ui
|
||||
.add_sized(
|
||||
[ui.available_width(), 30.0],
|
||||
.add(
|
||||
egui::Slider::new(&mut self.settings.note_body_font_size, 8.0..=32.0)
|
||||
.text(""),
|
||||
)
|
||||
.changed()
|
||||
{
|
||||
action = Some(SettingsAction::SetNoteBodyFontSize(
|
||||
self.settings.note_body_font_size,
|
||||
));
|
||||
};
|
||||
|
||||
if ui
|
||||
.button(richtext_small(tr!(
|
||||
self.note_context.i18n,
|
||||
"Reset",
|
||||
"Label for reset note body font size, Appearance settings section",
|
||||
)))
|
||||
.clicked()
|
||||
{
|
||||
action = Some(SettingsAction::SetNoteBodyFontSize(
|
||||
DEFAULT_NOTE_BODY_FONT_SIZE,
|
||||
));
|
||||
}
|
||||
});
|
||||
|
||||
let txn = Transaction::new(self.note_context.ndb).unwrap();
|
||||
|
||||
if let Some(note_id) = NoteId::from_bech(PREVIEW_NOTE_ID) {
|
||||
if let Ok(preview_note) =
|
||||
self.note_context.ndb.get_note_by_id(&txn, note_id.bytes())
|
||||
{
|
||||
notedeck_ui::padding(8.0, ui, |ui| {
|
||||
if is_narrow(ui.ctx()) {
|
||||
ui.set_max_width(ui.available_width());
|
||||
|
||||
NoteView::new(
|
||||
self.note_context,
|
||||
&preview_note,
|
||||
*self.note_options,
|
||||
self.jobs,
|
||||
)
|
||||
.actionbar(false)
|
||||
.options_button(false)
|
||||
.show(ui);
|
||||
}
|
||||
});
|
||||
ui.separator();
|
||||
}
|
||||
}
|
||||
|
||||
let current_zoom = ui.ctx().zoom_factor();
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(richtext_small(tr!(
|
||||
self.note_context.i18n,
|
||||
"Zoom Level:",
|
||||
"Label for zoom level, Appearance settings section",
|
||||
)));
|
||||
|
||||
let min_reached = current_zoom <= MIN_ZOOM;
|
||||
let max_reached = current_zoom >= MAX_ZOOM;
|
||||
|
||||
if ui
|
||||
.add_enabled(
|
||||
!min_reached,
|
||||
Button::new(
|
||||
RichText::new(tr!(
|
||||
self.i18n,
|
||||
"Configure relays",
|
||||
"Label for configure relays, settings section"
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
RichText::new("-").text_style(NotedeckTextStyle::Small.text_style()),
|
||||
),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
action = Some(SettingsAction::OpenRelays);
|
||||
let new_zoom = (current_zoom - ZOOM_STEP).max(MIN_ZOOM);
|
||||
action = Some(SettingsAction::SetZoomFactor(new_zoom));
|
||||
};
|
||||
|
||||
ui.label(
|
||||
RichText::new(format!("{:.0}%", current_zoom * 100.0))
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
);
|
||||
|
||||
if ui
|
||||
.add_enabled(
|
||||
!max_reached,
|
||||
Button::new(
|
||||
RichText::new("+").text_style(NotedeckTextStyle::Small.text_style()),
|
||||
),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
let new_zoom = (current_zoom + ZOOM_STEP).min(MAX_ZOOM);
|
||||
action = Some(SettingsAction::SetZoomFactor(new_zoom));
|
||||
};
|
||||
|
||||
if ui
|
||||
.button(richtext_small(tr!(
|
||||
self.note_context.i18n,
|
||||
"Reset",
|
||||
"Label for reset zoom level, Appearance settings section",
|
||||
)))
|
||||
.clicked()
|
||||
{
|
||||
action = Some(SettingsAction::SetZoomFactor(RESET_ZOOM));
|
||||
}
|
||||
});
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(richtext_small(tr!(
|
||||
self.note_context.i18n,
|
||||
"Language:",
|
||||
"Label for language, Appearance settings section",
|
||||
)));
|
||||
|
||||
//
|
||||
ComboBox::from_label("")
|
||||
.selected_text(self.get_selected_language_name())
|
||||
.show_ui(ui, |ui| {
|
||||
for lang in self.note_context.i18n.get_available_locales() {
|
||||
let name = self
|
||||
.note_context
|
||||
.i18n
|
||||
.get_locale_native_name(lang)
|
||||
.map(|s| s.to_owned())
|
||||
.unwrap_or_else(|| lang.to_string());
|
||||
if ui
|
||||
.selectable_value(&mut self.settings.locale, lang.to_string(), name)
|
||||
.clicked()
|
||||
{
|
||||
action = Some(SettingsAction::SetLocale(lang.to_owned()))
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(richtext_small(tr!(
|
||||
self.note_context.i18n,
|
||||
"Theme:",
|
||||
"Label for theme, Appearance settings section",
|
||||
)));
|
||||
|
||||
if ui
|
||||
.selectable_value(
|
||||
&mut self.settings.theme,
|
||||
ThemePreference::Light,
|
||||
richtext_small(tr!(
|
||||
self.note_context.i18n,
|
||||
"Light",
|
||||
"Label for Theme Light, Appearance settings section",
|
||||
)),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
action = Some(SettingsAction::SetTheme(ThemePreference::Light));
|
||||
}
|
||||
|
||||
if ui
|
||||
.selectable_value(
|
||||
&mut self.settings.theme,
|
||||
ThemePreference::Dark,
|
||||
richtext_small(tr!(
|
||||
self.note_context.i18n,
|
||||
"Dark",
|
||||
"Label for Theme Dark, Appearance settings section",
|
||||
)),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
action = Some(SettingsAction::SetTheme(ThemePreference::Dark));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
action
|
||||
}
|
||||
|
||||
pub fn storage_section(&mut self, ui: &mut egui::Ui) -> Option<SettingsAction> {
|
||||
let id = ui.id();
|
||||
let mut action: Option<SettingsAction> = None;
|
||||
let title = tr!(
|
||||
self.note_context.i18n,
|
||||
"Storage",
|
||||
"Label for storage settings section"
|
||||
);
|
||||
settings_group(ui, title, |ui| {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
let static_imgs_size = self
|
||||
.note_context
|
||||
.img_cache
|
||||
.static_imgs
|
||||
.cache_size
|
||||
.lock()
|
||||
.unwrap();
|
||||
|
||||
let gifs_size = self.note_context.img_cache.gifs.cache_size.lock().unwrap();
|
||||
|
||||
ui.label(
|
||||
RichText::new(format!(
|
||||
"{} {}",
|
||||
tr!(
|
||||
self.note_context.i18n,
|
||||
"Image cache size:",
|
||||
"Label for Image cache size, Storage settings section"
|
||||
),
|
||||
format_size(
|
||||
[static_imgs_size, gifs_size]
|
||||
.iter()
|
||||
.fold(0_u64, |acc, cur| acc + cur.unwrap_or_default())
|
||||
)
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
);
|
||||
|
||||
ui.end_row();
|
||||
|
||||
if !notedeck::ui::is_compiled_as_mobile()
|
||||
&& ui
|
||||
.button(richtext_small(tr!(
|
||||
self.note_context.i18n,
|
||||
"View folder",
|
||||
"Label for view folder button, Storage settings section",
|
||||
)))
|
||||
.clicked()
|
||||
{
|
||||
action = Some(SettingsAction::OpenCacheFolder);
|
||||
}
|
||||
|
||||
let clearcache_resp = ui.button(
|
||||
richtext_small(tr!(
|
||||
self.note_context.i18n,
|
||||
"Clear cache",
|
||||
"Label for clear cache button, Storage settings section",
|
||||
))
|
||||
.color(Color32::LIGHT_RED),
|
||||
);
|
||||
|
||||
let id_clearcache = id.with("clear_cache");
|
||||
if clearcache_resp.clicked() {
|
||||
ui.data_mut(|d| d.insert_temp(id_clearcache, true));
|
||||
}
|
||||
|
||||
if ui.data_mut(|d| *d.get_temp_mut_or_default(id_clearcache)) {
|
||||
let mut confirm_pressed = false;
|
||||
clearcache_resp.show_tooltip_ui(|ui| {
|
||||
let confirm_resp = ui.button(tr!(
|
||||
self.note_context.i18n,
|
||||
"Confirm",
|
||||
"Label for confirm clear cache, Storage settings section"
|
||||
));
|
||||
if confirm_resp.clicked() {
|
||||
confirm_pressed = true;
|
||||
}
|
||||
|
||||
if confirm_resp.clicked()
|
||||
|| ui
|
||||
.button(tr!(
|
||||
self.note_context.i18n,
|
||||
"Cancel",
|
||||
"Label for cancel clear cache, Storage settings section"
|
||||
))
|
||||
.clicked()
|
||||
{
|
||||
ui.data_mut(|d| d.insert_temp(id_clearcache, false));
|
||||
}
|
||||
});
|
||||
|
||||
if confirm_pressed {
|
||||
action = Some(SettingsAction::ClearCacheFolder);
|
||||
} else if !confirm_pressed && clearcache_resp.clicked_elsewhere() {
|
||||
ui.data_mut(|d| d.insert_temp(id_clearcache, false));
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
action
|
||||
}
|
||||
|
||||
fn other_options_section(&mut self, ui: &mut egui::Ui) -> Option<SettingsAction> {
|
||||
let mut action = None;
|
||||
|
||||
let title = tr!(
|
||||
self.note_context.i18n,
|
||||
"Others",
|
||||
"Label for others settings section"
|
||||
);
|
||||
settings_group(ui, title, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(richtext_small(tr!(
|
||||
self.note_context.i18n,
|
||||
"Sort replies newest first:",
|
||||
"Label for Sort replies newest first, others settings section",
|
||||
)));
|
||||
|
||||
if ui
|
||||
.toggle_value(
|
||||
&mut self.settings.show_replies_newest_first,
|
||||
RichText::new(tr!(
|
||||
self.note_context.i18n,
|
||||
"On",
|
||||
"Setting to turn on sorting replies so that the newest are shown first"
|
||||
))
|
||||
.text_style(NotedeckTextStyle::Small.text_style()),
|
||||
)
|
||||
.changed()
|
||||
{
|
||||
action = Some(SettingsAction::SetRepliestNewestFirst(
|
||||
self.settings.show_replies_newest_first,
|
||||
));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
action
|
||||
}
|
||||
|
||||
fn manage_relays_section(&mut self, ui: &mut egui::Ui) -> Option<SettingsAction> {
|
||||
let mut action = None;
|
||||
|
||||
if ui
|
||||
.add_sized(
|
||||
[ui.available_width(), 30.0],
|
||||
Button::new(richtext_small(tr!(
|
||||
self.note_context.i18n,
|
||||
"Configure relays",
|
||||
"Label for configure relays, settings section",
|
||||
))),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
action = Some(SettingsAction::OpenRelays);
|
||||
}
|
||||
|
||||
action
|
||||
}
|
||||
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui) -> Option<SettingsAction> {
|
||||
let mut action: Option<SettingsAction> = None;
|
||||
|
||||
Frame::default()
|
||||
.inner_margin(Margin::symmetric(10, 10))
|
||||
.show(ui, |ui| {
|
||||
ScrollArea::vertical().show(ui, |ui| {
|
||||
if let Some(new_action) = self.appearance_section(ui) {
|
||||
action = Some(new_action);
|
||||
}
|
||||
|
||||
ui.add_space(5.0);
|
||||
|
||||
if let Some(new_action) = self.storage_section(ui) {
|
||||
action = Some(new_action);
|
||||
}
|
||||
|
||||
ui.add_space(5.0);
|
||||
|
||||
if let Some(new_action) = self.other_options_section(ui) {
|
||||
action = Some(new_action);
|
||||
}
|
||||
|
||||
ui.add_space(10.0);
|
||||
|
||||
if let Some(new_action) = self.manage_relays_section(ui) {
|
||||
action = Some(new_action);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
action
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use crate::support::{Support, SUPPORT_EMAIL};
|
||||
use egui::{vec2, Button, Label, Layout, RichText};
|
||||
use notedeck::{tr, Localization, NamedFontFamily, NotedeckTextStyle};
|
||||
use notedeck_ui::{colors::PINK, padding};
|
||||
use robius_open::Uri;
|
||||
use tracing::error;
|
||||
|
||||
use crate::support::Support;
|
||||
|
||||
pub struct SupportView<'a> {
|
||||
support: &'a mut Support,
|
||||
i18n: &'a mut Localization,
|
||||
@@ -44,15 +44,21 @@ impl<'a> SupportView<'a> {
|
||||
"Open your default email client to get help from the Damus team",
|
||||
"Instruction to open email client"
|
||||
));
|
||||
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.label(tr!(self.i18n, "Support email:", "Support email address",));
|
||||
ui.label(RichText::new(SUPPORT_EMAIL).color(PINK))
|
||||
});
|
||||
|
||||
let size = vec2(120.0, 40.0);
|
||||
ui.allocate_ui_with_layout(size, Layout::top_down(egui::Align::Center), |ui| {
|
||||
let font_size =
|
||||
notedeck::fonts::get_font_size(ui.ctx(), &NotedeckTextStyle::Body);
|
||||
let button_resp = ui.add(open_email_button(self.i18n, font_size, size));
|
||||
if button_resp.clicked() {
|
||||
if let Err(e) = open::that(self.support.get_mailto_url()) {
|
||||
if let Err(e) = Uri::new(self.support.get_mailto_url()).open() {
|
||||
error!(
|
||||
"Failed to open URL {} because: {}",
|
||||
"Failed to open URL {} because: {:?}",
|
||||
self.support.get_mailto_url(),
|
||||
e
|
||||
);
|
||||
|
||||
@@ -2,8 +2,8 @@ use egui::InnerResponse;
|
||||
use egui_virtual_list::VirtualList;
|
||||
use nostrdb::{Note, Transaction};
|
||||
use notedeck::note::root_note_id_from_selected_id;
|
||||
use notedeck::JobsCache;
|
||||
use notedeck::{NoteAction, NoteContext};
|
||||
use notedeck_ui::jobs::JobsCache;
|
||||
use notedeck_ui::note::NoteResponse;
|
||||
use notedeck_ui::{NoteOptions, NoteView};
|
||||
|
||||
@@ -52,17 +52,26 @@ impl<'a, 'd> ThreadView<'a, 'd> {
|
||||
.auto_shrink([false, false])
|
||||
.scroll_bar_visibility(egui::scroll_area::ScrollBarVisibility::AlwaysVisible);
|
||||
|
||||
let offset_id = scroll_id.with(("scroll_offset", self.selected_note_id));
|
||||
|
||||
if let Some(offset) = ui.data(|i| i.get_temp::<f32>(offset_id)) {
|
||||
scroll_area = scroll_area.vertical_scroll_offset(offset);
|
||||
if let Some(thread) = self.threads.threads.get_mut(&self.selected_note_id) {
|
||||
if let Some(new_offset) = thread.set_scroll_offset.take() {
|
||||
scroll_area = scroll_area.vertical_scroll_offset(new_offset);
|
||||
}
|
||||
}
|
||||
|
||||
let output = scroll_area.show(ui, |ui| self.notes(ui, &txn));
|
||||
|
||||
ui.data_mut(|d| d.insert_temp(offset_id, output.state.offset.y));
|
||||
let mut resp = output.inner;
|
||||
|
||||
output.inner
|
||||
if let Some(NoteAction::Note {
|
||||
note_id: _,
|
||||
preview: _,
|
||||
scroll_offset,
|
||||
}) = &mut resp
|
||||
{
|
||||
*scroll_offset = output.state.offset.y;
|
||||
}
|
||||
|
||||
resp
|
||||
}
|
||||
|
||||
fn notes(&mut self, ui: &mut egui::Ui, txn: &Transaction) -> Option<NoteAction> {
|
||||
@@ -115,7 +124,10 @@ impl<'a, 'd> ThreadView<'a, 'd> {
|
||||
.unwrap()
|
||||
.list;
|
||||
|
||||
let notes = note_builder.into_notes(&mut self.threads.seen_flags);
|
||||
let notes = note_builder.into_notes(
|
||||
self.note_options.contains(NoteOptions::RepliesNewestFirst),
|
||||
&mut self.threads.seen_flags,
|
||||
);
|
||||
|
||||
if !full_chain {
|
||||
// TODO(kernelkind): insert UI denoting we don't have the full chain yet
|
||||
@@ -192,6 +204,7 @@ fn strip_note_action(action: NoteAction) -> Option<NoteAction> {
|
||||
NoteAction::Note {
|
||||
note_id: _,
|
||||
preview: false,
|
||||
scroll_offset: _,
|
||||
}
|
||||
) {
|
||||
return None;
|
||||
@@ -223,7 +236,11 @@ impl<'a> ThreadNoteBuilder<'a> {
|
||||
self.replies.push(note);
|
||||
}
|
||||
|
||||
pub fn into_notes(mut self, seen_flags: &mut NoteSeenFlags) -> ThreadNotes<'a> {
|
||||
pub fn into_notes(
|
||||
mut self,
|
||||
replies_newer_first: bool,
|
||||
seen_flags: &mut NoteSeenFlags,
|
||||
) -> ThreadNotes<'a> {
|
||||
let mut notes = Vec::new();
|
||||
|
||||
let selected_is_root = self.chain.is_empty();
|
||||
@@ -246,6 +263,11 @@ impl<'a> ThreadNoteBuilder<'a> {
|
||||
unread_and_have_replies: false,
|
||||
});
|
||||
|
||||
if replies_newer_first {
|
||||
self.replies
|
||||
.sort_by_key(|b| std::cmp::Reverse(b.created_at()));
|
||||
}
|
||||
|
||||
for reply in self.replies {
|
||||
notes.push(ThreadNote {
|
||||
unread_and_have_replies: *seen_flags.get(reply.id()).unwrap_or(&false),
|
||||
@@ -267,6 +289,12 @@ enum ThreadNoteType {
|
||||
Reply,
|
||||
}
|
||||
|
||||
impl ThreadNoteType {
|
||||
fn is_selected(&self) -> bool {
|
||||
matches!(self, ThreadNoteType::Selected { .. })
|
||||
}
|
||||
}
|
||||
|
||||
struct ThreadNotes<'a> {
|
||||
notes: Vec<ThreadNote<'a>>,
|
||||
selected_index: usize,
|
||||
@@ -285,6 +313,7 @@ impl<'a> ThreadNote<'a> {
|
||||
ThreadNoteType::Selected { root: _ } => {
|
||||
cur_options.set(NoteOptions::Wide, true);
|
||||
cur_options.set(NoteOptions::SelectableText, true);
|
||||
cur_options.set(NoteOptions::FullCreatedDate, true);
|
||||
cur_options
|
||||
}
|
||||
ThreadNoteType::Reply => cur_options,
|
||||
@@ -300,6 +329,7 @@ impl<'a> ThreadNote<'a> {
|
||||
) -> NoteResponse {
|
||||
let inner = notedeck_ui::padding(8.0, ui, |ui| {
|
||||
NoteView::new(note_context, &self.note, self.options(flags), jobs)
|
||||
.selected_style(self.note_type.is_selected())
|
||||
.unread_indicator(self.unread_and_have_replies)
|
||||
.show(ui)
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ use egui::{vec2, Direction, Layout, Pos2, Stroke};
|
||||
use egui_tabs::TabColor;
|
||||
use nostrdb::Transaction;
|
||||
use notedeck::ui::is_narrow;
|
||||
use notedeck_ui::jobs::JobsCache;
|
||||
use notedeck::JobsCache;
|
||||
use std::f32::consts::PI;
|
||||
use tracing::{error, warn};
|
||||
|
||||
|
||||
@@ -6,8 +6,12 @@ use crate::deck_state::DeckState;
|
||||
use crate::login_manager::AcquireKeyState;
|
||||
use crate::ui::search::SearchQueryState;
|
||||
use enostr::ProfileState;
|
||||
use notedeck_ui::media::MediaViewerState;
|
||||
|
||||
/// Various state for views
|
||||
///
|
||||
/// TODO(jb55): we likely want to encapsulate these better,
|
||||
/// or at least document where they are used
|
||||
#[derive(Default)]
|
||||
pub struct ViewState {
|
||||
pub login: AcquireKeyState,
|
||||
@@ -16,6 +20,11 @@ pub struct ViewState {
|
||||
pub id_string_map: HashMap<egui::Id, String>,
|
||||
pub searches: HashMap<egui::Id, SearchQueryState>,
|
||||
pub pubkey_to_profile_state: HashMap<Pubkey, ProfileState>,
|
||||
|
||||
/// Keeps track of what urls we are actively viewing in the
|
||||
/// fullscreen media viewier, as well as any other state we want to
|
||||
/// keep track of
|
||||
pub media_viewer: MediaViewerState,
|
||||
}
|
||||
|
||||
impl ViewState {
|
||||
|
||||
@@ -18,8 +18,9 @@ serde_json = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
nostrdb = { workspace = true }
|
||||
hex = { workspace = true }
|
||||
chrono = "0.4.40"
|
||||
chrono = { workspace = true }
|
||||
rand = "0.9.0"
|
||||
bytemuck = "1.22.0"
|
||||
futures = "0.3.31"
|
||||
#reqwest = "0.12.15"
|
||||
egui_extras = { workspace = true }
|
||||
|
||||
+139
-155
@@ -1,13 +1,19 @@
|
||||
use std::num::NonZeroU64;
|
||||
|
||||
use crate::mesh;
|
||||
use crate::{Quaternion, Vec3};
|
||||
use eframe::egui_wgpu::{self, wgpu};
|
||||
use eframe::egui_wgpu::{
|
||||
self,
|
||||
wgpu::{self, util::DeviceExt},
|
||||
};
|
||||
use egui::{Rect, Response};
|
||||
use rand::Rng;
|
||||
use std::borrow::Cow;
|
||||
|
||||
pub struct DaveAvatar {
|
||||
rotation: Quaternion,
|
||||
rot_dir: Vec3,
|
||||
logical_time: f32,
|
||||
}
|
||||
|
||||
// Matrix utilities for perspective projection
|
||||
@@ -53,141 +59,75 @@ fn matrix_multiply(a: &[f32; 16], b: &[f32; 16]) -> [f32; 16] {
|
||||
result
|
||||
}
|
||||
|
||||
fn lerp3(a: [f32; 3], b: [f32; 3], t: f32) -> [f32; 3] {
|
||||
[
|
||||
a[0] + (b[0] - a[0]) * t,
|
||||
a[1] + (b[1] - a[1]) * t,
|
||||
a[2] + (b[2] - a[2]) * t,
|
||||
]
|
||||
}
|
||||
|
||||
fn generate_dave_instances(instance_count: u32) -> Vec<mesh::Instance> {
|
||||
let mut rng = rand::rng();
|
||||
let mut instances = Vec::with_capacity(instance_count as usize);
|
||||
|
||||
// Logo gradient endpoints (0–1 range)
|
||||
const C0: [f32; 3] = [53.0 / 255.0, 77.0 / 255.0, 235.0 / 255.0]; // rgb(53, 77, 235)
|
||||
const C1: [f32; 3] = [229.0 / 255.0, 20.0 / 255.0, 205.0 / 255.0]; // rgb(229, 20, 205)
|
||||
let golden_angle = std::f32::consts::PI * (3.0 - 5.0_f32.sqrt());
|
||||
|
||||
for i in 0..instance_count {
|
||||
let i_f = (i as f32) + 0.5;
|
||||
let n = instance_count as f32;
|
||||
|
||||
// Fibonacci sphere (unit directions)
|
||||
let z = 1.0 - (2.0 * i_f) / n;
|
||||
let r = (1.0 - z * z).sqrt();
|
||||
let theta = golden_angle * i_f;
|
||||
|
||||
// Use base_pos as *direction*; shader will normalize/scale anyway
|
||||
let base_pos = [r * theta.cos(), z, r * theta.sin()];
|
||||
|
||||
let scale = 0.03;
|
||||
|
||||
//let scale = scale + scale_var + rng.random::<f32>() * scale; // slightly smaller cubes
|
||||
let seed = rng.random::<f32>() * 1000.0;
|
||||
|
||||
// damus logo gradient
|
||||
let t_base = (z + 1.0) * 0.5; // 0..1
|
||||
let t_jitter = (rng.random::<f32>() - 0.5) * 0.06; // ±0.03
|
||||
let t = (t_base + t_jitter).clamp(0.0, 1.0);
|
||||
let color = lerp3(C0, C1, t);
|
||||
|
||||
instances.push(mesh::Instance {
|
||||
base_pos,
|
||||
scale,
|
||||
seed,
|
||||
color,
|
||||
});
|
||||
}
|
||||
|
||||
instances
|
||||
}
|
||||
|
||||
impl DaveAvatar {
|
||||
pub fn new(wgpu_render_state: &egui_wgpu::RenderState) -> Self {
|
||||
const BINDING_SIZE: u64 = 256;
|
||||
|
||||
let device = &wgpu_render_state.device;
|
||||
let instance_count: u32 = 256;
|
||||
let instances = generate_dave_instances(instance_count);
|
||||
|
||||
// Create shader module with improved shader code
|
||||
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {
|
||||
label: Some("cube_shader"),
|
||||
source: wgpu::ShaderSource::Wgsl(
|
||||
r#"
|
||||
struct Uniforms {
|
||||
model_view_proj: mat4x4<f32>,
|
||||
model: mat4x4<f32>, // Added model matrix for correct normal transformation
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
var<uniform> uniforms: Uniforms;
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position) position: vec4<f32>,
|
||||
@location(0) normal: vec3<f32>,
|
||||
@location(1) world_pos: vec3<f32>,
|
||||
};
|
||||
|
||||
@vertex
|
||||
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
|
||||
// Define cube vertices (-0.5 to 0.5 in each dimension)
|
||||
var positions = array<vec3<f32>, 8>(
|
||||
vec3<f32>(-0.5, -0.5, -0.5), // 0: left bottom back
|
||||
vec3<f32>(0.5, -0.5, -0.5), // 1: right bottom back
|
||||
vec3<f32>(-0.5, 0.5, -0.5), // 2: left top back
|
||||
vec3<f32>(0.5, 0.5, -0.5), // 3: right top back
|
||||
vec3<f32>(-0.5, -0.5, 0.5), // 4: left bottom front
|
||||
vec3<f32>(0.5, -0.5, 0.5), // 5: right bottom front
|
||||
vec3<f32>(-0.5, 0.5, 0.5), // 6: left top front
|
||||
vec3<f32>(0.5, 0.5, 0.5) // 7: right top front
|
||||
);
|
||||
|
||||
// Define indices for the 12 triangles (6 faces * 2 triangles)
|
||||
var indices = array<u32, 36>(
|
||||
// back face (Z-)
|
||||
0, 2, 1, 1, 2, 3,
|
||||
// front face (Z+)
|
||||
4, 5, 6, 5, 7, 6,
|
||||
// left face (X-)
|
||||
0, 4, 2, 2, 4, 6,
|
||||
// right face (X+)
|
||||
1, 3, 5, 3, 7, 5,
|
||||
// bottom face (Y-)
|
||||
0, 1, 4, 1, 5, 4,
|
||||
// top face (Y+)
|
||||
2, 6, 3, 3, 6, 7
|
||||
);
|
||||
|
||||
// Define normals for each face
|
||||
var face_normals = array<vec3<f32>, 6>(
|
||||
vec3<f32>(0.0, 0.0, -1.0), // back face (Z-)
|
||||
vec3<f32>(0.0, 0.0, 1.0), // front face (Z+)
|
||||
vec3<f32>(-1.0, 0.0, 0.0), // left face (X-)
|
||||
vec3<f32>(1.0, 0.0, 0.0), // right face (X+)
|
||||
vec3<f32>(0.0, -1.0, 0.0), // bottom face (Y-)
|
||||
vec3<f32>(0.0, 1.0, 0.0) // top face (Y+)
|
||||
);
|
||||
|
||||
var output: VertexOutput;
|
||||
|
||||
// Get vertex from indices
|
||||
let index = indices[vertex_index];
|
||||
let position = positions[index];
|
||||
|
||||
// Determine which face this vertex belongs to
|
||||
let face_index = vertex_index / 6u;
|
||||
|
||||
// Apply transformations
|
||||
output.position = uniforms.model_view_proj * vec4<f32>(position, 1.0);
|
||||
|
||||
// Transform normal to world space
|
||||
// Extract the 3x3 rotation part from the 4x4 model matrix
|
||||
let normal_matrix = mat3x3<f32>(
|
||||
uniforms.model[0].xyz,
|
||||
uniforms.model[1].xyz,
|
||||
uniforms.model[2].xyz
|
||||
);
|
||||
output.normal = normalize(normal_matrix * face_normals[face_index]);
|
||||
|
||||
// Pass world position for lighting calculations
|
||||
output.world_pos = (uniforms.model * vec4<f32>(position, 1.0)).xyz;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
// Material properties
|
||||
let material_color = vec3<f32>(1.0, 1.0, 1.0); // White color
|
||||
let ambient_strength = 0.2;
|
||||
let diffuse_strength = 0.7;
|
||||
let specular_strength = 0.2;
|
||||
let shininess = 20.0;
|
||||
|
||||
// Light properties
|
||||
let light_pos = vec3<f32>(2.0, 2.0, 2.0); // Light positioned diagonally above and to the right
|
||||
let light_color = vec3<f32>(1.0, 1.0, 1.0); // White light
|
||||
|
||||
// View position (camera)
|
||||
let view_pos = vec3<f32>(0.0, 0.0, 3.0); // Camera position
|
||||
|
||||
// Calculate ambient lighting
|
||||
let ambient = ambient_strength * light_color;
|
||||
|
||||
// Calculate diffuse lighting
|
||||
let normal = normalize(in.normal); // Renormalize the interpolated normal
|
||||
let light_dir = normalize(light_pos - in.world_pos);
|
||||
let diff = max(dot(normal, light_dir), 0.0);
|
||||
let diffuse = diffuse_strength * diff * light_color;
|
||||
|
||||
// Calculate specular lighting
|
||||
let view_dir = normalize(view_pos - in.world_pos);
|
||||
let reflect_dir = reflect(-light_dir, normal);
|
||||
let spec = pow(max(dot(view_dir, reflect_dir), 0.0), shininess);
|
||||
let specular = specular_strength * spec * light_color;
|
||||
|
||||
// Combine lighting components
|
||||
let result = (ambient + diffuse + specular) * material_color;
|
||||
|
||||
return vec4<f32>(result, 1.0);
|
||||
}
|
||||
"#
|
||||
.into(),
|
||||
),
|
||||
source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("dave.wgsl"))),
|
||||
});
|
||||
|
||||
// Create uniform buffer for MVP matrix and model matrix
|
||||
let uniform_buffer = device.create_buffer(&wgpu::BufferDescriptor {
|
||||
label: Some("cube_uniform_buffer"),
|
||||
size: 128, // Two 4x4 matrices of f32 (2 * 16 * 4 bytes)
|
||||
size: BINDING_SIZE, // Two 4x4 matrices of f32 (2 * 16 * 4 bytes)
|
||||
usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
|
||||
mapped_at_creation: false,
|
||||
});
|
||||
@@ -197,11 +137,11 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
label: Some("cube_bind_group_layout"),
|
||||
entries: &[wgpu::BindGroupLayoutEntry {
|
||||
binding: 0,
|
||||
visibility: wgpu::ShaderStages::VERTEX,
|
||||
visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
|
||||
ty: wgpu::BindingType::Buffer {
|
||||
ty: wgpu::BufferBindingType::Uniform,
|
||||
has_dynamic_offset: false,
|
||||
min_binding_size: NonZeroU64::new(128),
|
||||
min_binding_size: NonZeroU64::new(BINDING_SIZE),
|
||||
},
|
||||
count: None,
|
||||
}],
|
||||
@@ -224,6 +164,24 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
|
||||
let vertex_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
label: Some("cube_vertices"),
|
||||
contents: bytemuck::cast_slice(&mesh::CUBE_VERTICES),
|
||||
usage: wgpu::BufferUsages::VERTEX,
|
||||
});
|
||||
|
||||
let instance_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
label: Some("cube_instances"),
|
||||
contents: bytemuck::cast_slice(&instances),
|
||||
usage: wgpu::BufferUsages::VERTEX | wgpu::BufferUsages::COPY_DST,
|
||||
});
|
||||
|
||||
let index_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
label: Some("cube_indices"),
|
||||
contents: bytemuck::cast_slice(&mesh::CUBE_INDICES),
|
||||
usage: wgpu::BufferUsages::INDEX,
|
||||
});
|
||||
|
||||
// Create render pipeline
|
||||
let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("cube_pipeline"),
|
||||
@@ -231,7 +189,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
vertex: wgpu::VertexState {
|
||||
module: &shader,
|
||||
entry_point: Some("vs_main"),
|
||||
buffers: &[], // No vertex buffer - vertices are in the shader
|
||||
buffers: &[mesh::Vertex::LAYOUT, mesh::Instance::LAYOUT],
|
||||
compilation_options: wgpu::PipelineCompilationOptions::default(),
|
||||
},
|
||||
fragment: Some(wgpu::FragmentState {
|
||||
@@ -274,6 +232,10 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
pipeline,
|
||||
bind_group,
|
||||
uniform_buffer,
|
||||
instance_buffer,
|
||||
vertex_buffer,
|
||||
index_buffer,
|
||||
instance_count,
|
||||
});
|
||||
|
||||
let initial_rot = {
|
||||
@@ -283,7 +245,9 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
// Apply rotations (order matters)
|
||||
y_rotation.multiply(&x_rotation)
|
||||
};
|
||||
|
||||
Self {
|
||||
logical_time: 0.0,
|
||||
rotation: initial_rot,
|
||||
rot_dir: Vec3::new(0.0, 0.0, 0.0),
|
||||
}
|
||||
@@ -364,7 +328,7 @@ impl DaveAvatar {
|
||||
}
|
||||
|
||||
// Create model matrix from rotation quaternion
|
||||
let model_matrix = self.rotation.to_matrix4();
|
||||
let model = self.rotation.to_matrix4();
|
||||
|
||||
// Create projection matrix with proper depth range
|
||||
// Adjust aspect ratio based on rect dimensions
|
||||
@@ -372,20 +336,37 @@ impl DaveAvatar {
|
||||
let projection = perspective_matrix(std::f32::consts::PI / 4.0, aspect, 0.1, 100.0);
|
||||
|
||||
// Create view matrix (move camera back a bit)
|
||||
let view_matrix = [
|
||||
1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, -3.0, 1.0,
|
||||
let camera_pos = [0.0, 0.0, 1.5];
|
||||
|
||||
// Right-handed look-at at origin; view is a translate by -camera_pos
|
||||
let [cx, cy, cz] = camera_pos;
|
||||
|
||||
#[rustfmt::skip]
|
||||
let view = [
|
||||
1.0, 0.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0, 0.0,
|
||||
0.0, 0.0, 1.0, 0.0,
|
||||
-cx, -cy, -cz, 1.0,
|
||||
];
|
||||
|
||||
// Combine matrices: projection * view * model
|
||||
let mv_matrix = matrix_multiply(&view_matrix, &model_matrix);
|
||||
let mvp_matrix = matrix_multiply(&projection, &mv_matrix);
|
||||
let view_proj = matrix_multiply(&projection, &view);
|
||||
let is_light = if ui.ctx().theme() == egui::Theme::Light {
|
||||
1.0
|
||||
} else {
|
||||
-1.0
|
||||
};
|
||||
|
||||
self.logical_time += ui.ctx().input(|i| i.stable_dt.min(0.1));
|
||||
|
||||
// Add paint callback
|
||||
ui.painter().add(egui_wgpu::Callback::new_paint_callback(
|
||||
rect,
|
||||
CubeCallback {
|
||||
mvp_matrix,
|
||||
model_matrix,
|
||||
GpuData {
|
||||
view_proj,
|
||||
model,
|
||||
camera_pos,
|
||||
time: self.logical_time,
|
||||
is_light: [is_light, 0.0, 0.0, 0.0],
|
||||
},
|
||||
));
|
||||
|
||||
@@ -394,12 +375,17 @@ impl DaveAvatar {
|
||||
}
|
||||
|
||||
// Callback implementation
|
||||
struct CubeCallback {
|
||||
mvp_matrix: [f32; 16], // Model-View-Projection matrix
|
||||
model_matrix: [f32; 16], // Model matrix for lighting calculations
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
|
||||
struct GpuData {
|
||||
view_proj: [f32; 16], // Model-View-Projection matrix
|
||||
model: [f32; 16], // Model matrix for lighting calculations
|
||||
camera_pos: [f32; 3], // xyz
|
||||
time: f32,
|
||||
is_light: [f32; 4],
|
||||
}
|
||||
|
||||
impl egui_wgpu::CallbackTrait for CubeCallback {
|
||||
impl egui_wgpu::CallbackTrait for GpuData {
|
||||
fn prepare(
|
||||
&self,
|
||||
_device: &wgpu::Device,
|
||||
@@ -410,21 +396,8 @@ impl egui_wgpu::CallbackTrait for CubeCallback {
|
||||
) -> Vec<wgpu::CommandBuffer> {
|
||||
let resources: &CubeRenderResources = resources.get().unwrap();
|
||||
|
||||
// Create a combined uniform buffer with both matrices
|
||||
let mut uniform_data = [0.0f32; 32]; // Space for two 4x4 matrices
|
||||
|
||||
// Copy MVP matrix to first 16 floats
|
||||
uniform_data[0..16].copy_from_slice(&self.mvp_matrix);
|
||||
|
||||
// Copy model matrix to next 16 floats
|
||||
uniform_data[16..32].copy_from_slice(&self.model_matrix);
|
||||
|
||||
// Update uniform buffer with both matrices
|
||||
queue.write_buffer(
|
||||
&resources.uniform_buffer,
|
||||
0,
|
||||
bytemuck::cast_slice(&uniform_data),
|
||||
);
|
||||
queue.write_buffer(&resources.uniform_buffer, 0, bytemuck::bytes_of(self));
|
||||
|
||||
Vec::new()
|
||||
}
|
||||
@@ -439,7 +412,14 @@ impl egui_wgpu::CallbackTrait for CubeCallback {
|
||||
|
||||
render_pass.set_pipeline(&resources.pipeline);
|
||||
render_pass.set_bind_group(0, &resources.bind_group, &[]);
|
||||
render_pass.draw(0..36, 0..1); // 36 vertices for a cube (6 faces * 2 triangles * 3 vertices)
|
||||
render_pass.set_vertex_buffer(0, resources.vertex_buffer.slice(..));
|
||||
render_pass.set_vertex_buffer(1, resources.instance_buffer.slice(..));
|
||||
render_pass.set_index_buffer(resources.index_buffer.slice(..), wgpu::IndexFormat::Uint16);
|
||||
render_pass.draw_indexed(
|
||||
0..mesh::CUBE_INDICES.len() as u32,
|
||||
0,
|
||||
0..resources.instance_count,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,4 +428,8 @@ struct CubeRenderResources {
|
||||
pipeline: wgpu::RenderPipeline,
|
||||
bind_group: wgpu::BindGroup,
|
||||
uniform_buffer: wgpu::Buffer,
|
||||
instance_buffer: wgpu::Buffer,
|
||||
vertex_buffer: wgpu::Buffer,
|
||||
index_buffer: wgpu::Buffer,
|
||||
instance_count: u32,
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
struct Uniforms {
|
||||
view_proj: mat4x4<f32>,
|
||||
model: mat4x4<f32>,
|
||||
camera_pos: vec3<f32>,
|
||||
time: f32,
|
||||
is_light: vec4<f32>,
|
||||
};
|
||||
|
||||
@group(0) @binding(0)
|
||||
var<uniform> uniforms: Uniforms;
|
||||
|
||||
struct VSOut {
|
||||
@builtin(position) position: vec4<f32>,
|
||||
@location(0) normal: vec3<f32>,
|
||||
@location(1) world_pos: vec3<f32>,
|
||||
@location(2) color: vec3<f32>,
|
||||
};
|
||||
|
||||
// Vertex inputs
|
||||
@vertex
|
||||
fn vs_main(
|
||||
@location(0) in_pos: vec3<f32>,
|
||||
@location(1) in_normal: vec3<f32>,
|
||||
@location(2) base_pos: vec3<f32>,
|
||||
@location(3) scale: f32,
|
||||
@location(4) seed: f32,
|
||||
@location(5) color: vec3<f32>,
|
||||
) -> VSOut {
|
||||
var out: VSOut;
|
||||
|
||||
let t = uniforms.time;
|
||||
|
||||
// --- Coherent spherical layout ---
|
||||
let dir = normalize(base_pos + vec3<f32>(1e-6, 0.0, 0.0)); // avoid NaN if zero
|
||||
let radius = 0.4;
|
||||
|
||||
// Gentle, coherent drift so it breathes
|
||||
let drift = vec3<f32>(
|
||||
0.06 * sin(0.9 * t + seed * 1.3),
|
||||
0.05 * sin(1.1 * t + seed * 2.1),
|
||||
0.06 * cos(0.7 * t + seed * 0.7)
|
||||
);
|
||||
|
||||
// Final instance position on/near the sphere
|
||||
//let loose = 0.2 * base_pos + drift;
|
||||
let tight = dir * radius + drift;
|
||||
//let tight = dir * radius;
|
||||
//let coherence = 0.8; // [0..1], or pass as a uniform
|
||||
//let pos_ws = mix(loose, tight, coherence);
|
||||
let pos_ws = tight;
|
||||
|
||||
// --- Orient cube so its local +Z points outward (along dir) ---
|
||||
// Build a stable tangent basis
|
||||
var up = vec3<f32>(0.0, 1.0, 0.0);
|
||||
if (abs(dot(dir, up)) > 0.92) {
|
||||
up = vec3<f32>(1.0, 0.0, 0.0);
|
||||
}
|
||||
let tangent = normalize(cross(up, dir));
|
||||
let bitangent = cross(dir, tangent);
|
||||
|
||||
// Optional tiny spin around outward axis for sparkle
|
||||
let spin = 0.9 * t + seed * 0.9;
|
||||
let cs = cos(spin);
|
||||
let sn = sin(spin);
|
||||
let rot_tangent = cs * tangent + sn * bitangent;
|
||||
let rot_bitangent = -sn * tangent + cs * bitangent;
|
||||
|
||||
// Rotation matrix whose columns are the local basis
|
||||
let R = mat3x3<f32>(rot_tangent, rot_bitangent, dir);
|
||||
|
||||
// Scale + orient local vertex + place at spherical position
|
||||
let local = R * (in_pos * scale);
|
||||
let world_vec4 = uniforms.model * vec4<f32>(local, 1.0);
|
||||
let world = world_vec4 + vec4<f32>(pos_ws, 0.0);
|
||||
|
||||
out.position = uniforms.view_proj * world;
|
||||
|
||||
// Normal from model rotation only (ignoring per-instance rotation for now)
|
||||
let nmat = mat3x3<f32>(
|
||||
uniforms.model[0].xyz,
|
||||
uniforms.model[1].xyz,
|
||||
uniforms.model[2].xyz
|
||||
);
|
||||
out.normal = normalize(nmat * in_normal);
|
||||
out.world_pos = world.xyz;
|
||||
out.color = color;
|
||||
return out;
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fs_main(in: VSOut) -> @location(0) vec4<f32> {
|
||||
// Same lighting as you had, but tint by per-instance color
|
||||
let material_color = in.color;
|
||||
|
||||
let ambient_strength = 0.2;
|
||||
let diffuse_strength = 0.7;
|
||||
let specular_strength = 0.2;
|
||||
let shininess = 20.0;
|
||||
|
||||
let light_pos = vec3<f32>(2.0, 2.0, 2.0);
|
||||
let light_color = vec3<f32>(1.0, 1.0, 1.0);
|
||||
let view_pos = uniforms.camera_pos;
|
||||
|
||||
let n = normalize(in.normal);
|
||||
let l = normalize(light_pos - in.world_pos);
|
||||
let v = normalize(view_pos - in.world_pos);
|
||||
let r = reflect(-l, n);
|
||||
|
||||
let ambient = ambient_strength * light_color;
|
||||
let diffuse = diffuse_strength * max(dot(n, l), 0.0) * light_color;
|
||||
let specular = specular_strength * pow(max(dot(v, r), 0.0), shininess) * light_color;
|
||||
|
||||
let exposure = exp2(1.5);
|
||||
var color = (ambient + diffuse + specular) * material_color;
|
||||
|
||||
// --- Distance-based factor (camera-space distance) ---
|
||||
let dist = length(view_pos - in.world_pos);
|
||||
let FADE_NEAR = 1.0; // start ramping here
|
||||
let FADE_FAR = 2.2; // fully applied by here
|
||||
let fade = smoothstep(FADE_NEAR, FADE_FAR, dist); // 0..1
|
||||
|
||||
// --- Exposure drift with distance (sign flips by mode) ---
|
||||
// Dark mode target exposure at far: lower; Light mode target at far: higher.
|
||||
let min_exp = 1.80; // far-end exposure multiplier in dark mode
|
||||
let max_exp = 1.35; // far-end exposure multiplier in light mode
|
||||
let darker = mix(1.0, min_exp, fade); // darkens with distance
|
||||
let brighter = mix(1.0, max_exp, fade); // brightens with distance
|
||||
let exp_factor = select(darker, brighter, uniforms.is_light.x > 0.0);
|
||||
|
||||
// Apply exposure + tonemap
|
||||
let base_exposure = exp2(1.5);
|
||||
color = aces_fitted(color * base_exposure * exp_factor);
|
||||
|
||||
// --- Optional: fade to background so distant points dissolve away ---
|
||||
// Background: black in dark mode, white in light mode.
|
||||
let bg = select(vec3<f32>(0.0), vec3<f32>(1.0), uniforms.is_light.x > 0.0);
|
||||
// If you want white for BOTH modes instead, use:
|
||||
// let bg = vec3<f32>(1.0);
|
||||
|
||||
color = mix(color, bg, fade);
|
||||
|
||||
return vec4<f32>(color, 1.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ACES-fit tonemap (keeps highlights nicer than Reinhard)
|
||||
fn aces_fitted(x: vec3<f32>) -> vec3<f32> {
|
||||
let a = 2.51;
|
||||
let b = 0.03;
|
||||
let c = 2.43;
|
||||
let d = 0.59;
|
||||
let e = 0.14;
|
||||
return clamp((x * (a * x + b)) / (x * (c * x + d) + e), vec3(0.0), vec3(1.0));
|
||||
}
|
||||
@@ -8,8 +8,7 @@ use egui_wgpu::RenderState;
|
||||
use enostr::KeypairUnowned;
|
||||
use futures::StreamExt;
|
||||
use nostrdb::Transaction;
|
||||
use notedeck::{AppAction, AppContext};
|
||||
use notedeck_ui::jobs::JobsCache;
|
||||
use notedeck::{AppAction, AppContext, JobsCache};
|
||||
use std::collections::HashMap;
|
||||
use std::string::ToString;
|
||||
use std::sync::mpsc::{self, Receiver};
|
||||
@@ -28,6 +27,7 @@ pub use vec3::Vec3;
|
||||
|
||||
mod avatar;
|
||||
mod config;
|
||||
pub(crate) mod mesh;
|
||||
mod messages;
|
||||
mod quaternion;
|
||||
mod tools;
|
||||
@@ -180,6 +180,15 @@ You are an AI agent for the nostr protocol called Dave, created by Damus. nostr
|
||||
}
|
||||
|
||||
fn ui(&mut self, app_ctx: &mut AppContext, ui: &mut egui::Ui) -> DaveResponse {
|
||||
/*
|
||||
let rect = ui.available_rect_before_wrap();
|
||||
if let Some(av) = self.avatar.as_mut() {
|
||||
av.render(rect, ui);
|
||||
ui.ctx().request_repaint();
|
||||
}
|
||||
DaveResponse::default()
|
||||
*/
|
||||
|
||||
DaveUi::new(self.model_config.trial, &self.chat, &mut self.input).ui(
|
||||
app_ctx,
|
||||
&mut self.jobs,
|
||||
@@ -335,11 +344,6 @@ You are an AI agent for the nostr protocol called Dave, created by Damus. nostr
|
||||
|
||||
impl notedeck::App for Dave {
|
||||
fn update(&mut self, ctx: &mut AppContext<'_>, ui: &mut egui::Ui) -> Option<AppAction> {
|
||||
/*
|
||||
self.app
|
||||
.frame_history
|
||||
.on_new_frame(ctx.input(|i| i.time), frame.info().cpu_usage);
|
||||
*/
|
||||
let mut app_action: Option<AppAction> = None;
|
||||
|
||||
// always insert system prompt if we have no context
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
use eframe::egui_wgpu::wgpu;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
|
||||
pub struct Vertex {
|
||||
pos: [f32; 3],
|
||||
normal: [f32; 3],
|
||||
}
|
||||
|
||||
impl Vertex {
|
||||
pub const ATTRS: [wgpu::VertexAttribute; 2] = wgpu::vertex_attr_array![
|
||||
0 => Float32x3, // position
|
||||
1 => Float32x3 // normal
|
||||
];
|
||||
pub const LAYOUT: wgpu::VertexBufferLayout<'static> = wgpu::VertexBufferLayout {
|
||||
array_stride: std::mem::size_of::<Vertex>() as wgpu::BufferAddress,
|
||||
step_mode: wgpu::VertexStepMode::Vertex,
|
||||
attributes: &Self::ATTRS,
|
||||
};
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
|
||||
pub struct Instance {
|
||||
pub base_pos: [f32; 3],
|
||||
pub scale: f32,
|
||||
pub seed: f32,
|
||||
pub color: [f32; 3],
|
||||
}
|
||||
|
||||
impl Instance {
|
||||
pub const ATTRS: [wgpu::VertexAttribute; 4] = wgpu::vertex_attr_array![
|
||||
2 => Float32x3, // base_pos
|
||||
3 => Float32, // scale
|
||||
4 => Float32, // seed
|
||||
5 => Float32x3 // color
|
||||
];
|
||||
pub const LAYOUT: wgpu::VertexBufferLayout<'static> = wgpu::VertexBufferLayout {
|
||||
array_stride: std::mem::size_of::<Instance>() as wgpu::BufferAddress,
|
||||
step_mode: wgpu::VertexStepMode::Instance,
|
||||
attributes: &Self::ATTRS,
|
||||
};
|
||||
}
|
||||
|
||||
// 6 faces * 4 verts. Each face has a constant normal.
|
||||
#[rustfmt::skip]
|
||||
pub const CUBE_VERTICES: [Vertex; 24] = [
|
||||
// -Z (back)
|
||||
Vertex { pos: [-0.5,-0.5,-0.5], normal: [0.0, 0.0,-1.0] },
|
||||
Vertex { pos: [ 0.5,-0.5,-0.5], normal: [0.0, 0.0,-1.0] },
|
||||
Vertex { pos: [ 0.5, 0.5,-0.5], normal: [0.0, 0.0,-1.0] },
|
||||
Vertex { pos: [-0.5, 0.5,-0.5], normal: [0.0, 0.0,-1.0] },
|
||||
|
||||
// +Z (front)
|
||||
Vertex { pos: [-0.5,-0.5, 0.5], normal: [0.0, 0.0, 1.0] },
|
||||
Vertex { pos: [ 0.5,-0.5, 0.5], normal: [0.0, 0.0, 1.0] },
|
||||
Vertex { pos: [ 0.5, 0.5, 0.5], normal: [0.0, 0.0, 1.0] },
|
||||
Vertex { pos: [-0.5, 0.5, 0.5], normal: [0.0, 0.0, 1.0] },
|
||||
|
||||
// -X (left)
|
||||
Vertex { pos: [-0.5,-0.5,-0.5], normal: [-1.0, 0.0, 0.0] },
|
||||
Vertex { pos: [-0.5, 0.5,-0.5], normal: [-1.0, 0.0, 0.0] },
|
||||
Vertex { pos: [-0.5, 0.5, 0.5], normal: [-1.0, 0.0, 0.0] },
|
||||
Vertex { pos: [-0.5,-0.5, 0.5], normal: [-1.0, 0.0, 0.0] },
|
||||
|
||||
// +X (right)
|
||||
Vertex { pos: [ 0.5,-0.5,-0.5], normal: [1.0, 0.0, 0.0] },
|
||||
Vertex { pos: [ 0.5, 0.5,-0.5], normal: [1.0, 0.0, 0.0] },
|
||||
Vertex { pos: [ 0.5, 0.5, 0.5], normal: [1.0, 0.0, 0.0] },
|
||||
Vertex { pos: [ 0.5,-0.5, 0.5], normal: [1.0, 0.0, 0.0] },
|
||||
|
||||
// -Y (bottom)
|
||||
Vertex { pos: [-0.5,-0.5,-0.5], normal: [0.0,-1.0, 0.0] },
|
||||
Vertex { pos: [-0.5,-0.5, 0.5], normal: [0.0,-1.0, 0.0] },
|
||||
Vertex { pos: [ 0.5,-0.5, 0.5], normal: [0.0,-1.0, 0.0] },
|
||||
Vertex { pos: [ 0.5,-0.5,-0.5], normal: [0.0,-1.0, 0.0] },
|
||||
|
||||
// +Y (top)
|
||||
Vertex { pos: [-0.5, 0.5,-0.5], normal: [0.0, 1.0, 0.0] },
|
||||
Vertex { pos: [-0.5, 0.5, 0.5], normal: [0.0, 1.0, 0.0] },
|
||||
Vertex { pos: [ 0.5, 0.5, 0.5], normal: [0.0, 1.0, 0.0] },
|
||||
Vertex { pos: [ 0.5, 0.5,-0.5], normal: [0.0, 1.0, 0.0] },
|
||||
];
|
||||
|
||||
// 6 faces * 2 triangles * 3 indices — all CCW when viewed from the outside
|
||||
pub const CUBE_INDICES: [u16; 36] = [
|
||||
// -Z (back) normal (0, 0,-1)
|
||||
0, 3, 2, 0, 2, 1, // +Z (front) normal (0, 0, 1)
|
||||
4, 5, 6, 4, 6, 7, // -X (left) normal (-1,0, 0)
|
||||
8, 11, 10, 8, 10, 9, // +X (right) normal ( 1,0, 0)
|
||||
12, 13, 14, 12, 14, 15, // -Y (bottom) normal (0,-1, 0)
|
||||
16, 18, 17, 16, 19, 18, // +Y (top) normal (0, 1, 0)
|
||||
20, 21, 22, 20, 22, 23,
|
||||
];
|
||||
@@ -4,8 +4,10 @@ use crate::{
|
||||
};
|
||||
use egui::{Align, Key, KeyboardShortcut, Layout, Modifiers};
|
||||
use nostrdb::{Ndb, Transaction};
|
||||
use notedeck::{tr, Accounts, AppContext, Images, Localization, NoteAction, NoteContext};
|
||||
use notedeck_ui::{app_images, icons::search_icon, jobs::JobsCache, NoteOptions, ProfilePic};
|
||||
use notedeck::{
|
||||
tr, Accounts, AppContext, Images, JobsCache, Localization, NoteAction, NoteContext,
|
||||
};
|
||||
use notedeck_ui::{app_images, icons::search_icon, NoteOptions, ProfilePic};
|
||||
|
||||
/// DaveUi holds all of the data it needs to render itself
|
||||
pub struct DaveUi<'a> {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "notedeck_notebook"
|
||||
edition = "2024"
|
||||
version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
jsoncanvas = { git = "https://github.com/jb55/jsoncanvas", rev = "ae60f96e4d022cf037e086b793cacc3225bc14e5" }
|
||||
notedeck = { workspace = true }
|
||||
egui = { workspace = true }
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,26 @@
|
||||
|
||||
/*
|
||||
fn debug_slider(
|
||||
ui: &mut egui::Ui,
|
||||
id: egui::Id,
|
||||
point: Pos2,
|
||||
initial: f32,
|
||||
range: std::ops::RangeInclusive<f32>,
|
||||
) -> f32 {
|
||||
let mut val = ui.data_mut(|d| *d.get_temp_mut_or::<f32>(id, initial));
|
||||
let nudge = vec2(10.0, 10.0);
|
||||
let slider = Rect::from_min_max(point - nudge, point + nudge);
|
||||
let label = Rect::from_min_max(point + nudge * 2.0, point - nudge * 2.0);
|
||||
|
||||
let old_val = val;
|
||||
ui.put(slider, egui::Slider::new(&mut val, range));
|
||||
ui.put(label, egui::Label::new(format!("{val}")));
|
||||
|
||||
if val != old_val {
|
||||
ui.data_mut(|d| d.insert_temp(id, val))
|
||||
}
|
||||
|
||||
val
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
use crate::ui::{edge_ui, node_ui};
|
||||
use egui::{Pos2, Rect};
|
||||
use jsoncanvas::JsonCanvas;
|
||||
use notedeck::{AppAction, AppContext};
|
||||
|
||||
mod ui;
|
||||
|
||||
pub struct Notebook {
|
||||
canvas: JsonCanvas,
|
||||
scene_rect: Rect,
|
||||
loaded: bool,
|
||||
}
|
||||
|
||||
impl Notebook {
|
||||
pub fn new() -> Self {
|
||||
Notebook::default()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Notebook {
|
||||
fn default() -> Self {
|
||||
Notebook {
|
||||
canvas: demo_canvas(),
|
||||
scene_rect: Rect::from_min_max(Pos2::ZERO, Pos2::ZERO),
|
||||
loaded: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl notedeck::App for Notebook {
|
||||
fn update(&mut self, _ctx: &mut AppContext<'_>, ui: &mut egui::Ui) -> Option<AppAction> {
|
||||
//let app_action: Option<AppAction> = None;
|
||||
|
||||
if !self.loaded {
|
||||
self.scene_rect = ui.available_rect_before_wrap();
|
||||
self.loaded = true;
|
||||
}
|
||||
|
||||
egui::Scene::new().show(ui, &mut self.scene_rect, |ui| {
|
||||
// render nodes
|
||||
for (_node_id, node) in self.canvas.get_nodes().iter() {
|
||||
let _resp = node_ui(ui, node);
|
||||
}
|
||||
|
||||
// render edges
|
||||
for (_edge_id, edge) in self.canvas.get_edges().iter() {
|
||||
let _resp = edge_ui(ui, self.canvas.get_nodes(), edge);
|
||||
}
|
||||
});
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn demo_canvas() -> JsonCanvas {
|
||||
let demo_json: String = include_str!("../demo.canvas").to_string();
|
||||
|
||||
let canvas: JsonCanvas = demo_json.parse().unwrap_or_else(|_| JsonCanvas::default());
|
||||
canvas
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user