From fa11bf12ce8b8f0fdf44978581c508024a43f3e9 Mon Sep 17 00:00:00 2001 From: Stadnik Andrii Date: Fri, 24 May 2024 12:22:08 +0300 Subject: [PATCH 1/4] Enable english --- core/src/model/lang.rs | 63 +++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/core/src/model/lang.rs b/core/src/model/lang.rs index 01c7fd5b..ceb9fd84 100644 --- a/core/src/model/lang.rs +++ b/core/src/model/lang.rs @@ -10,21 +10,22 @@ use std::fmt::Display; #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Default)] pub enum Lang { #[default] - Ua, - /* En, - Ru, */ + // Ua, + En, + // Ru } impl Lang { // https://github.com/rust-lang/rfcs/issues/284 pub fn iter() -> impl Iterator { - [Lang::Ua /* En, Ru */].into_iter() + // [Lang::Ua].into_iter() + [Lang::En].into_iter() } pub const fn details(self) -> LangDetails { match self { - Lang::Ua => UA_LD, - /* En => EN_LD, - Ru => RU_LD, */ + // Lang::Ua => UA_LD, + Lang::En => EN_LD, + // Lang::Ru => RU_LD, } } pub fn name(self) -> String { @@ -69,33 +70,43 @@ pub struct LangDetails { pub broadcast: &'static str, } -const UA_LD: LangDetails = LangDetails { - name: "Ukrainian", - button_lang: "Українська", - button_back: "◀️ Повернутись", - button_home: "◀️ На початок", +// const UA_LD: LangDetails = LangDetails { +// name: "Ukrainian", +// button_lang: "Українська", +// button_back: "◀️ Повернутись", +// button_home: "◀️ На початок", +// error: concatcp!( +// "Сталась помилка :( Перезапустіть бота (/start), і якщо це не допоможе, будь ласка, повідомте про це у ", +// HELP_CHAT_URL +// ), +// error_due_to_update: concatcp!( +// "Схоже, що бота було оновлено. Повертаюсь на початок. Якщо бот далі не працює, будь ласка, повідомте про це у ", +// HELP_CHAT_URL +// ), +// use_buttons_text: "Використайте кнопки, або перезавантажте бота \\(/start\\)", +// // TODO: Change it <26-06-22, astadnik> // +// greeting: "Що трапилось?", +// broadcast: "Транслювати", +// }; + +const EN_LD: LangDetails = LangDetails { + name: "English", + button_lang: "English", + button_back: "◀️ Back", + button_home: "◀️ Home", error: concatcp!( - "Сталась помилка :( Перезапустіть бота (/start), і якщо це не допоможе, будь ласка, повідомте про це у ", + "An error occurred :( Restart the bot (/start), and if that doesn't help, please report it in ", HELP_CHAT_URL ), error_due_to_update: concatcp!( - "Схоже, що бота було оновлено. Повертаюсь на початок. Якщо бот далі не працює, будь ласка, повідомте про це у ", + "It seems that the bot has been updated. Returning to the beginning. If the bot still doesn't work, please report it in ", HELP_CHAT_URL ), - use_buttons_text: "Використайте кнопки, або перезавантажте бота \\(/start\\)", - // TODO: Change it <26-06-22, astadnik> // - greeting: "Що трапилось?", - broadcast: "Транслювати", + use_buttons_text: "Use buttons, or restart bot if something is wrong (/start)", + greeting: "What happened?", + broadcast: "Broadcast", }; -// const EN_LD: LangDetails = LangDetails { -// name: "English", -// button_lang_name: "English", -// error: "An error occured, please tell us about it at " + HELP_CHAT_URL, -// use_buttons_text: "Use buttons, or restart bot i\f something is wrong (/start)", -// greeting: "What happened?", -// }; - // const RU_LD: LangDetails = LangDetails { // name: "Russian", // button_lang_name: "Русский", From 7f2594fb9d80f7dd7cd1329f29cd01dbdc53a56e Mon Sep 17 00:00:00 2001 From: Stadnik Andrii Date: Fri, 24 May 2024 12:33:23 +0300 Subject: [PATCH 2/4] Fix --- bot/src/bot/dialogue/logic/broadcast.rs | 4 ++-- core/src/model/lang.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bot/src/bot/dialogue/logic/broadcast.rs b/bot/src/bot/dialogue/logic/broadcast.rs index be4c225b..5108d591 100644 --- a/bot/src/bot/dialogue/logic/broadcast.rs +++ b/bot/src/bot/dialogue/logic/broadcast.rs @@ -78,7 +78,7 @@ async fn broadcast_if_confirmed( async fn ask_to_confirm(bot: &FABot, id: ChatId, text: &str, dialogue: &FADialogue) -> Result<()> { bot.send_message(id, "Your message is:").await?; let vec = vec![MSG_CONFIRM]; - let keyboard = make_keyboard(&vec, Lang::Ua, 42, true); + let keyboard = make_keyboard(&vec, Lang::En, 42, true); bot.send_message(id, text).reply_markup(keyboard).await?; let message = Some(text.to_string()); dialogue.update(State::Broadcast { message }).await?; @@ -86,7 +86,7 @@ async fn ask_to_confirm(bot: &FABot, id: ChatId, text: &str, dialogue: &FADialog } async fn wait_for_message(bot: &FABot, id: ChatId) -> Result<()> { - let kbd = make_keyboard(&Vec::new(), Lang::Ua, 42, true); + let kbd = make_keyboard(&Vec::new(), Lang::En, 42, true); bot.send_message(id, MSG_REQUEST).reply_markup(kbd).await?; Ok(()) } diff --git a/core/src/model/lang.rs b/core/src/model/lang.rs index ceb9fd84..61907c00 100644 --- a/core/src/model/lang.rs +++ b/core/src/model/lang.rs @@ -9,8 +9,8 @@ use std::fmt::Display; #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Default)] pub enum Lang { - #[default] // Ua, + #[default] En, // Ru } From 6c67d1b51fe125c6bf2817bfc06540589b3645d7 Mon Sep 17 00:00:00 2001 From: Stadnik Andrii Date: Fri, 24 May 2024 12:56:33 +0300 Subject: [PATCH 3/4] Update --- Cargo.lock | 8 ++++---- app/pubspec.lock | 30 +++++++++++++++--------------- app/pubspec.yaml | 2 +- app/rust/Cargo.toml | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3d72258b..449eb550 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -545,9 +545,9 @@ dependencies = [ [[package]] name = "flutter_rust_bridge" -version = "2.0.0-dev.34" +version = "2.0.0-dev.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aacad3a820c302fd81c2842ee70ab6f6c61526c39c449e490c6cbe2023ec802" +checksum = "34014207992d96657886c50c90ab503bb4581cc9c2b1ea7ffad2ec12400032da" dependencies = [ "allo-isolate", "android_logger", @@ -572,9 +572,9 @@ dependencies = [ [[package]] name = "flutter_rust_bridge_macros" -version = "2.0.0-dev.34" +version = "2.0.0-dev.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5dd5e1d22e85c8978199ebabaeaf66cf452bb3a8f5cb9dcc2c8e14a576ca287" +checksum = "fd250246955bb9548a99733859946a5721289ec152de5fcc6eb03da7d3143dd1" dependencies = [ "hex", "quote", diff --git a/app/pubspec.lock b/app/pubspec.lock index c2bf06dd..9497069c 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -111,10 +111,10 @@ packages: dependency: "direct main" description: name: flutter_rust_bridge - sha256: "2bf072117fe975e18aa418234572aa6c60a0513141dc4239a5409eebd0a6a597" + sha256: d65dbdd271de6050d3204bab69a8ae25a291deb359403cd4f95a86055cab66c3 url: "https://pub.dev" source: hosted - version: "2.0.0-dev.33" + version: "2.0.0-dev.32" flutter_test: dependency: "direct dev" description: flutter @@ -142,26 +142,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.1" lints: dependency: transitive description: @@ -190,10 +190,10 @@ packages: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.0" nested: dependency: transitive description: @@ -306,10 +306,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" vector_math: dependency: transitive description: @@ -322,10 +322,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "14.2.1" webdriver: dependency: transitive description: @@ -336,4 +336,4 @@ packages: version: "3.0.3" sdks: dart: ">=3.3.4 <4.0.0" - flutter: ">=3.16.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/app/pubspec.yaml b/app/pubspec.yaml index c61835ef..6540a905 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -37,7 +37,7 @@ dependencies: cupertino_icons: ^1.0.6 rust_lib_app: path: rust_builder - flutter_rust_bridge: 2.0.0-dev.33 + flutter_rust_bridge: 2.0.0-dev.32 provider: ^6.1.2 flutter_platform_widgets: ^6.1.0 diff --git a/app/rust/Cargo.toml b/app/rust/Cargo.toml index c15fe9f4..394ae087 100644 --- a/app/rust/Cargo.toml +++ b/app/rust/Cargo.toml @@ -9,5 +9,5 @@ crate-type = ["cdylib", "staticlib"] [dependencies] openssl = { version = "0.10", features = ["vendored"] } first_aid_bot_core = { path = "../../core" } -flutter_rust_bridge = "=2.0.0-dev.34" +flutter_rust_bridge = "=2.0.0-dev.32" anyhow = { workspace = true } From 3eff62f7d44d82315b65f84ac3abd8c8baa6f15f Mon Sep 17 00:00:00 2001 From: Stadnik Andrii Date: Fri, 24 May 2024 12:58:55 +0300 Subject: [PATCH 4/4] Update --- app/pubspec.lock | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/pubspec.lock b/app/pubspec.lock index 05054ead..62b2e700 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -111,17 +111,10 @@ packages: dependency: "direct main" description: name: flutter_rust_bridge -<<<<<<< english - sha256: d65dbdd271de6050d3204bab69a8ae25a291deb359403cd4f95a86055cab66c3 - url: "https://pub.dev" - source: hosted - version: "2.0.0-dev.32" -======= sha256: "915d48099928282c80f7f13ad7b9bbf5808bd3c2a1ec3dc76a749aefde3025ae" url: "https://pub.dev" source: hosted version: "2.0.0-dev.35" ->>>>>>> dev flutter_test: dependency: "direct dev" description: flutter