From b709442ea45077186bf869ff87ab0448a08e69bd Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Thu, 21 Sep 2023 23:17:09 +0800 Subject: [PATCH 01/10] cargo update Signed-off-by: Bugen Zhao --- Cargo.lock | 854 ++++++++++++++++++++++++++++--------------------- rust-toolchain | 2 +- 2 files changed, 499 insertions(+), 357 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 65e2fc1..d8d1ca5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.17.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -19,13 +19,19 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "0.7.19" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_log-sys" version = "0.2.0" @@ -34,12 +40,12 @@ checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e" [[package]] name = "android_logger" -version = "0.11.1" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e9dd62f37dea550caf48c77591dc50bd1a378ce08855be1a0c42a97b7550fb" +checksum = "8619b80c242aa7bd638b5c7ddd952addeecb71f69c75e33f1d47b2804f8f883a" dependencies = [ "android_log-sys", - "env_logger", + "env_logger 0.10.0", "log", "once_cell", ] @@ -55,18 +61,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.65" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "atomic" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" -dependencies = [ - "autocfg", -] +checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" [[package]] name = "atty" @@ -74,7 +77,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -87,9 +90,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.66" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", @@ -114,9 +117,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.13.0" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "bitflags" @@ -124,6 +127,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + [[package]] name = "bitmaps" version = "2.1.0" @@ -135,15 +144,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytes" -version = "1.2.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cache" @@ -166,28 +175,31 @@ checksum = "1582e1c9e755dd6ad6b224dcffb135d199399a4568d454bd89fe515ca8425695" [[package]] name = "cbindgen" -version = "0.24.3" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6358dedf60f4d9b8db43ad187391afe959746101346fe51bb978126bec61dfb" +checksum = "4b922faaf31122819ec80c4047cc684c6979a087366c069611e33649bf98e18d" dependencies = [ "clap", "heck", - "indexmap", + "indexmap 1.9.3", "log", "proc-macro2", "quote", "serde", "serde_json", - "syn", + "syn 1.0.109", "tempfile", "toml", ] [[package]] name = "cc" -version = "1.0.73" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cesu8" @@ -203,29 +215,28 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ + "android-tzdata", "iana-time-zone", "js-sys", - "num-integer", "num-traits", - "time", "wasm-bindgen", - "winapi", + "windows-targets", ] [[package]] name = "clap" -version = "3.2.21" +version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ed5341b2301a26ab80be5cbdced622e80ed808483c52e45e3310a877d3b37d7" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", - "bitflags", + "bitflags 1.3.2", "clap_lex", - "indexmap", + "indexmap 1.9.3", "strsim", "termcolor", "textwrap", @@ -261,9 +272,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "crc32fast" @@ -276,15 +287,15 @@ dependencies = [ [[package]] name = "dashmap" -version = "5.4.0" +version = "5.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown", + "hashbrown 0.14.0", "lock_api", "once_cell", - "parking_lot_core 0.9.3", + "parking_lot_core 0.9.8", ] [[package]] @@ -295,24 +306,24 @@ checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] name = "either" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "encoding_rs" -version = "0.8.31" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] [[package]] name = "env_logger" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" dependencies = [ "atty", "humantime", @@ -321,6 +332,43 @@ dependencies = [ "termcolor", ] +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "failure" version = "0.1.8" @@ -339,18 +387,15 @@ checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "synstructure", ] [[package]] name = "fastrand" -version = "1.8.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" -dependencies = [ - "instant", -] +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" [[package]] name = "fnv" @@ -360,9 +405,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -379,9 +424,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.24" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" dependencies = [ "futures-channel", "futures-core", @@ -394,9 +439,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.24" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", "futures-sink", @@ -404,15 +449,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.24" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-executor" -version = "0.3.24" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" dependencies = [ "futures-core", "futures-task", @@ -421,38 +466,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.24" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] name = "futures-macro" -version = "0.3.24" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.37", ] [[package]] name = "futures-sink" -version = "0.3.24" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" [[package]] name = "futures-task" -version = "0.3.24" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-util" -version = "0.3.24" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-channel", "futures-core", @@ -479,9 +524,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.7" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", @@ -490,15 +535,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.2" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "h2" -version = "0.3.14" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -506,7 +551,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -519,11 +564,17 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -534,20 +585,35 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys", +] + [[package]] name = "html-escape" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e7479fa1ef38eb49fb6a42c426be515df2d063f06cb8efd3e50af073dbc26c" +checksum = "6d1ad449764d627e22bfd7cd5e8868264fc9236e07c752972b4080cd351cb476" dependencies = [ "utf8-width", ] [[package]] name = "http" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", @@ -573,9 +639,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" @@ -585,9 +651,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.20" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -600,7 +666,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -609,10 +675,11 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" dependencies = [ + "futures-util", "http", "hyper", "rustls", @@ -622,23 +689,32 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.48" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a0714f28b1ee39ccec0770ccb544eb02c9ef2c82bb096230eefcffa6468b0" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", + "iana-time-zone-haiku", "js-sys", - "once_cell", "wasm-bindgen", - "winapi", + "windows", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", ] [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -660,12 +736,22 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", ] [[package]] @@ -679,15 +765,15 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.5.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "itoa" -version = "1.0.3" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jni" @@ -711,9 +797,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -726,15 +812,21 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.132" +version = "0.2.148" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" + +[[package]] +name = "linux-raw-sys" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" [[package]] name = "lock_api" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f80bf5aacaf25cbfc8210d1cfb718f2bf3b11c4c54e5afe36c236853a8ec390" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -742,12 +834,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "logic" @@ -756,7 +845,7 @@ dependencies = [ "android_logger", "cbindgen", "dotenv", - "env_logger", + "env_logger 0.9.3", "jni", "lazy_static", "log", @@ -767,15 +856,15 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "mime" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" @@ -789,21 +878,20 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.4" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys", ] @@ -842,43 +930,43 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.3", "libc", ] [[package]] name = "object" -version = "0.29.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.14.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "os_str_bytes" -version = "6.3.0" +version = "6.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" +checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" [[package]] name = "parking_lot" @@ -888,47 +976,47 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core 0.8.5", + "parking_lot_core 0.8.6", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ "cfg-if", "instant", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "winapi", ] [[package]] name = "parking_lot_core" -version = "0.9.3" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.3.5", "smallvec", - "windows-sys", + "windows-targets", ] [[package]] name = "paste" -version = "1.0.9" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "peg" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af728fe826811af3b38c37e93de6d104485953ea373d656eebae53d6987fcd2c" +checksum = "a07f2cafdc3babeebc087e499118343442b742cc7c31b4d054682cc598508554" dependencies = [ "peg-macros", "peg-runtime", @@ -936,9 +1024,9 @@ dependencies = [ [[package]] name = "peg-macros" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4536be147b770b824895cbad934fccce8e49f14b4c4946eaa46a6e4a12fcdc16" +checksum = "4a90084dc05cf0428428e3d12399f39faad19b0909f64fb9170c9fdd6d9cd49b" dependencies = [ "peg-runtime", "proc-macro2", @@ -947,15 +1035,15 @@ dependencies = [ [[package]] name = "peg-runtime" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b0efd3ba03c3a409d44d60425f279ec442bcf0b9e63ff4e410da31c8b0f69f" +checksum = "9fa00462b37ead6d11a82c9d568b26682d78e0477dc02d1966c013af80969739" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "peresil" @@ -965,9 +1053,9 @@ checksum = "f658886ed52e196e850cfbbfddab9eaa7f6d90dd0929e264c31e5cec07e09e57" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -977,39 +1065,39 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.43" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" dependencies = [ "unicode-ident", ] [[package]] name = "protobuf" -version = "2.27.1" +version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf7e6d18738ecd0902d30d1ad232c9125985a3422929b16c65517b38adc14f96" +checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" [[package]] name = "protobuf-codegen" -version = "2.27.1" +version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aec1632b7c8f2e620343439a7dfd1f3c47b18906c4be58982079911482b5d707" +checksum = "033460afb75cf755fcfc16dfaed20b86468082a2ea24e05ac35ab4a099a017d6" dependencies = [ "protobuf", ] [[package]] name = "protoc" -version = "2.27.1" +version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ef1dc036942fac2470fdb8a911f125404ee9129e9e807f3d12d8589001a38f" +checksum = "a0218039c514f9e14a5060742ecd50427f8ac4f85a6dc58f2ddb806e318c55ee" dependencies = [ "log", "which", @@ -1017,9 +1105,9 @@ dependencies = [ [[package]] name = "protoc-rust" -version = "2.27.1" +version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9e315121c8e7e21396e940a3d27f92280a6d28e3931213bf6cbfea76c5cc94" +checksum = "22f8a182bb17c485f20bdc4274a8c39000a61024cfe461c799b50fec77267838" dependencies = [ "protobuf", "protobuf-codegen", @@ -1047,9 +1135,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.21" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -1125,40 +1213,52 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", ] [[package]] name = "regex" -version = "1.6.0" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" dependencies = [ "aho-corasick", "memchr", + "regex-automata", "regex-syntax", ] [[package]] -name = "regex-syntax" -version = "0.6.27" +name = "regex-automata" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] [[package]] -name = "remove_dir_all" -version = "0.5.3" +name = "regex-syntax" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "reqwest" -version = "0.11.11" +version = "0.11.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" +checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" dependencies = [ "base64", "bytes", @@ -1172,10 +1272,10 @@ dependencies = [ "hyper-rustls", "ipnet", "js-sys", - "lazy_static", "log", "mime", "mime_guess", + "once_cell", "percent-encoding", "pin-project-lite", "rustls", @@ -1211,36 +1311,59 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustix" +version = "0.38.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747c788e9ce8e92b12cd485c49ddf90723550b654b32508f979b71a7b1ecda4f" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] [[package]] name = "rustls" -version = "0.20.6" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", + "rustls-webpki", "sct", - "webpki", ] [[package]] name = "rustls-pemfile" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ "base64", ] +[[package]] +name = "rustls-webpki" +version = "0.101.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45a27e3b59326c16e23d30aeb7a36a24cc0d29e71d68ff611cdfb4a01d013bed" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -1253,9 +1376,9 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" @@ -1269,29 +1392,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.144" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.144" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.37", ] [[package]] name = "serde_json" -version = "1.0.85" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ "itoa", "ryu", @@ -1312,11 +1435,11 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.13" +version = "0.9.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8613d593412a0deb7bbd8de9d908efff5a0cb9ccd8f62c641e7b2ed2f57291d1" +checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" dependencies = [ - "indexmap", + "indexmap 2.0.0", "itoa", "ryu", "serde", @@ -1364,9 +1487,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] @@ -1386,20 +1509,30 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.9.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", "winapi", ] +[[package]] +name = "socket2" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +dependencies = [ + "libc", + "windows-sys", +] + [[package]] name = "spin" version = "0.5.2" @@ -1435,9 +1568,20 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.99" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" dependencies = [ "proc-macro2", "quote", @@ -1452,29 +1596,28 @@ checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "unicode-xid", ] [[package]] name = "tempfile" -version = "3.3.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", + "redox_syscall 0.3.5", + "rustix", + "windows-sys", ] [[package]] name = "termcolor" -version = "1.1.3" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" dependencies = [ "winapi-util", ] @@ -1491,39 +1634,28 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.35" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53f98874615aea268107765aa1ed8f6116782501d18e53d08b471733bea6c85" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.35" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", - "syn", -] - -[[package]] -name = "time" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", + "syn 2.0.37", ] [[package]] @@ -1537,56 +1669,53 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.21.1" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0020c875007ad96677dcc890298f4b942882c5d4eb7cc8f439fc3bf813dc9c95" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", - "memchr", "mio", "num_cpus", - "once_cell", "pin-project-lite", - "socket2", + "socket2 0.5.4", "tokio-macros", - "winapi", + "windows-sys", ] [[package]] name = "tokio-macros" -version = "1.8.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.37", ] [[package]] name = "tokio-rustls" -version = "0.23.4" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ "rustls", "tokio", - "webpki", ] [[package]] name = "tokio-util" -version = "0.7.4" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -1598,9 +1727,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" dependencies = [ "serde", ] @@ -1613,9 +1742,9 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.36" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "pin-project-lite", @@ -1624,18 +1753,18 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.29" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", ] [[package]] name = "try-lock" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "typed-arena" @@ -1645,51 +1774,51 @@ checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d" [[package]] name = "typenum" -version = "1.15.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicase" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" dependencies = [ "version_check", ] [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.4" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ "tinyvec", ] [[package]] name = "unicode-xid" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "unsafe-libyaml" -version = "0.2.4" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e5fa573d8ac5f1a856f8d7be41d390ee973daf97c806b2c1a465e4e1406e68" +checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" [[package]] name = "untrusted" @@ -1699,9 +1828,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.3.1" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -1716,11 +1845,11 @@ checksum = "5190c9442dcdaf0ddd50f37420417d219ae5261bbf5db120d0f9bab996c9cba1" [[package]] name = "uuid" -version = "1.1.2" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" dependencies = [ - "getrandom 0.2.7", + "getrandom 0.2.10", ] [[package]] @@ -1731,22 +1860,20 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.2" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", - "winapi", "winapi-util", ] [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -1756,12 +1883,6 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -1770,9 +1891,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1780,24 +1901,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.37", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.33" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -1807,9 +1928,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1817,61 +1938,49 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.37", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.60" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webpki-roots" -version = "0.22.4" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1c760f0d366a6c24a02ed7816e23e691f5d92291f94d15e836006fd11b04daf" -dependencies = [ - "webpki", -] +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "which" -version = "4.3.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ "either", - "libc", + "home", "once_cell", + "rustix", ] [[package]] @@ -1892,9 +2001,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -1905,67 +2014,100 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-sys" -version = "0.36.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_msvc", "windows_x86_64_gnu", + "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_msvc" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.36.1" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winreg" -version = "0.10.1" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "winapi", + "cfg-if", + "windows-sys", ] [[package]] name = "workspace-hack" version = "0.1.0" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", "libc", "log", "memchr", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] diff --git a/rust-toolchain b/rust-toolchain index 58e4eb6..cc31fcd 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.63 +1.72 From d0742c5289a01f6cab03909387a384d740f0e07e Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Thu, 21 Sep 2023 23:27:22 +0800 Subject: [PATCH 02/10] bump dependencies Signed-off-by: Bugen Zhao --- Cargo.lock | 48 +++++++++++++++++++++++--------------- Cargo.toml | 5 ++++ logic/cache/Cargo.toml | 6 ++--- logic/config/Cargo.toml | 2 +- logic/logic/Cargo.toml | 8 +++---- logic/mock_gen/Cargo.toml | 4 ++-- logic/protos/Cargo.toml | 10 ++++---- logic/service/Cargo.toml | 22 ++++++++--------- logic/service/src/utils.rs | 2 +- logic/text/Cargo.toml | 2 +- 10 files changed, 62 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d8d1ca5..510cd65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -45,7 +45,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8619b80c242aa7bd638b5c7ddd952addeecb71f69c75e33f1d47b2804f8f883a" dependencies = [ "android_log-sys", - "env_logger 0.10.0", + "env_logger", "log", "once_cell", ] @@ -67,9 +67,12 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "atomic" -version = "0.5.3" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" +checksum = "8d818003e740b63afc82337e3160717f4f63078720a810b7b903e70a5d1d2994" +dependencies = [ + "bytemuck", +] [[package]] name = "atty" @@ -148,6 +151,12 @@ version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +[[package]] +name = "bytemuck" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" + [[package]] name = "bytes" version = "1.5.0" @@ -175,9 +184,9 @@ checksum = "1582e1c9e755dd6ad6b224dcffb135d199399a4568d454bd89fe515ca8425695" [[package]] name = "cbindgen" -version = "0.24.5" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b922faaf31122819ec80c4047cc684c6979a087366c069611e33649bf98e18d" +checksum = "da6bc11b07529f16944307272d5bd9b22530bc7d05751717c9d416586cedab49" dependencies = [ "clap", "heck", @@ -319,27 +328,17 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "env_logger" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - [[package]] name = "env_logger" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" dependencies = [ + "humantime", + "is-terminal", "log", "regex", + "termcolor", ] [[package]] @@ -769,6 +768,17 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi 0.3.3", + "rustix", + "windows-sys", +] + [[package]] name = "itoa" version = "1.0.9" @@ -845,7 +855,7 @@ dependencies = [ "android_logger", "cbindgen", "dotenv", - "env_logger 0.9.3", + "env_logger", "jni", "lazy_static", "log", diff --git a/Cargo.toml b/Cargo.toml index 8e6b488..7cfe026 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ "logic/cache", "logic/config", @@ -15,3 +16,7 @@ inherits = "release" opt-level = "s" # Optimize for size. lto = true # Enable link time optimization codegen-units = 1 + +[workspace.dependencies] +tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] } +serde = { version = "1", features = ["derive"] } diff --git a/logic/cache/Cargo.toml b/logic/cache/Cargo.toml index 49acf41..f0e5913 100644 --- a/logic/cache/Cargo.toml +++ b/logic/cache/Cargo.toml @@ -7,9 +7,9 @@ edition = "2021" [dependencies] config = { path = "../config" } -lazy_static = "1.4" +lazy_static = "1" log = "0.4" protos = { path = "../protos" } sled = { git = "https://github.com/spacejam/sled", rev = "95a883f" } -thiserror = "1.0" -tokio = { version = "1.21", features = ["rt-multi-thread", "macros", "time"] } +thiserror = "1" +tokio = { workspace = true } diff --git a/logic/config/Cargo.toml b/logic/config/Cargo.toml index 6c6b995..caa241d 100644 --- a/logic/config/Cargo.toml +++ b/logic/config/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" [dependencies] log = "0.4" -once_cell = "1.14" +once_cell = "1" protos = { path = "../protos" } diff --git a/logic/logic/Cargo.toml b/logic/logic/Cargo.toml index 94bad3a..1d87228 100755 --- a/logic/logic/Cargo.toml +++ b/logic/logic/Cargo.toml @@ -10,10 +10,10 @@ name = "logic" crate-type = ["staticlib", "cdylib"] [dependencies] -env_logger = "0.9" -lazy_static = "1.4" +env_logger = "0.10" +lazy_static = "1" log = "0.4" -tokio = { version = "1.21", features = ["rt-multi-thread", "macros", "time"] } +tokio = { workspace = true } protos = { path = "../protos" } service = { path = "../service" } @@ -25,7 +25,7 @@ android_logger = "0.11" dotenv = "0.15" [build-dependencies] -cbindgen = "0.24" +cbindgen = "0.26" # [features] # default = ["with-serde"] diff --git a/logic/mock_gen/Cargo.toml b/logic/mock_gen/Cargo.toml index 70e5edd..583b30f 100644 --- a/logic/mock_gen/Cargo.toml +++ b/logic/mock_gen/Cargo.toml @@ -6,9 +6,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -anyhow = "1.0" +anyhow = "1" protos = { path = "../protos" } -serde = { version = "1.0", features = ["derive"] } +serde = { workspace = true } serde_yaml = "0.9" text = { path = "../text" } diff --git a/logic/protos/Cargo.toml b/logic/protos/Cargo.toml index 46b36e1..c524efa 100644 --- a/logic/protos/Cargo.toml +++ b/logic/protos/Cargo.toml @@ -5,13 +5,13 @@ edition = "2021" [build-dependencies] -cargo-emit = "0.2.1" -protoc-rust = "2.27" +cargo-emit = "0.2" +protoc-rust = "2" [dependencies] base-62 = "0.1" -paste = "1.0" -protobuf = "2.27" -serde = { version = "1.0", features = ["derive"] } +paste = "1" +protobuf = "2" +serde = { workspace = true } [features] diff --git a/logic/service/Cargo.toml b/logic/service/Cargo.toml index d31099d..4561d6a 100644 --- a/logic/service/Cargo.toml +++ b/logic/service/Cargo.toml @@ -6,30 +6,30 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -dashmap = "5.4" +dashmap = "5" futures = "0.3" -lazy_static = "1.4" +lazy_static = "1" log = "0.4" reqwest = { version = "0.11", features = [ "rustls-tls", "multipart", ], default-features = false } -serde = { version = "1.0", features = ["derive"] } +serde = { workspace = true } sxd-document = "0.3" sxd-xpath = "0.4" -thiserror = "1.0" -tokio = { version = "1.21", features = ["rt-multi-thread", "macros", "time"] } +thiserror = "1" +tokio = { workspace = true } chrono = "0.4" -regex = "1.6" -uuid = { version = "1.1", features = ["v4"] } +regex = "1" +uuid = { version = "1", features = ["v4"] } protos = { path = "../protos" } text = { path = "../text" } cache = { path = "../cache" } config = { path = "../config" } -atomic = "0.5" -url = "2.3" -serde_json = "1.0" -paste = "1.0" +atomic = "0.6" +url = "2" +serde_json = "1" +paste = "1" randua = "0.1" [dev-dependencies] diff --git a/logic/service/src/utils.rs b/logic/service/src/utils.rs index 0362cc7..ffe97df 100644 --- a/logic/service/src/utils.rs +++ b/logic/service/src/utils.rs @@ -173,7 +173,7 @@ pub fn get_unique_id() -> String { #[inline] pub fn server_now() -> DateTime { const HOUR: i32 = 3600; - Utc::now().with_timezone(&FixedOffset::east(8 * HOUR)) + Utc::now().with_timezone(&FixedOffset::east_opt(8 * HOUR).unwrap()) } #[inline] diff --git a/logic/text/Cargo.toml b/logic/text/Cargo.toml index c741cc2..13c86ac 100644 --- a/logic/text/Cargo.toml +++ b/logic/text/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -thiserror = "1.0" +thiserror = "1" protos = { path = "../protos" } peg = "0.8" From f78382d55f8e9dee0381975bf131f7639bf6f6de Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Thu, 21 Sep 2023 23:32:47 +0800 Subject: [PATCH 03/10] use ctor to init logger Signed-off-by: Bugen Zhao --- Cargo.lock | 11 +++++++++++ logic/logic/Cargo.toml | 1 + logic/logic/src/c/lib.rs | 6 +----- logic/logic/src/init.rs | 10 +++------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 510cd65..18b2c4e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -294,6 +294,16 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "ctor" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f34ba9a9bcb8645379e9de8cb3ecfcf4d1c85ba66d90deb3259206fa5aa193b" +dependencies = [ + "quote", + "syn 2.0.37", +] + [[package]] name = "dashmap" version = "5.5.3" @@ -854,6 +864,7 @@ version = "0.1.0" dependencies = [ "android_logger", "cbindgen", + "ctor", "dotenv", "env_logger", "jni", diff --git a/logic/logic/Cargo.toml b/logic/logic/Cargo.toml index 1d87228..609a280 100755 --- a/logic/logic/Cargo.toml +++ b/logic/logic/Cargo.toml @@ -16,6 +16,7 @@ log = "0.4" tokio = { workspace = true } protos = { path = "../protos" } service = { path = "../service" } +ctor = "0.2.4" [target.'cfg(target_os = "android")'.dependencies] jni = "0.19" diff --git a/logic/logic/src/c/lib.rs b/logic/logic/src/c/lib.rs index 6b91d65..0ba7f1a 100644 --- a/logic/logic/src/c/lib.rs +++ b/logic/logic/src/c/lib.rs @@ -1,7 +1,6 @@ use super::{byte_buffer::ByteBuffer, callback::Callback}; use crate::{ - callback_trait::CallbackTrait, init::may_init, r#async::serve_request_async, - sync::serve_request_sync, + callback_trait::CallbackTrait, r#async::serve_request_async, sync::serve_request_sync, }; use protos::{ Message, @@ -18,7 +17,6 @@ unsafe fn parse_from_raw(data: *const u8, len: usize) -> T { /// totally unsafe #[no_mangle] pub unsafe extern "C" fn rust_call(data: *const u8, len: usize) -> ByteBuffer { - may_init(); let request = parse_from_raw::(data, len); log::info!("request {:?}", request); let response_buf = serve_request_sync(request); @@ -29,7 +27,6 @@ pub unsafe extern "C" fn rust_call(data: *const u8, len: usize) -> ByteBuffer { /// totally unsafe #[no_mangle] pub unsafe extern "C" fn rust_call_async(data: *const u8, len: usize, callback: Callback) { - may_init(); log::trace!("get {:?} at {:?}", callback, &callback as *const _); let request = parse_from_raw::(data, len); log::info!("async request #{} {:?}", callback.id(), request); @@ -40,7 +37,6 @@ pub unsafe extern "C" fn rust_call_async(data: *const u8, len: usize, callback: /// totally unsafe #[no_mangle] pub unsafe extern "C" fn rust_free(byte_buffer: ByteBuffer) { - may_init(); log::trace!("free buffer {:?}", byte_buffer); let ByteBuffer { ptr, len, cap, err } = byte_buffer; diff --git a/logic/logic/src/init.rs b/logic/logic/src/init.rs index e4d0b15..ec1b560 100644 --- a/logic/logic/src/init.rs +++ b/logic/logic/src/init.rs @@ -1,6 +1,5 @@ -use std::sync::Once; - -fn do_init() { +#[ctor::ctor] +fn init() { #[cfg(not(target_os = "android"))] env_logger::builder() .filter_level(log::LevelFilter::Info) @@ -8,9 +7,6 @@ fn do_init() { #[cfg(target_os = "android")] android_logger::init_once(android_logger::Config::default().with_min_level(log::Level::Debug)); -} -pub fn may_init() { - static INIT: Once = Once::new(); - INIT.call_once(do_init) + log::info!("initialized logic"); } From 1042a0afb5df5f068973250aab2d933fa2e7c5c3 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Thu, 21 Sep 2023 23:36:17 +0800 Subject: [PATCH 04/10] update hakari Signed-off-by: Bugen Zhao --- .config/hakari.toml | 2 +- Cargo.lock | 12 +++++++++--- logic/cache/Cargo.toml | 1 + logic/config/Cargo.toml | 1 + logic/logic/Cargo.toml | 1 + logic/mock_gen/Cargo.toml | 1 + logic/protos/Cargo.toml | 1 + logic/service/Cargo.toml | 1 + logic/text/Cargo.toml | 1 + logic/workspace-hack/Cargo.toml | 13 +++++-------- 10 files changed, 22 insertions(+), 12 deletions(-) mode change 100755 => 100644 logic/logic/Cargo.toml diff --git a/.config/hakari.toml b/.config/hakari.toml index 49c316d..4424727 100644 --- a/.config/hakari.toml +++ b/.config/hakari.toml @@ -4,7 +4,7 @@ hakari-package = "workspace-hack" # Format for `workspace-hack = ...` lines in other Cargo.tomls. Requires cargo-hakari 0.9.8 or above. -dep-format-version = "2" +dep-format-version = "4" # Setting workspace.resolver = "2" in the root Cargo.toml is HIGHLY recommended. # Hakari works much better with the new feature resolver. diff --git a/Cargo.lock b/Cargo.lock index 18b2c4e..360db20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -174,6 +174,7 @@ dependencies = [ "sled", "thiserror", "tokio", + "workspace-hack", ] [[package]] @@ -277,6 +278,7 @@ dependencies = [ "log", "once_cell", "protos", + "workspace-hack", ] [[package]] @@ -873,6 +875,7 @@ dependencies = [ "protos", "service", "tokio", + "workspace-hack", ] [[package]] @@ -926,6 +929,7 @@ dependencies = [ "serde", "serde_yaml", "text", + "workspace-hack", ] [[package]] @@ -1146,6 +1150,7 @@ dependencies = [ "protobuf", "protoc-rust", "serde", + "workspace-hack", ] [[package]] @@ -1494,6 +1499,7 @@ dependencies = [ "tokio", "url", "uuid", + "workspace-hack", ] [[package]] @@ -1651,6 +1657,7 @@ dependencies = [ "peg", "protos", "thiserror", + "workspace-hack", ] [[package]] @@ -2124,11 +2131,10 @@ dependencies = [ name = "workspace-hack" version = "0.1.0" dependencies = [ - "hashbrown 0.12.3", - "libc", + "hashbrown 0.14.0", "log", - "memchr", "proc-macro2", "quote", "syn 1.0.109", + "syn 2.0.37", ] diff --git a/logic/cache/Cargo.toml b/logic/cache/Cargo.toml index f0e5913..1508958 100644 --- a/logic/cache/Cargo.toml +++ b/logic/cache/Cargo.toml @@ -13,3 +13,4 @@ protos = { path = "../protos" } sled = { git = "https://github.com/spacejam/sled", rev = "95a883f" } thiserror = "1" tokio = { workspace = true } +workspace-hack = { version = "0.1", path = "../workspace-hack" } diff --git a/logic/config/Cargo.toml b/logic/config/Cargo.toml index caa241d..a3408a5 100644 --- a/logic/config/Cargo.toml +++ b/logic/config/Cargo.toml @@ -9,3 +9,4 @@ edition = "2021" log = "0.4" once_cell = "1" protos = { path = "../protos" } +workspace-hack = { version = "0.1", path = "../workspace-hack" } diff --git a/logic/logic/Cargo.toml b/logic/logic/Cargo.toml old mode 100755 new mode 100644 index 609a280..12d95bf --- a/logic/logic/Cargo.toml +++ b/logic/logic/Cargo.toml @@ -17,6 +17,7 @@ tokio = { workspace = true } protos = { path = "../protos" } service = { path = "../service" } ctor = "0.2.4" +workspace-hack = { version = "0.1", path = "../workspace-hack" } [target.'cfg(target_os = "android")'.dependencies] jni = "0.19" diff --git a/logic/mock_gen/Cargo.toml b/logic/mock_gen/Cargo.toml index 583b30f..0a1dfed 100644 --- a/logic/mock_gen/Cargo.toml +++ b/logic/mock_gen/Cargo.toml @@ -11,5 +11,6 @@ protos = { path = "../protos" } serde = { workspace = true } serde_yaml = "0.9" text = { path = "../text" } +workspace-hack = { version = "0.1", path = "../workspace-hack" } [features] diff --git a/logic/protos/Cargo.toml b/logic/protos/Cargo.toml index c524efa..49d0f85 100644 --- a/logic/protos/Cargo.toml +++ b/logic/protos/Cargo.toml @@ -13,5 +13,6 @@ base-62 = "0.1" paste = "1" protobuf = "2" serde = { workspace = true } +workspace-hack = { version = "0.1", path = "../workspace-hack" } [features] diff --git a/logic/service/Cargo.toml b/logic/service/Cargo.toml index 4561d6a..f9fae2b 100644 --- a/logic/service/Cargo.toml +++ b/logic/service/Cargo.toml @@ -31,6 +31,7 @@ url = "2" serde_json = "1" paste = "1" randua = "0.1" +workspace-hack = { version = "0.1", path = "../workspace-hack" } [dev-dependencies] dotenv = "0.15" diff --git a/logic/text/Cargo.toml b/logic/text/Cargo.toml index 13c86ac..f50f4b9 100644 --- a/logic/text/Cargo.toml +++ b/logic/text/Cargo.toml @@ -11,3 +11,4 @@ thiserror = "1" protos = { path = "../protos" } peg = "0.8" html-escape = "0.2" +workspace-hack = { version = "0.1", path = "../workspace-hack" } diff --git a/logic/workspace-hack/Cargo.toml b/logic/workspace-hack/Cargo.toml index 972b6fc..c916b8e 100644 --- a/logic/workspace-hack/Cargo.toml +++ b/logic/workspace-hack/Cargo.toml @@ -14,17 +14,14 @@ publish = false ### BEGIN HAKARI SECTION [dependencies] -hashbrown = { version = "0.12", default-features = false, features = ["raw"] } -libc = { version = "0.2", features = ["std"] } +hashbrown = { version = "0.14", default-features = false, features = ["raw"] } log = { version = "0.4", default-features = false, features = ["std"] } -memchr = { version = "2", features = ["std"] } [build-dependencies] -hashbrown = { version = "0.12", default-features = false, features = ["raw"] } -libc = { version = "0.2", features = ["std"] } log = { version = "0.4", default-features = false, features = ["std"] } -proc-macro2 = { version = "1", features = ["proc-macro"] } -quote = { version = "1", features = ["proc-macro"] } -syn = { version = "1", features = ["clone-impls", "derive", "extra-traits", "full", "parsing", "printing", "proc-macro", "quote", "visit"] } +proc-macro2 = { version = "1" } +quote = { version = "1" } +syn-dff4ba8e3ae991db = { package = "syn", version = "1", features = ["extra-traits", "fold", "full", "visit"] } +syn-f595c2ba2a3f28df = { package = "syn", version = "2", features = ["full"] } ### END HAKARI SECTION From 296736e137dabd7e97264c22c35ccf29b5aff470 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Thu, 21 Sep 2023 23:39:14 +0800 Subject: [PATCH 05/10] fix clippy Signed-off-by: Bugen Zhao --- logic/cache/src/bin/repair.rs | 2 +- logic/logic/build.rs | 2 +- logic/protos/build.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/logic/cache/src/bin/repair.rs b/logic/cache/src/bin/repair.rs index ee34daf..2b1feb9 100644 --- a/logic/cache/src/bin/repair.rs +++ b/logic/cache/src/bin/repair.rs @@ -3,7 +3,7 @@ use std::env; fn open(path: &str, flush: bool) -> sled::Db { sled::Config::new() .path(path) - .flush_every_ms(flush.then(|| 1000)) + .flush_every_ms(flush.then_some(1000)) .cache_capacity(50 * 1024 * 1024) .open() .expect("cannot open or create cache db") diff --git a/logic/logic/build.rs b/logic/logic/build.rs index 73733cf..0996368 100755 --- a/logic/logic/build.rs +++ b/logic/logic/build.rs @@ -6,7 +6,7 @@ fn main() { let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); cbindgen::Builder::new() - .with_crate(&crate_dir) + .with_crate(crate_dir) .with_language(cbindgen::Language::C) .generate() .expect("Unable to generate bindings") diff --git a/logic/protos/build.rs b/logic/protos/build.rs index 9ca8d46..e9c7195 100644 --- a/logic/protos/build.rs +++ b/logic/protos/build.rs @@ -6,8 +6,8 @@ fn main() { protoc_rust::Codegen::new() .out_dir("src/generated") - .includes(&["../../protos"]) - .inputs(&["../../protos/Service.proto", "../../protos/DataModel.proto"]) + .includes(["../../protos"]) + .inputs(["../../protos/Service.proto", "../../protos/DataModel.proto"]) .customize(Customize { // serde_derive: Some(true), gen_mod_rs: Some(true), From a417d25aa4d02e1092c8780c6393106f7580ae30 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Fri, 22 Sep 2023 00:16:09 +0800 Subject: [PATCH 06/10] make it compile Signed-off-by: Bugen Zhao --- Makefile | 2 +- app/MNGA Widget/HotTopicsView.swift | 2 +- app/Shared/Logic/BasicLogicCall.swift | 2 +- .../Models/TopicDetailsActionModel.swift | 24 +++---- app/Shared/Protos/Extensions.swift | 2 +- app/Shared/Utilities/ContentCombiner.swift | 2 +- app/Shared/Utilities/Platform.swift | 16 ++--- app/Shared/Views/AttachmentsView.swift | 2 +- app/Shared/Views/BlockWordListView.swift | 10 +-- app/Shared/Views/CacheView.swift | 18 ++--- app/Shared/Views/CollapsedContentView.swift | 10 +-- app/Shared/Views/ContentImageView.swift | 4 +- app/Shared/Views/DateTimeTextView.swift | 2 +- app/Shared/Views/ForumListView.swift | 2 +- app/Shared/Views/GenericEditorView.swift | 10 +-- app/Shared/Views/LoginView.swift | 18 ++--- app/Shared/Views/PostEditorView.swift | 2 +- app/Shared/Views/PostReplyChainView.swift | 2 +- app/Shared/Views/PostRowUserView.swift | 2 +- app/Shared/Views/PostRowView.swift | 16 ++--- app/Shared/Views/QuoteUserView.swift | 2 +- app/Shared/Views/ShareLinksView.swift | 7 +- .../Views/ShortMessageDetailsView.swift | 2 +- app/Shared/Views/ShortMessageListView.swift | 2 +- .../Views/ShortMessagePostRowView.swift | 2 +- app/Shared/Views/StickerInputView.swift | 2 +- app/Shared/Views/TopicDetailsView.swift | 72 ++++++++++--------- app/Shared/Views/TopicListView.swift | 18 ++--- app/Shared/Views/UserMenuView.swift | 4 +- app/Shared/Views/UserProfileView.swift | 10 +-- app/Shared/Views/UserView.swift | 8 +-- app/iOS/Views/ContentEditorView.swift | 2 +- app/iOS/Views/ImageOverlay.swift | 20 +++--- logic/protos/Cargo.toml | 4 +- 34 files changed, 154 insertions(+), 149 deletions(-) diff --git a/Makefile b/Makefile index 2b5b394..c7b6791 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,7 @@ swiftformat: @if [ -z "${SWIFTFORMAT}" ]; then \ echo "warning: swiftformat not installed, skip" ;\ else \ - ${SWIFTFORMAT} --indent 2 --swiftversion 5.5 . ;\ + ${SWIFTFORMAT} --indent 2 --swiftversion 5.9 . ;\ fi diff --git a/app/MNGA Widget/HotTopicsView.swift b/app/MNGA Widget/HotTopicsView.swift index 7bb14e4..1750777 100644 --- a/app/MNGA Widget/HotTopicsView.swift +++ b/app/MNGA Widget/HotTopicsView.swift @@ -25,7 +25,7 @@ struct HotTopicsView: View { VStack(alignment: .leading, spacing: 8) { HStack(spacing: 4) { Group { - if let image = self.image { + if let image = image { Image(uiImage: image).resizable() } else { Image("default_forum_icon").resizable() diff --git a/app/Shared/Logic/BasicLogicCall.swift b/app/Shared/Logic/BasicLogicCall.swift index 182f703..1c669e1 100644 --- a/app/Shared/Logic/BasicLogicCall.swift +++ b/app/Shared/Logic/BasicLogicCall.swift @@ -1,5 +1,5 @@ // -// RustCall.swift +// BasicLogicCall.swift // InteropApp // // Created by Bugen Zhao on 6/23/21. diff --git a/app/Shared/Models/TopicDetailsActionModel.swift b/app/Shared/Models/TopicDetailsActionModel.swift index 000ab5f..71b10df 100644 --- a/app/Shared/Models/TopicDetailsActionModel.swift +++ b/app/Shared/Models/TopicDetailsActionModel.swift @@ -82,26 +82,26 @@ struct TopicDetailsActionBasicNavigationView: View { var body: some View { let navTopic = Topic.with { - if let tid = self.action.navigateToTid { $0.id = tid } + if let tid = action.navigateToTid { $0.id = tid } } - let user = self.action.showUserProfile ?? .init() - let forum = self.action.navigateToForum ?? .init() - let view = self.action.navigateToView ?? EmptyView().eraseToAnyView() + let user = action.showUserProfile ?? .init() + let forum = action.navigateToForum ?? .init() + let view = action.navigateToView ?? EmptyView().eraseToAnyView() - NavigationLink(destination: TopicDetailsView.build(topic: navTopic), isActive: self.$action.navigateToTid.isNotNil()) {}.hidden() - NavigationLink(destination: UserProfileView.build(user: user), isActive: self.$action.showUserProfile.isNotNil()) {}.hidden() - NavigationLink(destination: TopicListView.build(forum: forum), isActive: self.$action.navigateToForum.isNotNil()) {}.hidden() - NavigationLink(destination: view, isActive: self.$action.navigateToView.isNotNil()) {}.hidden() + NavigationLink(destination: TopicDetailsView.build(topic: navTopic), isActive: $action.navigateToTid.isNotNil()) {}.hidden() + NavigationLink(destination: UserProfileView.build(user: user), isActive: $action.showUserProfile.isNotNil()) {}.hidden() + NavigationLink(destination: TopicListView.build(forum: forum), isActive: $action.navigateToForum.isNotNil()) {}.hidden() + NavigationLink(destination: view, isActive: $action.navigateToView.isNotNil()) {}.hidden() let withPidTopic = Topic.with { - if let tid = self.action.navigateToTidWithPidAndPage?.tid { $0.id = tid } + if let tid = action.navigateToTidWithPidAndPage?.tid { $0.id = tid } } - let page = self.action.navigateToTidWithPidAndPage?.page + let page = action.navigateToTidWithPidAndPage?.page let postId = PostId.with { - if let pid = self.action.navigateToTidWithPidAndPage?.pid { $0.pid = pid } + if let pid = action.navigateToTidWithPidAndPage?.pid { $0.pid = pid } $0.tid = withPidTopic.id } - NavigationLink(destination: TopicDetailsView.build(topic: withPidTopic, fromPage: page, postIdToJump: postId), isActive: self.$action.navigateToTidWithPidAndPage.isNotNil()) {}.hidden() + NavigationLink(destination: TopicDetailsView.build(topic: withPidTopic, fromPage: page, postIdToJump: postId), isActive: $action.navigateToTidWithPidAndPage.isNotNil()) {}.hidden() } } diff --git a/app/Shared/Protos/Extensions.swift b/app/Shared/Protos/Extensions.swift index 6d5db76..b467dc4 100644 --- a/app/Shared/Protos/Extensions.swift +++ b/app/Shared/Protos/Extensions.swift @@ -360,7 +360,7 @@ extension BlockWord { static let userPrefix = "User: " static func fromUser(_ user: UserName) -> Self { - Self.with { $0.word = "\(userPrefix)\(user.display)" } + with { $0.word = "\(userPrefix)\(user.display)" } } var userName: String? { diff --git a/app/Shared/Utilities/ContentCombiner.swift b/app/Shared/Utilities/ContentCombiner.swift index 4c1e08d..8e1046c 100644 --- a/app/Shared/Utilities/ContentCombiner.swift +++ b/app/Shared/Utilities/ContentCombiner.swift @@ -406,7 +406,7 @@ class ContentCombiner { var name: String? if case let .plain(p) = uid.spans.first?.value, p.text != "" { name = p.text - self.setEnv(key: "username", globalValue: p.text) + setEnv(key: "username", globalValue: p.text) } if let uid = uid.attributes.first { setEnv(key: "uid", globalValue: uid) diff --git a/app/Shared/Utilities/Platform.swift b/app/Shared/Utilities/Platform.swift index 89cc1ae..621453c 100644 --- a/app/Shared/Utilities/Platform.swift +++ b/app/Shared/Utilities/Platform.swift @@ -123,33 +123,33 @@ func copyToPasteboard(image: AppKitOrUIKitImage) { extension ToolbarItemPlacement { static var mayNavigationBarLeading: Self { #if os(iOS) - Self.navigationBarLeading + navigationBarLeading #else - Self.navigation + navigation #endif } static var mayNavigationBarLeadingOrAction: Self { #if os(iOS) - Self.navigationBarLeading + navigationBarLeading #else - Self.primaryAction + primaryAction #endif } static var mayNavigationBarTrailing: Self { #if os(iOS) - Self.navigationBarTrailing + navigationBarTrailing #else - Self.automatic + automatic #endif } static var mayBottomBar: Self { #if os(iOS) - Self.bottomBar + bottomBar #else - Self.status + status #endif } } diff --git a/app/Shared/Views/AttachmentsView.swift b/app/Shared/Views/AttachmentsView.swift index 5679756..7a42797 100644 --- a/app/Shared/Views/AttachmentsView.swift +++ b/app/Shared/Views/AttachmentsView.swift @@ -28,7 +28,7 @@ struct AttachmentsView: View { var body: some View { List { ForEachOrEmpty(model.items, id: \.url) { attachment in - Button(action: { self.show(attachment) }) { + Button(action: { show(attachment) }) { Label(attachment.url, systemImage: image(for: attachment)) .font(.system(.subheadline, design: .monospaced)) .lineLimit(1) diff --git a/app/Shared/Views/BlockWordListView.swift b/app/Shared/Views/BlockWordListView.swift index 366f871..06c6a29 100644 --- a/app/Shared/Views/BlockWordListView.swift +++ b/app/Shared/Views/BlockWordListView.swift @@ -25,10 +25,10 @@ struct BlockWordListView: View { List { if newWord != nil { HStack { - TextField(LocalizedStringKey("New word"), text: ($newWord ?? .init()).word, onCommit: self.commitNewWord) + TextField(LocalizedStringKey("New word"), text: ($newWord ?? .init()).word, onCommit: commitNewWord) #if os(iOS) .introspectTextField { - if self.newWord?.word.isEmpty == true { + if newWord?.word.isEmpty == true { $0.becomeFirstResponder() } } @@ -56,10 +56,10 @@ struct BlockWordListView: View { var addButton: some View { Button(action: { withAnimation { - if let newWord = self.newWord, !newWord.word.isEmpty { - self.storage.add(newWord) + if let newWord = newWord, !newWord.word.isEmpty { + storage.add(newWord) } - self.newWord = .init() + newWord = .init() } }) { Label("Add Word", systemImage: "plus.circle") diff --git a/app/Shared/Views/CacheView.swift b/app/Shared/Views/CacheView.swift index da8f5d1..c3cce4d 100644 --- a/app/Shared/Views/CacheView.swift +++ b/app/Shared/Views/CacheView.swift @@ -22,7 +22,7 @@ struct CacheRowView: View { Text(text) .foregroundColor(clear == nil ? .secondary : .primary) Spacer() - if let status = self.status { + if let status = status { Text(status) .foregroundColor(.secondary) } else { @@ -34,7 +34,7 @@ struct CacheRowView: View { var body: some View { Group { if let clear = clear { - Button(action: { self.alertPresented = true }) { + Button(action: { alertPresented = true }) { inner }.alert(isPresented: $alertPresented) { Alert(title: Text("Are you sure to clear the cache?"), message: Text("This will take a while."), primaryButton: .default(Text("Clear")) { clear() }, secondaryButton: .cancel()) @@ -56,16 +56,16 @@ struct CacheView: View { List { Section(header: Text("Image")) { CacheRowView(text: "Image Cache", status: imageStatus) { - self.imageStatus = nil - self.clearImageCache() + imageStatus = nil + clearImageCache() }.onAppear { if imageStatus == nil { loadImageCacheSize() } } } Section(header: Text("Data")) { ForEach(CacheType.allCases, id: \.self) { type in let action = type == .all ? nil : { - self.cacheStatus.removeValue(forKey: type) - self.manipulateCache(for: type, operation: .clear) + cacheStatus.removeValue(forKey: type) + manipulateCache(for: type, operation: .clear) } CacheRowView(text: type.description, status: cacheStatus[type], clear: action) .onAppear { manipulateCache(for: type, operation: .check) } @@ -91,7 +91,7 @@ struct CacheView: View { func loadImageCacheSize() { SDImageCache.shared.calculateSize { _, totalSize in - self.imageStatus = ByteCountFormatter().string(fromByteCount: Int64(totalSize)) + imageStatus = ByteCountFormatter().string(fromByteCount: Int64(totalSize)) } } @@ -101,9 +101,9 @@ struct CacheView: View { $0.operation = operation })) { (response: CacheResponse) in if type == .all { - self.cacheStatus[type] = ByteCountFormatter().string(fromByteCount: Int64(response.totalSize)) + cacheStatus[type] = ByteCountFormatter().string(fromByteCount: Int64(response.totalSize)) } else { - self.cacheStatus[type] = String(format: "%llu items".localized, response.items) + cacheStatus[type] = String(format: "%llu items".localized, response.items) } if operation == .clear { diff --git a/app/Shared/Views/CollapsedContentView.swift b/app/Shared/Views/CollapsedContentView.swift index f237af6..42b4a7a 100644 --- a/app/Shared/Views/CollapsedContentView.swift +++ b/app/Shared/Views/CollapsedContentView.swift @@ -16,18 +16,18 @@ struct CollapsedContentView: View { var body: some View { VStack(alignment: .leading) { - Button(action: { self.collapsed.toggle() }) { + Button(action: { collapsed.toggle() }) { HStack { - Image(systemName: self.collapsed ? "chevron.down" : "chevron.up") - Text(self.title) + Image(systemName: collapsed ? "chevron.down" : "chevron.up") + Text(title) }.padding(.bottom, 1) .foregroundColor(.accentColor) .font(.subheadline.bold()) }.buttonStyle(PlainButtonStyle()) Group { - if !self.collapsed { - self.content() + if !collapsed { + content() } } }.fixedSize(horizontal: false, vertical: true) diff --git a/app/Shared/Views/ContentImageView.swift b/app/Shared/Views/ContentImageView.swift index 92f396b..3155354 100644 --- a/app/Shared/Views/ContentImageView.swift +++ b/app/Shared/Views/ContentImageView.swift @@ -34,7 +34,7 @@ struct ContentImageView: View { .frame(width: 50, height: 50) } else { if onlyThumbs { - ContentButtonView(icon: "photo", title: Text("View Image"), inQuote: true) { self.showImage() } + ContentButtonView(icon: "photo", title: Text("View Image"), inQuote: true) { showImage() } } else { Group { if let model = presendAttachmentsModel, let image = model.image(for: url) { @@ -45,7 +45,7 @@ struct ContentImageView: View { } }.scaledToFit() .clipShape(RoundedRectangle(cornerRadius: 8)) - .onTapGesture(perform: self.showImage) + .onTapGesture(perform: showImage) } } } diff --git a/app/Shared/Views/DateTimeTextView.swift b/app/Shared/Views/DateTimeTextView.swift index 0c958b3..3d6d694 100644 --- a/app/Shared/Views/DateTimeTextView.swift +++ b/app/Shared/Views/DateTimeTextView.swift @@ -55,7 +55,7 @@ struct DateTimeTextView: View { if switchable { view.onTapGesture { - withAnimation { self.showDetailed.toggle() } + withAnimation { showDetailed.toggle() } } } else { view diff --git a/app/Shared/Views/ForumListView.swift b/app/Shared/Views/ForumListView.swift index d1b61bc..2f1f6af 100644 --- a/app/Shared/Views/ForumListView.swift +++ b/app/Shared/Views/ForumListView.swift @@ -53,7 +53,7 @@ struct ForumListView: View { favorites.favoriteForums.remove(atOffsets: offsets) }.onMove { from, to in favorites.favoriteForums.move(fromOffsets: from, toOffset: to) - withAnimation { self.favoriteEditing = false } + withAnimation { favoriteEditing = false } } } } diff --git a/app/Shared/Views/GenericEditorView.swift b/app/Shared/Views/GenericEditorView.swift index 2b74714..d9f474a 100644 --- a/app/Shared/Views/GenericEditorView.swift +++ b/app/Shared/Views/GenericEditorView.swift @@ -46,14 +46,14 @@ private struct GenericEditorViewInner>: @ViewBuilder var previewInner: some View { - if let subject = self.subject { + if let subject = subject { TopicSubjectView(topic: .with { $0.subject = subject }, showIndicators: false) } VStack(alignment: .leading, spacing: 10) { if postReply.context?.anonymous == true { UserView(user: .anonymousExample, style: .normal) - } else if let user = self.currentUser.user { + } else if let user = currentUser.user { UserView(user: user, style: .normal) } @@ -107,7 +107,7 @@ private struct GenericEditorViewInner>: DispatchQueue.global(qos: .userInitiated).async { let content = (postReply.context?.content ?? "").replacingOccurrences(of: "\n", with: "
") let response: ContentParseResponse? = try? logicCall(.contentParse(.with { $0.raw = content })) - self.parsedContent = response?.content ?? .init() + parsedContent = response?.content ?? .init() } if let subject = postReply.context?.subject { DispatchQueue.global(qos: .userInitiated).async { @@ -137,14 +137,14 @@ private struct GenericEditorViewInner>: @ViewBuilder var cancelButton: some View { - Button(action: { self.presentation.dismiss() }) { + Button(action: { presentation.dismiss() }) { Text("Cancel") } } @ViewBuilder var discardButton: some View { - Button(role: .destructive, action: { self.postReply.discardCurrentContext() }) { + Button(role: .destructive, action: { postReply.discardCurrentContext() }) { Text("Discard").foregroundColor(.red).bold() } } diff --git a/app/Shared/Views/LoginView.swift b/app/Shared/Views/LoginView.swift index 13b24a3..834ada2 100644 --- a/app/Shared/Views/LoginView.swift +++ b/app/Shared/Views/LoginView.swift @@ -94,9 +94,9 @@ struct LoginView: View { var toolbar: some ToolbarContent { ToolbarItem(placement: .cancellationAction) { Button(action: close) { Text("Cancel") } } ToolbarItem(placement: .mayNavigationBarTrailing) { if authing { ProgressView() } } - ToolbarItem(placement: .status) { Button(action: { self.load(url: URLs.login) }) { Text("Sign In") } } - ToolbarItem(placement: .status) { Button(action: { self.load(url: URLs.agreement) }) { Text("Agreement") } } - ToolbarItem(placement: .status) { Button(action: { self.load(url: URLs.privacy) }) { Text("Privacy") } } + ToolbarItem(placement: .status) { Button(action: { load(url: URLs.login) }) { Text("Sign In") } } + ToolbarItem(placement: .status) { Button(action: { load(url: URLs.agreement) }) { Text("Agreement") } } + ToolbarItem(placement: .status) { Button(action: { load(url: URLs.privacy) }) { Text("Privacy") } } } func load(url: URL) { @@ -107,13 +107,13 @@ struct LoginView: View { var webView: some View { WebView(webView: webViewStore.webView) .onAppear { - self.delegate = .init(parent: self) - self.webViewStore.webView.load(URLRequest(url: URLs.login)) - self.webViewStore.webView.uiDelegate = self.delegate - self.webViewStore.webView.navigationDelegate = self.delegate - self.load(url: URLs.login) + delegate = .init(parent: self) + webViewStore.webView.load(URLRequest(url: URLs.login)) + webViewStore.webView.uiDelegate = delegate + webViewStore.webView.navigationDelegate = delegate + load(url: URLs.login) }.onReceive(timer) { _ in - self.webViewStore.configuration.websiteDataStore.httpCookieStore.getAllCookies(authWithCookies) + webViewStore.configuration.websiteDataStore.httpCookieStore.getAllCookies(authWithCookies) }.navigationTitleInline(key: "Sign in to NGA") } diff --git a/app/Shared/Views/PostEditorView.swift b/app/Shared/Views/PostEditorView.swift index 62816c4..ee71cd0 100644 --- a/app/Shared/Views/PostEditorView.swift +++ b/app/Shared/Views/PostEditorView.swift @@ -32,7 +32,7 @@ struct PostReplyTask: TaskProtocol { func buildUploadAttachmentRequest(data: Data) -> AsyncRequest.OneOf_Value? { .uploadAttachment(.with { - $0.action = self.action + $0.action = action $0.file = data }) } diff --git a/app/Shared/Views/PostReplyChainView.swift b/app/Shared/Views/PostReplyChainView.swift index 959c48f..29b8a05 100644 --- a/app/Shared/Views/PostReplyChainView.swift +++ b/app/Shared/Views/PostReplyChainView.swift @@ -47,7 +47,7 @@ struct PostReplyChainView: View { $0.postID = id.pid })) { (response: TopicDetailsResponse) in guard let post = response.replies.first else { return } - withAnimation { self.remotePosts[post.id] = post } + withAnimation { remotePosts[post.id] = post } } } } diff --git a/app/Shared/Views/PostRowUserView.swift b/app/Shared/Views/PostRowUserView.swift index cc7b971..67ed7d7 100644 --- a/app/Shared/Views/PostRowUserView.swift +++ b/app/Shared/Views/PostRowUserView.swift @@ -24,7 +24,7 @@ struct PostRowUserView: View { } var body: some View { - if let user = self.user { + if let user = user { UserView(user: user, style: style, isAuthor: isAuthor) } else { UserView(id: post.authorID, style: style, isAuthor: isAuthor) diff --git a/app/Shared/Views/PostRowView.swift b/app/Shared/Views/PostRowView.swift index e025d1b..8df55e5 100644 --- a/app/Shared/Views/PostRowView.swift +++ b/app/Shared/Views/PostRowView.swift @@ -213,7 +213,7 @@ struct PostRowView: View { .contextMenu { menu } #endif #if os(iOS) - .listRowBackground(action?.scrollToPid == self.post.id.pid ? Color.tertiarySystemBackground : nil) + .listRowBackground(action?.scrollToPid == post.id.pid ? Color.tertiarySystemBackground : nil) #endif .background { navigation } .environmentObject(attachments) @@ -244,10 +244,10 @@ struct PostRowView: View { })) { (response: PostVoteResponse) in if !response.hasError { withAnimation { - self.vote.state = response.state - self.vote.delta += response.delta + vote.state = response.state + vote.delta += response.delta #if os(iOS) - if self.vote.state != .none { + if vote.state != .none { HapticUtils.play(style: .light) } #endif @@ -262,7 +262,7 @@ struct PostRowView: View { if dummy { return } model.show(action: .with { - $0.postID = self.post.id + $0.postID = post.id $0.forumID = .with { f in f.fid = post.fid } @@ -272,7 +272,7 @@ struct PostRowView: View { func doComment(model: PostReplyModel) { model.show(action: .with { - $0.postID = self.post.id + $0.postID = post.id $0.forumID = .with { f in f.fid = post.fid } @@ -282,7 +282,7 @@ struct PostRowView: View { func doEdit(model: PostReplyModel) { model.show(action: .with { - $0.postID = self.post.id + $0.postID = post.id $0.forumID = .with { f in f.fid = post.fid } @@ -292,7 +292,7 @@ struct PostRowView: View { func doReport(model: PostReplyModel) { model.show(action: .with { - $0.postID = self.post.id + $0.postID = post.id $0.operation = .report }) } diff --git a/app/Shared/Views/QuoteUserView.swift b/app/Shared/Views/QuoteUserView.swift index 5eaf8a9..bf1825e 100644 --- a/app/Shared/Views/QuoteUserView.swift +++ b/app/Shared/Views/QuoteUserView.swift @@ -18,7 +18,7 @@ struct QuoteUserView: View { var body: some View { HStack { UserView(id: uid, nameHint: nameHint, style: .compact) - if let action = self.action, enableShowReplyChain { + if let action = action, enableShowReplyChain { Spacer() Button(action: action) { HStack(spacing: 2) { diff --git a/app/Shared/Views/ShareLinksView.swift b/app/Shared/Views/ShareLinksView.swift index 76e72c5..44ff188 100644 --- a/app/Shared/Views/ShareLinksView.swift +++ b/app/Shared/Views/ShareLinksView.swift @@ -16,16 +16,17 @@ struct ShareLinksView: View { var body: some View { Menu { - Button(action: { self.activity.put(navigationID.mngaURL) }) { + Button(action: { activity.put(navigationID.mngaURL) }) { Label("MNGA Link", systemImage: "m.circle") } if !navigationID.isMNGAMockID { - Button(action: { self.activity.put(navigationID.webpageURL) }) { + Button(action: { activity.put(navigationID.webpageURL) }) { Label("NGA Link", systemImage: "network") } } - if let o = others { o() } + + others() } label: { Label("Share", systemImage: "square.and.arrow.up") } diff --git a/app/Shared/Views/ShortMessageDetailsView.swift b/app/Shared/Views/ShortMessageDetailsView.swift index 5c3b449..87c502d 100644 --- a/app/Shared/Views/ShortMessageDetailsView.swift +++ b/app/Shared/Views/ShortMessageDetailsView.swift @@ -38,7 +38,7 @@ struct ShortMessageDetailsView: View { @ViewBuilder var replyButton: some View { - Button(action: { self.doReply() }) { + Button(action: { doReply() }) { Label("Reply", systemImage: "arrowshape.turn.up.left") } } diff --git a/app/Shared/Views/ShortMessageListView.swift b/app/Shared/Views/ShortMessageListView.swift index e91bcc3..287d54a 100644 --- a/app/Shared/Views/ShortMessageListView.swift +++ b/app/Shared/Views/ShortMessageListView.swift @@ -33,7 +33,7 @@ struct ShortMessageListView: View { @ViewBuilder var newShortMessageButton: some View { - Button(action: { self.newShortMessage() }) { + Button(action: { newShortMessage() }) { Label("New Short Message", systemImage: "square.and.pencil") } } diff --git a/app/Shared/Views/ShortMessagePostRowView.swift b/app/Shared/Views/ShortMessagePostRowView.swift index 771078c..ff7d366 100644 --- a/app/Shared/Views/ShortMessagePostRowView.swift +++ b/app/Shared/Views/ShortMessagePostRowView.swift @@ -43,7 +43,7 @@ struct ShortMessagePostRowView: View { @ViewBuilder var header: some View { HStack { - if let user = self.user { + if let user = user { UserView(user: user, style: .normal) } else { UserView(id: post.authorID, style: .normal) diff --git a/app/Shared/Views/StickerInputView.swift b/app/Shared/Views/StickerInputView.swift index db68e6f..fdc5a5d 100644 --- a/app/Shared/Views/StickerInputView.swift +++ b/app/Shared/Views/StickerInputView.swift @@ -18,7 +18,7 @@ struct StickerInputView: View { ScrollView(.horizontal) { LazyHGrid(rows: rows, spacing: 10) { ForEach(stickerImageNames, id: \.self) { name in - Button(action: { self.insert(name: name) }) { + Button(action: { insert(name: name) }) { Image(name) .renderingMode(name.starts(with: "a") ? .template : .original) .resizable() diff --git a/app/Shared/Views/TopicDetailsView.swift b/app/Shared/Views/TopicDetailsView.swift index 1cb9d63..3076ce4 100644 --- a/app/Shared/Views/TopicDetailsView.swift +++ b/app/Shared/Views/TopicDetailsView.swift @@ -53,7 +53,7 @@ struct TopicDetailsView: View { } static func build(id: String, fav: String? = nil) -> some View { - Self.build(topic: .with { + build(topic: .with { $0.id = id if let fav = fav { $0.fav = fav @@ -96,7 +96,7 @@ struct TopicDetailsView: View { static func build(topic: Topic, localMode: Bool = false, onlyPost: (id: PostId?, atPage: Int?) = (nil, nil), fromPage: Int? = nil, postIdToJump: PostId? = nil) -> some View { StaticTopicDetailsView(topic: topic) { binding in - Self.build(topicBinding: binding, localMode: localMode, onlyPost: onlyPost, fromPage: fromPage, postIdToJump: postIdToJump) + build(topicBinding: binding, localMode: localMode, onlyPost: onlyPost, fromPage: fromPage, postIdToJump: postIdToJump) } } @@ -155,7 +155,7 @@ struct TopicDetailsView: View { @ViewBuilder var replyButton: some View { if !mock { - Button(action: { self.doReplyTopic() }) { + Button(action: { doReplyTopic() }) { Label("Reply", systemImage: "arrowshape.turn.up.left") } } @@ -178,15 +178,15 @@ struct TopicDetailsView: View { Menu { Section { if enableAuthorOnly, !topic.authorName.isAnonymous { - Button(action: { self.action.navigateToAuthorOnly = self.topic.authorID }) { + Button(action: { action.navigateToAuthorOnly = topic.authorID }) { Label("Author Only", systemImage: "person.fill") } } if !localMode { - Button(action: { self.action.navigateToLocalMode = true }) { + Button(action: { action.navigateToLocalMode = true }) { Label("View Cached Topic", systemImage: "clock") } - Button(action: { self.showJumpSelector = true }) { + Button(action: { showJumpSelector = true }) { Label("Jump to...", systemImage: "arrow.up.arrow.down") } } @@ -194,7 +194,7 @@ struct TopicDetailsView: View { #if os(iOS) ShareLinksView(navigationID: navID) { - Button(action: self.shareAsImage) { + Button(action: shareAsImage) { Label("Screenshot (Beta)", systemImage: "text.below.photo") } } @@ -202,14 +202,14 @@ struct TopicDetailsView: View { Section { if let atForum = atForum { - Button(action: { self.action.navigateToForum = atForum }) { + Button(action: { action.navigateToForum = atForum }) { Label("Goto \(atForum.name)", systemImage: "list.triangle") } } #if os(iOS) favoriteButton #endif - Button(action: { self.dataSource.refresh() }) { + Button(action: { dataSource.refresh() }) { Label("Refresh", systemImage: "arrow.clockwise") } Label("#" + topic.id, systemImage: "number") @@ -246,10 +246,10 @@ struct TopicDetailsView: View { let currFirst = dataSource.items.min(by: { $0.floor < $1.floor }) { Button(action: { - self.action.scrollToFloor = Int(currFirst.floor) // scroll to first for fixing scroll position + action.scrollToFloor = Int(currFirst.floor) // scroll to first for fixing scroll position dataSource.reload(page: prevPage, evenIfNotLoaded: true) { guard let floor = dataSource.itemsAtPage(prevPage).map(\.floor).max() else { return } - DispatchQueue.main.async { self.action.scrollToFloor = Int(floor) } // scroll to last of prev page + DispatchQueue.main.async { action.scrollToFloor = Int(floor) } // scroll to last of prev page } }) { Label("Load Page \(prevPage)", systemImage: "arrow.counterclockwise") @@ -275,7 +275,7 @@ struct TopicDetailsView: View { } .fixedSize(horizontal: false, vertical: true) - if let first = self.first { + if let first = first { buildRow(post: first) } } @@ -289,7 +289,7 @@ struct TopicDetailsView: View { @ViewBuilder var hotRepliesSection: some View { - if let hotReplies = self.first?.hotReplies, !hotReplies.isEmpty { + if let hotReplies = first?.hotReplies, !hotReplies.isEmpty { Section(header: Text("Hot Replies")) { ForEach(hotReplies, id: \.id.pid) { post in buildRow(post: post, withId: false) @@ -316,14 +316,14 @@ struct TopicDetailsView: View { @ViewBuilder var navigation: some View { - let showingChain = self.action.showingReplyChain ?? .init() - NavigationLink(destination: PostReplyChainView(baseDataSource: dataSource, votes: votes, chain: showingChain).environmentObject(postReply), isActive: self.$action.showingReplyChain.isNotNil()) {}.hidden() + let showingChain = action.showingReplyChain ?? .init() + NavigationLink(destination: PostReplyChainView(baseDataSource: dataSource, votes: votes, chain: showingChain).environmentObject(postReply), isActive: $action.showingReplyChain.isNotNil()) {}.hidden() - let authorOnlyView = TopicDetailsView.build(topic: topic, only: self.action.navigateToAuthorOnly ?? .init()) - NavigationLink(destination: authorOnlyView, isActive: self.$action.navigateToAuthorOnly.isNotNil()) {}.hidden() + let authorOnlyView = TopicDetailsView.build(topic: topic, only: action.navigateToAuthorOnly ?? .init()) + NavigationLink(destination: authorOnlyView, isActive: $action.navigateToAuthorOnly.isNotNil()) {}.hidden() let localCacheView = TopicDetailsView.build(topic: topic, localMode: true) - NavigationLink(destination: localCacheView, isActive: self.$action.navigateToLocalMode) {}.hidden() + NavigationLink(destination: localCacheView, isActive: $action.navigateToLocalMode) {}.hidden() } @ViewBuilder @@ -467,9 +467,9 @@ struct TopicDetailsView: View { .navigationTitleInline(string: title) .toolbarWithFix { toolbar } .background { navigation } - .onChange(of: postReply.sent, perform: self.reloadPageAfter(sent:)) - .onChange(of: dataSource.latestResponse, perform: self.onNewResponse(response:)) - .onChange(of: dataSource.latestError, perform: self.onError(e:)) + .onChange(of: postReply.sent, perform: reloadPageAfter(sent:)) + .onChange(of: dataSource.latestResponse, perform: onNewResponse(response:)) + .onChange(of: dataSource.latestError, perform: onError(e:)) .environmentObject(postReply) .onAppear { dataSource.initialLoad() } .userActivity(Constants.Activity.openTopic) { $0.webpageURL = navID.webpageURL } @@ -499,9 +499,9 @@ struct TopicDetailsView: View { func toggleFavor() { logicCallAsync(.topicFavor(.with { $0.topicID = topic.id - $0.operation = self.isFavored ? .delete : .add + $0.operation = isFavored ? .delete : .add })) { (response: TopicFavorResponse) in - self.isFavored = response.isFavored + isFavored = response.isFavored #if os(iOS) HapticUtils.play(type: .success) #endif @@ -515,7 +515,7 @@ struct TopicDetailsView: View { f.fid = topic.fid } $0.postID = .with { - $0.tid = self.topic.id + $0.tid = topic.id $0.pid = "0" } }, pageToReload: .last) @@ -570,7 +570,7 @@ struct TopicDetailsView: View { VStack(alignment: .leading) { headerSectionInner - if let hotReplies = self.first?.hotReplies, !hotReplies.isEmpty { + if let hotReplies = first?.hotReplies, !hotReplies.isEmpty { Text("Hot Replies") .font(.footnote) .foregroundColor(.secondary) @@ -578,15 +578,17 @@ struct TopicDetailsView: View { Divider() buildRow(post: post, withId: false) } - } else if let latestReplies = dataSource.sortedItems(by: \.floor).dropFirst().prefix(5), - !latestReplies.isEmpty - { - Text("Replies") - .font(.footnote) - .foregroundColor(.secondary) - ForEach(latestReplies, id: \.id.pid) { post in - Divider() - buildRow(post: post, withId: false) + } else { + let latestReplies = dataSource.sortedItems(by: \.floor).dropFirst().prefix(5) + + if !latestReplies.isEmpty { + Text("Replies") + .font(.footnote) + .foregroundColor(.secondary) + ForEach(latestReplies, id: \.id.pid) { post in + Divider() + buildRow(post: post, withId: false) + } } } } @@ -602,7 +604,7 @@ struct TopicDetailsView: View { DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { let image = screenshotView.snapshot() if image.size == .zero { - self.alert.message = .error("Contents are too large to take a screenshot.".localized) + alert.message = .error("Contents are too large to take a screenshot.".localized) } else { viewingImage.show(image: image) } diff --git a/app/Shared/Views/TopicListView.swift b/app/Shared/Views/TopicListView.swift index 0de2490..1962026 100644 --- a/app/Shared/Views/TopicListView.swift +++ b/app/Shared/Views/TopicListView.swift @@ -103,7 +103,7 @@ struct TopicListView: View { func newTopic() { postReply.show(action: .with { $0.operation = .new - $0.forumID = self.forum.id + $0.forumID = forum.id }, pageToReload: nil) } @@ -118,7 +118,7 @@ struct TopicListView: View { @ViewBuilder var newTopicButton: some View { - Button(action: { self.newTopic() }) { + Button(action: { newTopic() }) { Label("New Topic", systemImage: "square.and.pencil") } } @@ -196,8 +196,8 @@ struct TopicListView: View { subforums: subforums, refresh: { dataSource.refresh() }, onNavigateToForum: { - self.showingSubforumsModal = false - self.currentShowingSubforum = $0 + showingSubforumsModal = false + currentShowingSubforum = $0 } ) } @@ -206,7 +206,7 @@ struct TopicListView: View { @ViewBuilder var subforum: some View { - let destination = TopicListView.build(forum: self.currentShowingSubforum ?? Forum()) + let destination = TopicListView.build(forum: currentShowingSubforum ?? Forum()) NavigationLink(destination: destination, isActive: $currentShowingSubforum.isNotNil()) {} .isDetailLink(false) .hidden() @@ -252,7 +252,7 @@ struct TopicListView: View { ProgressView() .onAppear { DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { // hack for search bar animation - self.dataSource.initialLoad() + dataSource.initialLoad() } } } else { @@ -285,9 +285,9 @@ struct TopicListView: View { .background { subforum; navigations } .toolbarWithFix { toolbar } .onAppear { selectedForum.inner = forum } - .onChange(of: prefs.defaultTopicListOrder) { if $0 != self.order { self.order = $0 } } - .onAppear { if self.order == nil { self.order = prefs.defaultTopicListOrder } } - .onChange(of: dataSource.latestResponse, perform: self.updateForumMeta(r:)) + .onChange(of: prefs.defaultTopicListOrder) { if $0 != order { order = $0 } } + .onAppear { if order == nil { order = prefs.defaultTopicListOrder } } + .onChange(of: dataSource.latestResponse, perform: updateForumMeta(r:)) } var navID: NavigationIdentifier { diff --git a/app/Shared/Views/UserMenuView.swift b/app/Shared/Views/UserMenuView.swift index ff539ae..e84ab78 100644 --- a/app/Shared/Views/UserMenuView.swift +++ b/app/Shared/Views/UserMenuView.swift @@ -82,7 +82,7 @@ struct UserMenuView: View { @ViewBuilder var menu: some View { Menu { - if let _ = self.user { + if let _ = user { Section { notificationButton Button(action: { showShortMessages = true }) { @@ -91,7 +91,7 @@ struct UserMenuView: View { } } Section { - if let _ = self.user { + if let _ = user { Button(action: { showUserProfile = true }) { Label("My Profile", systemImage: "person.fill") } diff --git a/app/Shared/Views/UserProfileView.swift b/app/Shared/Views/UserProfileView.swift index 0b6e7fd..7e2c8b4 100644 --- a/app/Shared/Views/UserProfileView.swift +++ b/app/Shared/Views/UserProfileView.swift @@ -72,7 +72,7 @@ struct UserProfileView: View { @ViewBuilder var list: some View { - switch self.tab { + switch tab { case .topics: if topicDataSource.notLoaded { LoadingRowView() @@ -127,13 +127,13 @@ struct UserProfileView: View { Menu { if !user.isAnonymous { Section { - Button(action: { self.newShortMessage() }) { + Button(action: { newShortMessage() }) { Label("New Short Message", systemImage: "message") } } } Section { - Button(role: blocked ? nil : .destructive, action: { self.blockWords.toggle(user: user.name) }) { + Button(role: blocked ? nil : .destructive, action: { blockWords.toggle(user: user.name) }) { if blocked { Label("Unblock This User", systemImage: "hand.raised") } else { @@ -155,7 +155,9 @@ struct UserProfileView: View { List { Section(header: Text("User Profile")) { UserView(user: user, style: .huge) - if let sig = user.signature, !sig.spans.isEmpty, !blocked { + + let sig = user.signature + if !sig.spans.isEmpty, !blocked { UserSignatureView(content: sig, font: .callout, color: .primary) } } diff --git a/app/Shared/Views/UserView.swift b/app/Shared/Views/UserView.swift index 20d1c9b..9392d3a 100644 --- a/app/Shared/Views/UserView.swift +++ b/app/Shared/Views/UserView.swift @@ -93,7 +93,7 @@ struct UserView: View { Button(action: { if let url = avatarURL { viewingImage.show(url: url) } }) { avatarInner }.buttonStyle(PlainButtonStyle()) - } else if let user = self.user, let action = self.action { + } else if let user = user, let action = action { Button(action: { action.showUserProfile = user }) { avatarInner }.buttonStyle(PlainButtonStyle()) @@ -161,9 +161,9 @@ struct UserView: View { HStack(spacing: 4) { Group { if showId { - Text(self.idDisplay) + Text(idDisplay) } else { - Text(self.name) + Text(name) } }.font(nameFont, weight: style == .huge ? .bold : .medium) @@ -179,7 +179,7 @@ struct UserView: View { } }.font(style == .huge ? .body : .footnote) } - }.onTapGesture { withAnimation { self.showId.toggle() } } + }.onTapGesture { withAnimation { showId.toggle() } } .redacted(if: shouldRedactName) } diff --git a/app/iOS/Views/ContentEditorView.swift b/app/iOS/Views/ContentEditorView.swift index 0323cce..2b15988 100644 --- a/app/iOS/Views/ContentEditorView.swift +++ b/app/iOS/Views/ContentEditorView.swift @@ -27,7 +27,7 @@ struct ContentEditorView>: View { @ViewBuilder var textEditor: some View { - ContentTextEditorView(model: self.model) + ContentTextEditorView(model: model) } @ViewBuilder diff --git a/app/iOS/Views/ImageOverlay.swift b/app/iOS/Views/ImageOverlay.swift index 95fe525..13a2656 100644 --- a/app/iOS/Views/ImageOverlay.swift +++ b/app/iOS/Views/ImageOverlay.swift @@ -18,7 +18,7 @@ struct ImageViewer: View { var dragGesture: some Gesture { DragGesture() - .onChanged { value in self.dragOffset = value.translation } + .onChanged { value in dragOffset = value.translation } .onEnded { value in let offset = value.translation let predicted = value.predictedEndTranslation @@ -26,10 +26,10 @@ struct ImageViewer: View { abs(predicted.height) / abs(offset.height) > 3 || abs(predicted.width) / abs(offset.width) > 3 { - withAnimation(.spring()) { self.dragOffset = predicted } - self.view = nil + withAnimation(.spring()) { dragOffset = predicted } + view = nil } else { - withAnimation(.interactiveSpring()) { self.dragOffset = .zero } + withAnimation(.interactiveSpring()) { dragOffset = .zero } } } } @@ -47,15 +47,15 @@ struct ImageViewer: View { } } .edgesIgnoringSafeArea(.all) - .offset(x: self.dragOffset.width, y: self.dragOffset.height) - .rotationEffect(.init(degrees: Double(self.dragOffset.width / 30))) + .offset(x: dragOffset.width, y: dragOffset.height) + .rotationEffect(.init(degrees: Double(dragOffset.width / 30))) .frame(maxWidth: .infinity, maxHeight: .infinity) - .background(Color(red: 0.12, green: 0.12, blue: 0.12, opacity: 1.0 - Double(abs(self.dragOffset.width) + abs(self.dragOffset.height)) / 1000).edgesIgnoringSafeArea(.all)) + .background(Color(red: 0.12, green: 0.12, blue: 0.12, opacity: 1.0 - Double(abs(dragOffset.width) + abs(dragOffset.height)) / 1000).edgesIgnoringSafeArea(.all)) .zIndex(1) .transition(AnyTransition.opacity.animation(.easeInOut(duration: 0.2))) // .onAppear { self.dragOffset = .zero; self.scale = 1.0 } - .onChange(of: scale) { s in if s != 1.0 { self.dragOffset = .zero } } - .gesture(self.scale == 1.0 ? dragGesture : nil) + .onChange(of: scale) { s in if s != 1.0 { dragOffset = .zero } } + .gesture(scale == 1.0 ? dragGesture : nil) } } } @@ -68,7 +68,7 @@ struct ImageOverlay: View { ImageViewer(view: $model.view) .overlay(alignment: .topTrailing) { if model.view != nil, model.imageData != nil { - Button(action: { self.activity.put(model.imageData) }) { + Button(action: { activity.put(model.imageData) }) { Image(systemName: "square.and.arrow.up") .padding(.small) .foregroundColor(.white) diff --git a/logic/protos/Cargo.toml b/logic/protos/Cargo.toml index 49d0f85..e62c3c0 100644 --- a/logic/protos/Cargo.toml +++ b/logic/protos/Cargo.toml @@ -6,12 +6,12 @@ edition = "2021" [build-dependencies] cargo-emit = "0.2" -protoc-rust = "2" +protoc-rust = "2" # TODO: protobuf-codegen = "3" [dependencies] base-62 = "0.1" paste = "1" -protobuf = "2" +protobuf = "2" # TODO: 3 serde = { workspace = true } workspace-hack = { version = "0.1", path = "../workspace-hack" } From 4dcfe5c027497272c22698ca236bd918bf541de8 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Fri, 22 Sep 2023 00:48:07 +0800 Subject: [PATCH 07/10] bump target to 16 Signed-off-by: Bugen Zhao --- Makefile | 2 +- app/MNGA Widget/HotTopicsView.swift | 2 +- app/MNGA.xcodeproj/project.pbxproj | 25 ++-- .../xcschemes/MNGA (iOS).xcscheme | 2 +- .../xcschemes/MNGA (macOS).xcscheme | 2 +- .../xcschemes/MNGA WidgetExtension.xcscheme | 3 +- app/Shared/Logic/BasicLogicCall.swift | 4 +- app/Shared/Models/ActivityModel.swift | 2 +- app/Shared/Models/GenericPostModel.swift | 4 +- app/Shared/Models/NotificationModel.swift | 4 +- app/Shared/Models/PagingDataSource.swift | 12 +- app/Shared/Models/SchemesModel.swift | 20 ++- app/Shared/Models/SearchModel.swift | 4 +- app/Shared/Models/ToastModel.swift | 12 +- .../Models/TopicDetailsActionModel.swift | 2 +- app/Shared/Modifiers/ToastModifier.swift | 6 +- app/Shared/Modifiers/ToolbarModifier.swift | 2 +- app/Shared/Protos/Extensions.swift | 120 +++++++++--------- .../Storage/FavoriteForumsStorage.swift | 8 +- app/Shared/Utilities/Alignment.swift | 8 +- app/Shared/Utilities/Appearance.swift | 56 ++++---- app/Shared/Utilities/ContentCombiner.swift | 8 +- app/Shared/Utilities/Misc.swift | 4 +- app/Shared/Utilities/Platform.swift | 4 +- app/Shared/Utilities/RawRepresentable.swift | 4 +- app/Shared/Views/AttachmentsView.swift | 6 +- app/Shared/Views/BlockWordListView.swift | 4 +- app/Shared/Views/CacheView.swift | 4 +- app/Shared/Views/DateTimeTextView.swift | 15 +-- app/Shared/Views/GenericEditorView.swift | 2 +- app/Shared/Views/PlaceholderView.swift | 2 +- app/Shared/Views/PostContentView.swift | 2 +- app/Shared/Views/PostRowUserView.swift | 2 +- app/Shared/Views/PostRowView.swift | 2 +- app/Shared/Views/QuoteUserView.swift | 2 +- app/Shared/Views/RepliesNumView.swift | 16 +-- app/Shared/Views/ShareLinksView.swift | 10 +- app/Shared/Views/ShortMessageEditorView.swift | 9 +- .../Views/ShortMessagePostRowView.swift | 2 +- app/Shared/Views/TopicDetailsView.swift | 26 ++-- app/Shared/Views/TopicListView.swift | 18 +-- app/Shared/Views/UserView.swift | 32 ++--- app/Shared/Views/WebOrAsyncImage.swift | 2 +- .../Modifiers/CellContextMenuModifier.swift | 2 +- app/iOS/Views/ContentEditorView.swift | 2 +- app/iOS/Views/ImageOverlay.swift | 2 +- 46 files changed, 244 insertions(+), 238 deletions(-) diff --git a/Makefile b/Makefile index c7b6791..0b31635 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,7 @@ swiftformat: @if [ -z "${SWIFTFORMAT}" ]; then \ echo "warning: swiftformat not installed, skip" ;\ else \ - ${SWIFTFORMAT} --indent 2 --swiftversion 5.9 . ;\ + ${SWIFTFORMAT} --indent 2 --swiftversion 5.9 --exclude "app/Shared/Protos/*" . ;\ fi diff --git a/app/MNGA Widget/HotTopicsView.swift b/app/MNGA Widget/HotTopicsView.swift index 1750777..e437815 100644 --- a/app/MNGA Widget/HotTopicsView.swift +++ b/app/MNGA Widget/HotTopicsView.swift @@ -25,7 +25,7 @@ struct HotTopicsView: View { VStack(alignment: .leading, spacing: 8) { HStack(spacing: 4) { Group { - if let image = image { + if let image { Image(uiImage: image).resizable() } else { Image("default_forum_icon").resizable() diff --git a/app/MNGA.xcodeproj/project.pbxproj b/app/MNGA.xcodeproj/project.pbxproj index 1262543..dbb59a3 100644 --- a/app/MNGA.xcodeproj/project.pbxproj +++ b/app/MNGA.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -298,14 +298,14 @@ /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ - B43DEDBC269F0952009C52F5 /* Embed App Extensions */ = { + B43DEDBC269F0952009C52F5 /* Embed Foundation Extensions */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 13; files = ( ); - name = "Embed App Extensions"; + name = "Embed Foundation Extensions"; runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ @@ -884,7 +884,7 @@ B4C024C426884FD700E53554 /* Sources */, B4C024C526884FD700E53554 /* Frameworks */, B4C024C626884FD700E53554 /* Resources */, - B43DEDBC269F0952009C52F5 /* Embed App Extensions */, + B43DEDBC269F0952009C52F5 /* Embed Foundation Extensions */, ); buildRules = ( ); @@ -943,8 +943,9 @@ B4C024BC26884FD600E53554 /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1300; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1500; TargetAttributes = { B404C4F7270D9EBA00FF1743 = { CreatedOnToolsVersion = 13.0; @@ -1486,9 +1487,11 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -1503,9 +1506,9 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LIBRARY_SEARCH_PATHS = "../out/libs/**"; - MACOSX_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 14.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -1551,9 +1554,11 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -1562,9 +1567,9 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LIBRARY_SEARCH_PATHS = "../out/libs/**"; - MACOSX_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 14.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SWIFT_COMPILATION_MODE = wholemodule; @@ -1644,6 +1649,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = 87F9J2DF6R; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; @@ -1670,6 +1676,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; + DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = 87F9J2DF6R; ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; diff --git a/app/MNGA.xcodeproj/xcshareddata/xcschemes/MNGA (iOS).xcscheme b/app/MNGA.xcodeproj/xcshareddata/xcschemes/MNGA (iOS).xcscheme index 2999851..d6bf14a 100644 --- a/app/MNGA.xcodeproj/xcshareddata/xcschemes/MNGA (iOS).xcscheme +++ b/app/MNGA.xcodeproj/xcshareddata/xcschemes/MNGA (iOS).xcscheme @@ -1,6 +1,6 @@ diff --git a/app/Shared/Logic/BasicLogicCall.swift b/app/Shared/Logic/BasicLogicCall.swift index 1c669e1..24d0833 100644 --- a/app/Shared/Logic/BasicLogicCall.swift +++ b/app/Shared/Logic/BasicLogicCall.swift @@ -60,7 +60,7 @@ func logicCall(_ requestValue: SyncRequest.OneO let (resData, resError) = extractByteBuffer(resByteBuffer) defer { rust_free(resByteBuffer) } - if let resData = resData { + if let resData { let res = try Response(serializedData: resData) return res } else { @@ -85,7 +85,7 @@ private class WrappedDataCallback { func run(_ data: Data?, _ error: LogicError?) { DispatchQueue.main.async { logger.debug("running callback on thread `\(Thread.current)`") - if let error = error { + if let error { self.errorCallback(error) } else { self.callback(data!) diff --git a/app/Shared/Models/ActivityModel.swift b/app/Shared/Models/ActivityModel.swift index 939087f..f5d9ab7 100644 --- a/app/Shared/Models/ActivityModel.swift +++ b/app/Shared/Models/ActivityModel.swift @@ -11,7 +11,7 @@ import Foundation class ActivityModel: ObservableObject { @Published var activityItems: [Any]? = nil - func put(_ item: Item) { + func put(_ item: some Any) { activityItems = [item as Any] } } diff --git a/app/Shared/Models/GenericPostModel.swift b/app/Shared/Models/GenericPostModel.swift index c3bccd1..441c6dd 100644 --- a/app/Shared/Models/GenericPostModel.swift +++ b/app/Shared/Models/GenericPostModel.swift @@ -78,7 +78,7 @@ class GenericPostModel: ObservableObject { private var contexts = [Task: Context]() private func reset() { - if let context = context { + if let context { contexts.removeValue(forKey: context.task) self.context = nil } @@ -115,7 +115,7 @@ class GenericPostModel: ObservableObject { } public func send() { - guard let context = context else { return } + guard let context else { return } isSending = true doSend(with: context) } diff --git a/app/Shared/Models/NotificationModel.swift b/app/Shared/Models/NotificationModel.swift index 65beb84..c795962 100644 --- a/app/Shared/Models/NotificationModel.swift +++ b/app/Shared/Models/NotificationModel.swift @@ -34,9 +34,9 @@ extension NotificationDataSource { var title: LocalizedStringKey { if unreadCount > 0 { - return "Notifications (\(unreadCount))" + "Notifications (\(unreadCount))" } else { - return "Notifications" + "Notifications" } } } diff --git a/app/Shared/Models/PagingDataSource.swift b/app/Shared/Models/PagingDataSource.swift index 2c79e79..b09fa67 100644 --- a/app/Shared/Models/PagingDataSource.swift +++ b/app/Shared/Models/PagingDataSource.swift @@ -63,7 +63,7 @@ class PagingDataSource: ObservableObject { .store(in: &cancellables) } - func sortedItems(by key: KeyPath) -> [Item] { + func sortedItems(by key: KeyPath) -> [Item] { items.sorted { $0[keyPath: key] < $1[keyPath: key] } } @@ -84,7 +84,7 @@ class PagingDataSource: ObservableObject { return pagedItems.sorted { $0.key < $1.key }.map { (page: $0.key, items: $0.value) } } - private func upsertItems(_ items: S, page: Int) where S: Sequence, S.Element == Item { + private func upsertItems(_ items: some Sequence, page: Int) { items.forEach { let id = $0[keyPath: self.id] @@ -97,7 +97,7 @@ class PagingDataSource: ObservableObject { } } - private func replaceItems(_ items: S, page: Int) where S: Sequence, S.Element == Item { + private func replaceItems(_ items: some Sequence, page: Int) { if neverRemove == false { self.items.removeAll() itemToIndexAndPage.removeAll() @@ -178,7 +178,7 @@ class PagingDataSource: ObservableObject { @available(iOS 15.0, *) func refreshAsync(animated: Bool = false, fromPage: Int = 1) async { let request = DispatchQueue.main.sync { preRefresh(fromPage: fromPage) } - guard let request = request else { return } + guard let request else { return } let response: Result = await logicCallAsync(request) @@ -222,7 +222,7 @@ class PagingDataSource: ObservableObject { self.isLoading = false } self.totalPages = newTotalPages ?? self.totalPages - if let after = after { after() } + if let after { after() } } onError: { e in withAnimation { self.isLoading = false @@ -265,7 +265,7 @@ class PagingDataSource: ObservableObject { } extension View { - func refreshable(dataSource: PagingDataSource, iOS15Only: Bool = false, refreshWhenEnterForeground _: Bool = false) -> some View { + func refreshable(dataSource: PagingDataSource, iOS15Only: Bool = false, refreshWhenEnterForeground _: Bool = false) -> some View { #if canImport(SwiftUIRefresh) Group { if #available(iOS 15.0, *) { diff --git a/app/Shared/Models/SchemesModel.swift b/app/Shared/Models/SchemesModel.swift index 1b8b966..1d9f0d8 100644 --- a/app/Shared/Models/SchemesModel.swift +++ b/app/Shared/Models/SchemesModel.swift @@ -19,9 +19,9 @@ extension NavigationIdentifier { var isMNGAMockID: Bool { switch self { case let .topicID(tid, _): - return tid.isMNGAMockID + tid.isMNGAMockID case let .forumID(forumID): - return forumID.fid.isMNGAMockID + forumID.fid.isMNGAMockID } } @@ -32,7 +32,7 @@ extension NavigationIdentifier { switch self { case let .topicID(tid, fav): components.path = tid - if let fav = fav { + if let fav { components.queryItems = [.init(name: "fav", value: fav)] } url = components.url(relativeTo: URL(string: Constants.MNGA.topicBase)) @@ -60,7 +60,7 @@ extension NavigationIdentifier { case let .topicID(tid, fav): components.path = "read.php" components.queryItems = [.init(name: "tid", value: tid)] - if let fav = fav { + if let fav { components.queryItems!.append(.init(name: "fav", value: fav)) } @@ -169,15 +169,13 @@ struct SchemesNavigationModifier: ViewModifier { @State var urlFromPasteboardForAlert: URL? var navigation: some View { - let view: AnyView - - switch model.navID { + let view: AnyView = switch model.navID { case let .topicID(tid, fav): - view = TopicDetailsView.build(id: tid, fav: fav).eraseToAnyView() + TopicDetailsView.build(id: tid, fav: fav).eraseToAnyView() case let .forumID(forumID): - view = TopicListView.build(id: forumID).eraseToAnyView() + TopicListView.build(id: forumID).eraseToAnyView() case .none: - view = EmptyView().eraseToAnyView() + EmptyView().eraseToAnyView() } return NavigationLink(destination: view, isActive: $model.navID.isNotNil()) {}.hidden() @@ -188,7 +186,7 @@ struct SchemesNavigationModifier: ViewModifier { .background { navigation } .alert(isPresented: $urlFromPasteboardForAlert.isNotNil()) { let url = urlFromPasteboardForAlert - return Alert(title: Text("Navigate to Link from Pasteboard?"), message: Text(url?.absoluteString ?? ""), primaryButton: .default(Text("Navigate")) { if let url = url, model.canNavigateTo(url) { _ = model.onNavigateToURL(url) } }, secondaryButton: .cancel()) + return Alert(title: Text("Navigate to Link from Pasteboard?"), message: Text(url?.absoluteString ?? ""), primaryButton: .default(Text("Navigate")) { if let url, model.canNavigateTo(url) { _ = model.onNavigateToURL(url) } }, secondaryButton: .cancel()) } .onChange(of: urlFromPasteboardForAlert) { if $0 == nil { copyToPasteboard(string: "") } } .onReceive(NotificationCenter.default.publisher(for: AppKitOrUIKitApplication.didBecomeActiveNotification)) { _ in diff --git a/app/Shared/Models/SearchModel.swift b/app/Shared/Models/SearchModel.swift index 082b172..9923bc7 100644 --- a/app/Shared/Models/SearchModel.swift +++ b/app/Shared/Models/SearchModel.swift @@ -48,8 +48,8 @@ class SearchModel: BasicSearchModel { if commited { $commitedText .map { t -> DataSource? in - if let t = t { return self.buildDataSource(text: t) } - else { return nil } + if let t { self.buildDataSource(text: t) } + else { nil } } .assign(to: &$dataSource) } else { diff --git a/app/Shared/Models/ToastModel.swift b/app/Shared/Models/ToastModel.swift index 0313511..9f83e9e 100644 --- a/app/Shared/Models/ToastModel.swift +++ b/app/Shared/Models/ToastModel.swift @@ -66,17 +66,17 @@ extension ToastModel.Message { func toastView(for displayMode: AlertToast.DisplayMode) -> AlertToast { switch self { case let .success(msg): - return AlertToast(displayMode: displayMode, type: .complete(.green), title: "Success".localized, subTitle: msg) + AlertToast(displayMode: displayMode, type: .complete(.green), title: "Success".localized, subTitle: msg) case let .error(msg): - return AlertToast(displayMode: displayMode, type: .error(.red), title: "Error".localized, subTitle: msg.errorLocalized) + AlertToast(displayMode: displayMode, type: .error(.red), title: "Error".localized, subTitle: msg.errorLocalized) case let .notification(newCount): - return AlertToast(displayMode: displayMode, type: .systemImage("bell.badge", .accentColor), title: "Notifications".localized, subTitle: String(format: "%lld new unread notifications".localized, newCount)) + AlertToast(displayMode: displayMode, type: .systemImage("bell.badge", .accentColor), title: "Notifications".localized, subTitle: String(format: "%lld new unread notifications".localized, newCount)) case let .userSwitch(user): - return AlertToast(displayMode: displayMode, type: .systemImage("person.crop.circle.badge.checkmark", .accentColor), title: "Account Switched".localized, subTitle: user) + AlertToast(displayMode: displayMode, type: .systemImage("person.crop.circle.badge.checkmark", .accentColor), title: "Account Switched".localized, subTitle: user) case let .clockIn(msg): - return AlertToast(displayMode: displayMode, type: .systemImage("lanyardcard", .accentColor), title: "Clocked in Successfully".localized, subTitle: msg) + AlertToast(displayMode: displayMode, type: .systemImage("lanyardcard", .accentColor), title: "Clocked in Successfully".localized, subTitle: msg) case let .openURL(url): - return AlertToast(displayMode: displayMode, type: .complete(.accentColor), title: "Navigated to Link".localized, subTitle: url.absoluteString) + AlertToast(displayMode: displayMode, type: .complete(.accentColor), title: "Navigated to Link".localized, subTitle: url.absoluteString) } } } diff --git a/app/Shared/Models/TopicDetailsActionModel.swift b/app/Shared/Models/TopicDetailsActionModel.swift index 71b10df..0393c46 100644 --- a/app/Shared/Models/TopicDetailsActionModel.swift +++ b/app/Shared/Models/TopicDetailsActionModel.swift @@ -118,7 +118,7 @@ struct TopicDetailsActionModifier: ViewModifier { extension View { @ViewBuilder func withTopicDetailsAction(action: TopicDetailsActionModel? = nil) -> some View { - if let action = action { + if let action { modifier(TopicDetailsActionModifier(action: action)) } else { modifier(TopicDetailsActionModifier()) diff --git a/app/Shared/Modifiers/ToastModifier.swift b/app/Shared/Modifiers/ToastModifier.swift index 7ebccd7..844727a 100644 --- a/app/Shared/Modifiers/ToastModifier.swift +++ b/app/Shared/Modifiers/ToastModifier.swift @@ -27,15 +27,15 @@ struct MainToastModifier: ViewModifier { .toast(isPresenting: $hud.message.isNotNil(), duration: 3, tapToDismiss: onTap == nil) { (hud.message ?? .success("")).toastView(for: .hud) - } onTap: { if let onTap = onTap { onTap() } } + } onTap: { if let onTap { onTap() } } .toast(isPresenting: $banner.message.isNotNil(), duration: 3, tapToDismiss: onTap == nil) { (banner.message ?? .success("")).toastView(for: .banner(.pop)) - } onTap: { if let onTap = onTap { onTap() } } + } onTap: { if let onTap { onTap() } } .toast(isPresenting: $alert.message.isNotNil(), duration: 3, tapToDismiss: onTap == nil) { (alert.message ?? .success("")).toastView(for: .alert) - } onTap: { if let onTap = onTap { onTap() } } + } onTap: { if let onTap { onTap() } } } } diff --git a/app/Shared/Modifiers/ToolbarModifier.swift b/app/Shared/Modifiers/ToolbarModifier.swift index 9e58608..118ba25 100644 --- a/app/Shared/Modifiers/ToolbarModifier.swift +++ b/app/Shared/Modifiers/ToolbarModifier.swift @@ -9,7 +9,7 @@ import Foundation import SwiftUI extension View { - func toolbarWithFix(@ToolbarContentBuilder content: () -> Content) -> some View where Content: ToolbarContent { + func toolbarWithFix(@ToolbarContentBuilder content: () -> some ToolbarContent) -> some View { toolbar { #if os(iOS) ToolbarItem(placement: .navigationBarLeading) { Text("") } // fix back button bug for iOS 14 diff --git a/app/Shared/Protos/Extensions.swift b/app/Shared/Protos/Extensions.swift index b467dc4..3df453b 100644 --- a/app/Shared/Protos/Extensions.swift +++ b/app/Shared/Protos/Extensions.swift @@ -17,8 +17,8 @@ extension Subject { extension Forum { var idDescription: String { switch id.id! { - case let .fid(fid): return "#\(fid)" - case let .stid(stid): return "##\(stid)" + case let .fid(fid): "#\(fid)" + case let .stid(stid): "##\(stid)" } } } @@ -27,26 +27,26 @@ extension HotTopicListRequest.DateRange { var description: LocalizedStringKey { switch self { case .day: - return "Last 24 hours" + "Last 24 hours" case .week: - return "Last week" + "Last week" case .month: - return "Last month" + "Last month" default: - return "" + "" } } var icon: String { switch self { case .day: - return "1.circle" + "1.circle" case .week: - return "7.circle" + "7.circle" case .month: - return "30.circle" + "30.circle" default: - return "" + "" } } } @@ -55,13 +55,13 @@ extension VoteState { var defaultDelta: Int32 { switch self { case .none: - return 0 + 0 case .up: - return 1 + 1 case .down: - return -1 + -1 default: - return 0 + 0 } } } @@ -70,34 +70,34 @@ extension Device { var description: LocalizedStringKey { switch self { case .apple: - return "iOS" + "iOS" case .android: - return "Android" + "Android" case .desktop: - return "Desktop" + "Desktop" case .windowsPhone: - return "Windows Phone" + "Windows Phone" case .custom: - return "Custom" + "Custom" default: - return "Unknown" + "Unknown" } } var icon: String { switch self { case .apple: - return "applelogo" + "applelogo" case .android: - return "candybarphone" + "candybarphone" case .desktop: - return "pc" + "pc" case .windowsPhone: - return "flipphone" + "flipphone" case .custom: - return "questionmark.square.dashed" + "questionmark.square.dashed" default: - return "pc" + "pc" } } } @@ -106,19 +106,19 @@ extension PostReplyAction { var title: LocalizedStringKey { switch operation { case .reply: - return "Reply" + "Reply" case .quote: - return "Quote" + "Quote" case .modify: - return verbatim.modifyAppend ? "Append" : "Edit" + verbatim.modifyAppend ? "Append" : "Edit" case .comment: - return "Comment" + "Comment" case .new: - return "New Topic" + "New Topic" case .report: - return "Report" + "Report" case .UNRECOGNIZED: - return "" + "" } } } @@ -136,30 +136,30 @@ extension Notification.TypeEnum { var icon: String { switch self { case .replyPost, .replyTopic: - return "arrowshape.turn.up.left" + "arrowshape.turn.up.left" case .vote: - return "hand.thumbsup" + "hand.thumbsup" case .shortMessage: - return "message" + "message" case .shortMessageStart: - return "plus.message" + "plus.message" case .unknown, .UNRECOGNIZED: - return "questionmark.circle" + "questionmark.circle" } } var description: LocalizedStringKey { switch self { case .replyPost: - return "replied to your post" + "replied to your post" case .replyTopic: - return "replied to your topic" + "replied to your topic" case .vote: - return "received 10 more votes" + "received 10 more votes" case .shortMessage, .shortMessageStart: - return "send you a short message" + "send you a short message" case .unknown, .UNRECOGNIZED: - return "" + "" } } } @@ -180,33 +180,33 @@ extension TopicListRequest.Order { var description: LocalizedStringKey { switch self { case .lastPost: - return "Last Reply" + "Last Reply" case .postDate: - return "Topic Post" + "Topic Post" default: - return "" + "" } } var latestTopicsDescription: LocalizedStringKey { switch self { case .lastPost: - return "Latest Topics by Last Reply Date" + "Latest Topics by Last Reply Date" case .postDate: - return "Latest Topics by Topic Post Date" + "Latest Topics by Topic Post Date" default: - return "" + "" } } var icon: String { switch self { case .lastPost: - return "p.circle" + "p.circle" case .postDate: - return "t.circle" + "t.circle" default: - return "" + "" } } } @@ -215,11 +215,11 @@ extension ShortMessagePostAction { var title: LocalizedStringKey { switch operation { case .reply: - return "Reply" + "Reply" case .new, .newSingleTo: - return "New Short Message" + "New Short Message" case .UNRECOGNIZED: - return "" + "" } } } @@ -277,15 +277,15 @@ extension CacheType { var description: LocalizedStringKey { switch self { case .all: - return "All" + "All" case .topicHistory: - return "Topic Histories" + "Topic Histories" case .topicDetails: - return "Topic Cache" + "Topic Cache" case .notification: - return "Notifications" + "Notifications" default: - return "" + "" } } } diff --git a/app/Shared/Storage/FavoriteForumsStorage.swift b/app/Shared/Storage/FavoriteForumsStorage.swift index d9844dd..567657f 100644 --- a/app/Shared/Storage/FavoriteForumsStorage.swift +++ b/app/Shared/Storage/FavoriteForumsStorage.swift @@ -27,18 +27,18 @@ class FavoriteForumsStorage: ObservableObject { var icon: String { switch self { case .favoritesOnly: - return "star.fill" + "star.fill" case .all: - return "star.lefthalf.fill" + "star.lefthalf.fill" } } var filterIcon: String { switch self { case .all: - return "line.horizontal.3.decrease.circle" + "line.horizontal.3.decrease.circle" default: - return "line.horizontal.3.decrease.circle.fill" + "line.horizontal.3.decrease.circle.fill" } } } diff --git a/app/Shared/Utilities/Alignment.swift b/app/Shared/Utilities/Alignment.swift index 560bdf4..1976a4a 100644 --- a/app/Shared/Utilities/Alignment.swift +++ b/app/Shared/Utilities/Alignment.swift @@ -11,10 +11,10 @@ import SwiftUI extension HorizontalAlignment { var textAlignment: TextAlignment { switch self { - case .leading: return .leading - case .center: return .center - case .trailing: return .trailing - default: return .leading + case .leading: .leading + case .center: .center + case .trailing: .trailing + default: .leading } } } diff --git a/app/Shared/Utilities/Appearance.swift b/app/Shared/Utilities/Appearance.swift index 1795534..4b85f88 100644 --- a/app/Shared/Utilities/Appearance.swift +++ b/app/Shared/Utilities/Appearance.swift @@ -17,17 +17,17 @@ enum ColorSchemeMode: Int, CaseIterable { extension ColorSchemeMode { var scheme: ColorScheme? { switch self { - case .auto: return nil - case .light: return .light - case .dark: return .dark + case .auto: nil + case .light: .light + case .dark: .dark } } var description: LocalizedStringKey { switch self { - case .auto: return "Auto" - case .light: return "Light" - case .dark: return "Dark" + case .auto: "Auto" + case .light: "Light" + case .dark: "Dark" } } } @@ -40,33 +40,33 @@ enum ThemeColor: Int, CaseIterable { extension ThemeColor { var color: Color? { switch self { - case .mnga: return nil - case .blue: return .systemBlue - case .gray: return .systemGray - case .green: return .systemGreen - case .indigo: return .systemIndigo - case .orange: return .systemOrange - case .pink: return .systemPink - case .purple: return .systemPurple - case .red: return .systemRed - case .teal: return .systemTeal - case .yellow: return .systemYellow + case .mnga: nil + case .blue: .systemBlue + case .gray: .systemGray + case .green: .systemGreen + case .indigo: .systemIndigo + case .orange: .systemOrange + case .pink: .systemPink + case .purple: .systemPurple + case .red: .systemRed + case .teal: .systemTeal + case .yellow: .systemYellow } } var description: LocalizedStringKey { switch self { - case .mnga: return "MNGA" - case .blue: return "Blue" - case .gray: return "Gray" - case .green: return "Green" - case .indigo: return "Indigo" - case .orange: return "Orange" - case .pink: return "Pink" - case .purple: return "Purple" - case .red: return "Red" - case .teal: return "Teal" - case .yellow: return "Yellow" + case .mnga: "MNGA" + case .blue: "Blue" + case .gray: "Gray" + case .green: "Green" + case .indigo: "Indigo" + case .orange: "Orange" + case .pink: "Pink" + case .purple: "Purple" + case .red: "Red" + case .teal: "Teal" + case .yellow: "Yellow" } } } diff --git a/app/Shared/Utilities/ContentCombiner.swift b/app/Shared/Utilities/ContentCombiner.swift index 8e1046c..554672d 100644 --- a/app/Shared/Utilities/ContentCombiner.swift +++ b/app/Shared/Utilities/ContentCombiner.swift @@ -154,7 +154,7 @@ class ContentCombiner { return text } - private func append(_ view: V) { + private func append(_ view: some View) { let subview: Subview if view is Text { @@ -228,7 +228,7 @@ class ContentCombiner { } } - func visit(spans: S) where S.Element == Span { + func visit(spans: some Sequence) { spans.forEach(visit(span:)) } @@ -410,7 +410,7 @@ class ContentCombiner { } if let uid = uid.attributes.first { setEnv(key: "uid", globalValue: uid) - } else if let name = name { // treat raw name as id, mainly for anonymous users + } else if let name { // treat raw name as id, mainly for anonymous users setEnv(key: "uid", globalValue: name) } @@ -464,7 +464,7 @@ class ContentCombiner { } let link = ContentButtonView(icon: "link", title: innerView, inQuote: inQuote) { - guard let urlString = urlString else { return } + guard let urlString else { return } guard let url = URL(string: urlString, relativeTo: URLs.base) else { return } switch url.mngaNavigationIdentifier { diff --git a/app/Shared/Utilities/Misc.swift b/app/Shared/Utilities/Misc.swift index a69466a..ab5dcdd 100644 --- a/app/Shared/Utilities/Misc.swift +++ b/app/Shared/Utilities/Misc.swift @@ -10,9 +10,9 @@ import SwiftUI public func withAnimation(_: Animation? = .default, when condition: Bool, _ body: () throws -> Result) rethrows -> Result { if condition { - return withAnimation { try! body() } + withAnimation { try! body() } } else { - return try! body() + try! body() } } diff --git a/app/Shared/Utilities/Platform.swift b/app/Shared/Utilities/Platform.swift index 621453c..21c3a38 100644 --- a/app/Shared/Utilities/Platform.swift +++ b/app/Shared/Utilities/Platform.swift @@ -57,7 +57,7 @@ extension View { } extension View { - func navigationTitleInline(string title: S) -> some View where S: StringProtocol { + func navigationTitleInline(string title: some StringProtocol) -> some View { #if os(iOS) navigationBarTitle(title, displayMode: .inline) #elseif os(macOS) @@ -73,7 +73,7 @@ extension View { #endif } - func navigationTitleLarge(string title: S) -> some View where S: StringProtocol { + func navigationTitleLarge(string title: some StringProtocol) -> some View { #if os(iOS) navigationBarTitle(title, displayMode: .large) #elseif os(macOS) diff --git a/app/Shared/Utilities/RawRepresentable.swift b/app/Shared/Utilities/RawRepresentable.swift index e407f56..c77b643 100644 --- a/app/Shared/Utilities/RawRepresentable.swift +++ b/app/Shared/Utilities/RawRepresentable.swift @@ -82,9 +82,9 @@ extension RawRepresentable where RawValue == String { extension Optional: RawRepresentable where Wrapped: RawRepresentable, Wrapped.RawValue == String { public var rawValue: String { if let s = self { - return s.rawValue + s.rawValue } else { - return "" + "" } } diff --git a/app/Shared/Views/AttachmentsView.swift b/app/Shared/Views/AttachmentsView.swift index 7a42797..84979c0 100644 --- a/app/Shared/Views/AttachmentsView.swift +++ b/app/Shared/Views/AttachmentsView.swift @@ -19,9 +19,9 @@ struct AttachmentsView: View { func image(for attachment: Attachment) -> String { switch attachment.type { case "img": - return "photo" + "photo" default: - return "link" + "link" } } @@ -42,7 +42,7 @@ struct AttachmentsView: View { func show(_ attachment: Attachment) { let url = URL(string: attachment.url, relativeTo: URLs.attachmentBase) - guard let url = url else { return } + guard let url else { return } if attachment.type == "img" { image?.show(url: url) diff --git a/app/Shared/Views/BlockWordListView.swift b/app/Shared/Views/BlockWordListView.swift index 06c6a29..5050312 100644 --- a/app/Shared/Views/BlockWordListView.swift +++ b/app/Shared/Views/BlockWordListView.swift @@ -14,7 +14,7 @@ struct BlockWordListView: View { @State var newWord = nil as BlockWord? func commitNewWord() { - if let newWord = newWord, !newWord.word.isEmpty { + if let newWord, !newWord.word.isEmpty { storage.add(newWord) self.newWord = nil } @@ -56,7 +56,7 @@ struct BlockWordListView: View { var addButton: some View { Button(action: { withAnimation { - if let newWord = newWord, !newWord.word.isEmpty { + if let newWord, !newWord.word.isEmpty { storage.add(newWord) } newWord = .init() diff --git a/app/Shared/Views/CacheView.swift b/app/Shared/Views/CacheView.swift index c3cce4d..3f1e82e 100644 --- a/app/Shared/Views/CacheView.swift +++ b/app/Shared/Views/CacheView.swift @@ -22,7 +22,7 @@ struct CacheRowView: View { Text(text) .foregroundColor(clear == nil ? .secondary : .primary) Spacer() - if let status = status { + if let status { Text(status) .foregroundColor(.secondary) } else { @@ -33,7 +33,7 @@ struct CacheRowView: View { var body: some View { Group { - if let clear = clear { + if let clear { Button(action: { alertPresented = true }) { inner }.alert(isPresented: $alertPresented) { diff --git a/app/Shared/Views/DateTimeTextView.swift b/app/Shared/Views/DateTimeTextView.swift index 3d6d694..4a4299c 100644 --- a/app/Shared/Views/DateTimeTextView.swift +++ b/app/Shared/Views/DateTimeTextView.swift @@ -16,11 +16,11 @@ struct DateTimeTextView: View { var description: LocalizedStringKey { switch self { case .automatic: - return "Auto" + "Auto" case .detailed: - return "Detailed" + "Detailed" case .timeAgo: - return "Time Ago" + "Time Ago" } } } @@ -31,14 +31,13 @@ struct DateTimeTextView: View { @State var showDetailed: Bool static func build(timestamp: UInt64, switchable: Bool = true) -> Self { - let showDetailed: Bool - switch PreferencesStorage.shared.postRowDateTimeStrategy { + let showDetailed: Bool = switch PreferencesStorage.shared.postRowDateTimeStrategy { case .automatic: - showDetailed = (Date().timeIntervalSince1970 - TimeInterval(timestamp)) > 30 * 24 * 3600 + (Date().timeIntervalSince1970 - TimeInterval(timestamp)) > 30 * 24 * 3600 case .detailed: - showDetailed = true + true case .timeAgo: - showDetailed = false + false } return Self(timestamp: timestamp, switchable: switchable, showDetailed: showDetailed) diff --git a/app/Shared/Views/GenericEditorView.swift b/app/Shared/Views/GenericEditorView.swift index d9f474a..715d862 100644 --- a/app/Shared/Views/GenericEditorView.swift +++ b/app/Shared/Views/GenericEditorView.swift @@ -46,7 +46,7 @@ private struct GenericEditorViewInner>: @ViewBuilder var previewInner: some View { - if let subject = subject { + if let subject { TopicSubjectView(topic: .with { $0.subject = subject }, showIndicators: false) } diff --git a/app/Shared/Views/PlaceholderView.swift b/app/Shared/Views/PlaceholderView.swift index 7b27d5d..32f4883 100644 --- a/app/Shared/Views/PlaceholderView.swift +++ b/app/Shared/Views/PlaceholderView.swift @@ -14,7 +14,7 @@ struct PlaceholderView: View { var body: some View { VStack(spacing: 12) { - if let icon = icon { + if let icon { Image(systemName: icon) .font(.largeTitle) } diff --git a/app/Shared/Views/PostContentView.swift b/app/Shared/Views/PostContentView.swift index 58966a8..738f6af 100644 --- a/app/Shared/Views/PostContentView.swift +++ b/app/Shared/Views/PostContentView.swift @@ -61,7 +61,7 @@ struct PostContentView: View where S.Element == Span { var body: some View { VStack(alignment: .leading) { - if let error = error, !error.isEmpty { + if let error, !error.isEmpty { QuoteView(fullWidth: true) { Text("Bad or Unsupported Post Content Format") .bold() diff --git a/app/Shared/Views/PostRowUserView.swift b/app/Shared/Views/PostRowUserView.swift index 67ed7d7..b5e4ed8 100644 --- a/app/Shared/Views/PostRowUserView.swift +++ b/app/Shared/Views/PostRowUserView.swift @@ -24,7 +24,7 @@ struct PostRowUserView: View { } var body: some View { - if let user = user { + if let user { UserView(user: user, style: style, isAuthor: isAuthor) } else { UserView(id: post.authorID, style: style, isAuthor: isAuthor) diff --git a/app/Shared/Views/PostRowView.swift b/app/Shared/Views/PostRowView.swift index 8df55e5..c925ec5 100644 --- a/app/Shared/Views/PostRowView.swift +++ b/app/Shared/Views/PostRowView.swift @@ -182,7 +182,7 @@ struct PostRowView: View { } } } - if let action = action { + if let action { Section { if enableAuthorOnly, !(user?.isAnonymous ?? false) { Button(action: { action.navigateToAuthorOnly = post.authorID }) { diff --git a/app/Shared/Views/QuoteUserView.swift b/app/Shared/Views/QuoteUserView.swift index bf1825e..dba5d98 100644 --- a/app/Shared/Views/QuoteUserView.swift +++ b/app/Shared/Views/QuoteUserView.swift @@ -18,7 +18,7 @@ struct QuoteUserView: View { var body: some View { HStack { UserView(id: uid, nameHint: nameHint, style: .compact) - if let action = action, enableShowReplyChain { + if let action, enableShowReplyChain { Spacer() Button(action: action) { HStack(spacing: 2) { diff --git a/app/Shared/Views/RepliesNumView.swift b/app/Shared/Views/RepliesNumView.swift index 01a691e..82c02d5 100644 --- a/app/Shared/Views/RepliesNumView.swift +++ b/app/Shared/Views/RepliesNumView.swift @@ -15,26 +15,26 @@ struct RepliesNumView: View { var fontStyle: (Font?, Color?) { switch num { case 0: - return (.subheadline.weight(.regular), .accentColor.opacity(0.0)) + (.subheadline.weight(.regular), .accentColor.opacity(0.0)) case 1 ..< 40: - return (.callout.weight(.medium), .accentColor.opacity(0.8)) + (.callout.weight(.medium), .accentColor.opacity(0.8)) case 40 ..< 100: - return (.callout.weight(.semibold), .accentColor.opacity(0.9)) + (.callout.weight(.semibold), .accentColor.opacity(0.9)) case 100 ..< 200: - return (.body.weight(.semibold), .accentColor) + (.body.weight(.semibold), .accentColor) case 200 ..< 500: - return (.body.weight(.bold), .accentColor) + (.body.weight(.bold), .accentColor) case 500...: - return (.body.weight(.heavy), .accentColor) + (.body.weight(.heavy), .accentColor) default: - return (nil, nil) + (nil, nil) } } var text: some View { let (font, color) = fontStyle var text = Text("\(num)").font(font) - if let lastNum = lastNum, num > lastNum { + if let lastNum, num > lastNum { text = text + Text("(+\(num - lastNum))").font(.footnote) } return text.foregroundColor(color) diff --git a/app/Shared/Views/ShareLinksView.swift b/app/Shared/Views/ShareLinksView.swift index 44ff188..e278e67 100644 --- a/app/Shared/Views/ShareLinksView.swift +++ b/app/Shared/Views/ShareLinksView.swift @@ -16,12 +16,14 @@ struct ShareLinksView: View { var body: some View { Menu { - Button(action: { activity.put(navigationID.mngaURL) }) { - Label("MNGA Link", systemImage: "m.circle") + if let mngaURL = navigationID.mngaURL { + ShareLink(item: mngaURL) { + Label("MNGA Link", systemImage: "m.circle") + } } - if !navigationID.isMNGAMockID { - Button(action: { activity.put(navigationID.webpageURL) }) { + if !navigationID.isMNGAMockID, let webpageURL = navigationID.webpageURL { + ShareLink(item: webpageURL) { Label("NGA Link", systemImage: "network") } } diff --git a/app/Shared/Views/ShortMessageEditorView.swift b/app/Shared/Views/ShortMessageEditorView.swift index 22ccca0..1fb385e 100644 --- a/app/Shared/Views/ShortMessageEditorView.swift +++ b/app/Shared/Views/ShortMessageEditorView.swift @@ -28,11 +28,10 @@ struct ShortMessagePostTask: TaskProtocol, Hashable { class ShortMessagePostModel: GenericPostModel { override func buildContext(with task: ShortMessagePostTask, ignoreError _: Bool = false) { - let to: String? - switch task.action.operation { - case .new: to = "" - case .newSingleTo: to = task.action.singleTo - default: to = nil + let to: String? = switch task.action.operation { + case .new: "" + case .newSingleTo: task.action.singleTo + default: nil } let context = Context(task: task, to: to, subject: "From MNGA", content: "") diff --git a/app/Shared/Views/ShortMessagePostRowView.swift b/app/Shared/Views/ShortMessagePostRowView.swift index ff7d366..dd8fafd 100644 --- a/app/Shared/Views/ShortMessagePostRowView.swift +++ b/app/Shared/Views/ShortMessagePostRowView.swift @@ -43,7 +43,7 @@ struct ShortMessagePostRowView: View { @ViewBuilder var header: some View { HStack { - if let user = user { + if let user { UserView(user: user, style: .normal) } else { UserView(id: post.authorID, style: .normal) diff --git a/app/Shared/Views/TopicDetailsView.swift b/app/Shared/Views/TopicDetailsView.swift index 3076ce4..b3e4b5f 100644 --- a/app/Shared/Views/TopicDetailsView.swift +++ b/app/Shared/Views/TopicDetailsView.swift @@ -55,7 +55,7 @@ struct TopicDetailsView: View { static func build(id: String, fav: String? = nil) -> some View { build(topic: .with { $0.id = id - if let fav = fav { + if let fav { $0.fav = fav } }) @@ -201,7 +201,7 @@ struct TopicDetailsView: View { #endif Section { - if let atForum = atForum { + if let atForum { Button(action: { action.navigateToForum = atForum }) { Label("Goto \(atForum.name)", systemImage: "list.triangle") } @@ -275,7 +275,7 @@ struct TopicDetailsView: View { } .fixedSize(horizontal: false, vertical: true) - if let first = first { + if let first { buildRow(post: first) } } @@ -377,15 +377,15 @@ struct TopicDetailsView: View { var title: String { if forceLocalMode { - return "Topic".localized + "Topic".localized } else if !enableAuthorOnly { - return "Author Only".localized + "Author Only".localized } else if onlyPost.id != nil { - return "Reply".localized + "Reply".localized } else if prefs.showTopicSubject { - return topic.subject.content + topic.subject.content } else { - return "Topic".localized + "Topic".localized } } @@ -448,11 +448,11 @@ struct TopicDetailsView: View { listMain } }.onReceive(action.$scrollToFloor) { floor in - guard let floor = floor else { return } + guard let floor else { return } let item = dataSource.items.first { $0.floor == UInt32(floor) } proxy.scrollTo(item, anchor: .top) }.onReceive(action.$scrollToPid) { pid in - guard let pid = pid else { return } + guard let pid else { return } let item = dataSource.items.first { $0.id.pid == pid } proxy.scrollTo(item, anchor: .top) } @@ -522,7 +522,7 @@ struct TopicDetailsView: View { } func reloadPageAfter(sent: PostReplyModel.Context?) { - guard let sent = sent else { return } + guard let sent else { return } switch sent.task.pageToReload { case let .exact(page): @@ -535,7 +535,7 @@ struct TopicDetailsView: View { } func onNewResponse(response: TopicDetailsResponse?) { - guard let response = response else { return } + guard let response else { return } let newTopic = response.topic guard #available(iOS 15.0, *) else { @@ -618,7 +618,7 @@ struct TopicDetailsView: View { } func onError(e: LogicError?) { - guard let e = e else { return } + guard let e else { return } if e.isXMLParseError, prefs.autoOpenInBrowserWhenBanned { DispatchQueue.main.asyncAfter(deadline: .now() + 0.75) { openInBrowser() diff --git a/app/Shared/Views/TopicListView.swift b/app/Shared/Views/TopicListView.swift index 1962026..127b922 100644 --- a/app/Shared/Views/TopicListView.swift +++ b/app/Shared/Views/TopicListView.swift @@ -34,8 +34,8 @@ struct TopicListView: View { var dataSource: DataSource { switch order { - case .lastPost, .none: return dataSourceLastPost - case .postDate: return dataSourcePostDate + case .lastPost, .none: dataSourceLastPost + case .postDate: dataSourcePostDate default: fatalError() } } @@ -47,9 +47,9 @@ struct TopicListView: View { var itemBindings: Binding<[Topic]> { switch order { case .lastPost, .none: - return $dataSourceLastPost.items + $dataSourceLastPost.items case .postDate: - return $dataSourcePostDate.items + $dataSourcePostDate.items default: fatalError() } } @@ -281,21 +281,21 @@ struct TopicListView: View { .searchable(model: searchModel, prompt: "Search Topics".localized, iOS15Only: true) .navigationTitleLarge(string: forum.name.localized) .sheet(isPresented: $showingSubforumsModal) { subforumsModal } - .onChange(of: postReply.sent) { _ in dataSource.reload(page: 1, evenIfNotLoaded: false) } + .onChange(of: postReply.sent) { dataSource.reload(page: 1, evenIfNotLoaded: false) } .background { subforum; navigations } .toolbarWithFix { toolbar } .onAppear { selectedForum.inner = forum } - .onChange(of: prefs.defaultTopicListOrder) { if $0 != order { order = $0 } } + .onChange(of: prefs.defaultTopicListOrder) { _, new in if new != order { order = new } } .onAppear { if order == nil { order = prefs.defaultTopicListOrder } } - .onChange(of: dataSource.latestResponse, perform: updateForumMeta(r:)) + .onChange(of: dataSource.latestResponse) { _, new in updateForumMeta(new) } } var navID: NavigationIdentifier { .forumID(forum.id) } - func updateForumMeta(r: TopicListResponse?) { - guard let r = r else { return } + func updateForumMeta(_ r: TopicListResponse?) { + guard let r else { return } if forum.name.isEmpty { forum.name = r.forum.name forum.info = r.forum.info diff --git a/app/Shared/Views/UserView.swift b/app/Shared/Views/UserView.swift index 9392d3a..1a0f588 100644 --- a/app/Shared/Views/UserView.swift +++ b/app/Shared/Views/UserView.swift @@ -40,7 +40,7 @@ struct UserView: View { init(id: String, nameHint: String? = nil, style: Style, isAuthor: Bool = false, remote: Bool = false) { var user = UsersModel.shared.localUser(id: id) - if let nameHint = nameHint, user == nil { + if let nameHint, user == nil { user = .with { $0.id = id $0.name.normal = nameHint @@ -64,13 +64,13 @@ struct UserView: View { private var avatarSize: CGFloat { switch style { case .compact: - return 24 + 24 case .normal: - return 36 + 36 case .huge: - return 56 + 56 case .vertical: - return 48 + 48 } } @@ -93,7 +93,7 @@ struct UserView: View { Button(action: { if let url = avatarURL { viewingImage.show(url: url) } }) { avatarInner }.buttonStyle(PlainButtonStyle()) - } else if let user = user, let action = action { + } else if let user, let action { Button(action: { action.showUserProfile = user }) { avatarInner }.buttonStyle(PlainButtonStyle()) @@ -107,19 +107,19 @@ struct UserView: View { var name: String { if let name = user?.name, !name.display.isEmpty { - return name.display + name.display } else if !id.isEmpty { - return id + id } else { - return "????????" + "????????" } } var idDisplay: String { - if isAnonymous, let user = user { - return user.name.normal + if isAnonymous, let user { + user.name.normal } else { - return id + id } } @@ -146,13 +146,13 @@ struct UserView: View { var nameFont: Font { switch style { case .compact: - return .subheadline + .subheadline case .normal: - return showDetails ? .subheadline : .callout + showDetails ? .subheadline : .callout case .huge: - return .title + .title case .vertical: - return .footnote + .footnote } } diff --git a/app/Shared/Views/WebOrAsyncImage.swift b/app/Shared/Views/WebOrAsyncImage.swift index d0bd84e..aa63593 100644 --- a/app/Shared/Views/WebOrAsyncImage.swift +++ b/app/Shared/Views/WebOrAsyncImage.swift @@ -19,7 +19,7 @@ struct WebOrAsyncImage: View { // if let p = placeholder { p } else { ProgressView() } // }) } else { - if let url = url { + if let url { let image = WebImage(url: url).resizable() if let p = placeholder { image.placeholder(p) diff --git a/app/iOS/Modifiers/CellContextMenuModifier.swift b/app/iOS/Modifiers/CellContextMenuModifier.swift index 0bde1ab..323c25d 100644 --- a/app/iOS/Modifiers/CellContextMenuModifier.swift +++ b/app/iOS/Modifiers/CellContextMenuModifier.swift @@ -26,7 +26,7 @@ private class MenuDelegate: NSObject, UIContextMenuInteractionDelegate { func contextMenuInteraction(_: UIContextMenuInteraction, configurationForMenuAtLocation _: CGPoint) -> UIContextMenuConfiguration? { UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { _ in let actions = self.actions.map { action -> UIMenuElement? in - guard let action = action else { return nil } + guard let action else { return nil } return UIAction( title: action.title.localized, image: UIImage(systemName: action.systemImage), diff --git a/app/iOS/Views/ContentEditorView.swift b/app/iOS/Views/ContentEditorView.swift index 2b15988..40c2227 100644 --- a/app/iOS/Views/ContentEditorView.swift +++ b/app/iOS/Views/ContentEditorView.swift @@ -87,7 +87,7 @@ struct ContentEditorView>: View { } func uploadImageAttachment(data: Data?) { - guard let data = data else { return } + guard let data else { return } guard let request = context.task.buildUploadAttachmentRequest(data: data) else { model.image = nil return diff --git a/app/iOS/Views/ImageOverlay.swift b/app/iOS/Views/ImageOverlay.swift index 13a2656..d0dc00b 100644 --- a/app/iOS/Views/ImageOverlay.swift +++ b/app/iOS/Views/ImageOverlay.swift @@ -36,7 +36,7 @@ struct ImageViewer: View { @ViewBuilder public var body: some View { - if let view = view { + if let view { Group { if prefs.imageViewerEnableZoom { ZoomableScrollView(scale: $scale) { From c0d4de8495b85f84157650bd17ca995ffceee537 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Fri, 22 Sep 2023 18:50:58 +0800 Subject: [PATCH 08/10] refactor deprecated onChange(of) Signed-off-by: Bugen Zhao --- app/Shared/MNGAApp.swift | 2 +- app/Shared/Models/SchemesModel.swift | 2 +- app/Shared/Views/LoginView.swift | 2 +- app/Shared/Views/ShortMessageDetailsView.swift | 2 +- app/Shared/Views/ShortMessageListView.swift | 2 +- app/Shared/Views/TopicDetailsView.swift | 6 +++--- app/Shared/Views/TopicJumpSelectorView.swift | 4 ++-- app/Shared/Views/TopicListView.swift | 4 ++-- app/iOS/Views/ContentEditorView.swift | 4 ++-- app/iOS/Views/ImageOverlay.swift | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/Shared/MNGAApp.swift b/app/Shared/MNGAApp.swift index 270dcc0..69e6b11 100644 --- a/app/Shared/MNGAApp.swift +++ b/app/Shared/MNGAApp.swift @@ -18,7 +18,7 @@ struct MNGAApp: App { var body: some Scene { WindowGroup { ContentView() - .onChange(of: prefs.themeColor) { _ in setupColor() } + .onChange(of: prefs.themeColor) { setupColor() } .onAppear { setupColor() } } diff --git a/app/Shared/Models/SchemesModel.swift b/app/Shared/Models/SchemesModel.swift index 1d9f0d8..099178c 100644 --- a/app/Shared/Models/SchemesModel.swift +++ b/app/Shared/Models/SchemesModel.swift @@ -188,7 +188,7 @@ struct SchemesNavigationModifier: ViewModifier { let url = urlFromPasteboardForAlert return Alert(title: Text("Navigate to Link from Pasteboard?"), message: Text(url?.absoluteString ?? ""), primaryButton: .default(Text("Navigate")) { if let url, model.canNavigateTo(url) { _ = model.onNavigateToURL(url) } }, secondaryButton: .cancel()) } - .onChange(of: urlFromPasteboardForAlert) { if $0 == nil { copyToPasteboard(string: "") } } + .onChange(of: urlFromPasteboardForAlert) { if $1 == nil { copyToPasteboard(string: "") } } .onReceive(NotificationCenter.default.publisher(for: AppKitOrUIKitApplication.didBecomeActiveNotification)) { _ in #if os(iOS) UIPasteboard.general.detectPatterns(for: [\.probableWebURL]) { result in diff --git a/app/Shared/Views/LoginView.swift b/app/Shared/Views/LoginView.swift index 834ada2..8738f5e 100644 --- a/app/Shared/Views/LoginView.swift +++ b/app/Shared/Views/LoginView.swift @@ -124,7 +124,7 @@ struct LoginView: View { ProgressView().hidden(!loading) }.toolbar { toolbar } .alert(isPresented: $alertMessage.isNotNil()) { Alert(title: "From NGA".localized, message: alertMessage) } - .onChange(of: alertMessage) { if $0 == nil, let c = alertCompletion { c(); alertCompletion = nil } } + .onChange(of: alertMessage) { if $1 == nil, let c = alertCompletion { c(); alertCompletion = nil } } } var body: some View { diff --git a/app/Shared/Views/ShortMessageDetailsView.swift b/app/Shared/Views/ShortMessageDetailsView.swift index 87c502d..f28a317 100644 --- a/app/Shared/Views/ShortMessageDetailsView.swift +++ b/app/Shared/Views/ShortMessageDetailsView.swift @@ -73,7 +73,7 @@ struct ShortMessageDetailsView: View { .refreshable(dataSource: dataSource) .withTopicDetailsAction() .toolbarWithFix { ToolbarItem(placement: .primaryAction) { replyButton } } - .onChange(of: postModel.sent) { _ in dataSource.reloadLastPages(evenIfNotLoaded: false) } + .onChange(of: postModel.sent) { dataSource.reloadLastPages(evenIfNotLoaded: false) } } func doReply() { diff --git a/app/Shared/Views/ShortMessageListView.swift b/app/Shared/Views/ShortMessageListView.swift index 287d54a..36a2d32 100644 --- a/app/Shared/Views/ShortMessageListView.swift +++ b/app/Shared/Views/ShortMessageListView.swift @@ -57,7 +57,7 @@ struct ShortMessageListView: View { .mayGroupedListStyle() .refreshable(dataSource: dataSource) .toolbarWithFix { ToolbarItem(placement: .primaryAction) { newShortMessageButton } } - .onChange(of: postModel.sent) { _ in dataSource.reload(page: 1, evenIfNotLoaded: false) } + .onChange(of: postModel.sent) { dataSource.reload(page: 1, evenIfNotLoaded: false) } } func newShortMessage() { diff --git a/app/Shared/Views/TopicDetailsView.swift b/app/Shared/Views/TopicDetailsView.swift index b3e4b5f..15b670f 100644 --- a/app/Shared/Views/TopicDetailsView.swift +++ b/app/Shared/Views/TopicDetailsView.swift @@ -467,9 +467,9 @@ struct TopicDetailsView: View { .navigationTitleInline(string: title) .toolbarWithFix { toolbar } .background { navigation } - .onChange(of: postReply.sent, perform: reloadPageAfter(sent:)) - .onChange(of: dataSource.latestResponse, perform: onNewResponse(response:)) - .onChange(of: dataSource.latestError, perform: onError(e:)) + .onChange(of: postReply.sent) { reloadPageAfter(sent: $1) } + .onChange(of: dataSource.latestResponse) { onNewResponse(response: $1) } + .onChange(of: dataSource.latestError) { onError(e: $1) } .environmentObject(postReply) .onAppear { dataSource.initialLoad() } .userActivity(Constants.Activity.openTopic) { $0.webpageURL = navID.webpageURL } diff --git a/app/Shared/Views/TopicJumpSelectorView.swift b/app/Shared/Views/TopicJumpSelectorView.swift index 7f7066e..12ed586 100644 --- a/app/Shared/Views/TopicJumpSelectorView.swift +++ b/app/Shared/Views/TopicJumpSelectorView.swift @@ -102,8 +102,8 @@ struct TopicJumpSelectorView: View { }.frame(maxWidth: .infinity) }.buttonStyle(.plain) .foregroundColor(.accentColor) - }.onChange(of: text) { _ in parseText() } - .onChange(of: mode) { _ in parseText() } + }.onChange(of: text) { parseText() } + .onChange(of: mode) { parseText() } } } diff --git a/app/Shared/Views/TopicListView.swift b/app/Shared/Views/TopicListView.swift index 127b922..0631949 100644 --- a/app/Shared/Views/TopicListView.swift +++ b/app/Shared/Views/TopicListView.swift @@ -285,9 +285,9 @@ struct TopicListView: View { .background { subforum; navigations } .toolbarWithFix { toolbar } .onAppear { selectedForum.inner = forum } - .onChange(of: prefs.defaultTopicListOrder) { _, new in if new != order { order = new } } + .onChange(of: prefs.defaultTopicListOrder) { if $1 != order { order = $1 } } .onAppear { if order == nil { order = prefs.defaultTopicListOrder } } - .onChange(of: dataSource.latestResponse) { _, new in updateForumMeta(new) } + .onChange(of: dataSource.latestResponse) { updateForumMeta($1) } } var navID: NavigationIdentifier { diff --git a/app/iOS/Views/ContentEditorView.swift b/app/iOS/Views/ContentEditorView.swift index 40c2227..636209a 100644 --- a/app/iOS/Views/ContentEditorView.swift +++ b/app/iOS/Views/ContentEditorView.swift @@ -80,9 +80,9 @@ struct ContentEditorView>: View { } } .onReceive(keyboard.$isShown) { shown in if shown { model.showing = .none } } - .onChange(of: model.text) { text in context.content = text } + .onChange(of: model.text) { context.content = $1 } .sheet(isPresented: $model.showingImagePicker) { ImagePicker(data: $model.image, encoding: .jpeg(compressionQuality: 0.8)) } - .onChange(of: model.image) { image in uploadImageAttachment(data: image) } + .onChange(of: model.image) { uploadImageAttachment(data: $1) } .toast(isPresenting: $model.image.isNotNil()) { AlertToast(type: .loading) } } diff --git a/app/iOS/Views/ImageOverlay.swift b/app/iOS/Views/ImageOverlay.swift index d0dc00b..c4d1eea 100644 --- a/app/iOS/Views/ImageOverlay.swift +++ b/app/iOS/Views/ImageOverlay.swift @@ -54,7 +54,7 @@ struct ImageViewer: View { .zIndex(1) .transition(AnyTransition.opacity.animation(.easeInOut(duration: 0.2))) // .onAppear { self.dragOffset = .zero; self.scale = 1.0 } - .onChange(of: scale) { s in if s != 1.0 { dragOffset = .zero } } + .onChange(of: scale) { if $1 != 1.0 { dragOffset = .zero } } .gesture(scale == 1.0 ? dragGesture : nil) } } From e4d6dab0e1cd32888edeaa7bcefc0525a61cbbf9 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Fri, 22 Sep 2023 23:24:21 +0800 Subject: [PATCH 09/10] refactor navigation Signed-off-by: Bugen Zhao --- app/Shared/ContentView.swift | 49 +++++++++++-------- app/Shared/Models/SchemesModel.swift | 15 +++--- .../Models/TopicDetailsActionModel.swift | 43 ++++++---------- app/Shared/Views/PostRowView.swift | 28 +++-------- app/Shared/Views/TopicDetailsView.swift | 25 +++++----- app/Shared/Views/TopicListView.swift | 34 ++----------- app/Shared/Views/UserMenuView.swift | 31 +++--------- 7 files changed, 79 insertions(+), 146 deletions(-) diff --git a/app/Shared/ContentView.swift b/app/Shared/ContentView.swift index 4665a99..5ddc34b 100644 --- a/app/Shared/ContentView.swift +++ b/app/Shared/ContentView.swift @@ -9,7 +9,13 @@ import BetterSafariView import SwiftUI import SwiftUIX +@Observable class Router { + var path = NavigationPath() +} + struct ContentView: View { + @State var router = Router() + @StateObject var viewingImage = ViewingImageModel() @StateObject var activity = ActivityModel() @StateObject var postReply = PostReplyModel() @@ -46,33 +52,34 @@ struct ContentView: View { TopicDetailsPlaceholderView() } } else { - NavigationView { + NavigationStack(path: $router.path) { main } } } + .environment(router) #if os(iOS) - .safariView(item: $openURL.inAppURL) { url in SafariView(url: url).preferredControlAccentColor(Color("AccentColor")) } + .safariView(item: $openURL.inAppURL) { url in SafariView(url: url).preferredControlAccentColor(Color("AccentColor")) } #endif - .onOpenURL { _ = schemes.onNavigateToURL($0) } - .overlay { ImageOverlay() } - .fullScreenCover(isPresented: $authStorage.isSigning) { LoginView() } - .onAppear { if !authStorage.signedIn { authStorage.isSigning = true } } - .sheet(isPresented: $activity.activityItems.isNotNil(), content: { - AppActivityView(activityItems: activity.activityItems ?? []) - }) - .modifier(MainToastModifier()) - .sheet(isPresented: $notis.showingSheet) { NotificationListNavigationView() } - .sheet(isPresented: $postReply.showEditor) { PostEditorView().environmentObject(postReply) } - .sheet(isPresented: $shortMessagePost.showEditor) { ShortMessageEditorView().environmentObject(shortMessagePost) } - .sheet(isPresented: $textSelection.text.isNotNil()) { TextSelectionView().environmentObject(textSelection) } - .environmentObject(viewingImage) - .environmentObject(activity) - .environmentObject(postReply) - .environmentObject(shortMessagePost) - .environmentObject(currentUser) - .environmentObject(textSelection) - .preferredColorScheme(prefs.colorScheme.scheme) + .onOpenURL { _ = schemes.onNavigateToURL($0) } + .overlay { ImageOverlay() } + .fullScreenCover(isPresented: $authStorage.isSigning) { LoginView() } + .onAppear { if !authStorage.signedIn { authStorage.isSigning = true } } + .sheet(isPresented: $activity.activityItems.isNotNil(), content: { + AppActivityView(activityItems: activity.activityItems ?? []) + }) + .modifier(MainToastModifier()) + .sheet(isPresented: $notis.showingSheet) { NotificationListNavigationView() } + .sheet(isPresented: $postReply.showEditor) { PostEditorView().environmentObject(postReply) } + .sheet(isPresented: $shortMessagePost.showEditor) { ShortMessageEditorView().environmentObject(shortMessagePost) } + .sheet(isPresented: $textSelection.text.isNotNil()) { TextSelectionView().environmentObject(textSelection) } + .environmentObject(viewingImage) + .environmentObject(activity) + .environmentObject(postReply) + .environmentObject(shortMessagePost) + .environmentObject(currentUser) + .environmentObject(textSelection) + .preferredColorScheme(prefs.colorScheme.scheme) } } diff --git a/app/Shared/Models/SchemesModel.swift b/app/Shared/Models/SchemesModel.swift index 099178c..025be55 100644 --- a/app/Shared/Models/SchemesModel.swift +++ b/app/Shared/Models/SchemesModel.swift @@ -168,22 +168,19 @@ struct SchemesNavigationModifier: ViewModifier { @State var urlFromPasteboardForAlert: URL? - var navigation: some View { - let view: AnyView = switch model.navID { + @ViewBuilder + func destination(_ navID: NavigationIdentifier) -> some View { + switch navID { case let .topicID(tid, fav): - TopicDetailsView.build(id: tid, fav: fav).eraseToAnyView() + TopicDetailsView.build(id: tid, fav: fav) case let .forumID(forumID): - TopicListView.build(id: forumID).eraseToAnyView() - case .none: - EmptyView().eraseToAnyView() + TopicListView.build(id: forumID) } - - return NavigationLink(destination: view, isActive: $model.navID.isNotNil()) {}.hidden() } func body(content: Content) -> some View { content - .background { navigation } + .navigationDestination(item: $model.navID) { self.destination($0) } .alert(isPresented: $urlFromPasteboardForAlert.isNotNil()) { let url = urlFromPasteboardForAlert return Alert(title: Text("Navigate to Link from Pasteboard?"), message: Text(url?.absoluteString ?? ""), primaryButton: .default(Text("Navigate")) { if let url, model.canNavigateTo(url) { _ = model.onNavigateToURL(url) } }, secondaryButton: .cancel()) diff --git a/app/Shared/Models/TopicDetailsActionModel.swift b/app/Shared/Models/TopicDetailsActionModel.swift index 0393c46..4c3a1f8 100644 --- a/app/Shared/Models/TopicDetailsActionModel.swift +++ b/app/Shared/Models/TopicDetailsActionModel.swift @@ -77,41 +77,26 @@ extension EnvironmentValues { // MARK: TopicDetailsAction -struct TopicDetailsActionBasicNavigationView: View { - @ObservedObject var action: TopicDetailsActionModel - - var body: some View { - let navTopic = Topic.with { - if let tid = action.navigateToTid { $0.id = tid } - } - let user = action.showUserProfile ?? .init() - let forum = action.navigateToForum ?? .init() - let view = action.navigateToView ?? EmptyView().eraseToAnyView() - - NavigationLink(destination: TopicDetailsView.build(topic: navTopic), isActive: $action.navigateToTid.isNotNil()) {}.hidden() - NavigationLink(destination: UserProfileView.build(user: user), isActive: $action.showUserProfile.isNotNil()) {}.hidden() - NavigationLink(destination: TopicListView.build(forum: forum), isActive: $action.navigateToForum.isNotNil()) {}.hidden() - NavigationLink(destination: view, isActive: $action.navigateToView.isNotNil()) {}.hidden() - - let withPidTopic = Topic.with { - if let tid = action.navigateToTidWithPidAndPage?.tid { $0.id = tid } - } - let page = action.navigateToTidWithPidAndPage?.page - let postId = PostId.with { - if let pid = action.navigateToTidWithPidAndPage?.pid { $0.pid = pid } - $0.tid = withPidTopic.id - } - NavigationLink(destination: TopicDetailsView.build(topic: withPidTopic, fromPage: page, postIdToJump: postId), isActive: $action.navigateToTidWithPidAndPage.isNotNil()) {}.hidden() - } -} - struct TopicDetailsActionModifier: ViewModifier { @StateObject var action = TopicDetailsActionModel() func body(content: Content) -> some View { content .environmentObject(action) - .background { TopicDetailsActionBasicNavigationView(action: action) } + .navigationDestination(item: $action.navigateToTid) { tid in + let navTopic = Topic.with { $0.id = tid } + TopicDetailsView.build(topic: navTopic) + } + .navigationDestination(item: $action.showUserProfile) { UserProfileView.build(user: $0) } + .navigationDestination(item: $action.navigateToForum) { TopicListView.build(forum: $0) } + .navigationDestination(isPresented: $action.navigateToView.isNotNil()) { action.navigateToView } // TODO(ng): use item + .navigationDestination(isPresented: $action.navigateToTidWithPidAndPage.isNotNil()) { // TODO(ng): use item + if let x = action.navigateToTidWithPidAndPage { + let withPidTopic = Topic.with { $0.id = x.tid } + let postId = PostId.with { $0.pid = x.pid; $0.tid = x.tid } + TopicDetailsView.build(topic: withPidTopic, fromPage: x.page, postIdToJump: postId) + } + } } } diff --git a/app/Shared/Views/PostRowView.swift b/app/Shared/Views/PostRowView.swift index c925ec5..b1c0edd 100644 --- a/app/Shared/Views/PostRowView.swift +++ b/app/Shared/Views/PostRowView.swift @@ -56,17 +56,10 @@ struct PostRowView: View { @ViewBuilder var menuButton: some View { #if os(iOS) - if #available(iOS 15.0, *) { - Menu(content: { menu }) { - Image(systemName: "ellipsis.circle.fill") - .symbolRenderingMode(.hierarchical) - .imageScale(.large) - } - } else { - Menu(content: { menu }) { - Image(systemName: "ellipsis") - .imageScale(.large) - } + Menu(content: { menu }) { + Image(systemName: "ellipsis.circle.fill") + .symbolRenderingMode(.hierarchical) + .imageScale(.large) } #endif } @@ -158,7 +151,7 @@ struct PostRowView: View { Button(action: { textSelection.text = post.content.raw.replacingOccurrences(of: "
", with: "\n") }) { Label("Select Text", systemImage: "selection.pin.in.out") } - if #available(iOS 15.0, *), !attachments.items.isEmpty { + if !attachments.items.isEmpty { Button(action: { showAttachments = true }) { Label("Attachments (\(attachments.items.count))", systemImage: "paperclip") } @@ -193,13 +186,6 @@ struct PostRowView: View { } } - @ViewBuilder - var navigation: some View { - if #available(iOS 15.0, *) { - NavigationLink(destination: AttachmentsView(model: attachments), isActive: $showAttachments) {}.hidden() - } - } - var body: some View { let body = VStack(alignment: .leading, spacing: 10) { header @@ -215,10 +201,10 @@ struct PostRowView: View { #if os(iOS) .listRowBackground(action?.scrollToPid == post.id.pid ? Color.tertiarySystemBackground : nil) #endif - .background { navigation } + .sheet(isPresented: $showAttachments) { NavigationView { AttachmentsView(model: attachments) } } .environmentObject(attachments) - if #available(iOS 15.0, *), let model = postReply, !mock { + if let model = postReply, !mock { body .swipeActions(edge: pref.postRowSwipeActionLeading ? .leading : .trailing) { Button(action: { self.doQuote(model: model) }) { diff --git a/app/Shared/Views/TopicDetailsView.swift b/app/Shared/Views/TopicDetailsView.swift index 15b670f..a43bd7a 100644 --- a/app/Shared/Views/TopicDetailsView.swift +++ b/app/Shared/Views/TopicDetailsView.swift @@ -314,18 +314,6 @@ struct TopicDetailsView: View { } } - @ViewBuilder - var navigation: some View { - let showingChain = action.showingReplyChain ?? .init() - NavigationLink(destination: PostReplyChainView(baseDataSource: dataSource, votes: votes, chain: showingChain).environmentObject(postReply), isActive: $action.showingReplyChain.isNotNil()) {}.hidden() - - let authorOnlyView = TopicDetailsView.build(topic: topic, only: action.navigateToAuthorOnly ?? .init()) - NavigationLink(destination: authorOnlyView, isActive: $action.navigateToAuthorOnly.isNotNil()) {}.hidden() - - let localCacheView = TopicDetailsView.build(topic: topic, localMode: true) - NavigationLink(destination: localCacheView, isActive: $action.navigateToLocalMode) {}.hidden() - } - @ViewBuilder var listMain: some View { List { @@ -457,7 +445,19 @@ struct TopicDetailsView: View { proxy.scrollTo(item, anchor: .top) } }.mayGroupedListStyle() + // Action Navigation .withTopicDetailsAction(action: action) + .navigationDestination(item: $action.showingReplyChain) { + PostReplyChainView(baseDataSource: dataSource, votes: votes, chain: $0) + .environmentObject(postReply) + } + .navigationDestination(item: $action.navigateToAuthorOnly) { + TopicDetailsView.build(topic: topic, only: $0) + } + .navigationDestination(isPresented: $action.navigateToLocalMode) { + TopicDetailsView.build(topic: topic, localMode: true) + } + // Action Navigation End .onReceive(dataSource.$lastRefreshTime) { _ in mayScrollToJumpFloor() } .sheet(isPresented: $showJumpSelector) { TopicJumpSelectorView(maxFloor: maxFloor, initialFloor: floorToJump ?? 0, floorToJump: $floorToJump, pageToJump: $dataSource.loadFromPage) } } @@ -466,7 +466,6 @@ struct TopicDetailsView: View { main .navigationTitleInline(string: title) .toolbarWithFix { toolbar } - .background { navigation } .onChange(of: postReply.sent) { reloadPageAfter(sent: $1) } .onChange(of: dataSource.latestResponse) { onNewResponse(response: $1) } .onChange(of: dataSource.latestError) { onError(e: $1) } diff --git a/app/Shared/Views/TopicListView.swift b/app/Shared/Views/TopicListView.swift index 0631949..a365ad9 100644 --- a/app/Shared/Views/TopicListView.swift +++ b/app/Shared/Views/TopicListView.swift @@ -27,9 +27,6 @@ struct TopicListView: View { @State var currentShowingSubforum: Forum? = nil @State var showingSubforumsModal = false - @State var showingHotTopics = false - @State var showingRecommendedTopics = false - @State var showingToppedTopic = false @State var order: TopicListRequest.Order? = nil var dataSource: DataSource { @@ -144,14 +141,14 @@ struct TopicListView: View { } label: { Label("Order by", systemImage: (order ?? .lastPost).icon) } - Button(action: { showingHotTopics = true }) { + NavigationLink(destination: HotTopicListView.build(forum: forum)) { Label("Hot Topics", systemImage: "flame") } - Button(action: { showingRecommendedTopics = true }) { + NavigationLink(destination: RecommendedTopicListView.build(forum: forum)) { Label("Recommended Topics", systemImage: "hand.thumbsup") } - if let _ = toppedTopicID { - Button(action: { showingToppedTopic = true }) { + if let topicID = toppedTopicID { + NavigationLink(destination: TopicDetailsView.build(id: topicID)) { Label("Topped Topic", systemImage: "arrow.up.to.line") } } @@ -204,27 +201,6 @@ struct TopicListView: View { } } - @ViewBuilder - var subforum: some View { - let destination = TopicListView.build(forum: currentShowingSubforum ?? Forum()) - NavigationLink(destination: destination, isActive: $currentShowingSubforum.isNotNil()) {} - .isDetailLink(false) - .hidden() - NavigationLink(destination: EmptyView()) {}.hidden() // hack: unexpected pop - } - - @ViewBuilder - var navigations: some View { - NavigationLink(destination: HotTopicListView.build(forum: forum), isActive: $showingHotTopics) {} - .isDetailLink(false) - .hidden() - NavigationLink(destination: RecommendedTopicListView.build(forum: forum), isActive: $showingRecommendedTopics) {} - .isDetailLink(false) - .hidden() - NavigationLink(destination: TopicDetailsView.build(id: toppedTopicID ?? ""), isActive: $showingToppedTopic) {} - .hidden() - } - @ViewBuilder var icon: some View { if #available(iOS 15.0, *) { @@ -282,7 +258,7 @@ struct TopicListView: View { .navigationTitleLarge(string: forum.name.localized) .sheet(isPresented: $showingSubforumsModal) { subforumsModal } .onChange(of: postReply.sent) { dataSource.reload(page: 1, evenIfNotLoaded: false) } - .background { subforum; navigations } + .navigationDestination(item: $currentShowingSubforum) { TopicListView.build(forum: $0) } .toolbarWithFix { toolbar } .onAppear { selectedForum.inner = forum } .onChange(of: prefs.defaultTopicListOrder) { if $1 != order { order = $1 } } diff --git a/app/Shared/Views/UserMenuView.swift b/app/Shared/Views/UserMenuView.swift index e84ab78..5b472d4 100644 --- a/app/Shared/Views/UserMenuView.swift +++ b/app/Shared/Views/UserMenuView.swift @@ -15,28 +15,12 @@ struct UserMenuView: View { @EnvironmentObject var model: CurrentUserModel - @State var showHistory: Bool = false - @State var showFavorite: Bool = false - @State var showNotifications: Bool = false - @State var showShortMessages: Bool = false @State var showPreferencesModal: Bool = false - @State var showAbout: Bool = false - @State var showUserProfile: Bool = false var user: User? { model.user } - @ViewBuilder - var navigationBackgrounds: some View { - NavigationLink(destination: TopicHistoryListView.build(), isActive: $showHistory) {}.hidden() - NavigationLink(destination: FavoriteTopicListView.build(), isActive: $showFavorite) {}.hidden() - NavigationLink(destination: NotificationListView(), isActive: $showNotifications) {}.hidden() - NavigationLink(destination: ShortMessageListView.build(), isActive: $showShortMessages) {}.hidden() - NavigationLink(destination: UserProfileView.build(user: user ?? .init()), isActive: $showUserProfile) {}.hidden() - NavigationLink(destination: AboutView(), isActive: $showAbout) {}.hidden() - } - @ViewBuilder var icon: some View { let icon = Image(systemName: authStorage.signedIn ? "person.crop.circle.fill" : "person.crop.circle") @@ -52,7 +36,7 @@ struct UserMenuView: View { @ViewBuilder var notificationButton: some View { - Button(action: { showNotifications = true }) { + NavigationLink(destination: NotificationListView()) { Label(notification.dataSource.title, systemImage: notification.dataSource.unreadCount > 0 ? "bell.badge.fill" : "bell") }.maySymbolRenderingModeHierarchical() } @@ -85,21 +69,21 @@ struct UserMenuView: View { if let _ = user { Section { notificationButton - Button(action: { showShortMessages = true }) { + NavigationLink(destination: ShortMessageListView.build()) { Label("Short Messages", systemImage: "message") } } } Section { - if let _ = user { - Button(action: { showUserProfile = true }) { + if let user = user { + NavigationLink(destination: UserProfileView.build(user: user)) { Label("My Profile", systemImage: "person.fill") } - Button(action: { showFavorite = true }) { + NavigationLink(destination: FavoriteTopicListView.build()) { Label("Favorite Topics", systemImage: "bookmark") } } - Button(action: { showHistory = true }) { + NavigationLink(destination: TopicHistoryListView.build()) { Label("History", systemImage: "clock") } } @@ -118,7 +102,7 @@ struct UserMenuView: View { Label("Preferences", systemImage: "gear") } #endif - Button(action: { showAbout = true }) { + NavigationLink(destination: AboutView()) { Label("About & Feedback", systemImage: "hands.sparkles") } } @@ -137,7 +121,6 @@ struct UserMenuView: View { .onAppear { model.loadData(uid: authStorage.authInfo.uid) } .onAppear { notification.showing = true } .onDisappear { notification.showing = false } - .background { navigationBackgrounds } .sheet(isPresented: $showPreferencesModal) { PreferencesView() } } From b5e2063df33e7fae9cffa6d420d1d9032bdf21d3 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Sat, 23 Sep 2023 00:17:02 +0800 Subject: [PATCH 10/10] disable testflight on main Signed-off-by: Bugen Zhao --- .github/workflows/ios.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ios.yaml b/.github/workflows/ios.yaml index d084d8c..e37b93d 100644 --- a/.github/workflows/ios.yaml +++ b/.github/workflows/ios.yaml @@ -1,9 +1,9 @@ name: iOS on: workflow_dispatch: - push: - branches: - - "main" + # push: + # branches: + # - "main" jobs: testflight: