From ba365a6143a53cd1aa5b51f06778c868403dfdbd Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Fri, 28 Jun 2024 19:03:11 +0530 Subject: [PATCH 01/14] Upgrade to latest matrix-rust-sdk --- Cargo.lock | 426 ++---------------- Cargo.toml | 32 +- .../rust_sdk/lib/acter_flutter_sdk_ffi.dart | 249 ---------- native/acter/api.rsh | 5 - native/acter/src/api/common.rs | 27 +- native/acter/src/api/message.rs | 12 +- native/acter/src/api/profile.rs | 2 +- native/acter/src/api/stream.rs | 56 +-- native/acter/src/api/verification.rs | 1 + native/media-cache-wrapper/src/lib.rs | 100 +++- 10 files changed, 184 insertions(+), 726 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6fc50e2debe8..b973fc621d3f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -424,6 +424,12 @@ dependencies = [ "nom", ] +[[package]] +name = "assert_matches2" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15832d94c458da98cac0ffa6eca52cc19c2a3c6c951058500a5ae8f01f0fdf56" + [[package]] name = "assign" version = "1.1.1" @@ -627,12 +633,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - [[package]] name = "base64" version = "0.13.1" @@ -734,7 +734,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed59b5c00048f48d7af971b71f800fdf23e858844a6f9e4d32ca72e9399e7864" dependencies = [ "serde", - "serde_with 1.14.0", + "serde_with", ] [[package]] @@ -1228,18 +1228,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -1459,7 +1447,6 @@ dependencies = [ "const-oid", "der_derive", "flagset", - "pem-rfc7468", "zeroize", ] @@ -1481,7 +1468,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" dependencies = [ "powerfmt", - "serde", ] [[package]] @@ -1546,7 +1532,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", - "const-oid", "crypto-common", "subtle", ] @@ -1557,26 +1542,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" -[[package]] -name = "dyn-clone" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" - -[[package]] -name = "ecdsa" -version = "0.16.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" -dependencies = [ - "der", - "digest", - "elliptic-curve", - "rfc6979", - "signature", - "spki", -] - [[package]] name = "ed25519" version = "2.2.2" @@ -1609,27 +1574,6 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" -[[package]] -name = "elliptic-curve" -version = "0.13.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest", - "ff", - "generic-array", - "group", - "hkdf", - "pem-rfc7468", - "pkcs8", - "rand_core 0.6.4", - "sec1", - "subtle", - "zeroize", -] - [[package]] name = "encode_unicode" version = "0.3.6" @@ -1782,16 +1726,6 @@ dependencies = [ "log", ] -[[package]] -name = "ff" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" -dependencies = [ - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "ffi-gen" version = "0.1.13" @@ -2042,7 +1976,6 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", - "zeroize", ] [[package]] @@ -2134,14 +2067,15 @@ dependencies = [ ] [[package]] -name = "group" -version = "0.13.0" +name = "growable-bloom-filter" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +checksum = "c669fa03050eb3445343f215d62fc1ab831e8098bc9a55f26e9724faff11075c" dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", + "serde", + "serde_bytes", + "serde_derive", + "xxhash-rust", ] [[package]] @@ -2589,7 +2523,6 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg 1.1.0", "hashbrown 0.12.3", - "serde", ] [[package]] @@ -2767,9 +2700,6 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -dependencies = [ - "spin 0.5.2", -] [[package]] name = "libc" @@ -2791,12 +2721,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - [[package]] name = "libsqlite3-sys" version = "0.27.0" @@ -3001,7 +2925,7 @@ dependencies = [ [[package]] name = "matrix-sdk" version = "0.7.1" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=1380af4f005ee5f34607db5cbb6705f93048b85a#1380af4f005ee5f34607db5cbb6705f93048b85a" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" dependencies = [ "anyhow", "anymap2", @@ -3011,13 +2935,11 @@ dependencies = [ "async-stream", "async-trait", "backoff", - "base64 0.22.1", "bytes", "bytesize", "event-listener", "eyeball", "eyeball-im", - "eyeball-im-util", "futures-core", "futures-util", "gloo-timers", @@ -3031,7 +2953,6 @@ dependencies = [ "matrix-sdk-sqlite", "mime", "mime2ext", - "openidconnect", "reqwest", "ruma", "serde", @@ -3052,7 +2973,7 @@ dependencies = [ [[package]] name = "matrix-sdk-base" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=1380af4f005ee5f34607db5cbb6705f93048b85a#1380af4f005ee5f34607db5cbb6705f93048b85a" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" dependencies = [ "as_variant", "async-trait", @@ -3060,6 +2981,7 @@ dependencies = [ "eyeball", "eyeball-im", "futures-util", + "growable-bloom-filter", "matrix-sdk-common", "matrix-sdk-crypto", "matrix-sdk-store-encryption", @@ -3075,7 +2997,7 @@ dependencies = [ [[package]] name = "matrix-sdk-common" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=1380af4f005ee5f34607db5cbb6705f93048b85a#1380af4f005ee5f34607db5cbb6705f93048b85a" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" dependencies = [ "async-trait", "futures-core", @@ -3097,10 +3019,11 @@ dependencies = [ [[package]] name = "matrix-sdk-crypto" version = "0.7.1" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=1380af4f005ee5f34607db5cbb6705f93048b85a#1380af4f005ee5f34607db5cbb6705f93048b85a" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" dependencies = [ "aes", "as_variant", + "assert_matches2", "async-trait", "bs58", "byteorder", @@ -3137,7 +3060,7 @@ dependencies = [ [[package]] name = "matrix-sdk-indexeddb" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=1380af4f005ee5f34607db5cbb6705f93048b85a#1380af4f005ee5f34607db5cbb6705f93048b85a" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" dependencies = [ "anyhow", "async-trait", @@ -3165,7 +3088,7 @@ dependencies = [ [[package]] name = "matrix-sdk-sqlite" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=1380af4f005ee5f34607db5cbb6705f93048b85a#1380af4f005ee5f34607db5cbb6705f93048b85a" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" dependencies = [ "async-trait", "deadpool-sqlite", @@ -3187,7 +3110,7 @@ dependencies = [ [[package]] name = "matrix-sdk-store-encryption" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=1380af4f005ee5f34607db5cbb6705f93048b85a#1380af4f005ee5f34607db5cbb6705f93048b85a" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" dependencies = [ "base64 0.22.1", "blake3", @@ -3228,7 +3151,7 @@ dependencies = [ [[package]] name = "matrix-sdk-test" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=1380af4f005ee5f34607db5cbb6705f93048b85a#1380af4f005ee5f34607db5cbb6705f93048b85a" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" dependencies = [ "ctor", "getrandom", @@ -3246,7 +3169,7 @@ dependencies = [ [[package]] name = "matrix-sdk-test-macros" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=1380af4f005ee5f34607db5cbb6705f93048b85a#1380af4f005ee5f34607db5cbb6705f93048b85a" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" dependencies = [ "quote 1.0.35", "syn 2.0.64", @@ -3255,7 +3178,7 @@ dependencies = [ [[package]] name = "matrix-sdk-ui" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=1380af4f005ee5f34607db5cbb6705f93048b85a#1380af4f005ee5f34607db5cbb6705f93048b85a" +source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" dependencies = [ "as_variant", "async-once-cell", @@ -3270,6 +3193,7 @@ dependencies = [ "futures-core", "futures-util", "fuzzy-matcher", + "growable-bloom-filter", "imbl", "indexmap 2.2.5", "itertools 0.12.0", @@ -3285,7 +3209,6 @@ dependencies = [ "tokio", "tracing", "unicode-normalization", - "url", ] [[package]] @@ -3413,49 +3336,12 @@ dependencies = [ "winapi", ] -[[package]] -name = "num-bigint-dig" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" -dependencies = [ - "byteorder", - "lazy_static", - "libm", - "num-integer", - "num-iter", - "num-traits", - "rand 0.8.5", - "smallvec", - "zeroize", -] - [[package]] name = "num-conv" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg 1.1.0", - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.15" @@ -3463,7 +3349,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg 1.1.0", - "libm", ] [[package]] @@ -3482,25 +3367,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" -[[package]] -name = "oauth2" -version = "5.0.0-alpha.4" -source = "git+https://github.com/poljar/oauth2-rs?rev=f8e28ce5a7f3278ac85b8593ecdd86f2cf51fa2e#f8e28ce5a7f3278ac85b8593ecdd86f2cf51fa2e" -dependencies = [ - "base64 0.22.1", - "chrono", - "getrandom", - "http 1.1.0", - "rand 0.8.5", - "reqwest", - "serde", - "serde_json", - "serde_path_to_error", - "sha2", - "thiserror", - "url", -] - [[package]] name = "object" version = "0.31.1" @@ -3528,36 +3394,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openidconnect" -version = "4.0.0-alpha.2" -source = "git+https://github.com/poljar/openidconnect-rs?rev=c7e1dc31b83dd7559125984bfd36b9c0f191585e#c7e1dc31b83dd7559125984bfd36b9c0f191585e" -dependencies = [ - "base64 0.21.7", - "chrono", - "dyn-clone", - "ed25519-dalek", - "hmac", - "http 1.1.0", - "itertools 0.10.5", - "log", - "oauth2", - "p256", - "p384", - "rand 0.8.5", - "rsa", - "serde", - "serde-value", - "serde_json", - "serde_path_to_error", - "serde_plain", - "serde_with 3.8.1", - "sha2", - "subtle", - "thiserror", - "url", -] - [[package]] name = "openssl" version = "0.10.55" @@ -3612,15 +3448,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "ordered-float" -version = "2.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" -dependencies = [ - "num-traits", -] - [[package]] name = "os_str_bytes" version = "6.5.1" @@ -3644,30 +3471,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "p256" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" -dependencies = [ - "ecdsa", - "elliptic-curve", - "primeorder", - "sha2", -] - -[[package]] -name = "p384" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" -dependencies = [ - "ecdsa", - "elliptic-curve", - "primeorder", - "sha2", -] - [[package]] name = "parking" version = "2.1.0" @@ -3728,15 +3531,6 @@ dependencies = [ "hmac", ] -[[package]] -name = "pem-rfc7468" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" -dependencies = [ - "base64ct", -] - [[package]] name = "percent-encoding" version = "2.3.1" @@ -3891,17 +3685,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkcs1" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" -dependencies = [ - "der", - "pkcs8", - "spki", -] - [[package]] name = "pkcs7" version = "0.4.1" @@ -3964,15 +3747,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -[[package]] -name = "primeorder" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" -dependencies = [ - "elliptic-curve", -] - [[package]] name = "proc-macro-crate" version = "3.1.0" @@ -4069,9 +3843,9 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.10.3" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76979bea66e7875e7509c4ec5300112b316af87fa7a252ca91c448b32dfe3993" +checksum = "8746739f11d39ce5ad5c2520a9b75285310dbfe78c541ccf832d38615765aec0" dependencies = [ "bitflags 2.4.2", "memchr", @@ -4081,9 +3855,9 @@ dependencies = [ [[package]] name = "pulldown-cmark-escape" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd348ff538bc9caeda7ee8cad2d1d48236a1f443c1fa3913c6a02fe0043b1dd3" +checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae" [[package]] name = "quote" @@ -4400,16 +4174,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - [[package]] name = "ring" version = "0.17.5" @@ -4419,7 +4183,7 @@ dependencies = [ "cc", "getrandom", "libc", - "spin 0.9.8", + "spin", "untrusted", "windows-sys 0.48.0", ] @@ -4446,30 +4210,10 @@ dependencies = [ "serde", ] -[[package]] -name = "rsa" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" -dependencies = [ - "const-oid", - "digest", - "num-bigint-dig", - "num-integer", - "num-traits", - "pkcs1", - "pkcs8", - "rand_core 0.6.4", - "signature", - "spki", - "subtle", - "zeroize", -] - [[package]] name = "ruma" version = "0.10.1" -source = "git+https://github.com/Hywan/ruma?branch=feat-sliding-sync-list-include-heroes#3d56fa8e83d04577bde5d585f6d1c709ca5d724e" +source = "git+https://github.com/ruma/ruma?rev=e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0#e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" dependencies = [ "assign", "js_int", @@ -4485,7 +4229,7 @@ dependencies = [ [[package]] name = "ruma-client-api" version = "0.18.0" -source = "git+https://github.com/Hywan/ruma?branch=feat-sliding-sync-list-include-heroes#3d56fa8e83d04577bde5d585f6d1c709ca5d724e" +source = "git+https://github.com/ruma/ruma?rev=e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0#e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" dependencies = [ "as_variant", "assign", @@ -4508,7 +4252,7 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.13.0" -source = "git+https://github.com/Hywan/ruma?branch=feat-sliding-sync-list-include-heroes#3d56fa8e83d04577bde5d585f6d1c709ca5d724e" +source = "git+https://github.com/ruma/ruma?rev=e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0#e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" dependencies = [ "as_variant", "base64 0.22.1", @@ -4540,14 +4284,14 @@ dependencies = [ [[package]] name = "ruma-events" version = "0.28.1" -source = "git+https://github.com/Hywan/ruma?branch=feat-sliding-sync-list-include-heroes#3d56fa8e83d04577bde5d585f6d1c709ca5d724e" +source = "git+https://github.com/ruma/ruma?rev=e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0#e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" dependencies = [ "as_variant", "indexmap 2.2.5", "js_int", "js_option", "percent-encoding", - "pulldown-cmark 0.10.3", + "pulldown-cmark 0.11.0", "regex", "ruma-common", "ruma-html", @@ -4564,7 +4308,7 @@ dependencies = [ [[package]] name = "ruma-federation-api" version = "0.9.0" -source = "git+https://github.com/Hywan/ruma?branch=feat-sliding-sync-list-include-heroes#3d56fa8e83d04577bde5d585f6d1c709ca5d724e" +source = "git+https://github.com/ruma/ruma?rev=e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0#e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" dependencies = [ "js_int", "ruma-common", @@ -4576,7 +4320,7 @@ dependencies = [ [[package]] name = "ruma-html" version = "0.2.0" -source = "git+https://github.com/Hywan/ruma?branch=feat-sliding-sync-list-include-heroes#3d56fa8e83d04577bde5d585f6d1c709ca5d724e" +source = "git+https://github.com/ruma/ruma?rev=e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0#e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" dependencies = [ "as_variant", "html5ever", @@ -4588,7 +4332,7 @@ dependencies = [ [[package]] name = "ruma-identifiers-validation" version = "0.9.5" -source = "git+https://github.com/Hywan/ruma?branch=feat-sliding-sync-list-include-heroes#3d56fa8e83d04577bde5d585f6d1c709ca5d724e" +source = "git+https://github.com/ruma/ruma?rev=e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0#e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" dependencies = [ "js_int", "thiserror", @@ -4597,7 +4341,7 @@ dependencies = [ [[package]] name = "ruma-macros" version = "0.13.0" -source = "git+https://github.com/Hywan/ruma?branch=feat-sliding-sync-list-include-heroes#3d56fa8e83d04577bde5d585f6d1c709ca5d724e" +source = "git+https://github.com/ruma/ruma?rev=e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0#e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" dependencies = [ "once_cell", "proc-macro-crate", @@ -4782,20 +4526,6 @@ dependencies = [ "syn 2.0.64", ] -[[package]] -name = "sec1" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "subtle", - "zeroize", -] - [[package]] name = "security-framework" version = "2.9.2" @@ -4837,16 +4567,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-value" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" -dependencies = [ - "ordered-float", - "serde", -] - [[package]] name = "serde-wasm-bindgen" version = "0.6.3" @@ -4902,25 +4622,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_path_to_error" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" -dependencies = [ - "itoa", - "serde", -] - -[[package]] -name = "serde_plain" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1fc6db65a611022b23a0dec6975d63fb80a302cb3388835ff02c097258d50" -dependencies = [ - "serde", -] - [[package]] name = "serde_repr" version = "0.1.13" @@ -4960,25 +4661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" dependencies = [ "serde", - "serde_with_macros 1.5.2", -] - -[[package]] -name = "serde_with" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" -dependencies = [ - "base64 0.22.1", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.2.5", - "serde", - "serde_derive", - "serde_json", - "serde_with_macros 3.8.1", - "time", + "serde_with_macros", ] [[package]] @@ -4993,18 +4676,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "serde_with_macros" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" -dependencies = [ - "darling 0.20.6", - "proc-macro2 1.0.82", - "quote 1.0.35", - "syn 2.0.64", -] - [[package]] name = "sha2" version = "0.10.8" @@ -5067,7 +4738,6 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest", "rand_core 0.6.4", ] @@ -5118,12 +4788,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -6553,6 +6217,12 @@ dependencies = [ "home", ] +[[package]] +name = "xxhash-rust" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03" + [[package]] name = "zerocopy" version = "0.7.32" diff --git a/Cargo.toml b/Cargo.toml index 204f08cfdb7d..7451d709a643 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,57 +9,57 @@ default-members = ["native/acter"] [workspace.dependencies.matrix-sdk] git = "https://github.com/matrix-org/matrix-rust-sdk" -rev = "1380af4f005ee5f34607db5cbb6705f93048b85a" +rev = "6464d218133717617310e23b3f3025a075bb87c2" default-features = false features = ["experimental-sliding-sync"] [workspace.dependencies.matrix-sdk-base] git = "https://github.com/matrix-org/matrix-rust-sdk" -rev = "1380af4f005ee5f34607db5cbb6705f93048b85a" +rev = "6464d218133717617310e23b3f3025a075bb87c2" default-features = false [workspace.dependencies.matrix-sdk-sqlite] git = "https://github.com/matrix-org/matrix-rust-sdk" -rev = "1380af4f005ee5f34607db5cbb6705f93048b85a" +rev = "6464d218133717617310e23b3f3025a075bb87c2" default-features = false features = ["crypto-store", "state-store"] [workspace.dependencies.matrix-sdk-store-encryption] git = "https://github.com/matrix-org/matrix-rust-sdk" -rev = "1380af4f005ee5f34607db5cbb6705f93048b85a" +rev = "6464d218133717617310e23b3f3025a075bb87c2" default-features = false [workspace.dependencies.matrix-sdk-test] git = "https://github.com/matrix-org/matrix-rust-sdk" -rev = "1380af4f005ee5f34607db5cbb6705f93048b85a" +rev = "6464d218133717617310e23b3f3025a075bb87c2" default-features = false [workspace.dependencies.matrix-sdk-ui] git = "https://github.com/matrix-org/matrix-rust-sdk" -rev = "1380af4f005ee5f34607db5cbb6705f93048b85a" +rev = "6464d218133717617310e23b3f3025a075bb87c2" default-features = false features = ["e2e-encryption"] [workspace.dependencies.ruma] -git = "https://github.com/Hywan/ruma" -branch = "feat-sliding-sync-list-include-heroes" +git = "https://github.com/ruma/ruma" +rev = "e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" features = ["client-api-c", "compat-upload-signatures", "compat-user-id", "compat-arbitrary-length-ids", "unstable-msc3401"] [workspace.dependencies.ruma-client-api] -git = "https://github.com/Hywan/ruma" -branch = "feat-sliding-sync-list-include-heroes" +git = "https://github.com/ruma/ruma" +rev = "e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" [workspace.dependencies.ruma-common] -git = "https://github.com/Hywan/ruma" -branch = "feat-sliding-sync-list-include-heroes" +git = "https://github.com/ruma/ruma" +rev = "e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" [workspace.dependencies.ruma-events] -git = "https://github.com/Hywan/ruma" -branch = "feat-sliding-sync-list-include-heroes" +git = "https://github.com/ruma/ruma" +rev = "e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" [workspace.dependencies.ruma-macros] -git = "https://github.com/Hywan/ruma" -branch = "feat-sliding-sync-list-include-heroes" +git = "https://github.com/ruma/ruma" +rev = "e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" [workspace.dependencies.url] version = "2.5.0" diff --git a/app/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart b/app/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart index 1104fa87c892..65d38d2d6bba 100644 --- a/app/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart +++ b/app/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart @@ -5680,94 +5680,6 @@ class Api { return tmp7; } - bool? __timelineStreamRetrySendFuturePoll( - int boxed, - int postCobject, - int port, - ) { - final tmp0 = boxed; - final tmp2 = postCobject; - final tmp4 = port; - var tmp1 = 0; - var tmp3 = 0; - var tmp5 = 0; - tmp1 = tmp0; - tmp3 = tmp2; - tmp5 = tmp4; - final tmp6 = _timelineStreamRetrySendFuturePoll( - tmp1, - tmp3, - tmp5, - ); - final tmp8 = tmp6.arg0; - final tmp9 = tmp6.arg1; - final tmp10 = tmp6.arg2; - final tmp11 = tmp6.arg3; - final tmp12 = tmp6.arg4; - final tmp13 = tmp6.arg5; - if (tmp8 == 0) { - return null; - } - if (tmp9 == 0) { - debugAllocation("handle error", tmp10, tmp11); - final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); - final tmp9_0 = - utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); - if (tmp11 > 0) { - final ffi.Pointer tmp10_0; - tmp10_0 = ffi.Pointer.fromAddress(tmp10); - this.__deallocate(tmp10_0, tmp12, 1); - } - throw tmp9_0; - } - final tmp7 = tmp13 > 0; - return tmp7; - } - - bool? __timelineStreamCancelSendFuturePoll( - int boxed, - int postCobject, - int port, - ) { - final tmp0 = boxed; - final tmp2 = postCobject; - final tmp4 = port; - var tmp1 = 0; - var tmp3 = 0; - var tmp5 = 0; - tmp1 = tmp0; - tmp3 = tmp2; - tmp5 = tmp4; - final tmp6 = _timelineStreamCancelSendFuturePoll( - tmp1, - tmp3, - tmp5, - ); - final tmp8 = tmp6.arg0; - final tmp9 = tmp6.arg1; - final tmp10 = tmp6.arg2; - final tmp11 = tmp6.arg3; - final tmp12 = tmp6.arg4; - final tmp13 = tmp6.arg5; - if (tmp8 == 0) { - return null; - } - if (tmp9 == 0) { - debugAllocation("handle error", tmp10, tmp11); - final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); - final tmp9_0 = - utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); - if (tmp11 > 0) { - final ffi.Pointer tmp10_0; - tmp10_0 = ffi.Pointer.fromAddress(tmp10); - this.__deallocate(tmp10_0, tmp12, 1); - } - throw tmp9_0; - } - final tmp7 = tmp13 > 0; - return tmp7; - } - SpaceRelations? __convoSpaceRelationsFuturePoll( int boxed, int postCobject, @@ -20366,39 +20278,6 @@ class Api { int, int, )>(); - late final _timelineStreamRetrySendPtr = _lookup< - ffi.NativeFunction< - ffi.Int64 Function( - ffi.Int64, - ffi.Int64, - ffi.Uint64, - ffi.Uint64, - )>>("__TimelineStream_retry_send"); - - late final _timelineStreamRetrySend = _timelineStreamRetrySendPtr.asFunction< - int Function( - int, - int, - int, - int, - )>(); - late final _timelineStreamCancelSendPtr = _lookup< - ffi.NativeFunction< - ffi.Int64 Function( - ffi.Int64, - ffi.Int64, - ffi.Uint64, - ffi.Uint64, - )>>("__TimelineStream_cancel_send"); - - late final _timelineStreamCancelSend = - _timelineStreamCancelSendPtr.asFunction< - int Function( - int, - int, - int, - int, - )>(); late final _convoGetProfilePtr = _lookup< ffi.NativeFunction< ffi.Int64 Function( @@ -28633,36 +28512,6 @@ class Api { int, int, )>(); - late final _timelineStreamRetrySendFuturePollPtr = _lookup< - ffi.NativeFunction< - _TimelineStreamRetrySendFuturePollReturn Function( - ffi.Int64, - ffi.Int64, - ffi.Int64, - )>>("__TimelineStream_retry_send_future_poll"); - - late final _timelineStreamRetrySendFuturePoll = - _timelineStreamRetrySendFuturePollPtr.asFunction< - _TimelineStreamRetrySendFuturePollReturn Function( - int, - int, - int, - )>(); - late final _timelineStreamCancelSendFuturePollPtr = _lookup< - ffi.NativeFunction< - _TimelineStreamCancelSendFuturePollReturn Function( - ffi.Int64, - ffi.Int64, - ffi.Int64, - )>>("__TimelineStream_cancel_send_future_poll"); - - late final _timelineStreamCancelSendFuturePoll = - _timelineStreamCancelSendFuturePollPtr.asFunction< - _TimelineStreamCancelSendFuturePollReturn Function( - int, - int, - int, - )>(); late final _convoSpaceRelationsFuturePollPtr = _lookup< ffi.NativeFunction< _ConvoSpaceRelationsFuturePollReturn Function( @@ -42026,74 +41875,6 @@ class TimelineStream { return tmp10; } - /// retry local echo message send - Future retrySend( - String txnId, - ) { - final tmp1 = txnId; - var tmp0 = 0; - var tmp2 = 0; - var tmp3 = 0; - var tmp4 = 0; - tmp0 = _box.borrow(); - final tmp1_0 = utf8.encode(tmp1); - tmp3 = tmp1_0.length; - - final ffi.Pointer tmp2_0 = _api.__allocate(tmp3 * 1, 1); - final Uint8List tmp2_1 = tmp2_0.asTypedList(tmp3); - tmp2_1.setAll(0, tmp1_0); - tmp2 = tmp2_0.address; - tmp4 = tmp3; - final tmp5 = _api._timelineStreamRetrySend( - tmp0, - tmp2, - tmp3, - tmp4, - ); - final tmp7 = tmp5; - final ffi.Pointer tmp7_0 = ffi.Pointer.fromAddress(tmp7); - final tmp7_1 = - _Box(_api, tmp7_0, "__TimelineStream_retry_send_future_drop"); - tmp7_1._finalizer = _api._registerFinalizer(tmp7_1); - final tmp6 = - _nativeFuture(tmp7_1, _api.__timelineStreamRetrySendFuturePoll); - return tmp6; - } - - /// cancel local echo message - Future cancelSend( - String txnId, - ) { - final tmp1 = txnId; - var tmp0 = 0; - var tmp2 = 0; - var tmp3 = 0; - var tmp4 = 0; - tmp0 = _box.borrow(); - final tmp1_0 = utf8.encode(tmp1); - tmp3 = tmp1_0.length; - - final ffi.Pointer tmp2_0 = _api.__allocate(tmp3 * 1, 1); - final Uint8List tmp2_1 = tmp2_0.asTypedList(tmp3); - tmp2_1.setAll(0, tmp1_0); - tmp2 = tmp2_0.address; - tmp4 = tmp3; - final tmp5 = _api._timelineStreamCancelSend( - tmp0, - tmp2, - tmp3, - tmp4, - ); - final tmp7 = tmp5; - final ffi.Pointer tmp7_0 = ffi.Pointer.fromAddress(tmp7); - final tmp7_1 = - _Box(_api, tmp7_0, "__TimelineStream_cancel_send_future_drop"); - tmp7_1._finalizer = _api._registerFinalizer(tmp7_1); - final tmp6 = - _nativeFuture(tmp7_1, _api.__timelineStreamCancelSendFuturePoll); - return tmp6; - } - /// Manually drops the object and unregisters the FinalizableHandle. void drop() { _box.drop(); @@ -60017,36 +59798,6 @@ class _TimelineStreamToggleReactionFuturePollReturn extends ffi.Struct { external int arg5; } -class _TimelineStreamRetrySendFuturePollReturn extends ffi.Struct { - @ffi.Uint8() - external int arg0; - @ffi.Uint8() - external int arg1; - @ffi.Int64() - external int arg2; - @ffi.Uint64() - external int arg3; - @ffi.Uint64() - external int arg4; - @ffi.Uint8() - external int arg5; -} - -class _TimelineStreamCancelSendFuturePollReturn extends ffi.Struct { - @ffi.Uint8() - external int arg0; - @ffi.Uint8() - external int arg1; - @ffi.Int64() - external int arg2; - @ffi.Uint64() - external int arg3; - @ffi.Uint64() - external int arg4; - @ffi.Uint8() - external int arg5; -} - class _ConvoSpaceRelationsFuturePollReturn extends ffi.Struct { @ffi.Uint8() external int arg0; diff --git a/native/acter/api.rsh b/native/acter/api.rsh index 578a3e92fdda..85e357f43b85 100644 --- a/native/acter/api.rsh +++ b/native/acter/api.rsh @@ -1205,11 +1205,6 @@ object TimelineStream { /// if sent twice, reaction is redacted fn toggle_reaction(event_id: string, key: string) -> Future>; - /// retry local echo message send - fn retry_send(txn_id: string) -> Future>; - - /// cancel local echo message - fn cancel_send(txn_id: string) -> Future>; } diff --git a/native/acter/src/api/common.rs b/native/acter/src/api/common.rs index 6effca8120e8..f330a9f18b56 100644 --- a/native/acter/src/api/common.rs +++ b/native/acter/src/api/common.rs @@ -9,17 +9,14 @@ use matrix_sdk::media::{MediaFormat, MediaThumbnailSize}; use ruma::UInt; use ruma_client_api::media::get_content_thumbnail; use ruma_common::{EventId, MilliSecondsSinceUnixEpoch, OwnedDeviceId, OwnedMxcUri, OwnedUserId}; -use ruma_events::{ - room::{ - message::{ - AudioInfo, AudioMessageEventContent, EmoteMessageEventContent, FileInfo, - FileMessageEventContent, ImageMessageEventContent, LocationInfo, - LocationMessageEventContent, TextMessageEventContent, UnstableAudioDetailsContentBlock, - VideoInfo, VideoMessageEventContent, - }, - ImageInfo, MediaSource as SdkMediaSource, ThumbnailInfo as SdkThumbnailInfo, +use ruma_events::room::{ + message::{ + AudioInfo, AudioMessageEventContent, EmoteMessageEventContent, FileInfo, + FileMessageEventContent, ImageMessageEventContent, LocationInfo, + LocationMessageEventContent, TextMessageEventContent, UnstableAudioDetailsContentBlock, + VideoInfo, VideoMessageEventContent, }, - sticker::StickerEventContent, + ImageInfo, MediaSource as SdkMediaSource, ThumbnailInfo as SdkThumbnailInfo, }; use serde::{Deserialize, Serialize}; use std::str::FromStr; @@ -227,16 +224,6 @@ impl From<&EmoteMessageEventContent> for MsgContent { } } -impl From<&StickerEventContent> for MsgContent { - fn from(value: &StickerEventContent) -> Self { - MsgContent::Image { - body: value.body.clone(), - source: SdkMediaSource::Plain(value.url.clone()), - info: Some(value.info.clone()), - } - } -} - impl From<&AttachmentContent> for MsgContent { fn from(value: &AttachmentContent) -> Self { match value { diff --git a/native/acter/src/api/message.rs b/native/acter/src/api/message.rs index 07bafc2ddf4b..ece927ef47b8 100644 --- a/native/acter/src/api/message.rs +++ b/native/acter/src/api/message.rs @@ -25,8 +25,10 @@ impl EventSendState { fn new(inner: &SdkEventSendState) -> Self { let (state, error, event_id) = match inner { SdkEventSendState::NotSentYet => ("NotSentYet".to_string(), None, None), - SdkEventSendState::Cancelled => ("Cancelled".to_string(), None, None), - SdkEventSendState::SendingFailed { error } => ( + SdkEventSendState::SendingFailed { + error, + is_recoverable, + } => ( "SendingFailed".to_string(), Some(error.to_owned().to_string()), None, @@ -150,7 +152,8 @@ impl RoomEventItem { } TimelineItemContent::Sticker(s) => { me.event_type("m.sticker".to_string()); - me.msg_content(Some(MsgContent::from(s.content()))); + // FIXME: proper sticker support needed + // me.msg_content(Some(MsgContent::from(s.content()))); } TimelineItemContent::UnableToDecrypt(encrypted_msg) => { info!("Edit event applies to event that couldn't be decrypted"); @@ -285,6 +288,9 @@ impl RoomEventItem { TimelineItemContent::CallInvite => { me.event_type("m.call_invite".to_owned()); } + TimelineItemContent::CallNotify => { + me.event_type("m.call_notify".to_owned()); + } }; me.build().expect("Building Room Event doesn't fail") } diff --git a/native/acter/src/api/profile.rs b/native/acter/src/api/profile.rs index f45f8c24a67c..3ca9c1f40644 100644 --- a/native/acter/src/api/profile.rs +++ b/native/acter/src/api/profile.rs @@ -138,7 +138,7 @@ impl RoomProfile { let room = self.room.clone(); RUNTIME .spawn(async move { - let result = room.computed_display_name().await?; + let result = room.compute_display_name().await?; match result { DisplayName::Named(name) => Ok(OptionString::new(Some(name))), DisplayName::Aliased(name) => Ok(OptionString::new(Some(name))), diff --git a/native/acter/src/api/stream.rs b/native/acter/src/api/stream.rs index 2e0dbe65ce29..8deba04d7005 100644 --- a/native/acter/src/api/stream.rs +++ b/native/acter/src/api/stream.rs @@ -145,14 +145,11 @@ impl TimelineStream { } let edit_item = timeline - .item_by_event_id(&event_id) + .edit_info_from_event_id(&event_id) .await .context("Not found which item would be edited")?; - if !edit_item.can_be_edited() { - bail!("This event item cannot be edited"); - } let new_content = draft.into_room_msg(&room).await?; - timeline.edit(new_content, &edit_item).await?; + timeline.edit(new_content, edit_item).await?; Ok(true) }) .await? @@ -177,17 +174,14 @@ impl TimelineStream { bail!("No permissions to send message in this room"); } let reply_item = timeline - .item_by_event_id(&event_id) + .replied_to_info_from_event_id(&event_id) .await .context("Not found which item would be replied to")?; - if !reply_item.can_be_replied_to() { - bail!("This event item cannot be replied to"); - } let content = draft.into_room_msg(&room).await?; timeline .send_reply( content.with_relation(None).into(), - &reply_item, + reply_item, ForwardThread::Yes, ) .await?; @@ -313,48 +307,6 @@ impl TimelineStream { }) .await? } - - pub async fn retry_send(&self, txn_id: String) -> Result { - let timeline = self.timeline.clone(); - let txn_id = OwnedTransactionId::from(txn_id); - - let room = self.room.clone(); - let my_id = self.room.user_id()?; - - RUNTIME - .spawn(async move { - let permitted = room - .can_user_send_message(&my_id, MessageLikeEventType::RoomMessage) - .await?; - if !permitted { - bail!("No permissions to send message in this room"); - } - timeline.retry_send(&txn_id).await?; - Ok(true) - }) - .await? - } - - pub async fn cancel_send(&self, txn_id: String) -> Result { - let timeline = self.timeline.clone(); - let txn_id = OwnedTransactionId::from(txn_id); - - let room = self.room.clone(); - let my_id = self.room.user_id()?; - - RUNTIME - .spawn(async move { - let permitted = room - .can_user_send_message(&my_id, MessageLikeEventType::RoomMessage) - .await?; - if !permitted { - bail!("No permissions to send message in this room"); - } - timeline.cancel_send(&txn_id).await; - Ok(true) - }) - .await? - } } impl Client { diff --git a/native/acter/src/api/verification.rs b/native/acter/src/api/verification.rs index 2c12785cfd4a..6041f6bb58af 100644 --- a/native/acter/src/api/verification.rs +++ b/native/acter/src/api/verification.rs @@ -662,6 +662,7 @@ async fn sas_verification_handler( error!("Dropping flow for {}: {}", flow_id, e); } } + SasState::Created { protocols } => {} // FIXME: Is there anything for us to do here? } } Ok(()) diff --git a/native/media-cache-wrapper/src/lib.rs b/native/media-cache-wrapper/src/lib.rs index 79d4c430c238..c7946ab6b66a 100644 --- a/native/media-cache-wrapper/src/lib.rs +++ b/native/media-cache-wrapper/src/lib.rs @@ -4,12 +4,15 @@ use core::fmt::Debug; use matrix_sdk_base::{ deserialized_responses::RawAnySyncOrStrippedState, media::{MediaRequest, UniqueKey}, - store::StoreEncryptionError, + store::{QueuedEvent, SerializableEventContent, StoreEncryptionError}, MinimalRoomMemberEvent, RoomInfo, RoomMemberships, StateChanges, StateStore, StateStoreDataKey, StateStoreDataValue, StoreError, }; use matrix_sdk_store_encryption::StoreCipher; -use ruma_common::{serde::Raw, EventId, MxcUri, OwnedEventId, OwnedUserId, RoomId, UserId}; +use ruma_common::{ + serde::Raw, EventId, MxcUri, OwnedEventId, OwnedRoomId, OwnedTransactionId, OwnedUserId, + RoomId, TransactionId, UserId, +}; use ruma_events::{ presence::PresenceEvent, receipt::{Receipt, ReceiptThread, ReceiptType}, @@ -573,6 +576,99 @@ where .map_err(|e| StoreCacheWrapperError::StoreError(e.into()))?) } + /// Save an event to be sent by a send queue later. + /// + /// # Arguments + /// + /// * `room_id` - The `RoomId` of the send queue's room. + /// * `transaction_id` - The unique key identifying the event to be sent + /// (and its transaction). Note: this is expected to be randomly generated + /// and thus unique. + /// * `content` - Serializable event content to be sent. + async fn save_send_queue_event( + &self, + room_id: &RoomId, + transaction_id: OwnedTransactionId, + content: SerializableEventContent, + ) -> Result<(), Self::Error> { + Ok(self + .inner + .save_send_queue_event(room_id, transaction_id, content) + .await + .map_err(|e| StoreCacheWrapperError::StoreError(e.into()))?) + } + + /// Updates a send queue event with the given content, and resets its wedged + /// status to false. + /// + /// # Arguments + /// + /// * `room_id` - The `RoomId` of the send queue's room. + /// * `transaction_id` - The unique key identifying the event to be sent + /// (and its transaction). + /// * `content` - Serializable event content to replace the original one. + async fn update_send_queue_event( + &self, + room_id: &RoomId, + transaction_id: &TransactionId, + content: SerializableEventContent, + ) -> Result<(), Self::Error> { + Ok(self + .inner + .update_send_queue_event(room_id, transaction_id, content) + .await + .map_err(|e| StoreCacheWrapperError::StoreError(e.into()))?) + } + + /// Remove an event previously inserted with [`Self::save_send_queue_event`] + /// from the database, based on its transaction id. + async fn remove_send_queue_event( + &self, + room_id: &RoomId, + transaction_id: &TransactionId, + ) -> Result<(), Self::Error> { + Ok(self + .inner + .remove_send_queue_event(room_id, transaction_id) + .await + .map_err(|e| StoreCacheWrapperError::StoreError(e.into()))?) + } + + /// Loads all the send queue events for the given room. + async fn load_send_queue_events( + &self, + room_id: &RoomId, + ) -> Result, Self::Error> { + Ok(self + .inner + .load_send_queue_events(room_id) + .await + .map_err(|e| StoreCacheWrapperError::StoreError(e.into()))?) + } + + /// Updates the send queue wedged status for a given send queue event. + async fn update_send_queue_event_status( + &self, + room_id: &RoomId, + transaction_id: &TransactionId, + wedged: bool, + ) -> Result<(), Self::Error> { + Ok(self + .inner + .update_send_queue_event_status(room_id, transaction_id, wedged) + .await + .map_err(|e| StoreCacheWrapperError::StoreError(e.into()))?) + } + + /// Loads all the rooms which have any pending events in their send queue. + async fn load_rooms_with_unsent_events(&self) -> Result, Self::Error> { + Ok(self + .inner + .load_rooms_with_unsent_events() + .await + .map_err(|e| StoreCacheWrapperError::StoreError(e.into()))?) + } + // All the media stuff! async fn add_media_content( From 1c61af8cf6000dcbac7414cdd9d988029cd891dd Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Fri, 28 Jun 2024 19:07:32 +0530 Subject: [PATCH 02/14] Update to new retry-sending facilities --- .../widgets/message_metadata_builder.dart | 47 +------------------ app/lib/l10n/app_en.arb | 1 + 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/app/lib/features/chat/widgets/message_metadata_builder.dart b/app/lib/features/chat/widgets/message_metadata_builder.dart index 6a30f68225cc..c2b0f75b9b2b 100644 --- a/app/lib/features/chat/widgets/message_metadata_builder.dart +++ b/app/lib/features/chat/widgets/message_metadata_builder.dart @@ -41,27 +41,7 @@ class MessageMetadataBuilder extends ConsumerWidget { case 'SendingFailed': return Row( children: [ - GestureDetector( - onTap: () => _handleCancelRetrySend(context, ref), - child: Text( - L10n.of(context).cancelSend, - style: Theme.of(context).textTheme.labelSmall!.copyWith( - color: Theme.of(context).colorScheme.onSurface, - decoration: TextDecoration.underline, - ), - ), - ), - const SizedBox(width: 10), - GestureDetector( - onTap: () => _handleRetry(context, ref), - child: Text( - L10n.of(context).retry, - style: Theme.of(context).textTheme.labelSmall!.copyWith( - color: Theme.of(context).colorScheme.onSurface, - decoration: TextDecoration.underline, - ), - ), - ), + Text(L10n.of(context).chatSendingFailed), const SizedBox(width: 5), Icon( Atlas.warning_thin, @@ -77,31 +57,6 @@ class MessageMetadataBuilder extends ConsumerWidget { return const SizedBox.shrink(); } } - - Future _handleRetry(BuildContext context, WidgetRef ref) async { - try { - final stream = ref.read(timelineStreamProvider(convo)); - // attempts to retry sending local echo to server - await stream.retrySend(message.id); - } catch (e) { - // ignore: use_build_context_synchronously - EasyLoading.showError(L10n.of(context).failedToSend(e)); - } - } - - Future _handleCancelRetrySend( - BuildContext context, - WidgetRef ref, - ) async { - try { - final stream = ref.read(timelineStreamProvider(convo)); - // cancels the retry sending of local echos - await stream.cancelSend(message.id); - } catch (e) { - // ignore: use_build_context_synchronously - EasyLoading.showError(L10n.of(context).failedToSend(e)); - } - } } class _UserReceiptsWidget extends ConsumerWidget { diff --git a/app/lib/l10n/app_en.arb b/app/lib/l10n/app_en.arb index 9b292238f1dc..1c4b29fa0a26 100644 --- a/app/lib/l10n/app_en.arb +++ b/app/lib/l10n/app_en.arb @@ -162,6 +162,7 @@ "@settingsSubmittingFailed": {}, "chatRoomCreated": "Chat Created", "@chatRoomCreated": {}, + "chatSendingFailed": "Failed to sent. Will retry ...", "chatSettingsTyping": "Send typing notifications", "@chatSettingsTyping": {}, "chatSettingsTypingExplainer": "(soon) Inform others when you are typing", From 88ea4fd656b50435671ee527b7d36c27c79f2ae3 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Fri, 28 Jun 2024 21:59:04 +0530 Subject: [PATCH 03/14] Simplify media store limiting by using the semaphore directly --- native/media-cache-wrapper/Cargo.toml | 4 +-- native/media-cache-wrapper/src/queued.rs | 39 ++++++++---------------- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/native/media-cache-wrapper/Cargo.toml b/native/media-cache-wrapper/Cargo.toml index 9844836d8fcf..8e26a52d8f8d 100644 --- a/native/media-cache-wrapper/Cargo.toml +++ b/native/media-cache-wrapper/Cargo.toml @@ -11,7 +11,7 @@ readme = "Readme.md" license = "MIT OR Apache-2.0" [features] -queued = ["dep:deadqueue"] +queued = ["dep:tokio"] default = ["queued"] [dependencies] @@ -24,7 +24,7 @@ ruma-common = { workspace = true } ruma-events = { workspace = true } serde_json = "1" tracing = "0.1.40" -deadqueue = { version = "0.2.4", features = ["limited"], optional = true } +tokio = { version = "1.38.0", features = ["sync"], default-features = false, optional = true } [dev-dependencies] anyhow = "1.0.79" diff --git a/native/media-cache-wrapper/src/queued.rs b/native/media-cache-wrapper/src/queued.rs index 6531972eace6..67bd48210f38 100644 --- a/native/media-cache-wrapper/src/queued.rs +++ b/native/media-cache-wrapper/src/queued.rs @@ -1,6 +1,7 @@ use crate::MediaStore; +use std::sync::Arc; use async_trait::async_trait; -use deadqueue::limited::Queue; +use tokio::sync::Semaphore; use matrix_sdk_base::media::MediaRequest; use ruma_common::MxcUri; use tracing::instrument; @@ -11,7 +12,7 @@ where T: MediaStore, { inner: T, - queue: Queue<()>, + queue: Arc, } impl QueuedMediaStore @@ -21,7 +22,7 @@ where pub fn new(store: T, queue_size: usize) -> Self { QueuedMediaStore { inner: store, - queue: Queue::new(queue_size), + queue: Arc::new(Semaphore::new(queue_size)), } } } @@ -39,12 +40,8 @@ where request: &MediaRequest, content: Vec, ) -> Result<(), Self::Error> { - self.queue.push(()).await; - let res = self.inner.add_media_content(request, content).await; - if self.queue.try_pop().is_none() { - tracing::warn!("More pop than pushed on add?"); - } - res + let _handle = self.queue.acquire().await.expect("We never close the semaphore"); + self.inner.add_media_content(request, content).await } #[instrument(skip_all)] @@ -52,31 +49,19 @@ where &self, request: &MediaRequest, ) -> Result>, Self::Error> { - self.queue.push(()).await; - let res = self.inner.get_media_content(request).await; - if self.queue.try_pop().is_none() { - tracing::warn!("More pop than pushed on get?"); - } - res + let _handle = self.queue.acquire().await.expect("We never close the semaphore"); + self.inner.get_media_content(request).await } #[instrument(skip_all)] async fn remove_media_content(&self, request: &MediaRequest) -> Result<(), Self::Error> { - self.queue.push(()).await; - let res = self.inner.remove_media_content(request).await; - if self.queue.try_pop().is_none() { - tracing::warn!("More pop than pushed on remove?"); - } - res + let _handle = self.queue.acquire().await.expect("We never close the semaphore"); + self.inner.remove_media_content(request).await } #[instrument(skip_all)] async fn remove_media_content_for_uri(&self, uri: &MxcUri) -> Result<(), Self::Error> { - self.queue.push(()).await; - let res = self.inner.remove_media_content_for_uri(uri).await; - if self.queue.try_pop().is_none() { - tracing::warn!("More pop than pushed on get?"); - } - res + let _handle = self.queue.acquire().await.expect("We never close the semaphore"); + self.inner.remove_media_content_for_uri(uri).await } } From 8772f95daed6a4aeac961d018bd8ffb2760c2aff Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Fri, 28 Jun 2024 22:27:44 +0530 Subject: [PATCH 04/14] Limit the concurrent HTTP request to 20 on mobile, 100 on desktop --- Cargo.lock | 49 ++++++++-------------------- Cargo.toml | 36 +++++++++++--------- native/acter/src/platform/android.rs | 6 ++-- native/acter/src/platform/desktop.rs | 7 ++-- native/acter/src/platform/ios.rs | 7 ++-- 5 files changed, 49 insertions(+), 56 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b973fc621d3f..410283dd316f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1184,16 +1184,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "crossbeam-queue" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" version = "0.8.16" @@ -1416,16 +1406,6 @@ dependencies = [ "deadpool-runtime", ] -[[package]] -name = "deadqueue" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16a2561fd313df162315935989dceb8c99db4ee1933358270a57a3cfb8c957f3" -dependencies = [ - "crossbeam-queue", - "tokio", -] - [[package]] name = "delegate-display" version = "2.1.1" @@ -2925,7 +2905,7 @@ dependencies = [ [[package]] name = "matrix-sdk" version = "0.7.1" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" dependencies = [ "anyhow", "anymap2", @@ -2973,7 +2953,7 @@ dependencies = [ [[package]] name = "matrix-sdk-base" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" dependencies = [ "as_variant", "async-trait", @@ -2997,7 +2977,7 @@ dependencies = [ [[package]] name = "matrix-sdk-common" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" dependencies = [ "async-trait", "futures-core", @@ -3019,7 +2999,7 @@ dependencies = [ [[package]] name = "matrix-sdk-crypto" version = "0.7.1" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" dependencies = [ "aes", "as_variant", @@ -3060,7 +3040,7 @@ dependencies = [ [[package]] name = "matrix-sdk-indexeddb" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" dependencies = [ "anyhow", "async-trait", @@ -3088,7 +3068,7 @@ dependencies = [ [[package]] name = "matrix-sdk-sqlite" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" dependencies = [ "async-trait", "deadpool-sqlite", @@ -3110,7 +3090,7 @@ dependencies = [ [[package]] name = "matrix-sdk-store-encryption" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" dependencies = [ "base64 0.22.1", "blake3", @@ -3133,7 +3113,6 @@ dependencies = [ "anyhow", "async-trait", "base64ct", - "deadqueue", "matrix-sdk-base", "matrix-sdk-sqlite", "matrix-sdk-store-encryption", @@ -3151,7 +3130,7 @@ dependencies = [ [[package]] name = "matrix-sdk-test" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" dependencies = [ "ctor", "getrandom", @@ -3169,7 +3148,7 @@ dependencies = [ [[package]] name = "matrix-sdk-test-macros" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" dependencies = [ "quote 1.0.35", "syn 2.0.64", @@ -3178,7 +3157,7 @@ dependencies = [ [[package]] name = "matrix-sdk-ui" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk?rev=6464d218133717617310e23b3f3025a075bb87c2#6464d218133717617310e23b3f3025a075bb87c2" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" dependencies = [ "as_variant", "async-once-cell", @@ -5091,9 +5070,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "bytes", @@ -5121,9 +5100,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2 1.0.82", "quote 1.0.35", diff --git a/Cargo.toml b/Cargo.toml index 7451d709a643..b969c46de31b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,38 +8,44 @@ members = [ default-members = ["native/acter"] [workspace.dependencies.matrix-sdk] -git = "https://github.com/matrix-org/matrix-rust-sdk" -rev = "6464d218133717617310e23b3f3025a075bb87c2" +git = "https://github.com/gnunicorn/matrix-rust-sdk" +branch = "ben-semaphore-for-limiting-concurrent-requests" +# path = "../matrix-rust-sdk/crates/matrix-sdk" default-features = false features = ["experimental-sliding-sync"] [workspace.dependencies.matrix-sdk-base] -git = "https://github.com/matrix-org/matrix-rust-sdk" -rev = "6464d218133717617310e23b3f3025a075bb87c2" +git = "https://github.com/gnunicorn/matrix-rust-sdk" +branch = "ben-semaphore-for-limiting-concurrent-requests" +# path = "../matrix-rust-sdk/crates/matrix-sdk-base" default-features = false [workspace.dependencies.matrix-sdk-sqlite] -git = "https://github.com/matrix-org/matrix-rust-sdk" -rev = "6464d218133717617310e23b3f3025a075bb87c2" +git = "https://github.com/gnunicorn/matrix-rust-sdk" +branch = "ben-semaphore-for-limiting-concurrent-requests" +# path = "../matrix-rust-sdk/crates/matrix-sdk-sqlite" default-features = false features = ["crypto-store", "state-store"] [workspace.dependencies.matrix-sdk-store-encryption] -git = "https://github.com/matrix-org/matrix-rust-sdk" -rev = "6464d218133717617310e23b3f3025a075bb87c2" -default-features = false - -[workspace.dependencies.matrix-sdk-test] -git = "https://github.com/matrix-org/matrix-rust-sdk" -rev = "6464d218133717617310e23b3f3025a075bb87c2" +git = "https://github.com/gnunicorn/matrix-rust-sdk" +branch = "ben-semaphore-for-limiting-concurrent-requests" +# path = "../matrix-rust-sdk/crates/matrix-sdk-store-encryption" default-features = false [workspace.dependencies.matrix-sdk-ui] -git = "https://github.com/matrix-org/matrix-rust-sdk" -rev = "6464d218133717617310e23b3f3025a075bb87c2" +git = "https://github.com/gnunicorn/matrix-rust-sdk" +branch = "ben-semaphore-for-limiting-concurrent-requests" +# path = "../matrix-rust-sdk/crates/matrix-sdk-ui" default-features = false features = ["e2e-encryption"] +[workspace.dependencies.matrix-sdk-test] +git = "https://github.com/gnunicorn/matrix-rust-sdk" +branch = "ben-semaphore-for-limiting-concurrent-requests" +# path = "../matrix-rust-sdk/testing/matrix-sdk-test" +default-features = false + [workspace.dependencies.ruma] git = "https://github.com/ruma/ruma" rev = "e5a370f7e5fcebb0da6e4945e51c5fafba9aa5f0" diff --git a/native/acter/src/platform/android.rs b/native/acter/src/platform/android.rs index 59f13e82450a..ccc12e3d2798 100644 --- a/native/acter/src/platform/android.rs +++ b/native/acter/src/platform/android.rs @@ -1,7 +1,7 @@ use android_logger::{AndroidLogger, Config}; use anyhow::Result; use log::LevelFilter; -use matrix_sdk::ClientBuilder; +use matrix_sdk::{config::RequestConfig, ClientBuilder}; use super::native; @@ -28,7 +28,9 @@ pub async fn new_client_config( reset_if_existing, ) .await? - .user_agent(format!("acter-android/{:}", env!("CARGO_PKG_VERSION"))); + .user_agent(format!("acter-android/{:}", env!("CARGO_PKG_VERSION"))) + // limit the concurrent request done at the same time to 50 + .request_config(RequestConfig::default().max_concurrent_requests(50)); Ok(builder) } diff --git a/native/acter/src/platform/desktop.rs b/native/acter/src/platform/desktop.rs index 84e446d085e5..f8c9a700172a 100644 --- a/native/acter/src/platform/desktop.rs +++ b/native/acter/src/platform/desktop.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use matrix_sdk::ClientBuilder; +use matrix_sdk::{config::RequestConfig, ClientBuilder}; use super::native; @@ -30,7 +30,10 @@ pub async fn new_client_config( "{:}/acter@{:}", option_env!("CARGO_BIN_NAME").unwrap_or("acter-desktop"), env!("CARGO_PKG_VERSION") - )); + )) + // limit the concurrent request done at the same time to 100 + .request_config(RequestConfig::default().max_concurrent_requests(100)); + Ok(builder) } diff --git a/native/acter/src/platform/ios.rs b/native/acter/src/platform/ios.rs index 179b019e5f27..91797513280f 100644 --- a/native/acter/src/platform/ios.rs +++ b/native/acter/src/platform/ios.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use matrix_sdk::ClientBuilder; +use matrix_sdk::{config::RequestConfig, ClientBuilder}; use oslog::OsLogger; use super::native; @@ -27,7 +27,10 @@ pub async fn new_client_config( reset_if_existing, ) .await? - .user_agent(format!("acter-ios/{:}", env!("CARGO_PKG_VERSION"))); + .user_agent(format!("acter-ios/{:}", env!("CARGO_PKG_VERSION"))) + // limit the concurrent request done at the same time to 20 + .request_config(RequestConfig::default().max_concurrent_requests(20)); + Ok(builder) } From 144edda2ba8ff9f2e7119bfa224cea69c7749b2f Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Mon, 1 Jul 2024 22:27:44 +0530 Subject: [PATCH 05/14] Update to latest API --- Cargo.lock | 20 ++++++++++---------- native/acter/src/platform/android.rs | 3 ++- native/acter/src/platform/desktop.rs | 3 ++- native/acter/src/platform/ios.rs | 3 ++- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 410283dd316f..895d0fab2484 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2905,7 +2905,7 @@ dependencies = [ [[package]] name = "matrix-sdk" version = "0.7.1" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" dependencies = [ "anyhow", "anymap2", @@ -2953,7 +2953,7 @@ dependencies = [ [[package]] name = "matrix-sdk-base" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" dependencies = [ "as_variant", "async-trait", @@ -2977,7 +2977,7 @@ dependencies = [ [[package]] name = "matrix-sdk-common" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" dependencies = [ "async-trait", "futures-core", @@ -2999,7 +2999,7 @@ dependencies = [ [[package]] name = "matrix-sdk-crypto" version = "0.7.1" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" dependencies = [ "aes", "as_variant", @@ -3040,7 +3040,7 @@ dependencies = [ [[package]] name = "matrix-sdk-indexeddb" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" dependencies = [ "anyhow", "async-trait", @@ -3068,7 +3068,7 @@ dependencies = [ [[package]] name = "matrix-sdk-sqlite" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" dependencies = [ "async-trait", "deadpool-sqlite", @@ -3090,7 +3090,7 @@ dependencies = [ [[package]] name = "matrix-sdk-store-encryption" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" dependencies = [ "base64 0.22.1", "blake3", @@ -3130,7 +3130,7 @@ dependencies = [ [[package]] name = "matrix-sdk-test" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" dependencies = [ "ctor", "getrandom", @@ -3148,7 +3148,7 @@ dependencies = [ [[package]] name = "matrix-sdk-test-macros" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" dependencies = [ "quote 1.0.35", "syn 2.0.64", @@ -3157,7 +3157,7 @@ dependencies = [ [[package]] name = "matrix-sdk-ui" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#0a38cdf085be9b17ccca793ad8f2bd2fa1aebf18" +source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" dependencies = [ "as_variant", "async-once-cell", diff --git a/native/acter/src/platform/android.rs b/native/acter/src/platform/android.rs index ccc12e3d2798..0c2cc949bde3 100644 --- a/native/acter/src/platform/android.rs +++ b/native/acter/src/platform/android.rs @@ -2,6 +2,7 @@ use android_logger::{AndroidLogger, Config}; use anyhow::Result; use log::LevelFilter; use matrix_sdk::{config::RequestConfig, ClientBuilder}; +use std::num::NonZeroUsize; use super::native; @@ -30,7 +31,7 @@ pub async fn new_client_config( .await? .user_agent(format!("acter-android/{:}", env!("CARGO_PKG_VERSION"))) // limit the concurrent request done at the same time to 50 - .request_config(RequestConfig::default().max_concurrent_requests(50)); + .request_config(RequestConfig::default().max_concurrent_requests(NonZeroUsize::new(50))); Ok(builder) } diff --git a/native/acter/src/platform/desktop.rs b/native/acter/src/platform/desktop.rs index f8c9a700172a..3fea0ff2461f 100644 --- a/native/acter/src/platform/desktop.rs +++ b/native/acter/src/platform/desktop.rs @@ -1,5 +1,6 @@ use anyhow::Result; use matrix_sdk::{config::RequestConfig, ClientBuilder}; +use std::num::NonZeroUsize; use super::native; @@ -32,7 +33,7 @@ pub async fn new_client_config( env!("CARGO_PKG_VERSION") )) // limit the concurrent request done at the same time to 100 - .request_config(RequestConfig::default().max_concurrent_requests(100)); + .request_config(RequestConfig::default().max_concurrent_requests(NonZeroUsize::new(100))); Ok(builder) } diff --git a/native/acter/src/platform/ios.rs b/native/acter/src/platform/ios.rs index 91797513280f..ca49a2af789c 100644 --- a/native/acter/src/platform/ios.rs +++ b/native/acter/src/platform/ios.rs @@ -1,6 +1,7 @@ use anyhow::Result; use matrix_sdk::{config::RequestConfig, ClientBuilder}; use oslog::OsLogger; +use std::num::NonZeroUsize; use super::native; @@ -29,7 +30,7 @@ pub async fn new_client_config( .await? .user_agent(format!("acter-ios/{:}", env!("CARGO_PKG_VERSION"))) // limit the concurrent request done at the same time to 20 - .request_config(RequestConfig::default().max_concurrent_requests(20)); + .request_config(RequestConfig::default().max_concurrent_requests(NonZeroUsize::new(20))); Ok(builder) } From ffe3c20709da0ce9b283175f6547484ff7e84141 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Thu, 4 Jul 2024 21:30:43 +0530 Subject: [PATCH 06/14] Switch back to mainline rust-sdk --- Cargo.lock | 45 ++++++++++++--------------- Cargo.toml | 18 ++++------- native/acter/Cargo.toml | 2 +- native/media-cache-wrapper/src/lib.rs | 4 +-- 4 files changed, 29 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 895d0fab2484..67c7b0c7374f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -424,12 +424,6 @@ dependencies = [ "nom", ] -[[package]] -name = "assert_matches2" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15832d94c458da98cac0ffa6eca52cc19c2a3c6c951058500a5ae8f01f0fdf56" - [[package]] name = "assign" version = "1.1.1" @@ -1633,9 +1627,9 @@ dependencies = [ [[package]] name = "eyeball" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42482893d982111055ce4b24234d6250396d3785767c6b04cedd84612a0b80fb" +checksum = "d93bd0ebf93d61d6332d3c09a96e97975968a44e19a64c947bde06e6baff383f" dependencies = [ "futures-core", "readlock", @@ -1644,9 +1638,9 @@ dependencies = [ [[package]] name = "eyeball-im" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "021fab29d9670be5867b16d56a95c29a12c3c1bb654e7d589010a028716d625d" +checksum = "2ae8c5165c9770f3ec7cccce12f4c5d70f01fa8bf84cf30cfbfd5a1c6f8901d5" dependencies = [ "futures-core", "imbl", @@ -1657,14 +1651,16 @@ dependencies = [ [[package]] name = "eyeball-im-util" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "191adac85d269e80f4e44c2b3e8fc2b193b2e3574a997962066b5980cab1fcc1" +checksum = "32b6b037e2cdce928a432ecc2880c944e5436d8a38c827974b882ad373f60037" dependencies = [ + "arrayvec", "eyeball-im", "futures-core", "imbl", "pin-project-lite", + "smallvec", ] [[package]] @@ -2438,9 +2434,9 @@ dependencies = [ [[package]] name = "imbl" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2806b69cd9f4664844027b64465eacb444c67c1db9c778e341adff0c25cdb0d" +checksum = "bc3be8d8cd36f33a46b1849f31f837c44d9fa87223baee3b4bd96b8f11df81eb" dependencies = [ "bitmaps", "imbl-sized-chunks", @@ -2905,7 +2901,7 @@ dependencies = [ [[package]] name = "matrix-sdk" version = "0.7.1" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" dependencies = [ "anyhow", "anymap2", @@ -2953,7 +2949,7 @@ dependencies = [ [[package]] name = "matrix-sdk-base" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" dependencies = [ "as_variant", "async-trait", @@ -2977,7 +2973,7 @@ dependencies = [ [[package]] name = "matrix-sdk-common" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" dependencies = [ "async-trait", "futures-core", @@ -2999,11 +2995,10 @@ dependencies = [ [[package]] name = "matrix-sdk-crypto" version = "0.7.1" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" dependencies = [ "aes", "as_variant", - "assert_matches2", "async-trait", "bs58", "byteorder", @@ -3040,7 +3035,7 @@ dependencies = [ [[package]] name = "matrix-sdk-indexeddb" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" dependencies = [ "anyhow", "async-trait", @@ -3068,7 +3063,7 @@ dependencies = [ [[package]] name = "matrix-sdk-sqlite" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" dependencies = [ "async-trait", "deadpool-sqlite", @@ -3090,7 +3085,7 @@ dependencies = [ [[package]] name = "matrix-sdk-store-encryption" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" dependencies = [ "base64 0.22.1", "blake3", @@ -3130,7 +3125,7 @@ dependencies = [ [[package]] name = "matrix-sdk-test" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" dependencies = [ "ctor", "getrandom", @@ -3148,7 +3143,7 @@ dependencies = [ [[package]] name = "matrix-sdk-test-macros" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" dependencies = [ "quote 1.0.35", "syn 2.0.64", @@ -3157,7 +3152,7 @@ dependencies = [ [[package]] name = "matrix-sdk-ui" version = "0.7.0" -source = "git+https://github.com/gnunicorn/matrix-rust-sdk?branch=ben-semaphore-for-limiting-concurrent-requests#273ec086479199998553d6afcd75d973230f8bc1" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" dependencies = [ "as_variant", "async-once-cell", diff --git a/Cargo.toml b/Cargo.toml index b969c46de31b..0d968fc05d37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,41 +8,35 @@ members = [ default-members = ["native/acter"] [workspace.dependencies.matrix-sdk] -git = "https://github.com/gnunicorn/matrix-rust-sdk" -branch = "ben-semaphore-for-limiting-concurrent-requests" +git = "https://github.com/matrix-org/matrix-rust-sdk" # path = "../matrix-rust-sdk/crates/matrix-sdk" default-features = false features = ["experimental-sliding-sync"] [workspace.dependencies.matrix-sdk-base] -git = "https://github.com/gnunicorn/matrix-rust-sdk" -branch = "ben-semaphore-for-limiting-concurrent-requests" +git = "https://github.com/matrix-org/matrix-rust-sdk" # path = "../matrix-rust-sdk/crates/matrix-sdk-base" default-features = false [workspace.dependencies.matrix-sdk-sqlite] -git = "https://github.com/gnunicorn/matrix-rust-sdk" -branch = "ben-semaphore-for-limiting-concurrent-requests" +git = "https://github.com/matrix-org/matrix-rust-sdk" # path = "../matrix-rust-sdk/crates/matrix-sdk-sqlite" default-features = false features = ["crypto-store", "state-store"] [workspace.dependencies.matrix-sdk-store-encryption] -git = "https://github.com/gnunicorn/matrix-rust-sdk" -branch = "ben-semaphore-for-limiting-concurrent-requests" +git = "https://github.com/matrix-org/matrix-rust-sdk" # path = "../matrix-rust-sdk/crates/matrix-sdk-store-encryption" default-features = false [workspace.dependencies.matrix-sdk-ui] -git = "https://github.com/gnunicorn/matrix-rust-sdk" -branch = "ben-semaphore-for-limiting-concurrent-requests" +git = "https://github.com/matrix-org/matrix-rust-sdk" # path = "../matrix-rust-sdk/crates/matrix-sdk-ui" default-features = false features = ["e2e-encryption"] [workspace.dependencies.matrix-sdk-test] -git = "https://github.com/gnunicorn/matrix-rust-sdk" -branch = "ben-semaphore-for-limiting-concurrent-requests" +git = "https://github.com/matrix-org/matrix-rust-sdk" # path = "../matrix-rust-sdk/testing/matrix-sdk-test" default-features = false diff --git a/native/acter/Cargo.toml b/native/acter/Cargo.toml index c475415ab6ef..24126133cad9 100644 --- a/native/acter/Cargo.toml +++ b/native/acter/Cargo.toml @@ -30,7 +30,7 @@ base64ct = { workspace = true, features = ["alloc"] } chrono = "0.4" derive-getters = { workspace = true } derive_builder = { workspace = true } -eyeball-im = "0.4.2" +eyeball-im = "0.5.0" fern = { git = "https://github.com/acterglobal/fern", branch = "rotate", features = ["manual"] } ffi-gen-macro = { git = "https://github.com/acterglobal/ffi-gen" } futures = "0.3.30" diff --git a/native/media-cache-wrapper/src/lib.rs b/native/media-cache-wrapper/src/lib.rs index c7946ab6b66a..03365e21dba4 100644 --- a/native/media-cache-wrapper/src/lib.rs +++ b/native/media-cache-wrapper/src/lib.rs @@ -612,7 +612,7 @@ where room_id: &RoomId, transaction_id: &TransactionId, content: SerializableEventContent, - ) -> Result<(), Self::Error> { + ) -> Result { Ok(self .inner .update_send_queue_event(room_id, transaction_id, content) @@ -626,7 +626,7 @@ where &self, room_id: &RoomId, transaction_id: &TransactionId, - ) -> Result<(), Self::Error> { + ) -> Result { Ok(self .inner .remove_send_queue_event(room_id, transaction_id) From 4855ac0a26e4b044263cdc41040a583872cfce9c Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Fri, 5 Jul 2024 20:52:28 +0530 Subject: [PATCH 07/14] Fixing several lints --- .../widgets/message_metadata_builder.dart | 2 -- native/acter/src/api/account.rs | 2 +- native/cli/src/action/list.rs | 4 +-- native/media-cache-wrapper/src/queued.rs | 28 +++++++++++++++---- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/app/lib/features/chat/widgets/message_metadata_builder.dart b/app/lib/features/chat/widgets/message_metadata_builder.dart index c2b0f75b9b2b..e7a901b96c6b 100644 --- a/app/lib/features/chat/widgets/message_metadata_builder.dart +++ b/app/lib/features/chat/widgets/message_metadata_builder.dart @@ -1,12 +1,10 @@ import 'package:acter/common/providers/room_providers.dart'; -import 'package:acter/features/chat/providers/chat_providers.dart'; import 'package:acter_avatar/acter_avatar.dart'; import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart' show Convo, EventSendState; import 'package:atlas_icons/atlas_icons.dart'; import 'package:flutter/material.dart'; import 'package:flutter_chat_types/flutter_chat_types.dart' as types; -import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:quds_popup_menu/quds_popup_menu.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; diff --git a/native/acter/src/api/account.rs b/native/acter/src/api/account.rs index efe6be6b8ff1..a9bb819d7665 100644 --- a/native/acter/src/api/account.rs +++ b/native/acter/src/api/account.rs @@ -85,7 +85,7 @@ impl Account { RUNTIME .spawn(async move { let source = match account.get_cached_avatar_url().await? { - Some(url) => MediaSource::Plain(url.into()), + Some(url) => MediaSource::Plain(url), None => match account.get_avatar_url().await? { Some(e) => MediaSource::Plain(e), None => return Ok(OptionBuffer::new(None)), diff --git a/native/cli/src/action/list.rs b/native/cli/src/action/list.rs index a882e331b7c4..001b4b81f01a 100644 --- a/native/cli/src/action/list.rs +++ b/native/cli/src/action/list.rs @@ -44,7 +44,7 @@ impl List { let room_id = sp.room_id(); let is_acter_space = sp.is_acter_space().await?; let acter_space = if is_acter_space { 'x' } else { ' ' }; - let display_name = sp.computed_display_name().await?; + let display_name = sp.compute_display_name().await?; println!(" ## [{acter_space}] {room_id}: {display_name}"); if self.details { let aliases = { @@ -155,7 +155,7 @@ impl List { println!( " * {} : {}", convo.room_id(), - convo.computed_display_name().await? + convo.compute_display_name().await? ); } } diff --git a/native/media-cache-wrapper/src/queued.rs b/native/media-cache-wrapper/src/queued.rs index 67bd48210f38..c03dcc432fe8 100644 --- a/native/media-cache-wrapper/src/queued.rs +++ b/native/media-cache-wrapper/src/queued.rs @@ -1,9 +1,9 @@ use crate::MediaStore; -use std::sync::Arc; use async_trait::async_trait; -use tokio::sync::Semaphore; use matrix_sdk_base::media::MediaRequest; use ruma_common::MxcUri; +use std::sync::Arc; +use tokio::sync::Semaphore; use tracing::instrument; #[derive(Debug)] @@ -40,7 +40,11 @@ where request: &MediaRequest, content: Vec, ) -> Result<(), Self::Error> { - let _handle = self.queue.acquire().await.expect("We never close the semaphore"); + let _handle = self + .queue + .acquire() + .await + .expect("We never close the semaphore"); self.inner.add_media_content(request, content).await } @@ -49,19 +53,31 @@ where &self, request: &MediaRequest, ) -> Result>, Self::Error> { - let _handle = self.queue.acquire().await.expect("We never close the semaphore"); + let _handle = self + .queue + .acquire() + .await + .expect("We never close the semaphore"); self.inner.get_media_content(request).await } #[instrument(skip_all)] async fn remove_media_content(&self, request: &MediaRequest) -> Result<(), Self::Error> { - let _handle = self.queue.acquire().await.expect("We never close the semaphore"); + let _handle = self + .queue + .acquire() + .await + .expect("We never close the semaphore"); self.inner.remove_media_content(request).await } #[instrument(skip_all)] async fn remove_media_content_for_uri(&self, uri: &MxcUri) -> Result<(), Self::Error> { - let _handle = self.queue.acquire().await.expect("We never close the semaphore"); + let _handle = self + .queue + .acquire() + .await + .expect("We never close the semaphore"); self.inner.remove_media_content_for_uri(uri).await } } From 358e4bac206be15119d11533ae688047c6eec5ca Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Tue, 9 Jul 2024 17:07:33 +0530 Subject: [PATCH 08/14] Update to latest matrix rust sdk --- Cargo.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 67c7b0c7374f..74823ef914a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2901,7 +2901,7 @@ dependencies = [ [[package]] name = "matrix-sdk" version = "0.7.1" -source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#1bc044349e54a680e36043f182d391d853d9640d" dependencies = [ "anyhow", "anymap2", @@ -2949,7 +2949,7 @@ dependencies = [ [[package]] name = "matrix-sdk-base" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#1bc044349e54a680e36043f182d391d853d9640d" dependencies = [ "as_variant", "async-trait", @@ -2973,7 +2973,7 @@ dependencies = [ [[package]] name = "matrix-sdk-common" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#1bc044349e54a680e36043f182d391d853d9640d" dependencies = [ "async-trait", "futures-core", @@ -2995,7 +2995,7 @@ dependencies = [ [[package]] name = "matrix-sdk-crypto" version = "0.7.1" -source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#1bc044349e54a680e36043f182d391d853d9640d" dependencies = [ "aes", "as_variant", @@ -3035,7 +3035,7 @@ dependencies = [ [[package]] name = "matrix-sdk-indexeddb" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#1bc044349e54a680e36043f182d391d853d9640d" dependencies = [ "anyhow", "async-trait", @@ -3063,7 +3063,7 @@ dependencies = [ [[package]] name = "matrix-sdk-sqlite" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#1bc044349e54a680e36043f182d391d853d9640d" dependencies = [ "async-trait", "deadpool-sqlite", @@ -3085,7 +3085,7 @@ dependencies = [ [[package]] name = "matrix-sdk-store-encryption" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#1bc044349e54a680e36043f182d391d853d9640d" dependencies = [ "base64 0.22.1", "blake3", @@ -3125,7 +3125,7 @@ dependencies = [ [[package]] name = "matrix-sdk-test" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#1bc044349e54a680e36043f182d391d853d9640d" dependencies = [ "ctor", "getrandom", @@ -3143,7 +3143,7 @@ dependencies = [ [[package]] name = "matrix-sdk-test-macros" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#1bc044349e54a680e36043f182d391d853d9640d" dependencies = [ "quote 1.0.35", "syn 2.0.64", @@ -3152,7 +3152,7 @@ dependencies = [ [[package]] name = "matrix-sdk-ui" version = "0.7.0" -source = "git+https://github.com/matrix-org/matrix-rust-sdk#b80c2f71975638bda06fd9ac716fcc9ce020c3b5" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#1bc044349e54a680e36043f182d391d853d9640d" dependencies = [ "as_variant", "async-once-cell", From 5c40df1462c71bda4d5b024bc121eb8de0c9a9db Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Tue, 9 Jul 2024 17:16:02 +0530 Subject: [PATCH 09/14] Simplify room providers, fix several possible cases of RoomNotFound errors --- app/lib/common/providers/room_providers.dart | 50 ++++++++----------- .../widgets/room/brief_room_list_entry.dart | 13 +++-- app/lib/common/widgets/user_builder.dart | 20 ++++---- .../pages/invite_indicidual_users.dart | 12 +++-- .../invite_members/widgets/direct_invite.dart | 16 +++--- .../member/widgets/member_info_drawer.dart | 8 ++- 6 files changed, 53 insertions(+), 66 deletions(-) diff --git a/app/lib/common/providers/room_providers.dart b/app/lib/common/providers/room_providers.dart index 0eb063bc9a4d..1c6ce6986a45 100644 --- a/app/lib/common/providers/room_providers.dart +++ b/app/lib/common/providers/room_providers.dart @@ -94,26 +94,6 @@ final roomInvitedMembersProvider = FutureProvider.autoDispose return members.toList(); }); -/// Get the RoomItem of the given sapceId filled in brief form -/// (only spaceProfileData, no activeMembers) with Membership. -/// Stays up to date with underlying client info -final briefRoomItemWithMembershipProvider = - FutureProvider.autoDispose.family((ref, roomId) async { - final room = await ref.watch(maybeRoomProvider(roomId).future); - if (room == null) { - throw RoomNotFound; - } - - final avatarInfo = ref.watch(roomAvatarInfoProvider(roomId)); - return RoomItem( - roomId: roomId, - room: room, - membership: room.isJoined() ? await room.getMyMembership() : null, - activeMembers: [], - avatarInfo: avatarInfo, - ); -}); - final roomSearchValueProvider = StateProvider.autoDispose((ref) => null); @@ -340,7 +320,14 @@ final _memberProfileProvider = FutureProvider.autoDispose final memberDisplayNameProvider = FutureProvider.autoDispose.family((ref, query) async { - return ref.watch(_memberProfileProvider(query)).valueOrNull?.getDisplayName(); + try { + return ref + .watch(_memberProfileProvider(query)) + .valueOrNull + ?.getDisplayName(); + } on RoomNotFound { + return null; + } }); /// Caching the MemoryImage of each room @@ -349,14 +336,18 @@ final _memberAvatarProvider = FutureProvider.autoDispose final sdk = await ref.watch(sdkProvider.future); final thumbsize = sdk.api.newThumbSize(48, 48); - final profile = await ref.watch(_memberProfileProvider(query).future); - // use .data() consumes the value so we keep it stored, any further call to .data() - // comes back empty as the data was consumed. - final avatar = (await profile.getAvatar(thumbsize)).data(); - if (avatar != null) { - return MemoryImage(avatar.asTypedList()); + try { + final profile = await ref.watch(_memberProfileProvider(query).future); + // use .data() consumes the value so we keep it stored, any further call to .data() + // comes back empty as the data was consumed. + final avatar = (await profile.getAvatar(thumbsize)).data(); + if (avatar != null) { + return MemoryImage(avatar.asTypedList()); + } + return null; + } on RoomNotFound { + return null; } - return null; }); final memberAvatarInfoProvider = @@ -371,11 +362,12 @@ final memberAvatarInfoProvider = ); }); +/// Ids of the members of this Room. Returns empty list if the room isn't found final membersIdsProvider = FutureProvider.family, String>((ref, roomIdOrAlias) async { final room = await ref.watch(maybeRoomProvider(roomIdOrAlias).future); if (room == null) { - throw RoomNotFound; + return []; } final members = await room.activeMembersIds(); return asDartStringList(members); diff --git a/app/lib/common/widgets/room/brief_room_list_entry.dart b/app/lib/common/widgets/room/brief_room_list_entry.dart index c845e60d3700..29788c8437f1 100644 --- a/app/lib/common/widgets/room/brief_room_list_entry.dart +++ b/app/lib/common/widgets/room/brief_room_list_entry.dart @@ -27,11 +27,13 @@ class BriefRoomEntry extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final roomData = ref.watch(briefRoomItemWithMembershipProvider(roomId)); - final canLink = roomData.maybeWhen( - data: (roomData) => roomData.membership!.canString(canCheck), + final roomMembership = ref.watch(roomMembershipProvider(roomId)); + final canLink = roomMembership.maybeWhen( + data: (membership) => membership?.canString(canCheck) == true, orElse: () => false, ); + final roomName = + ref.watch(roomDisplayNameProvider(roomId)).valueOrNull ?? roomId; Widget? trailing; if (trailingBuilder != null) { trailing = trailingBuilder!(canLink); @@ -42,10 +44,7 @@ class BriefRoomEntry extends ConsumerWidget { key: Key('$keyPrefix-$roomId'), enabled: canLink, leading: RoomAvatarBuilder(roomId: roomId, avatarSize: 24), - title: roomData.maybeWhen( - data: (roomData) => Text(roomData.avatarInfo.displayName ?? roomId), - orElse: () => Text(roomId), - ), + title: Text(roomName), subtitle: subtitle, trailing: trailing, onTap: canLink && onSelect != null ? () => onSelect!(roomId) : null, diff --git a/app/lib/common/widgets/user_builder.dart b/app/lib/common/widgets/user_builder.dart index 16e79b7c45fd..7f53ebe749f7 100644 --- a/app/lib/common/widgets/user_builder.dart +++ b/app/lib/common/widgets/user_builder.dart @@ -58,7 +58,7 @@ class UserBuilder extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final room = ref.watch(briefRoomItemWithMembershipProvider(roomId)); + final room = ref.watch(maybeRoomProvider(roomId)).valueOrNull; final avatarProv = ref.watch(userAvatarProvider(profile)); final displayName = profile.getDisplayName(); final userId = profile.userId().toString(); @@ -76,16 +76,14 @@ class UserBuilder extends ConsumerWidget { size: 18, ), ), - trailing: room.when( - data: (data) => UserStateButton( - userId: userId, - room: data.room!, - ), - error: (err, stackTrace) => Text('Error: $err'), - loading: () => const Skeletonizer( - child: Text('Loading user'), - ), - ), + trailing: room != null + ? UserStateButton( + userId: userId, + room: room, + ) + : const Skeletonizer( + child: Text('Loading user'), + ), ), ); } diff --git a/app/lib/features/invite_members/pages/invite_indicidual_users.dart b/app/lib/features/invite_members/pages/invite_indicidual_users.dart index 8506552498b6..e84353491925 100644 --- a/app/lib/features/invite_members/pages/invite_indicidual_users.dart +++ b/app/lib/features/invite_members/pages/invite_indicidual_users.dart @@ -126,7 +126,7 @@ class InviteIndividualUsers extends ConsumerWidget { } Widget _buildSuggestedUserItem(WidgetRef ref, FoundUser user) { - final room = ref.watch(briefRoomItemWithMembershipProvider(roomId)); + final room = ref.watch(maybeRoomProvider(roomId)).valueOrNull; return Card( child: ListTile( title: Text(user.avatarInfo.displayName ?? user.userId), @@ -137,10 +137,12 @@ class InviteIndividualUsers extends ConsumerWidget { user.avatarInfo, ), ), - trailing: UserStateButton( - userId: user.userId, - room: room.valueOrNull!.room!, - ), + trailing: room != null + ? UserStateButton( + userId: user.userId, + room: room, + ) + : null, ), ); } diff --git a/app/lib/features/invite_members/widgets/direct_invite.dart b/app/lib/features/invite_members/widgets/direct_invite.dart index 6ac2a44213f0..bf5c029d7f28 100644 --- a/app/lib/features/invite_members/widgets/direct_invite.dart +++ b/app/lib/features/invite_members/widgets/direct_invite.dart @@ -20,21 +20,19 @@ class DirectInvite extends ConsumerWidget { final invited = ref.watch(roomInvitedMembersProvider(roomId)).valueOrNull ?? []; final joined = ref.watch(membersIdsProvider(roomId)).valueOrNull ?? []; - final room = ref.watch(briefRoomItemWithMembershipProvider(roomId)); + final room = ref.watch(maybeRoomProvider(roomId)).valueOrNull; return Card( child: ListTile( title: !isInvited(userId, invited) && !isJoined(userId, joined) ? Text(L10n.of(context).directInviteUser(userId)) : Text(userId), - trailing: room.when( - data: (data) => UserStateButton( - userId: userId, - room: data.room!, - ), - error: (err, stackTrace) => Text('Error: $err'), - loading: () => const Skeletonizer(child: Text('Loading room')), - ), + trailing: room != null + ? UserStateButton( + userId: userId, + room: room, + ) + : const Skeletonizer(child: Text('Loading room')), ), ); } diff --git a/app/lib/features/member/widgets/member_info_drawer.dart b/app/lib/features/member/widgets/member_info_drawer.dart index c1e61fa8a790..c2a6ade72936 100644 --- a/app/lib/features/member/widgets/member_info_drawer.dart +++ b/app/lib/features/member/widgets/member_info_drawer.dart @@ -244,13 +244,11 @@ class _MemberInfoDrawerInner extends ConsumerWidget { Widget _roomTitle(BuildContext context, WidgetRef ref) { final roomId = member.roomIdStr(); - final roomData = ref.watch(briefRoomItemWithMembershipProvider(roomId)); + final roomName = + ref.watch(roomDisplayNameProvider(roomId)).valueOrNull ?? roomId; return ListTile( leading: RoomAvatarBuilder(roomId: roomId, avatarSize: 24), - title: roomData.maybeWhen( - data: (roomData) => Text(roomData.avatarInfo.displayName ?? roomId), - orElse: () => Text(roomId), - ), + title: Text(roomName), ); } From 6a55f7be78c39972e13f3aede388a6a053cd73b3 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Tue, 9 Jul 2024 20:00:10 +0530 Subject: [PATCH 10/14] Remove RoomProfile, simplify user profile for caching via providers --- .../providers/notifiers/room_notifiers.dart | 2 +- app/lib/common/providers/room_providers.dart | 75 +- app/lib/common/providers/space_providers.dart | 6 +- app/lib/common/widgets/user_builder.dart | 18 +- .../chat/pages/room_profile_page.dart | 7 +- .../features/chat/widgets/member_list.dart | 11 +- .../pages/invite_indicidual_users.dart | 2 +- .../invite_members/pages/invite_pending.dart | 2 +- .../member/widgets/member_list_entry.dart | 78 +- .../rust_sdk/lib/acter_flutter_sdk_ffi.dart | 1123 +++++++---------- native/acter/api.rsh | 37 +- native/acter/src/api.rs | 2 +- native/acter/src/api/profile.rs | 50 - native/acter/src/api/room.rs | 40 +- 14 files changed, 570 insertions(+), 883 deletions(-) diff --git a/app/lib/common/providers/notifiers/room_notifiers.dart b/app/lib/common/providers/notifiers/room_notifiers.dart index 6b8e4c69cd1b..3863cccbeed1 100644 --- a/app/lib/common/providers/notifiers/room_notifiers.dart +++ b/app/lib/common/providers/notifiers/room_notifiers.dart @@ -16,7 +16,7 @@ class AsyncMaybeRoomNotifier extends FamilyAsyncNotifier { try { return await client.room(arg); } catch (e) { - _log.warning('room not found', e); + _log.warning('room $arg not found', e); return null; } } diff --git a/app/lib/common/providers/room_providers.dart b/app/lib/common/providers/room_providers.dart index 1c6ce6986a45..b60d7128bd2b 100644 --- a/app/lib/common/providers/room_providers.dart +++ b/app/lib/common/providers/room_providers.dart @@ -40,26 +40,6 @@ final maybeRoomProvider = () => AsyncMaybeRoomNotifier(), ); -/// Provider the profile data of a the given room, keeps up to date with underlying client -// final roomProfileDataProvider = -// FutureProvider.autoDispose.family((ref, roomId) async { -// final room = await ref.watch(maybeRoomProvider(roomId).future); -// if (room == null) { -// throw RoomNotFound; -// } - -// final profile = room.getProfile(); -// OptionString displayName = await profile.getDisplayName(); -// try { -// final avatar = (await profile.getAvatar(null)).data(); -// _log.info('$roomId : hasAvatar: ${avatar != null}'); -// return ProfileData(displayName.text(), avatar); -// } catch (error) { -// _log.severe('Loading avatar for $roomId failed', error); -// return ProfileData(displayName.text(), null); -// } -// }); - /// gives current visibility state of space, return empty if no space is found final roomVisibilityProvider = FutureProvider.family .autoDispose((ref, roomId) async { @@ -107,13 +87,8 @@ final _briefGroupChatsWithName = List<_RoomIdAndName> items = []; for (final convo in chatList) { final roomId = convo.getRoomIdStr(); - final room = await ref.watch(maybeRoomProvider(roomId).future); - - if (room != null) { - final profile = room.getProfile(); - OptionString displayName = await profile.getDisplayName(); - items.add((roomId, displayName.text())); - } + final displayName = ref.watch(roomDisplayNameProvider(roomId)).valueOrNull; + items.add((roomId, displayName)); } return items; }); @@ -177,45 +152,31 @@ final parentIdsProvider = } }); -/// Caching the Profile of each Room -final _roomProfileProvider = - FutureProvider.family((ref, roomId) { - final room = ref.watch(maybeRoomProvider(roomId)).valueOrNull; - if (room == null) { - throw RoomNotFound; - } - - return room.getProfile(); -}); - /// Caching the name of each Room final roomDisplayNameProvider = FutureProvider.family((ref, roomId) async { - try { - final profile = await ref.watch(_roomProfileProvider(roomId).future); - return (await profile.getDisplayName()).text(); - } on RoomNotFound { + final room = await ref.watch(maybeRoomProvider(roomId).future); + if (room == null) { return null; } + return (await room.getDisplayName()).text(); }); /// Caching the MemoryImage of each room final roomAvatarProvider = FutureProvider.family((ref, roomId) async { - try { - final sdk = await ref.watch(sdkProvider.future); - final thumbsize = sdk.api.newThumbSize(48, 48); - - final avatar = (await (await ref.watch(_roomProfileProvider(roomId).future)) - .getAvatar(thumbsize)) - .data(); - if (avatar != null) { - return MemoryImage(avatar.asTypedList()); - } - return null; - } on RoomNotFound { + final sdk = await ref.watch(sdkProvider.future); + final thumbsize = sdk.api.newThumbSize(48, 48); + final room = await ref.watch(maybeRoomProvider(roomId).future); + if (room == null || !room.hasAvatar()) { return null; } + + final avatar = (await room.avatar(thumbsize)).data(); + if (avatar != null) { + return MemoryImage(avatar.asTypedList()); + } + return null; }); /// Provide the AvatarInfo for each room. Update internally accordingly @@ -318,6 +279,12 @@ final _memberProfileProvider = FutureProvider.autoDispose return member.getProfile(); }); +final membershipStatusStr = + FutureProvider.autoDispose.family((ref, query) async { + final member = await ref.watch(memberProvider(query).future); + return member.membershipStatusStr(); +}); + final memberDisplayNameProvider = FutureProvider.autoDispose.family((ref, query) async { try { diff --git a/app/lib/common/providers/space_providers.dart b/app/lib/common/providers/space_providers.dart index 136017eaeed7..5f162371e807 100644 --- a/app/lib/common/providers/space_providers.dart +++ b/app/lib/common/providers/space_providers.dart @@ -152,11 +152,9 @@ final _spaceIdAndNames = final spaces = ref.watch(spacesProvider); List<_SpaceIdAndName> items = []; for (final space in spaces) { + final roomId = space.getRoomIdStr(); items.add( - ( - space.getRoomIdStr(), - (await space.getProfile().getDisplayName()).text() - ), + (roomId, await ref.watch(roomDisplayNameProvider(roomId).future)), ); } return items; diff --git a/app/lib/common/widgets/user_builder.dart b/app/lib/common/widgets/user_builder.dart index 7f53ebe749f7..44d01b9cc216 100644 --- a/app/lib/common/widgets/user_builder.dart +++ b/app/lib/common/widgets/user_builder.dart @@ -47,32 +47,30 @@ bool isJoined(String userId, List joined) { } class UserBuilder extends ConsumerWidget { - final UserProfile profile; + final String userId; final String roomId; const UserBuilder({ super.key, - required this.profile, + required this.userId, required this.roomId, }); @override Widget build(BuildContext context, WidgetRef ref) { final room = ref.watch(maybeRoomProvider(roomId)).valueOrNull; - final avatarProv = ref.watch(userAvatarProvider(profile)); - final displayName = profile.getDisplayName(); - final userId = profile.userId().toString(); + final avatarInfo = + ref.watch(memberAvatarInfoProvider((roomId: roomId, userId: userId))); + final displayName = ref + .watch(memberDisplayNameProvider((roomId: roomId, userId: userId))) + .valueOrNull; return Card( child: ListTile( title: Text(displayName ?? userId), subtitle: (displayName == null) ? null : Text(userId), leading: ActerAvatar( options: AvatarOptions.DM( - AvatarInfo( - uniqueId: userId, - displayName: displayName, - avatar: avatarProv.valueOrNull, - ), + avatarInfo, size: 18, ), ), diff --git a/app/lib/features/chat/pages/room_profile_page.dart b/app/lib/features/chat/pages/room_profile_page.dart index 0d4413c14c05..9b0b821565ff 100644 --- a/app/lib/features/chat/pages/room_profile_page.dart +++ b/app/lib/features/chat/pages/room_profile_page.dart @@ -433,7 +433,6 @@ class _RoomProfilePageState extends ConsumerState { } Widget _convoMembersList() { - final convo = ref.watch(chatProvider(widget.roomId)); final members = ref.watch(membersIdsProvider(widget.roomId)); return Container( @@ -465,11 +464,7 @@ class _RoomProfilePageState extends ConsumerState { error: (error, stackTrace) => Text(L10n.of(context).errorLoadingMembersCount(error)), ), - convo.when( - data: (data) => MemberList(convo: data), - loading: () => const MembersListSkeleton(), - error: (e, s) => Text('${L10n.of(context).error}: $e'), - ), + MemberList(roomId: widget.roomId), ], ), ); diff --git a/app/lib/features/chat/widgets/member_list.dart b/app/lib/features/chat/widgets/member_list.dart index 9a11c85b956e..977da52f315a 100644 --- a/app/lib/features/chat/widgets/member_list.dart +++ b/app/lib/features/chat/widgets/member_list.dart @@ -1,21 +1,20 @@ import 'package:acter/common/providers/room_providers.dart'; +import 'package:acter/features/chat/widgets/skeletons/members_list_skeleton_widget.dart'; import 'package:acter/features/member/widgets/member_list_entry.dart'; -import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; class MemberList extends ConsumerWidget { - final Convo convo; + final String roomId; const MemberList({ - required this.convo, + required this.roomId, super.key, }); @override Widget build(BuildContext context, WidgetRef ref) { - final roomId = convo.getRoomIdStr(); final members = ref.watch(membersIdsProvider(roomId)); return members.when( @@ -46,9 +45,7 @@ class MemberList extends ConsumerWidget { error: (error, stack) => Center( child: Text(L10n.of(context).loadingFailed(error)), ), - loading: () => Center( - child: Text(L10n.of(context).loading), - ), + loading: () => const MembersListSkeleton(), ); } } diff --git a/app/lib/features/invite_members/pages/invite_indicidual_users.dart b/app/lib/features/invite_members/pages/invite_indicidual_users.dart index e84353491925..af9d9959927f 100644 --- a/app/lib/features/invite_members/pages/invite_indicidual_users.dart +++ b/app/lib/features/invite_members/pages/invite_indicidual_users.dart @@ -169,7 +169,7 @@ class InviteIndividualUsers extends ConsumerWidget { itemBuilder: (context, index) { return foundUsers.when( data: (data) => UserBuilder( - profile: data[index], + userId: data[index].userId().toString(), roomId: roomId, ), error: (err, stackTrace) => diff --git a/app/lib/features/invite_members/pages/invite_pending.dart b/app/lib/features/invite_members/pages/invite_pending.dart index 9c925d441132..6adb8b1fefce 100644 --- a/app/lib/features/invite_members/pages/invite_pending.dart +++ b/app/lib/features/invite_members/pages/invite_pending.dart @@ -43,7 +43,7 @@ class InvitePending extends ConsumerWidget { shrinkWrap: true, itemBuilder: (context, index) { return UserBuilder( - profile: invited[index].getProfile(), + userId: invited[index].userId().toString(), roomId: roomId, ); }, diff --git a/app/lib/features/member/widgets/member_list_entry.dart b/app/lib/features/member/widgets/member_list_entry.dart index b7ac3e2ef2aa..d50ff8904c3d 100644 --- a/app/lib/features/member/widgets/member_list_entry.dart +++ b/app/lib/features/member/widgets/member_list_entry.dart @@ -6,42 +6,6 @@ import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart'; import 'package:atlas_icons/atlas_icons.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:skeletonizer/skeletonizer.dart'; -import 'package:flutter_gen/gen_l10n/l10n.dart'; - -class _MemberListInnerSkeleton extends StatelessWidget { - const _MemberListInnerSkeleton(); - - @override - Widget build(BuildContext context) { - return ListTile( - leading: Skeletonizer( - child: ActerAvatar( - options: AvatarOptions.DM( - AvatarInfo( - uniqueId: L10n.of(context).noIdGiven, - ), - size: 18, - ), - ), - ), - title: Skeletonizer( - child: Text( - L10n.of(context).noId, - style: Theme.of(context).textTheme.bodyMedium, - overflow: TextOverflow.ellipsis, - ), - ), - subtitle: Skeletonizer( - child: Text( - L10n.of(context).noId, - style: Theme.of(context).textTheme.labelLarge, - overflow: TextOverflow.ellipsis, - ), - ), - ); - } -} class MemberListEntry extends ConsumerWidget { final String memberId; @@ -59,37 +23,9 @@ class MemberListEntry extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final member = - ref.watch(memberProvider((userId: memberId, roomId: roomId))); - return member.when( - data: (data) => _MemberListEntryInner( - userId: memberId, - roomId: roomId, - member: data, - isShowActions: isShowActions, - ), - error: (e, s) => Text(L10n.of(context).errorLoadingProfile(e)), - loading: () => const _MemberListInnerSkeleton(), - ); - } -} - -class _MemberListEntryInner extends ConsumerWidget { - final Member member; - final String userId; - final String roomId; - final bool isShowActions; - - const _MemberListEntryInner({ - required this.userId, - required this.member, - required this.roomId, - this.isShowActions = true, - }); - - @override - Widget build(BuildContext context, WidgetRef ref) { - final memberStatus = member.membershipStatusStr(); + final memberStatus = ref + .watch(membershipStatusStr((roomId: roomId, userId: memberId))) + .valueOrNull; Widget? trailing; if (memberStatus == 'Admin') { trailing = const Tooltip( @@ -104,7 +40,7 @@ class _MemberListEntryInner extends ConsumerWidget { } final avatarInfo = - ref.watch(memberAvatarInfoProvider((userId: userId, roomId: roomId))); + ref.watch(memberAvatarInfoProvider((userId: memberId, roomId: roomId))); return ListTile( onTap: () async { @@ -112,7 +48,7 @@ class _MemberListEntryInner extends ConsumerWidget { await showMemberInfoDrawer( context: context, roomId: roomId, - memberId: userId, + memberId: memberId, isShowActions: isShowActions, ); } @@ -124,13 +60,13 @@ class _MemberListEntryInner extends ConsumerWidget { ), ), title: Text( - avatarInfo.displayName ?? userId, + avatarInfo.displayName ?? memberId, style: Theme.of(context).textTheme.bodyMedium, overflow: TextOverflow.ellipsis, ), subtitle: avatarInfo.displayName != null ? Text( - userId, + memberId, style: Theme.of(context).textTheme.labelLarge, overflow: TextOverflow.ellipsis, ) diff --git a/app/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart b/app/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart index 30da90043750..d96789a09260 100644 --- a/app/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart +++ b/app/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart @@ -2649,100 +2649,6 @@ class Api { return tmp7; } - OptionBuffer? __roomProfileGetAvatarFuturePoll( - int boxed, - int postCobject, - int port, - ) { - final tmp0 = boxed; - final tmp2 = postCobject; - final tmp4 = port; - var tmp1 = 0; - var tmp3 = 0; - var tmp5 = 0; - tmp1 = tmp0; - tmp3 = tmp2; - tmp5 = tmp4; - final tmp6 = _roomProfileGetAvatarFuturePoll( - tmp1, - tmp3, - tmp5, - ); - final tmp8 = tmp6.arg0; - final tmp9 = tmp6.arg1; - final tmp10 = tmp6.arg2; - final tmp11 = tmp6.arg3; - final tmp12 = tmp6.arg4; - final tmp13 = tmp6.arg5; - if (tmp8 == 0) { - return null; - } - if (tmp9 == 0) { - debugAllocation("handle error", tmp10, tmp11); - final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); - final tmp9_0 = - utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); - if (tmp11 > 0) { - final ffi.Pointer tmp10_0; - tmp10_0 = ffi.Pointer.fromAddress(tmp10); - this.__deallocate(tmp10_0, tmp12, 1); - } - throw tmp9_0; - } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_OptionBuffer"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = OptionBuffer._(this, tmp13_1); - return tmp7; - } - - OptionString? __roomProfileGetDisplayNameFuturePoll( - int boxed, - int postCobject, - int port, - ) { - final tmp0 = boxed; - final tmp2 = postCobject; - final tmp4 = port; - var tmp1 = 0; - var tmp3 = 0; - var tmp5 = 0; - tmp1 = tmp0; - tmp3 = tmp2; - tmp5 = tmp4; - final tmp6 = _roomProfileGetDisplayNameFuturePoll( - tmp1, - tmp3, - tmp5, - ); - final tmp8 = tmp6.arg0; - final tmp9 = tmp6.arg1; - final tmp10 = tmp6.arg2; - final tmp11 = tmp6.arg3; - final tmp12 = tmp6.arg4; - final tmp13 = tmp6.arg5; - if (tmp8 == 0) { - return null; - } - if (tmp9 == 0) { - debugAllocation("handle error", tmp10, tmp11); - final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); - final tmp9_0 = - utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); - if (tmp11 > 0) { - final ffi.Pointer tmp10_0; - tmp10_0 = ffi.Pointer.fromAddress(tmp10); - this.__deallocate(tmp10_0, tmp12, 1); - } - throw tmp9_0; - } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_OptionString"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = OptionString._(this, tmp13_1); - return tmp7; - } - FfiBufferUint8? __newsSlideSourceBinaryFuturePoll( int boxed, int postCobject, @@ -4328,7 +4234,7 @@ class Api { return tmp7; } - bool? __roomSetJoinRuleFuturePoll( + OptionBuffer? __roomAvatarFuturePoll( int boxed, int postCobject, int port, @@ -4342,7 +4248,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomSetJoinRuleFuturePoll( + final tmp6 = _roomAvatarFuturePoll( tmp1, tmp3, tmp5, @@ -4368,11 +4274,14 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_OptionBuffer"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = OptionBuffer._(this, tmp13_1); return tmp7; } - SpaceRelations? __roomSpaceRelationsFuturePoll( + OptionString? __roomDisplayNameFuturePoll( int boxed, int postCobject, int port, @@ -4386,7 +4295,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomSpaceRelationsFuturePoll( + final tmp6 = _roomDisplayNameFuturePoll( tmp1, tmp3, tmp5, @@ -4413,13 +4322,13 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_SpaceRelations"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_OptionString"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = SpaceRelations._(this, tmp13_1); + final tmp7 = OptionString._(this, tmp13_1); return tmp7; } - bool? __roomIsDirectFuturePoll( + bool? __roomSetJoinRuleFuturePoll( int boxed, int postCobject, int port, @@ -4433,7 +4342,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomIsDirectFuturePoll( + final tmp6 = _roomSetJoinRuleFuturePoll( tmp1, tmp3, tmp5, @@ -4463,7 +4372,7 @@ class Api { return tmp7; } - String? __roomAddParentRoomFuturePoll( + SpaceRelations? __roomSpaceRelationsFuturePoll( int boxed, int postCobject, int port, @@ -4477,7 +4386,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomAddParentRoomFuturePoll( + final tmp6 = _roomSpaceRelationsFuturePoll( tmp1, tmp3, tmp5, @@ -4488,8 +4397,6 @@ class Api { final tmp11 = tmp6.arg3; final tmp12 = tmp6.arg4; final tmp13 = tmp6.arg5; - final tmp14 = tmp6.arg6; - final tmp15 = tmp6.arg7; if (tmp8 == 0) { return null; } @@ -4505,27 +4412,14 @@ class Api { } throw tmp9_0; } - if (tmp14 == 0) { - print("returning empty string"); - return ""; - } - final ffi.Pointer tmp13_ptr = ffi.Pointer.fromAddress(tmp13); - List tmp13_buf = []; - final tmp13_precast = tmp13_ptr.cast(); - for (int i = 0; i < tmp14; i++) { - int char = tmp13_precast.elementAt(i).value; - tmp13_buf.add(char); - } - final tmp7 = utf8.decode(tmp13_buf, allowMalformed: true); - if (tmp15 > 0) { - final ffi.Pointer tmp13_0; - tmp13_0 = ffi.Pointer.fromAddress(tmp13); - this.__deallocate(tmp13_0, tmp15 * 1, 1); - } + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_SpaceRelations"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = SpaceRelations._(this, tmp13_1); return tmp7; } - bool? __roomRemoveParentRoomFuturePoll( + bool? __roomIsDirectFuturePoll( int boxed, int postCobject, int port, @@ -4539,7 +4433,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomRemoveParentRoomFuturePoll( + final tmp6 = _roomIsDirectFuturePoll( tmp1, tmp3, tmp5, @@ -4569,7 +4463,7 @@ class Api { return tmp7; } - Member? __roomGetMyMembershipFuturePoll( + String? __roomAddParentRoomFuturePoll( int boxed, int postCobject, int port, @@ -4583,7 +4477,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomGetMyMembershipFuturePoll( + final tmp6 = _roomAddParentRoomFuturePoll( tmp1, tmp3, tmp5, @@ -4594,6 +4488,8 @@ class Api { final tmp11 = tmp6.arg3; final tmp12 = tmp6.arg4; final tmp13 = tmp6.arg5; + final tmp14 = tmp6.arg6; + final tmp15 = tmp6.arg7; if (tmp8 == 0) { return null; } @@ -4609,110 +4505,27 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_Member"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = Member._(this, tmp13_1); - return tmp7; - } - - FfiListFfiString? __roomActiveMembersIdsFuturePoll( - int boxed, - int postCobject, - int port, - ) { - final tmp0 = boxed; - final tmp2 = postCobject; - final tmp4 = port; - var tmp1 = 0; - var tmp3 = 0; - var tmp5 = 0; - tmp1 = tmp0; - tmp3 = tmp2; - tmp5 = tmp4; - final tmp6 = _roomActiveMembersIdsFuturePoll( - tmp1, - tmp3, - tmp5, - ); - final tmp8 = tmp6.arg0; - final tmp9 = tmp6.arg1; - final tmp10 = tmp6.arg2; - final tmp11 = tmp6.arg3; - final tmp12 = tmp6.arg4; - final tmp13 = tmp6.arg5; - if (tmp8 == 0) { - return null; - } - if (tmp9 == 0) { - debugAllocation("handle error", tmp10, tmp11); - final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); - final tmp9_0 = - utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); - if (tmp11 > 0) { - final ffi.Pointer tmp10_0; - tmp10_0 = ffi.Pointer.fromAddress(tmp10); - this.__deallocate(tmp10_0, tmp12, 1); - } - throw tmp9_0; + if (tmp14 == 0) { + print("returning empty string"); + return ""; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListFfiString"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListFfiString._(this, tmp13_1); - final tmp7 = tmp14; - return tmp7; - } - - FfiListMember? __roomActiveMembersFuturePoll( - int boxed, - int postCobject, - int port, - ) { - final tmp0 = boxed; - final tmp2 = postCobject; - final tmp4 = port; - var tmp1 = 0; - var tmp3 = 0; - var tmp5 = 0; - tmp1 = tmp0; - tmp3 = tmp2; - tmp5 = tmp4; - final tmp6 = _roomActiveMembersFuturePoll( - tmp1, - tmp3, - tmp5, - ); - final tmp8 = tmp6.arg0; - final tmp9 = tmp6.arg1; - final tmp10 = tmp6.arg2; - final tmp11 = tmp6.arg3; - final tmp12 = tmp6.arg4; - final tmp13 = tmp6.arg5; - if (tmp8 == 0) { - return null; + final ffi.Pointer tmp13_ptr = ffi.Pointer.fromAddress(tmp13); + List tmp13_buf = []; + final tmp13_precast = tmp13_ptr.cast(); + for (int i = 0; i < tmp14; i++) { + int char = tmp13_precast.elementAt(i).value; + tmp13_buf.add(char); } - if (tmp9 == 0) { - debugAllocation("handle error", tmp10, tmp11); - final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); - final tmp9_0 = - utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); - if (tmp11 > 0) { - final ffi.Pointer tmp10_0; - tmp10_0 = ffi.Pointer.fromAddress(tmp10); - this.__deallocate(tmp10_0, tmp12, 1); - } - throw tmp9_0; + final tmp7 = utf8.decode(tmp13_buf, allowMalformed: true); + if (tmp15 > 0) { + final ffi.Pointer tmp13_0; + tmp13_0 = ffi.Pointer.fromAddress(tmp13); + this.__deallocate(tmp13_0, tmp15 * 1, 1); } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListMember"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListMember._(this, tmp13_1); - final tmp7 = tmp14; return tmp7; } - FfiListMember? __roomInvitedMembersFuturePoll( + bool? __roomRemoveParentRoomFuturePoll( int boxed, int postCobject, int port, @@ -4726,7 +4539,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomInvitedMembersFuturePoll( + final tmp6 = _roomRemoveParentRoomFuturePoll( tmp1, tmp3, tmp5, @@ -4752,15 +4565,11 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListMember"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListMember._(this, tmp13_1); - final tmp7 = tmp14; + final tmp7 = tmp13 > 0; return tmp7; } - Member? __roomGetMemberFuturePoll( + Member? __roomGetMyMembershipFuturePoll( int boxed, int postCobject, int port, @@ -4774,7 +4583,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomGetMemberFuturePoll( + final tmp6 = _roomGetMyMembershipFuturePoll( tmp1, tmp3, tmp5, @@ -4807,7 +4616,7 @@ class Api { return tmp7; } - bool? __roomInviteUserFuturePoll( + FfiListFfiString? __roomActiveMembersIdsFuturePoll( int boxed, int postCobject, int port, @@ -4821,7 +4630,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomInviteUserFuturePoll( + final tmp6 = _roomActiveMembersIdsFuturePoll( tmp1, tmp3, tmp5, @@ -4847,11 +4656,15 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListFfiString"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp14 = FfiListFfiString._(this, tmp13_1); + final tmp7 = tmp14; return tmp7; } - String? __roomNotificationModeFuturePoll( + FfiListMember? __roomActiveMembersFuturePoll( int boxed, int postCobject, int port, @@ -4865,7 +4678,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomNotificationModeFuturePoll( + final tmp6 = _roomActiveMembersFuturePoll( tmp1, tmp3, tmp5, @@ -4876,8 +4689,6 @@ class Api { final tmp11 = tmp6.arg3; final tmp12 = tmp6.arg4; final tmp13 = tmp6.arg5; - final tmp14 = tmp6.arg6; - final tmp15 = tmp6.arg7; if (tmp8 == 0) { return null; } @@ -4893,27 +4704,15 @@ class Api { } throw tmp9_0; } - if (tmp14 == 0) { - print("returning empty string"); - return ""; - } - final ffi.Pointer tmp13_ptr = ffi.Pointer.fromAddress(tmp13); - List tmp13_buf = []; - final tmp13_precast = tmp13_ptr.cast(); - for (int i = 0; i < tmp14; i++) { - int char = tmp13_precast.elementAt(i).value; - tmp13_buf.add(char); - } - final tmp7 = utf8.decode(tmp13_buf, allowMalformed: true); - if (tmp15 > 0) { - final ffi.Pointer tmp13_0; - tmp13_0 = ffi.Pointer.fromAddress(tmp13); - this.__deallocate(tmp13_0, tmp15 * 1, 1); - } + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListMember"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp14 = FfiListMember._(this, tmp13_1); + final tmp7 = tmp14; return tmp7; } - String? __roomDefaultNotificationModeFuturePoll( + FfiListMember? __roomInvitedMembersFuturePoll( int boxed, int postCobject, int port, @@ -4927,7 +4726,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomDefaultNotificationModeFuturePoll( + final tmp6 = _roomInvitedMembersFuturePoll( tmp1, tmp3, tmp5, @@ -4936,30 +4735,32 @@ class Api { final tmp9 = tmp6.arg1; final tmp10 = tmp6.arg2; final tmp11 = tmp6.arg3; + final tmp12 = tmp6.arg4; + final tmp13 = tmp6.arg5; if (tmp8 == 0) { return null; } - if (tmp10 == 0) { - print("returning empty string"); - return ""; - } - final ffi.Pointer tmp9_ptr = ffi.Pointer.fromAddress(tmp9); - List tmp9_buf = []; - final tmp9_precast = tmp9_ptr.cast(); - for (int i = 0; i < tmp10; i++) { - int char = tmp9_precast.elementAt(i).value; - tmp9_buf.add(char); - } - final tmp7 = utf8.decode(tmp9_buf, allowMalformed: true); - if (tmp11 > 0) { - final ffi.Pointer tmp9_0; - tmp9_0 = ffi.Pointer.fromAddress(tmp9); - this.__deallocate(tmp9_0, tmp11 * 1, 1); + if (tmp9 == 0) { + debugAllocation("handle error", tmp10, tmp11); + final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); + final tmp9_0 = + utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); + if (tmp11 > 0) { + final ffi.Pointer tmp10_0; + tmp10_0 = ffi.Pointer.fromAddress(tmp10); + this.__deallocate(tmp10_0, tmp12, 1); + } + throw tmp9_0; } + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListMember"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp14 = FfiListMember._(this, tmp13_1); + final tmp7 = tmp14; return tmp7; } - bool? __roomUnmuteFuturePoll( + Member? __roomGetMemberFuturePoll( int boxed, int postCobject, int port, @@ -4973,7 +4774,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomUnmuteFuturePoll( + final tmp6 = _roomGetMemberFuturePoll( tmp1, tmp3, tmp5, @@ -4999,11 +4800,14 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_Member"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = Member._(this, tmp13_1); return tmp7; } - bool? __roomSetNotificationModeFuturePoll( + bool? __roomInviteUserFuturePoll( int boxed, int postCobject, int port, @@ -5017,7 +4821,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomSetNotificationModeFuturePoll( + final tmp6 = _roomInviteUserFuturePoll( tmp1, tmp3, tmp5, @@ -5047,7 +4851,7 @@ class Api { return tmp7; } - EventId? __roomUpdatePowerLevelFuturePoll( + String? __roomNotificationModeFuturePoll( int boxed, int postCobject, int port, @@ -5061,7 +4865,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomUpdatePowerLevelFuturePoll( + final tmp6 = _roomNotificationModeFuturePoll( tmp1, tmp3, tmp5, @@ -5072,6 +4876,8 @@ class Api { final tmp11 = tmp6.arg3; final tmp12 = tmp6.arg4; final tmp13 = tmp6.arg5; + final tmp14 = tmp6.arg6; + final tmp15 = tmp6.arg7; if (tmp8 == 0) { return null; } @@ -5087,14 +4893,27 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = EventId._(this, tmp13_1); + if (tmp14 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp13_ptr = ffi.Pointer.fromAddress(tmp13); + List tmp13_buf = []; + final tmp13_precast = tmp13_ptr.cast(); + for (int i = 0; i < tmp14; i++) { + int char = tmp13_precast.elementAt(i).value; + tmp13_buf.add(char); + } + final tmp7 = utf8.decode(tmp13_buf, allowMalformed: true); + if (tmp15 > 0) { + final ffi.Pointer tmp13_0; + tmp13_0 = ffi.Pointer.fromAddress(tmp13); + this.__deallocate(tmp13_0, tmp15 * 1, 1); + } return tmp7; } - MxcUri? __roomUploadAvatarFuturePoll( + String? __roomDefaultNotificationModeFuturePoll( int boxed, int postCobject, int port, @@ -5108,7 +4927,53 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomUploadAvatarFuturePoll( + final tmp6 = _roomDefaultNotificationModeFuturePoll( + tmp1, + tmp3, + tmp5, + ); + final tmp8 = tmp6.arg0; + final tmp9 = tmp6.arg1; + final tmp10 = tmp6.arg2; + final tmp11 = tmp6.arg3; + if (tmp8 == 0) { + return null; + } + if (tmp10 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp9_ptr = ffi.Pointer.fromAddress(tmp9); + List tmp9_buf = []; + final tmp9_precast = tmp9_ptr.cast(); + for (int i = 0; i < tmp10; i++) { + int char = tmp9_precast.elementAt(i).value; + tmp9_buf.add(char); + } + final tmp7 = utf8.decode(tmp9_buf, allowMalformed: true); + if (tmp11 > 0) { + final ffi.Pointer tmp9_0; + tmp9_0 = ffi.Pointer.fromAddress(tmp9); + this.__deallocate(tmp9_0, tmp11 * 1, 1); + } + return tmp7; + } + + bool? __roomUnmuteFuturePoll( + int boxed, + int postCobject, + int port, + ) { + final tmp0 = boxed; + final tmp2 = postCobject; + final tmp4 = port; + var tmp1 = 0; + var tmp3 = 0; + var tmp5 = 0; + tmp1 = tmp0; + tmp3 = tmp2; + tmp5 = tmp4; + final tmp6 = _roomUnmuteFuturePoll( tmp1, tmp3, tmp5, @@ -5134,14 +4999,11 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_MxcUri"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = MxcUri._(this, tmp13_1); + final tmp7 = tmp13 > 0; return tmp7; } - EventId? __roomRemoveAvatarFuturePoll( + bool? __roomSetNotificationModeFuturePoll( int boxed, int postCobject, int port, @@ -5155,7 +5017,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomRemoveAvatarFuturePoll( + final tmp6 = _roomSetNotificationModeFuturePoll( tmp1, tmp3, tmp5, @@ -5181,14 +5043,11 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = EventId._(this, tmp13_1); + final tmp7 = tmp13 > 0; return tmp7; } - EventId? __roomSetTopicFuturePoll( + EventId? __roomUpdatePowerLevelFuturePoll( int boxed, int postCobject, int port, @@ -5202,7 +5061,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomSetTopicFuturePoll( + final tmp6 = _roomUpdatePowerLevelFuturePoll( tmp1, tmp3, tmp5, @@ -5235,7 +5094,7 @@ class Api { return tmp7; } - EventId? __roomSetNameFuturePoll( + MxcUri? __roomUploadAvatarFuturePoll( int boxed, int postCobject, int port, @@ -5249,7 +5108,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _roomSetNameFuturePoll( + final tmp6 = _roomUploadAvatarFuturePoll( tmp1, tmp3, tmp5, @@ -5276,13 +5135,13 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_MxcUri"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = EventId._(this, tmp13_1); + final tmp7 = MxcUri._(this, tmp13_1); return tmp7; } - RoomMessage? __timelineStreamGetMessageFuturePoll( + EventId? __roomRemoveAvatarFuturePoll( int boxed, int postCobject, int port, @@ -5296,7 +5155,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _timelineStreamGetMessageFuturePoll( + final tmp6 = _roomRemoveAvatarFuturePoll( tmp1, tmp3, tmp5, @@ -5323,13 +5182,13 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_RoomMessage"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = RoomMessage._(this, tmp13_1); + final tmp7 = EventId._(this, tmp13_1); return tmp7; } - bool? __timelineStreamPaginateBackwardsFuturePoll( + EventId? __roomSetTopicFuturePoll( int boxed, int postCobject, int port, @@ -5343,7 +5202,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _timelineStreamPaginateBackwardsFuturePoll( + final tmp6 = _roomSetTopicFuturePoll( tmp1, tmp3, tmp5, @@ -5369,11 +5228,14 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = EventId._(this, tmp13_1); return tmp7; } - bool? __timelineStreamSendMessageFuturePoll( + EventId? __roomSetNameFuturePoll( int boxed, int postCobject, int port, @@ -5387,7 +5249,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _timelineStreamSendMessageFuturePoll( + final tmp6 = _roomSetNameFuturePoll( tmp1, tmp3, tmp5, @@ -5413,11 +5275,14 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = EventId._(this, tmp13_1); return tmp7; } - bool? __timelineStreamEditMessageFuturePoll( + RoomMessage? __timelineStreamGetMessageFuturePoll( int boxed, int postCobject, int port, @@ -5431,7 +5296,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _timelineStreamEditMessageFuturePoll( + final tmp6 = _timelineStreamGetMessageFuturePoll( tmp1, tmp3, tmp5, @@ -5457,11 +5322,14 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_RoomMessage"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = RoomMessage._(this, tmp13_1); return tmp7; } - bool? __timelineStreamReplyMessageFuturePoll( + bool? __timelineStreamPaginateBackwardsFuturePoll( int boxed, int postCobject, int port, @@ -5475,7 +5343,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _timelineStreamReplyMessageFuturePoll( + final tmp6 = _timelineStreamPaginateBackwardsFuturePoll( tmp1, tmp3, tmp5, @@ -5505,7 +5373,7 @@ class Api { return tmp7; } - bool? __timelineStreamSendSingleReceiptFuturePoll( + bool? __timelineStreamSendMessageFuturePoll( int boxed, int postCobject, int port, @@ -5519,7 +5387,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _timelineStreamSendSingleReceiptFuturePoll( + final tmp6 = _timelineStreamSendMessageFuturePoll( tmp1, tmp3, tmp5, @@ -5549,7 +5417,7 @@ class Api { return tmp7; } - bool? __timelineStreamSendMultipleReceiptsFuturePoll( + bool? __timelineStreamEditMessageFuturePoll( int boxed, int postCobject, int port, @@ -5563,7 +5431,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _timelineStreamSendMultipleReceiptsFuturePoll( + final tmp6 = _timelineStreamEditMessageFuturePoll( tmp1, tmp3, tmp5, @@ -5593,7 +5461,7 @@ class Api { return tmp7; } - bool? __timelineStreamMarkAsReadFuturePoll( + bool? __timelineStreamReplyMessageFuturePoll( int boxed, int postCobject, int port, @@ -5607,7 +5475,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _timelineStreamMarkAsReadFuturePoll( + final tmp6 = _timelineStreamReplyMessageFuturePoll( tmp1, tmp3, tmp5, @@ -5637,7 +5505,7 @@ class Api { return tmp7; } - bool? __timelineStreamToggleReactionFuturePoll( + bool? __timelineStreamSendSingleReceiptFuturePoll( int boxed, int postCobject, int port, @@ -5651,7 +5519,139 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _timelineStreamToggleReactionFuturePoll( + final tmp6 = _timelineStreamSendSingleReceiptFuturePoll( + tmp1, + tmp3, + tmp5, + ); + final tmp8 = tmp6.arg0; + final tmp9 = tmp6.arg1; + final tmp10 = tmp6.arg2; + final tmp11 = tmp6.arg3; + final tmp12 = tmp6.arg4; + final tmp13 = tmp6.arg5; + if (tmp8 == 0) { + return null; + } + if (tmp9 == 0) { + debugAllocation("handle error", tmp10, tmp11); + final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); + final tmp9_0 = + utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); + if (tmp11 > 0) { + final ffi.Pointer tmp10_0; + tmp10_0 = ffi.Pointer.fromAddress(tmp10); + this.__deallocate(tmp10_0, tmp12, 1); + } + throw tmp9_0; + } + final tmp7 = tmp13 > 0; + return tmp7; + } + + bool? __timelineStreamSendMultipleReceiptsFuturePoll( + int boxed, + int postCobject, + int port, + ) { + final tmp0 = boxed; + final tmp2 = postCobject; + final tmp4 = port; + var tmp1 = 0; + var tmp3 = 0; + var tmp5 = 0; + tmp1 = tmp0; + tmp3 = tmp2; + tmp5 = tmp4; + final tmp6 = _timelineStreamSendMultipleReceiptsFuturePoll( + tmp1, + tmp3, + tmp5, + ); + final tmp8 = tmp6.arg0; + final tmp9 = tmp6.arg1; + final tmp10 = tmp6.arg2; + final tmp11 = tmp6.arg3; + final tmp12 = tmp6.arg4; + final tmp13 = tmp6.arg5; + if (tmp8 == 0) { + return null; + } + if (tmp9 == 0) { + debugAllocation("handle error", tmp10, tmp11); + final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); + final tmp9_0 = + utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); + if (tmp11 > 0) { + final ffi.Pointer tmp10_0; + tmp10_0 = ffi.Pointer.fromAddress(tmp10); + this.__deallocate(tmp10_0, tmp12, 1); + } + throw tmp9_0; + } + final tmp7 = tmp13 > 0; + return tmp7; + } + + bool? __timelineStreamMarkAsReadFuturePoll( + int boxed, + int postCobject, + int port, + ) { + final tmp0 = boxed; + final tmp2 = postCobject; + final tmp4 = port; + var tmp1 = 0; + var tmp3 = 0; + var tmp5 = 0; + tmp1 = tmp0; + tmp3 = tmp2; + tmp5 = tmp4; + final tmp6 = _timelineStreamMarkAsReadFuturePoll( + tmp1, + tmp3, + tmp5, + ); + final tmp8 = tmp6.arg0; + final tmp9 = tmp6.arg1; + final tmp10 = tmp6.arg2; + final tmp11 = tmp6.arg3; + final tmp12 = tmp6.arg4; + final tmp13 = tmp6.arg5; + if (tmp8 == 0) { + return null; + } + if (tmp9 == 0) { + debugAllocation("handle error", tmp10, tmp11); + final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); + final tmp9_0 = + utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); + if (tmp11 > 0) { + final ffi.Pointer tmp10_0; + tmp10_0 = ffi.Pointer.fromAddress(tmp10); + this.__deallocate(tmp10_0, tmp12, 1); + } + throw tmp9_0; + } + final tmp7 = tmp13 > 0; + return tmp7; + } + + bool? __timelineStreamToggleReactionFuturePoll( + int boxed, + int postCobject, + int port, + ) { + final tmp0 = boxed; + final tmp2 = postCobject; + final tmp4 = port; + var tmp1 = 0; + var tmp3 = 0; + var tmp5 = 0; + tmp1 = tmp0; + tmp3 = tmp2; + tmp5 = tmp4; + final tmp6 = _timelineStreamToggleReactionFuturePoll( tmp1, tmp3, tmp5, @@ -16897,61 +16897,6 @@ class Api { _UserProfileGetDisplayNameReturn Function( int, )>(); - late final _roomProfileRoomIdPtr = _lookup< - ffi.NativeFunction< - ffi.Int64 Function( - ffi.Int64, - )>>("__RoomProfile_room_id"); - - late final _roomProfileRoomId = _roomProfileRoomIdPtr.asFunction< - int Function( - int, - )>(); - late final _roomProfileRoomIdStrPtr = _lookup< - ffi.NativeFunction< - _RoomProfileRoomIdStrReturn Function( - ffi.Int64, - )>>("__RoomProfile_room_id_str"); - - late final _roomProfileRoomIdStr = _roomProfileRoomIdStrPtr.asFunction< - _RoomProfileRoomIdStrReturn Function( - int, - )>(); - late final _roomProfileHasAvatarPtr = _lookup< - ffi.NativeFunction< - ffi.Uint8 Function( - ffi.Int64, - )>>("__RoomProfile_has_avatar"); - - late final _roomProfileHasAvatar = _roomProfileHasAvatarPtr.asFunction< - int Function( - int, - )>(); - late final _roomProfileGetAvatarPtr = _lookup< - ffi.NativeFunction< - ffi.Int64 Function( - ffi.Int64, - ffi.Uint8, - ffi.Int64, - )>>("__RoomProfile_get_avatar"); - - late final _roomProfileGetAvatar = _roomProfileGetAvatarPtr.asFunction< - int Function( - int, - int, - int, - )>(); - late final _roomProfileGetDisplayNamePtr = _lookup< - ffi.NativeFunction< - ffi.Int64 Function( - ffi.Int64, - )>>("__RoomProfile_get_display_name"); - - late final _roomProfileGetDisplayName = - _roomProfileGetDisplayNamePtr.asFunction< - int Function( - int, - )>(); late final _receiptEventRoomIdPtr = _lookup< ffi.NativeFunction< ffi.Int64 Function( @@ -19582,6 +19527,40 @@ class Api { _RoomRoomIdStrReturn Function( int, )>(); + late final _roomHasAvatarPtr = _lookup< + ffi.NativeFunction< + ffi.Uint8 Function( + ffi.Int64, + )>>("__Room_has_avatar"); + + late final _roomHasAvatar = _roomHasAvatarPtr.asFunction< + int Function( + int, + )>(); + late final _roomAvatarPtr = _lookup< + ffi.NativeFunction< + ffi.Int64 Function( + ffi.Int64, + ffi.Uint8, + ffi.Int64, + )>>("__Room_avatar"); + + late final _roomAvatar = _roomAvatarPtr.asFunction< + int Function( + int, + int, + int, + )>(); + late final _roomDisplayNamePtr = _lookup< + ffi.NativeFunction< + ffi.Int64 Function( + ffi.Int64, + )>>("__Room_display_name"); + + late final _roomDisplayName = _roomDisplayNamePtr.asFunction< + int Function( + int, + )>(); late final _roomSubscribeToUpdatesPtr = _lookup< ffi.NativeFunction< ffi.Int64 Function( @@ -19645,16 +19624,6 @@ class Api { int Function( int, )>(); - late final _roomGetProfilePtr = _lookup< - ffi.NativeFunction< - ffi.Int64 Function( - ffi.Int64, - )>>("__Room_get_profile"); - - late final _roomGetProfile = _roomGetProfilePtr.asFunction< - int Function( - int, - )>(); late final _roomSpaceRelationsPtr = _lookup< ffi.NativeFunction< ffi.Int64 Function( @@ -20331,16 +20300,6 @@ class Api { int, int, )>(); - late final _convoGetProfilePtr = _lookup< - ffi.NativeFunction< - ffi.Int64 Function( - ffi.Int64, - )>>("__Convo_get_profile"); - - late final _convoGetProfile = _convoGetProfilePtr.asFunction< - int Function( - int, - )>(); late final _convoSpaceRelationsPtr = _lookup< ffi.NativeFunction< ffi.Int64 Function( @@ -23515,16 +23474,6 @@ class Api { int, int, )>(); - late final _spaceGetProfilePtr = _lookup< - ffi.NativeFunction< - ffi.Int64 Function( - ffi.Int64, - )>>("__Space_get_profile"); - - late final _spaceGetProfile = _spaceGetProfilePtr.asFunction< - int Function( - int, - )>(); late final _spaceSpaceRelationsPtr = _lookup< ffi.NativeFunction< ffi.Int64 Function( @@ -27670,36 +27619,6 @@ class Api { int, int, )>(); - late final _roomProfileGetAvatarFuturePollPtr = _lookup< - ffi.NativeFunction< - _RoomProfileGetAvatarFuturePollReturn Function( - ffi.Int64, - ffi.Int64, - ffi.Int64, - )>>("__RoomProfile_get_avatar_future_poll"); - - late final _roomProfileGetAvatarFuturePoll = - _roomProfileGetAvatarFuturePollPtr.asFunction< - _RoomProfileGetAvatarFuturePollReturn Function( - int, - int, - int, - )>(); - late final _roomProfileGetDisplayNameFuturePollPtr = _lookup< - ffi.NativeFunction< - _RoomProfileGetDisplayNameFuturePollReturn Function( - ffi.Int64, - ffi.Int64, - ffi.Int64, - )>>("__RoomProfile_get_display_name_future_poll"); - - late final _roomProfileGetDisplayNameFuturePoll = - _roomProfileGetDisplayNameFuturePollPtr.asFunction< - _RoomProfileGetDisplayNameFuturePollReturn Function( - int, - int, - int, - )>(); late final _newsSlideSourceBinaryFuturePollPtr = _lookup< ffi.NativeFunction< _NewsSlideSourceBinaryFuturePollReturn Function( @@ -28208,6 +28127,35 @@ class Api { int, int, )>(); + late final _roomAvatarFuturePollPtr = _lookup< + ffi.NativeFunction< + _RoomAvatarFuturePollReturn Function( + ffi.Int64, + ffi.Int64, + ffi.Int64, + )>>("__Room_avatar_future_poll"); + + late final _roomAvatarFuturePoll = _roomAvatarFuturePollPtr.asFunction< + _RoomAvatarFuturePollReturn Function( + int, + int, + int, + )>(); + late final _roomDisplayNameFuturePollPtr = _lookup< + ffi.NativeFunction< + _RoomDisplayNameFuturePollReturn Function( + ffi.Int64, + ffi.Int64, + ffi.Int64, + )>>("__Room_display_name_future_poll"); + + late final _roomDisplayNameFuturePoll = + _roomDisplayNameFuturePollPtr.asFunction< + _RoomDisplayNameFuturePollReturn Function( + int, + int, + int, + )>(); late final _roomSetJoinRuleFuturePollPtr = _lookup< ffi.NativeFunction< _RoomSetJoinRuleFuturePollReturn Function( @@ -34612,123 +34560,6 @@ class UserProfile { } } -class RoomProfile { - final Api _api; - final _Box _box; - - RoomProfile._(this._api, this._box); - - /// get room id - RoomId roomId() { - var tmp0 = 0; - tmp0 = _box.borrow(); - final tmp1 = _api._roomProfileRoomId( - tmp0, - ); - final tmp3 = tmp1; - final ffi.Pointer tmp3_0 = ffi.Pointer.fromAddress(tmp3); - final tmp3_1 = _Box(_api, tmp3_0, "drop_box_RoomId"); - tmp3_1._finalizer = _api._registerFinalizer(tmp3_1); - final tmp2 = RoomId._(_api, tmp3_1); - return tmp2; - } - - /// get room id as String - String roomIdStr() { - var tmp0 = 0; - tmp0 = _box.borrow(); - final tmp1 = _api._roomProfileRoomIdStr( - tmp0, - ); - final tmp3 = tmp1.arg0; - final tmp4 = tmp1.arg1; - final tmp5 = tmp1.arg2; - if (tmp4 == 0) { - print("returning empty string"); - return ""; - } - final ffi.Pointer tmp3_ptr = ffi.Pointer.fromAddress(tmp3); - List tmp3_buf = []; - final tmp3_precast = tmp3_ptr.cast(); - for (int i = 0; i < tmp4; i++) { - int char = tmp3_precast.elementAt(i).value; - tmp3_buf.add(char); - } - final tmp2 = utf8.decode(tmp3_buf, allowMalformed: true); - if (tmp5 > 0) { - final ffi.Pointer tmp3_0; - tmp3_0 = ffi.Pointer.fromAddress(tmp3); - _api.__deallocate(tmp3_0, tmp5 * 1, 1); - } - return tmp2; - } - - /// whether to have avatar - bool hasAvatar() { - var tmp0 = 0; - tmp0 = _box.borrow(); - final tmp1 = _api._roomProfileHasAvatar( - tmp0, - ); - final tmp3 = tmp1; - final tmp2 = tmp3 > 0; - return tmp2; - } - - /// get the binary data of avatar - /// if thumb size is given, avatar thumbnail is returned - /// if thumb size is not given, avatar file is returned - Future getAvatar( - ThumbnailSize? thumbSize, - ) { - final tmp1 = thumbSize; - var tmp0 = 0; - var tmp2 = 0; - var tmp4 = 0; - tmp0 = _box.borrow(); - if (tmp1 == null) { - tmp2 = 0; - } else { - tmp2 = 1; - final tmp3 = tmp1; - tmp4 = tmp3._box.move(); - } - final tmp5 = _api._roomProfileGetAvatar( - tmp0, - tmp2, - tmp4, - ); - final tmp7 = tmp5; - final ffi.Pointer tmp7_0 = ffi.Pointer.fromAddress(tmp7); - final tmp7_1 = _Box(_api, tmp7_0, "__RoomProfile_get_avatar_future_drop"); - tmp7_1._finalizer = _api._registerFinalizer(tmp7_1); - final tmp6 = _nativeFuture(tmp7_1, _api.__roomProfileGetAvatarFuturePoll); - return tmp6; - } - - /// get the display name - Future getDisplayName() { - var tmp0 = 0; - tmp0 = _box.borrow(); - final tmp1 = _api._roomProfileGetDisplayName( - tmp0, - ); - final tmp3 = tmp1; - final ffi.Pointer tmp3_0 = ffi.Pointer.fromAddress(tmp3); - final tmp3_1 = - _Box(_api, tmp3_0, "__RoomProfile_get_display_name_future_drop"); - tmp3_1._finalizer = _api._registerFinalizer(tmp3_1); - final tmp2 = - _nativeFuture(tmp3_1, _api.__roomProfileGetDisplayNameFuturePoll); - return tmp2; - } - - /// Manually drops the object and unregisters the FinalizableHandle. - void drop() { - _box.drop(); - } -} - /// Deliver receipt event from rust to flutter class ReceiptEvent { final Api _api; @@ -40512,6 +40343,64 @@ class Room { return tmp2; } + /// whether to have avatar + bool hasAvatar() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomHasAvatar( + tmp0, + ); + final tmp3 = tmp1; + final tmp2 = tmp3 > 0; + return tmp2; + } + + /// get the binary data of avatar + /// if thumb size is given, avatar thumbnail is returned + /// if thumb size is not given, avatar file is returned + Future avatar( + ThumbnailSize? thumbSize, + ) { + final tmp1 = thumbSize; + var tmp0 = 0; + var tmp2 = 0; + var tmp4 = 0; + tmp0 = _box.borrow(); + if (tmp1 == null) { + tmp2 = 0; + } else { + tmp2 = 1; + final tmp3 = tmp1; + tmp4 = tmp3._box.move(); + } + final tmp5 = _api._roomAvatar( + tmp0, + tmp2, + tmp4, + ); + final tmp7 = tmp5; + final ffi.Pointer tmp7_0 = ffi.Pointer.fromAddress(tmp7); + final tmp7_1 = _Box(_api, tmp7_0, "__Room_avatar_future_drop"); + tmp7_1._finalizer = _api._registerFinalizer(tmp7_1); + final tmp6 = _nativeFuture(tmp7_1, _api.__roomAvatarFuturePoll); + return tmp6; + } + + /// get the display name + Future displayName() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomDisplayName( + tmp0, + ); + final tmp3 = tmp1; + final ffi.Pointer tmp3_0 = ffi.Pointer.fromAddress(tmp3); + final tmp3_1 = _Box(_api, tmp3_0, "__Room_display_name_future_drop"); + tmp3_1._finalizer = _api._registerFinalizer(tmp3_1); + final tmp2 = _nativeFuture(tmp3_1, _api.__roomDisplayNameFuturePoll); + return tmp2; + } + /// Whether new updates have been received for this room Stream subscribeToUpdates() { var tmp0 = 0; @@ -40619,21 +40508,6 @@ class Room { return tmp2; } - /// get the room profile that contains avatar and display name - RoomProfile getProfile() { - var tmp0 = 0; - tmp0 = _box.borrow(); - final tmp1 = _api._roomGetProfile( - tmp0, - ); - final tmp3 = tmp1; - final ffi.Pointer tmp3_0 = ffi.Pointer.fromAddress(tmp3); - final tmp3_1 = _Box(_api, tmp3_0, "drop_box_RoomProfile"); - tmp3_1._finalizer = _api._registerFinalizer(tmp3_1); - final tmp2 = RoomProfile._(_api, tmp3_1); - return tmp2; - } - /// get the room profile that contains avatar and display name Future spaceRelations() { var tmp0 = 0; @@ -42077,21 +41951,6 @@ class Convo { Convo._(this._api, this._box); - /// get the room profile that contains avatar and display name - RoomProfile getProfile() { - var tmp0 = 0; - tmp0 = _box.borrow(); - final tmp1 = _api._convoGetProfile( - tmp0, - ); - final tmp3 = tmp1; - final ffi.Pointer tmp3_0 = ffi.Pointer.fromAddress(tmp3); - final tmp3_1 = _Box(_api, tmp3_0, "drop_box_RoomProfile"); - tmp3_1._finalizer = _api._registerFinalizer(tmp3_1); - final tmp2 = RoomProfile._(_api, tmp3_1); - return tmp2; - } - /// get the room profile that contains avatar and display name Future spaceRelations() { var tmp0 = 0; @@ -47822,21 +47681,6 @@ class Space { Space._(this._api, this._box); - /// get the room profile that contains avatar and display name - RoomProfile getProfile() { - var tmp0 = 0; - tmp0 = _box.borrow(); - final tmp1 = _api._spaceGetProfile( - tmp0, - ); - final tmp3 = tmp1; - final ffi.Pointer tmp3_0 = ffi.Pointer.fromAddress(tmp3); - final tmp3_1 = _Box(_api, tmp3_0, "drop_box_RoomProfile"); - tmp3_1._finalizer = _api._registerFinalizer(tmp3_1); - final tmp2 = RoomProfile._(_api, tmp3_1); - return tmp2; - } - /// get the room profile that contains avatar and display name Future spaceRelations() { var tmp0 = 0; @@ -56823,15 +56667,6 @@ class _UserProfileGetDisplayNameReturn extends ffi.Struct { external int arg3; } -class _RoomProfileRoomIdStrReturn extends ffi.Struct { - @ffi.Int64() - external int arg0; - @ffi.Uint64() - external int arg1; - @ffi.Uint64() - external int arg2; -} - class _ReceiptThreadThreadIdReturn extends ffi.Struct { @ffi.Uint8() external int arg0; @@ -59218,36 +59053,6 @@ class _UserProfileGetAvatarFuturePollReturn extends ffi.Struct { external int arg5; } -class _RoomProfileGetAvatarFuturePollReturn extends ffi.Struct { - @ffi.Uint8() - external int arg0; - @ffi.Uint8() - external int arg1; - @ffi.Int64() - external int arg2; - @ffi.Uint64() - external int arg3; - @ffi.Uint64() - external int arg4; - @ffi.Int64() - external int arg5; -} - -class _RoomProfileGetDisplayNameFuturePollReturn extends ffi.Struct { - @ffi.Uint8() - external int arg0; - @ffi.Uint8() - external int arg1; - @ffi.Int64() - external int arg2; - @ffi.Uint64() - external int arg3; - @ffi.Uint64() - external int arg4; - @ffi.Int64() - external int arg5; -} - class _NewsSlideSourceBinaryFuturePollReturn extends ffi.Struct { @ffi.Uint8() external int arg0; @@ -59758,6 +59563,36 @@ class _ReactionManagerReloadFuturePollReturn extends ffi.Struct { external int arg5; } +class _RoomAvatarFuturePollReturn extends ffi.Struct { + @ffi.Uint8() + external int arg0; + @ffi.Uint8() + external int arg1; + @ffi.Int64() + external int arg2; + @ffi.Uint64() + external int arg3; + @ffi.Uint64() + external int arg4; + @ffi.Int64() + external int arg5; +} + +class _RoomDisplayNameFuturePollReturn extends ffi.Struct { + @ffi.Uint8() + external int arg0; + @ffi.Uint8() + external int arg1; + @ffi.Int64() + external int arg2; + @ffi.Uint64() + external int arg3; + @ffi.Uint64() + external int arg4; + @ffi.Int64() + external int arg5; +} + class _RoomSetJoinRuleFuturePollReturn extends ffi.Struct { @ffi.Uint8() external int arg0; diff --git a/native/acter/api.rsh b/native/acter/api.rsh index 5a6cfd79e212..5409c2a24f2f 100644 --- a/native/acter/api.rsh +++ b/native/acter/api.rsh @@ -250,25 +250,6 @@ object UserProfile { fn get_display_name() -> Option; } -object RoomProfile { - /// get room id - fn room_id() -> RoomId; - - /// get room id as String - fn room_id_str() -> string; - - /// whether to have avatar - fn has_avatar() -> bool; - - /// get the binary data of avatar - /// if thumb size is given, avatar thumbnail is returned - /// if thumb size is not given, avatar file is returned - fn get_avatar(thumb_size: Option) -> Future>; - - /// get the display name - fn get_display_name() -> Future>; -} - /// Deliver receipt event from rust to flutter object ReceiptEvent { @@ -1018,6 +999,17 @@ object Room { /// the RoomId as a String fn room_id_str() -> string; + /// whether to have avatar + fn has_avatar() -> bool; + + /// get the binary data of avatar + /// if thumb size is given, avatar thumbnail is returned + /// if thumb size is not given, avatar file is returned + fn avatar(thumb_size: Option) -> Future>; + + /// get the display name + fn display_name() -> Future>; + /// Whether new updates have been received for this room fn subscribe_to_updates() -> Stream; @@ -1036,9 +1028,6 @@ object Room { /// whether we are part of this room fn is_joined() -> bool; - /// get the room profile that contains avatar and display name - fn get_profile() -> RoomProfile; - /// get the room profile that contains avatar and display name fn space_relations() -> Future>; @@ -1219,8 +1208,6 @@ object TimelineStream { object Convo { - /// get the room profile that contains avatar and display name - fn get_profile() -> RoomProfile; /// get the room profile that contains avatar and display name fn space_relations() -> Future>; @@ -1991,8 +1978,6 @@ object ActerAppSettingsBuilder { object Space { - /// get the room profile that contains avatar and display name - fn get_profile() -> RoomProfile; /// get the room profile that contains avatar and display name fn space_relations() -> Future>; diff --git a/native/acter/src/api.rs b/native/acter/src/api.rs index 12ec388ae0cb..5960772bc49d 100644 --- a/native/acter/src/api.rs +++ b/native/acter/src/api.rs @@ -92,7 +92,7 @@ pub use invitation::Invitation; pub use message::{EventSendState, RoomEventItem, RoomMessage, RoomVirtualItem}; pub use news::{NewsEntry, NewsEntryDraft, NewsEntryUpdateBuilder, NewsSlide, NewsSlideDraft}; pub use pins::{Pin as ActerPin, PinDraft, PinUpdateBuilder}; -pub use profile::{RoomProfile, UserProfile}; +pub use profile::UserProfile; pub use push::{ NotificationItem, NotificationRoom, NotificationSender, NotificationSettings, Pusher, }; diff --git a/native/acter/src/api/profile.rs b/native/acter/src/api/profile.rs index 3ca9c1f40644..726f9e180a57 100644 --- a/native/acter/src/api/profile.rs +++ b/native/acter/src/api/profile.rs @@ -100,53 +100,3 @@ impl UserProfile { } } } - -#[derive(Clone)] -pub struct RoomProfile { - room: Room, -} - -impl RoomProfile { - pub(crate) fn new(room: Room) -> Self { - RoomProfile { room } - } - - pub fn room_id(&self) -> OwnedRoomId { - self.room.room_id().to_owned() - } - - pub fn room_id_str(&self) -> String { - self.room.room_id().to_string() - } - - pub fn has_avatar(&self) -> bool { - self.room.avatar_url().is_some() - } - - pub async fn get_avatar(&self, thumb_size: Option>) -> Result { - let room = self.room.clone(); - let format = ThumbnailSize::parse_into_media_format(thumb_size); - RUNTIME - .spawn(async move { - let buf = room.avatar(format).await?; - Ok(OptionBuffer::new(buf)) - }) - .await? - } - - pub async fn get_display_name(&self) -> Result { - let room = self.room.clone(); - RUNTIME - .spawn(async move { - let result = room.compute_display_name().await?; - match result { - DisplayName::Named(name) => Ok(OptionString::new(Some(name))), - DisplayName::Aliased(name) => Ok(OptionString::new(Some(name))), - DisplayName::Calculated(name) => Ok(OptionString::new(Some(name))), - DisplayName::EmptyWas(name) => Ok(OptionString::new(Some(name))), - DisplayName::Empty => Ok(OptionString::new(None)), - } - }) - .await? - } -} diff --git a/native/acter/src/api/room.rs b/native/acter/src/api/room.rs index 3e44768934cc..d6eae22288b5 100644 --- a/native/acter/src/api/room.rs +++ b/native/acter/src/api/room.rs @@ -23,6 +23,7 @@ use matrix_sdk::{ notification_settings::{IsEncrypted, IsOneToOne}, room::{Room as SdkRoom, RoomMember}, RoomMemberships, RoomState, + DisplayName, }; use ruma::{assign, Int}; use ruma_client_api::{ @@ -48,9 +49,7 @@ use std::{io::Write, ops::Deref, path::PathBuf}; use tokio_stream::{wrappers::BroadcastStream, StreamExt}; use tracing::{info, warn}; -use crate::{ - OptionBuffer, OptionString, RoomMessage, RoomProfile, ThumbnailSize, UserProfile, RUNTIME, -}; +use crate::{OptionBuffer, OptionString, RoomMessage, ThumbnailSize, UserProfile, RUNTIME}; use super::{ api::FfiBuffer, @@ -580,6 +579,37 @@ impl Room { Room { core, room } } + pub fn has_avatar(&self) -> bool { + self.room.avatar_url().is_some() + } + + pub async fn avatar(&self, thumb_size: Option>) -> Result { + let room = self.room.clone(); + let format = ThumbnailSize::parse_into_media_format(thumb_size); + RUNTIME + .spawn(async move { + let buf = room.avatar(format).await?; + Ok(OptionBuffer::new(buf)) + }) + .await? + } + + pub async fn display_name(&self) -> Result { + let room = self.room.clone(); + RUNTIME + .spawn(async move { + let result = room.compute_display_name().await?; + match result { + DisplayName::Named(name) => Ok(OptionString::new(Some(name))), + DisplayName::Aliased(name) => Ok(OptionString::new(Some(name))), + DisplayName::Calculated(name) => Ok(OptionString::new(Some(name))), + DisplayName::EmptyWas(name) => Ok(OptionString::new(Some(name))), + DisplayName::Empty => Ok(OptionString::new(None)), + } + }) + .await? + } + pub fn subscribe_to_updates(&self) -> impl Stream { BroadcastStream::new(self.room.subscribe_to_updates()).map(|f| f.is_ok()) } @@ -730,10 +760,6 @@ impl Room { .await? } - pub fn get_profile(&self) -> RoomProfile { - RoomProfile::new(self.room.clone()) - } - pub async fn upload_avatar(&self, uri: String) -> Result { if !self.is_joined() { bail!("Unable to upload avatar to a room we are not in"); From c15097151e109b57d80bbc82fdac3fb0a14008dd Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Tue, 9 Jul 2024 20:00:45 +0530 Subject: [PATCH 11/14] use room_filtered for cleaner room list generation --- native/acter/src/api/client.rs | 8 ++++---- native/acter/src/api/room.rs | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/native/acter/src/api/client.rs b/native/acter/src/api/client.rs index 5931eedeb8bd..c997f12c489e 100644 --- a/native/acter/src/api/client.rs +++ b/native/acter/src/api/client.rs @@ -14,8 +14,9 @@ use futures::{ use matrix_sdk::{ media::{MediaRequest, UniqueKey}, room::Room as SdkRoom, - Client as SdkClient, RoomState, + Client as SdkClient, }; +use matrix_sdk_base::RoomStateFilter; use ruma_common::{ device_id, IdParseError, OwnedDeviceId, OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId, OwnedServerName, OwnedUserId, RoomAliasId, RoomId, RoomOrAliasId, UserId, @@ -196,10 +197,9 @@ impl Client { async fn get_spaces_and_chats(&self) -> (Vec, Vec) { let client = self.core.clone(); - self.rooms() + // only include items we are ourselves are currently joined in + self.rooms_filtered(RoomStateFilter::JOINED) .into_iter() - .filter(|room| matches!(room.state(), RoomState::Joined)) - // only include items we are ourselves are currently joined in .fold( (Vec::new(), Vec::new()), move |(mut spaces, mut convos), room| { diff --git a/native/acter/src/api/room.rs b/native/acter/src/api/room.rs index d6eae22288b5..2cf3c70d23fd 100644 --- a/native/acter/src/api/room.rs +++ b/native/acter/src/api/room.rs @@ -22,8 +22,7 @@ use matrix_sdk::{ media::{MediaFormat, MediaRequest}, notification_settings::{IsEncrypted, IsOneToOne}, room::{Room as SdkRoom, RoomMember}, - RoomMemberships, RoomState, - DisplayName, + DisplayName, RoomMemberships, RoomState, }; use ruma::{assign, Int}; use ruma_client_api::{ From 5d9ac3c790f388f05d6d1fb93cc3fb3d4516757f Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Tue, 9 Jul 2024 20:02:40 +0530 Subject: [PATCH 12/14] remove unnused import --- app/lib/features/chat/pages/room_profile_page.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/app/lib/features/chat/pages/room_profile_page.dart b/app/lib/features/chat/pages/room_profile_page.dart index 9b0b821565ff..74065ad645d7 100644 --- a/app/lib/features/chat/pages/room_profile_page.dart +++ b/app/lib/features/chat/pages/room_profile_page.dart @@ -12,7 +12,6 @@ import 'package:acter/common/widgets/visibility/visibility_chip.dart'; import 'package:acter/features/chat/widgets/member_list.dart'; import 'package:acter/features/chat/widgets/room_avatar.dart'; import 'package:acter/features/chat/widgets/skeletons/action_item_skeleton_widget.dart'; -import 'package:acter/features/chat/widgets/skeletons/members_list_skeleton_widget.dart'; import 'package:acter/features/room/widgets/notifications_settings_tile.dart'; import 'package:acter_avatar/acter_avatar.dart'; import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart'; From 9b8199e31aac061ead84525acb6b3beeff105b95 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Tue, 9 Jul 2024 20:20:49 +0530 Subject: [PATCH 13/14] forgot to commit one --- app/lib/common/providers/room_providers.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/common/providers/room_providers.dart b/app/lib/common/providers/room_providers.dart index b60d7128bd2b..981d5f1c1de1 100644 --- a/app/lib/common/providers/room_providers.dart +++ b/app/lib/common/providers/room_providers.dart @@ -159,7 +159,7 @@ final roomDisplayNameProvider = if (room == null) { return null; } - return (await room.getDisplayName()).text(); + return (await room.displayName()).text(); }); /// Caching the MemoryImage of each room From 97ec76af496233c4dcef59a139c93caeba4b1545 Mon Sep 17 00:00:00 2001 From: bitfriend Date: Wed, 10 Jul 2024 00:08:06 +0800 Subject: [PATCH 14/14] Fix the missing in api change --- app/lib/common/providers/room_providers.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/common/providers/room_providers.dart b/app/lib/common/providers/room_providers.dart index b60d7128bd2b..981d5f1c1de1 100644 --- a/app/lib/common/providers/room_providers.dart +++ b/app/lib/common/providers/room_providers.dart @@ -159,7 +159,7 @@ final roomDisplayNameProvider = if (room == null) { return null; } - return (await room.getDisplayName()).text(); + return (await room.displayName()).text(); }); /// Caching the MemoryImage of each room