aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock139
-rw-r--r--Cargo.toml6
-rw-r--r--assets/icons/addcontact24.svg5
-rw-r--r--assets/icons/attachment24.svg3
-rw-r--r--assets/icons/away16.svg10
-rw-r--r--assets/icons/away16color.svg10
-rw-r--r--assets/icons/bubble16.svg3
-rw-r--r--assets/icons/bubble16color.svg3
-rw-r--r--assets/icons/bubble24.svg3
-rw-r--r--assets/icons/contact24.svg4
-rw-r--r--assets/icons/delivered16.svg4
-rw-r--r--assets/icons/dnd16.svg3
-rw-r--r--assets/icons/dnd16color.svg3
-rw-r--r--assets/icons/error16color.svg10
-rw-r--r--assets/icons/forward24.svg10
-rw-r--r--assets/icons/heart24.svg3
-rw-r--r--assets/icons/newbubble24.svg4
-rw-r--r--assets/icons/reply24.svg10
-rw-r--r--assets/icons/sending16.svg5
-rw-r--r--assets/icons/sent16.svg3
-rw-r--r--icons.md24
-rw-r--r--src/icons.rs127
-rw-r--r--src/main.rs87
-rw-r--r--src/message_view.rs4
24 files changed, 433 insertions, 50 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 2e2d829..c8b13ff 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -834,7 +834,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59fd57d82eb4bfe7ffa9b1cec0c05e2fd378155b47f255a67983cb4afe0e80c2"
dependencies = [
"bitflags 2.9.0",
- "fontdb",
+ "fontdb 0.16.2",
"log",
"rangemap",
"rayon",
@@ -979,6 +979,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010"
[[package]]
+name = "data-url"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c297a1c74b71ae29df00c3e22dd9534821d60eb9af5a0192823fa2acea70c2a"
+
+[[package]]
name = "dbus"
version = "0.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1348,7 +1354,6 @@ dependencies = [
[[package]]
name = "filamento"
version = "0.1.0"
-source = "git+https://bunny.garden/luz#15faa6b95ffb5c64a56e212cf386c29fef56efc8"
dependencies = [
"base64",
"chrono",
@@ -1379,6 +1384,12 @@ dependencies = [
]
[[package]]
+name = "float-cmp"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
+
+[[package]]
name = "flume"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1428,6 +1439,20 @@ dependencies = [
]
[[package]]
+name = "fontdb"
+version = "0.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e32eac81c1135c1df01d4e6d4233c47ba11f6a6d07f33e0bba09d18797077770"
+dependencies = [
+ "fontconfig-parser",
+ "log",
+ "memmap2",
+ "slotmap",
+ "tinyvec",
+ "ttf-parser 0.21.1",
+]
+
+[[package]]
name = "foreign-types"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2033,8 +2058,9 @@ dependencies = [
"bytemuck",
"cosmic-text",
"iced_graphics",
- "kurbo",
+ "kurbo 0.10.4",
"log",
+ "resvg",
"rustc-hash 2.1.1",
"softbuffer",
"tiny-skia",
@@ -2055,6 +2081,7 @@ dependencies = [
"iced_graphics",
"log",
"once_cell",
+ "resvg",
"rustc-hash 2.1.1",
"thiserror 1.0.69",
"wgpu",
@@ -2297,6 +2324,12 @@ dependencies = [
]
[[package]]
+name = "imagesize"
+version = "0.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284"
+
+[[package]]
name = "imgref"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2368,7 +2401,6 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "jid"
version = "0.1.0"
-source = "git+https://bunny.garden/luz#15faa6b95ffb5c64a56e212cf386c29fef56efc8"
dependencies = [
"sqlx",
]
@@ -2484,9 +2516,18 @@ dependencies = [
]
[[package]]
+name = "kurbo"
+version = "0.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89234b2cc610a7dd927ebde6b41dd1a5d4214cffaef4cf1fb2195d592f92518f"
+dependencies = [
+ "arrayvec",
+ "smallvec",
+]
+
+[[package]]
name = "lampada"
version = "0.1.0"
-source = "git+https://bunny.garden/luz#15faa6b95ffb5c64a56e212cf386c29fef56efc8"
dependencies = [
"futures",
"jid",
@@ -2659,7 +2700,6 @@ dependencies = [
[[package]]
name = "luz"
version = "0.1.0"
-source = "git+https://bunny.garden/luz#15faa6b95ffb5c64a56e212cf386c29fef56efc8"
dependencies = [
"async-recursion",
"async-trait",
@@ -3572,6 +3612,12 @@ dependencies = [
]
[[package]]
+name = "pico-args"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
+
+[[package]]
name = "pin-project"
version = "1.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3953,10 +3999,29 @@ dependencies = [
]
[[package]]
+name = "resvg"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "944d052815156ac8fa77eaac055220e95ba0b01fa8887108ca710c03805d9051"
+dependencies = [
+ "gif",
+ "jpeg-decoder",
+ "log",
+ "pico-args",
+ "rgb",
+ "svgtypes",
+ "tiny-skia",
+ "usvg",
+]
+
+[[package]]
name = "rgb"
version = "0.8.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a"
+dependencies = [
+ "bytemuck",
+]
[[package]]
name = "roxmltree"
@@ -4316,6 +4381,15 @@ dependencies = [
]
[[package]]
+name = "simplecss"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a9c6883ca9c3c7c90e888de77b7a5c849c779d25d74a1269b0218b14e8b136c"
+dependencies = [
+ "log",
+]
+
+[[package]]
name = "siphasher"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4677,7 +4751,6 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "stanza"
version = "0.1.0"
-source = "git+https://bunny.garden/luz#15faa6b95ffb5c64a56e212cf386c29fef56efc8"
dependencies = [
"chrono",
"jid",
@@ -4696,6 +4769,9 @@ name = "strict-num"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731"
+dependencies = [
+ "float-cmp",
+]
[[package]]
name = "stringprep"
@@ -4721,6 +4797,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce5d813d71d82c4cbc1742135004e4a79fd870214c155443451c139c9470a0aa"
[[package]]
+name = "svgtypes"
+version = "0.15.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68c7541fff44b35860c1a7a47a7cadf3e4a304c457b58f9870d9706ece028afc"
+dependencies = [
+ "kurbo 0.11.1",
+ "siphasher",
+]
+
+[[package]]
name = "swash"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5231,6 +5317,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
[[package]]
+name = "unicode-vo"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94"
+
+[[package]]
name = "unicode-width"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5254,6 +5346,33 @@ dependencies = [
]
[[package]]
+name = "usvg"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b84ea542ae85c715f07b082438a4231c3760539d902e11d093847a0b22963032"
+dependencies = [
+ "base64",
+ "data-url",
+ "flate2",
+ "fontdb 0.18.0",
+ "imagesize",
+ "kurbo 0.11.1",
+ "log",
+ "pico-args",
+ "roxmltree",
+ "rustybuzz",
+ "simplecss",
+ "siphasher",
+ "strict-num",
+ "svgtypes",
+ "tiny-skia-path",
+ "unicode-bidi",
+ "unicode-script",
+ "unicode-vo",
+ "xmlwriter",
+]
+
+[[package]]
name = "utf16_iter"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -6196,6 +6315,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a62ce76d9b56901b19a74f19431b0d8b3bc7ca4ad685a746dfd78ca8f4fc6bda"
[[package]]
+name = "xmlwriter"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"
+
+[[package]]
name = "yazi"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 8a324c9..85f4378 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,9 +7,9 @@ version = "0.1.0"
edition = "2021"
[dependencies]
-iced = { version = "0.13.0", features = ["tokio", "image"] }
-filamento = { version = "0.1.0", git = "https://bunny.garden/luz" }
-jid = { version = "0.1.0", git = "https://bunny.garden/luz" }
+iced = { version = "0.13.0", features = ["tokio", "image", "svg"] }
+filamento = { version = "0.1.0", path = "../luz/filamento" }
+jid = { version = "0.1.0", path = "../luz/jid" }
tokio = "1.43.0"
tokio-stream = "0.1.17"
tracing-subscriber = "0.3.19"
diff --git a/assets/icons/addcontact24.svg b/assets/icons/addcontact24.svg
new file mode 100644
index 0000000..3324996
--- /dev/null
+++ b/assets/icons/addcontact24.svg
@@ -0,0 +1,5 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M16.0004 11C16.6281 10.1643 17 9.12561 17 8C17 5.23858 14.7614 3 12 3C9.23858 3 7 5.23858 7 8C7 9.12561 7.37194 10.1643 7.99963 11" stroke="black" stroke-width="2"/>
+<path d="M7 14.0014C3.60117 15.6755 3.00884 19.0504 3 21H21.0264C21.0264 19.2423 20.4151 15.7748 17 14.0399" stroke="black" stroke-width="2"/>
+<path d="M12 13H15M12 13H9M12 13V10M12 13V16" stroke="black" stroke-width="2"/>
+</svg>
diff --git a/assets/icons/attachment24.svg b/assets/icons/attachment24.svg
new file mode 100644
index 0000000..ee808e6
--- /dev/null
+++ b/assets/icons/attachment24.svg
@@ -0,0 +1,3 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M21 13.3329C16.6369 19.9724 12.4124 20.8255 9.33666 20.8255C5.60908 20.8255 3 17.7955 3 15.1645C3 9.12539 9.09537 3.30998 15.6733 3.30998C19.1978 3.30998 22.3753 8.59036 15.5935 15.0402C11.6522 18.7886 8.39541 17.6137 7.57871 16.3206C5.87141 13.6174 9.33666 10.3925 12.0841 8.87491" stroke="black" stroke-width="2"/>
+</svg>
diff --git a/assets/icons/away16.svg b/assets/icons/away16.svg
new file mode 100644
index 0000000..5d78da1
--- /dev/null
+++ b/assets/icons/away16.svg
@@ -0,0 +1,10 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0_204_583)">
+<path d="M12.3949 3.68876C14.4905 5.78437 14.3985 9.52573 11.8703 12.0539C9.3422 14.582 5.60084 14.674 3.50523 12.5784C2.7029 11.7761 2.22277 10.747 2.07449 9.63325C2.10824 9.63849 2.14189 9.64327 2.17541 9.64762C2.83698 9.73336 3.54898 9.66529 4.21793 9.51478C5.52363 9.22102 6.93329 8.5485 7.73555 7.67748C8.50721 6.83967 9.11302 5.50754 9.35486 4.24412C9.47772 3.60222 9.51846 2.91991 9.40702 2.28141C9.4053 2.27156 9.40354 2.2617 9.40175 2.25184C10.5339 2.39262 11.5812 2.87506 12.3949 3.68876Z" stroke="black" stroke-width="2"/>
+</g>
+<defs>
+<clipPath id="clip0_204_583">
+<rect width="16" height="16" fill="white"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/assets/icons/away16color.svg b/assets/icons/away16color.svg
new file mode 100644
index 0000000..e35da57
--- /dev/null
+++ b/assets/icons/away16color.svg
@@ -0,0 +1,10 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0_204_583)">
+<path d="M12.3949 3.68876C14.4905 5.78437 14.3985 9.52573 11.8703 12.0539C9.3422 14.582 5.60084 14.674 3.50523 12.5784C2.7029 11.7761 2.22277 10.747 2.07449 9.63325C2.10824 9.63849 2.14189 9.64327 2.17541 9.64762C2.83698 9.73336 3.54898 9.66529 4.21793 9.51478C5.52363 9.22102 6.93329 8.5485 7.73555 7.67748C8.50721 6.83967 9.11302 5.50754 9.35486 4.24412C9.47772 3.60222 9.51846 2.91991 9.40702 2.28141C9.4053 2.27156 9.40354 2.2617 9.40175 2.25184C10.5339 2.39262 11.5812 2.87506 12.3949 3.68876Z" fill="#FFCE07" stroke="black" stroke-width="2"/>
+</g>
+<defs>
+<clipPath id="clip0_204_583">
+<rect width="16" height="16" fill="white"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/assets/icons/bubble16.svg b/assets/icons/bubble16.svg
new file mode 100644
index 0000000..8775127
--- /dev/null
+++ b/assets/icons/bubble16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M8.82231 12.4711L8.5106 11.499C8.70361 11.4713 8.89168 11.4358 9.07333 11.3943C10.1138 11.1566 11.0459 10.7001 11.6435 10.2423C13.6639 8.69425 14.4 6.1447 12.9614 4.2671C12.0904 3.13031 10.6908 2.71605 9.30488 2.79833C7.91203 2.88103 6.41494 3.45992 5.1034 4.46482C3.79187 5.46971 2.84338 6.76461 2.40112 8.08797C1.96106 9.40473 1.99689 10.8639 2.86789 12.0007C3.719 13.1115 5.83101 13.9667 8.82231 12.4711Z" stroke="black" stroke-width="2" stroke-miterlimit="1.41421"/>
+</svg>
diff --git a/assets/icons/bubble16color.svg b/assets/icons/bubble16color.svg
new file mode 100644
index 0000000..c3c01d8
--- /dev/null
+++ b/assets/icons/bubble16color.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M8.82231 12.4711L8.5106 11.499C8.70361 11.4713 8.89168 11.4358 9.07333 11.3943C10.1138 11.1566 11.0459 10.7001 11.6435 10.2423C13.6639 8.69425 14.4 6.1447 12.9614 4.2671C12.0904 3.13031 10.6908 2.71605 9.30488 2.79833C7.91203 2.88103 6.41494 3.45992 5.1034 4.46482C3.79187 5.46971 2.84338 6.76461 2.40112 8.08797C1.96106 9.40473 1.99689 10.8639 2.86789 12.0007C3.719 13.1115 5.83101 13.9667 8.82231 12.4711Z" fill="#52CF6E" stroke="black" stroke-width="2" stroke-miterlimit="1.41421"/>
+</svg>
diff --git a/assets/icons/bubble24.svg b/assets/icons/bubble24.svg
new file mode 100644
index 0000000..b9e9414
--- /dev/null
+++ b/assets/icons/bubble24.svg
@@ -0,0 +1,3 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M13.1661 18.7474L12.6411 17.1101C13.0131 17.0644 13.376 16.9992 13.7259 16.9192C15.3587 16.5462 16.8089 15.8307 17.7144 15.1369C20.8619 12.7253 21.8527 8.91393 19.7675 6.19249C18.5016 4.54019 16.4353 3.89603 14.2909 4.02335C12.1395 4.15109 9.79196 5.04995 7.71792 6.63908C5.64387 8.2282 4.16516 10.261 3.48204 12.305C2.80113 14.3425 2.88548 16.5052 4.15146 18.1575C5.3258 19.6902 8.44768 21.1066 13.1661 18.7474Z" stroke="black" stroke-width="2" stroke-miterlimit="1.41421"/>
+</svg>
diff --git a/assets/icons/contact24.svg b/assets/icons/contact24.svg
new file mode 100644
index 0000000..da03215
--- /dev/null
+++ b/assets/icons/contact24.svg
@@ -0,0 +1,4 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="12.0678" cy="8" r="5" stroke="black" stroke-width="2"/>
+<path d="M12 13C4.11584 13 3.01209 18.3333 3 21H21.0264C21.0264 18.5973 19.8842 13 12 13Z" stroke="black" stroke-width="2"/>
+</svg>
diff --git a/assets/icons/delivered16.svg b/assets/icons/delivered16.svg
new file mode 100644
index 0000000..feec0c2
--- /dev/null
+++ b/assets/icons/delivered16.svg
@@ -0,0 +1,4 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M14.1667 7.00724C12.9795 8.54119 10.9029 9.18264 10.0046 9.18264C9.88343 9.18264 9.27537 9.13373 9.21829 9.07586" stroke="black" stroke-width="2"/>
+<path d="M2.13982 7.66744C2.51405 8.66834 3.48325 9.1754 4.49578 9.1754C5.39405 9.1754 7.47067 8.53395 8.6579 7" stroke="black" stroke-width="2"/>
+</svg>
diff --git a/assets/icons/dnd16.svg b/assets/icons/dnd16.svg
new file mode 100644
index 0000000..d13d54b
--- /dev/null
+++ b/assets/icons/dnd16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M6 14L2 10V6L6 2H10L14 6V10L10 14H6Z" stroke="black" stroke-width="2"/>
+</svg>
diff --git a/assets/icons/dnd16color.svg b/assets/icons/dnd16color.svg
new file mode 100644
index 0000000..e69cbe3
--- /dev/null
+++ b/assets/icons/dnd16color.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M6 14L2 10V6L6 2H10L14 6V10L10 14H6Z" fill="#C1173C" stroke="black" stroke-width="2"/>
+</svg>
diff --git a/assets/icons/error16color.svg b/assets/icons/error16color.svg
new file mode 100644
index 0000000..21e28fc
--- /dev/null
+++ b/assets/icons/error16color.svg
@@ -0,0 +1,10 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0_204_962)">
+<path d="M2.80385 12.6928L8 3.6928L13.1962 12.6928H2.80385Z" fill="#C1173C" stroke="black" stroke-width="2"/>
+</g>
+<defs>
+<clipPath id="clip0_204_962">
+<rect width="16" height="16" fill="white"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/assets/icons/forward24.svg b/assets/icons/forward24.svg
new file mode 100644
index 0000000..a2fdaba
--- /dev/null
+++ b/assets/icons/forward24.svg
@@ -0,0 +1,10 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0_204_235)">
+<path d="M15.674 3.11258L15.674 9M15.674 3.11258L8.5 3.11258M15.674 3.11258C14.4547 3.63965 13.2902 4.34718 12.1355 5.23196C6.92147 9.22691 4.88415 15.323 7.58502 18.8481C8.26848 19.7401 9.84336 20.6926 12.1355 20.8434" stroke="black" stroke-width="2" stroke-miterlimit="16"/>
+</g>
+<defs>
+<clipPath id="clip0_204_235">
+<rect width="24" height="24" fill="white"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/assets/icons/heart24.svg b/assets/icons/heart24.svg
new file mode 100644
index 0000000..dd63532
--- /dev/null
+++ b/assets/icons/heart24.svg
@@ -0,0 +1,3 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M11.4455 5.90719L12.0788 6.42557L12.7122 5.90719C14.9006 4.11609 16.6254 3.44822 17.8564 3.39835C19.0193 3.35124 19.8258 3.84682 20.342 4.6883C20.8877 5.57785 21.1387 6.92101 20.9232 8.51425C20.7097 10.0929 20.0454 11.8434 18.8646 13.4786C17.0975 15.9258 15.7674 17.3884 14.6372 18.3999C13.6976 19.2408 12.8806 19.7855 12.0015 20.3471C11.1396 19.79 10.3533 19.2443 9.44622 18.4039C8.35343 17.3914 7.06118 15.9272 5.29303 13.4786C4.11223 11.8434 3.4479 10.0929 3.2344 8.51425C3.01893 6.92101 3.26991 5.57785 3.81561 4.6883C4.33182 3.84682 5.13833 3.35124 6.30121 3.39835C7.53222 3.44822 9.25705 4.11609 11.4455 5.90719Z" stroke="black" stroke-width="2"/>
+</svg>
diff --git a/assets/icons/newbubble24.svg b/assets/icons/newbubble24.svg
new file mode 100644
index 0000000..b1d72fd
--- /dev/null
+++ b/assets/icons/newbubble24.svg
@@ -0,0 +1,4 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M13.1661 18.7474L12.6411 17.1101C13.0131 17.0644 13.376 16.9992 13.7259 16.9192C15.3587 16.5462 16.8089 15.8307 17.7144 15.1369C20.8619 12.7253 21.8527 8.91393 19.7675 6.19249C18.5016 4.54019 16.4353 3.89603 14.2909 4.02335C12.1395 4.15109 9.79196 5.04995 7.71792 6.63908C5.64387 8.2282 4.16516 10.261 3.48204 12.305C2.80113 14.3425 2.88548 16.5052 4.15146 18.1575C5.3258 19.6902 8.44768 21.1066 13.1661 18.7474Z" stroke="black" stroke-width="2" stroke-miterlimit="1.41421"/>
+<path d="M12 8.05864V14.0586M15 11.0586H9" stroke="black" stroke-width="2"/>
+</svg>
diff --git a/assets/icons/reply24.svg b/assets/icons/reply24.svg
new file mode 100644
index 0000000..7136614
--- /dev/null
+++ b/assets/icons/reply24.svg
@@ -0,0 +1,10 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0_204_246)">
+<path d="M2.96446 13.4001L8.69828 13.4001M2.96446 13.4001L2.96446 7.25968M2.96446 13.4001C3.79279 12.3092 4.8179 11.2726 6.01902 10.3523C11.0135 6.5255 17.1596 6.16059 19.7468 9.5372C21.8385 12.2673 20.7102 16.0351 18.5396 18.6512" stroke="black" stroke-width="2" stroke-miterlimit="16"/>
+</g>
+<defs>
+<clipPath id="clip0_204_246">
+<rect width="24" height="24" fill="white"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/assets/icons/sending16.svg b/assets/icons/sending16.svg
new file mode 100644
index 0000000..a74179a
--- /dev/null
+++ b/assets/icons/sending16.svg
@@ -0,0 +1,5 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="3" cy="8" r="2" fill="black"/>
+<circle cx="8" cy="8" r="2" fill="black"/>
+<circle cx="13" cy="8" r="2" fill="black"/>
+</svg>
diff --git a/assets/icons/sent16.svg b/assets/icons/sent16.svg
new file mode 100644
index 0000000..5b7f3fa
--- /dev/null
+++ b/assets/icons/sent16.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M2.13982 7.66744C2.51405 8.66834 3.48325 9.1754 4.49578 9.1754C5.39405 9.1754 7.47067 8.53395 8.6579 7" stroke="black" stroke-width="2"/>
+</svg>
diff --git a/icons.md b/icons.md
new file mode 100644
index 0000000..9c3dd89
--- /dev/null
+++ b/icons.md
@@ -0,0 +1,24 @@
+# icons
+
+- [x] online
+- [x] away
+- [x] dnd
+- [x] xa
+- [x] person
+- [ ] settings
+- [x] sending
+- [x] failure
+- [x] sent tick
+- [x] delivered two ticks
+- [x] new message
+- [x] heart
+- [x] message bubble
+- [x] reply
+- [x] forward
+- [x] attachment
+- [ ] (re)send (up arrow)
+- [ ] mobile phone
+- [ ] default avatar
+- [ ] call
+
+- [ ] add
diff --git a/src/icons.rs b/src/icons.rs
new file mode 100644
index 0000000..934a0c8
--- /dev/null
+++ b/src/icons.rs
@@ -0,0 +1,127 @@
+use iced::widget::svg;
+use iced::widget::{svg::Handle, Svg};
+use iced::Element;
+
+pub enum Icon {
+ AddContact24,
+ Attachment24,
+ Away16,
+ Away16Color,
+ Bubble16,
+ Bubble16Color,
+ Bubble24,
+ Contact24,
+ Delivered16,
+ Dnd16,
+ Dnd16Color,
+ Error16Color,
+ Forward24,
+ Heart24,
+ NewBubble24,
+ Reply24,
+ Sending16,
+ Sent16,
+}
+
+impl From<Icon> for Svg<'_> {
+ fn from(value: Icon) -> Self {
+ match value {
+ Icon::AddContact24 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/addcontact24.svg"
+ )))
+ .width(24)
+ .height(24),
+ Icon::Attachment24 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/attachment24.svg"
+ )))
+ .width(24)
+ .height(24),
+ Icon::Away16 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/away16.svg"
+ )))
+ .width(16)
+ .height(16),
+ Icon::Away16Color => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/away16color.svg"
+ )))
+ .width(16)
+ .height(16),
+ Icon::Bubble16 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/bubble16.svg"
+ )))
+ .width(16)
+ .height(16),
+ Icon::Bubble16Color => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/bubble16color.svg"
+ )))
+ .width(16)
+ .height(16),
+ Icon::Bubble24 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/bubble24.svg"
+ )))
+ .width(24)
+ .height(24),
+ Icon::Contact24 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/contact24.svg"
+ )))
+ .width(24)
+ .height(24),
+ Icon::Delivered16 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/delivered16.svg"
+ )))
+ .width(16)
+ .height(16),
+ Icon::Dnd16 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/dnd16.svg"
+ )))
+ .width(16)
+ .height(16),
+ Icon::Dnd16Color => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/dnd16color.svg"
+ )))
+ .width(16)
+ .height(16),
+ Icon::Error16Color => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/error16color.svg"
+ )))
+ .width(16)
+ .height(16),
+ Icon::Forward24 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/forward24.svg"
+ )))
+ .width(24)
+ .height(24),
+ Icon::Heart24 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/heart24.svg"
+ )))
+ .width(24)
+ .height(24),
+ Icon::NewBubble24 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/newbubble24.svg"
+ )))
+ .width(24)
+ .height(24),
+ Icon::Reply24 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/reply24.svg"
+ )))
+ .width(24)
+ .height(24),
+ Icon::Sending16 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/sending16.svg"
+ )))
+ .width(16)
+ .height(16),
+ Icon::Sent16 => svg(Handle::from_memory(include_bytes!(
+ "../assets/icons/sent16.svg"
+ )))
+ .width(16)
+ .height(16),
+ }
+ }
+}
+
+impl<Message> From<Icon> for Element<'_, Message> {
+ fn from(value: Icon) -> Self {
+ Into::<Svg>::into(value).into()
+ }
+}
diff --git a/src/main.rs b/src/main.rs
index 0b8b3b8..106df79 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -23,10 +23,11 @@ use iced::widget::button::Status;
use iced::widget::text::{Fragment, IntoFragment, Wrapping};
use iced::widget::{
button, center, checkbox, column, container, horizontal_space, image, mouse_area, opaque, row,
- scrollable, stack, text, text_input, toggler, Column, Text, Toggler,
+ scrollable, stack, text, text_input, toggler, Column, Svg, Text, Toggler,
};
use iced::Length::{self, Fill, Shrink};
use iced::{color, stream, Color, Element, Subscription, Task, Theme};
+use icons::Icon;
use indexmap::{indexmap, IndexMap};
use jid::JID;
use keyring::Entry;
@@ -37,9 +38,10 @@ use thiserror::Error;
use tokio::sync::mpsc::Sender;
use tokio::sync::{mpsc, oneshot};
use tokio_stream::wrappers::ReceiverStream;
-use tracing::{error, info};
+use tracing::{debug, error, info};
use uuid::Uuid;
+mod icons;
mod login_modal;
mod message_view;
@@ -488,6 +490,7 @@ async fn main() -> iced::Result {
Task::stream(stream),
])
} else {
+ debug!("no auto connect");
Task::batch([
Task::perform(
async move { luz_handle1.get_roster_with_users().await },
@@ -524,7 +527,7 @@ async fn main() -> iced::Result {
};
iced::application("Macaw", Macaw::update, Macaw::view)
.subscription(subscription)
- .theme(Macaw::theme)
+ // .theme(Macaw::theme)
.run_with(|| {
(
Macaw::new(
@@ -698,7 +701,8 @@ impl Macaw {
}
UpdateMessage::Presence { from, presence } => {
// TODO: presence handling
- self.presences.insert(from, presence);
+ info!("got presence from {:?} {:?}", from, presence);
+ self.presences.insert(from.as_bare(), presence);
Task::none()
}
UpdateMessage::Message { to, message, from } => {
@@ -886,7 +890,7 @@ impl Macaw {
client.connection_state = ConnectionState::Connecting;
let client = client.client.clone();
Task::future(async move {
- client.connect().await;
+ client.connect().await.unwrap();
})
.discard()
}
@@ -896,7 +900,7 @@ impl Macaw {
Account::LoggedIn(client) => {
let client = client.client.clone();
Task::future(async move {
- client.disconnect(Offline::default()).await;
+ client.disconnect(Offline::default()).await.unwrap();
})
.discard()
}
@@ -1105,8 +1109,13 @@ impl Macaw {
open = true;
}
}
- let chat_list_item =
- chat_list_item(&self.roster, client.files_root(), chat, open);
+ let chat_list_item = chat_list_item(
+ &self.presences,
+ &self.roster,
+ client.files_root(),
+ chat,
+ open,
+ );
chats_list = chats_list.push(chat_list_item);
}
}
@@ -1288,6 +1297,7 @@ where
}
fn chat_list_item<'a>(
+ presences: &HashMap<JID, Presence>,
roster: &HashMap<JID, MacawContact>,
file_root: &'a Path,
chat_list_item: &'a ChatListItem,
@@ -1339,36 +1349,37 @@ fn chat_list_item<'a>(
latest_message_text = None;
}
- let avatar_image = if let Some(avatar) = avatar {
+ let mut avatar_stack = stack([]);
+ if let Some(avatar) = avatar {
let mut path = file_root.join(avatar);
path.set_extension("jpg");
info!("got avatar: {:?}", path);
- Some(image(path).width(48).height(48))
- } else {
- None
- };
- let content: Element<Message> = if let Some(avatar_image) = avatar_image {
- if let Some((message, time)) = latest_message_text {
- row![
- avatar_image,
- column![
- text(name),
- row![
- container(text(message).wrapping(Wrapping::None))
- .clip(true)
- .width(Fill),
- text(time)
- ]
- .spacing(8)
- .width(Fill)
- ]
- ]
- .into()
- } else {
- row![avatar_image, text(name)].into()
+ avatar_stack = avatar_stack.push(image(path).width(48).height(48));
+ }
+ let mut status_icon: Option<Icon> = None;
+ if let Some(presence) = presences.get(&chat_list_item.user.jid) {
+ debug!("found a presence");
+ match &presence.presence {
+ PresenceType::Online(online) => match online.show {
+ Some(s) => match s {
+ filamento::presence::Show::Away => status_icon = Some(Icon::Away16Color),
+ filamento::presence::Show::Chat => status_icon = Some(Icon::Bubble16Color),
+ filamento::presence::Show::DoNotDisturb => status_icon = Some(Icon::Dnd16Color),
+ filamento::presence::Show::ExtendedAway => {
+ status_icon = Some(Icon::Away16Color)
+ }
+ },
+ None => status_icon = Some(Icon::Bubble16Color),
+ },
+ PresenceType::Offline(offline) => {}
}
- } else {
- if let Some((message, time)) = latest_message_text {
+ }
+ if let Some(status_icon) = status_icon {
+ avatar_stack = avatar_stack.push(Into::<Svg>::into(status_icon));
+ }
+ let content: Element<Message> = if let Some((message, time)) = latest_message_text {
+ row![
+ avatar_stack,
column![
text(name),
row![
@@ -1380,10 +1391,10 @@ fn chat_list_item<'a>(
.spacing(8)
.width(Fill)
]
- .into()
- } else {
- text(name).into()
- }
+ ]
+ .into()
+ } else {
+ row![avatar_stack, text(name)].into()
};
let mut button =
button(content).on_press(Message::ToggleChat(chat_list_item.correspondent().clone()));
diff --git a/src/message_view.rs b/src/message_view.rs
index e936b69..fdb1a59 100644
--- a/src/message_view.rs
+++ b/src/message_view.rs
@@ -10,7 +10,7 @@ use indexmap::IndexMap;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
-use crate::{MacawChat, MacawMessage};
+use crate::{icons::Icon, MacawChat, MacawMessage};
pub struct MessageView {
// references chats, users
@@ -152,7 +152,7 @@ impl MessageView {
.wrapping(text::Wrapping::WordOrGlyph);
let message_send_input = row![
text_editor,
- button("send").on_press(Message::SendMessage(self.new_message.text()))
+ button(Icon::NewBubble24).on_press(Message::SendMessage(self.new_message.text()))
]
.padding(8);
column![