From d5fb9d546ef7dc1ccd075dcaa3e252108df8520f Mon Sep 17 00:00:00 2001 From: Frigyes Erdosi-Szucs Date: Fri, 22 Mar 2024 09:53:11 -0700 Subject: [PATCH 1/3] refactor(app): Use if-else instead of match over booleans --- src/gui/mod.rs | 11 ++++++----- src/gui/views/list.rs | 13 +++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 8b84bcb4..3ac7f119 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -344,13 +344,14 @@ impl Application for UadGui { } Message::ADBSatisfied(result) => { self.adb_satisfied = result; - match result { - true => self.update(Message::AppsAction(AppsMessage::ADBSatisfied( + if result { + self.update(Message::AppsAction(AppsMessage::ADBSatisfied( self.adb_satisfied, - ))), - false => self.update(Message::AppsAction(AppsMessage::ADBSatisfied( + ))) + } else { + self.update(Message::AppsAction(AppsMessage::ADBSatisfied( self.adb_satisfied, - ))), + ))) } } Message::Nothing => Command::none(), diff --git a/src/gui/views/list.rs b/src/gui/views/list.rs index 21f3f684..4a713ef6 100644 --- a/src/gui/views/list.rs +++ b/src/gui/views/list.rs @@ -314,20 +314,21 @@ impl List { let text = "Downloading latest UAD-ng lists from GitHub. Please wait..."; waiting_view(settings, text, true, style::Text::Default) } - LoadingState::FindingPhones => match self.is_adb_satisfied { - true => waiting_view( + LoadingState::FindingPhones => if self.is_adb_satisfied { + waiting_view( settings, "Finding connected devices...", false, style::Text::Default, - ), - false => waiting_view( + ) + } else { + waiting_view( settings, "ADB is not installed on your system, install ADB and relaunch application.", false, style::Text::Danger, - ), - }, + ) + } LoadingState::LoadingPackages => { let text = "Pulling packages from the device. Please wait..."; waiting_view(settings, text, false, style::Text::Default) From ee6994f524d71071aec59630794033d2cf01b2b3 Mon Sep 17 00:00:00 2001 From: Frigyes Erdosi-Szucs Date: Fri, 22 Mar 2024 10:05:19 -0700 Subject: [PATCH 2/3] refactor(app): formatting fix --- src/gui/views/list.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/gui/views/list.rs b/src/gui/views/list.rs index 4a713ef6..fc973815 100644 --- a/src/gui/views/list.rs +++ b/src/gui/views/list.rs @@ -314,20 +314,22 @@ impl List { let text = "Downloading latest UAD-ng lists from GitHub. Please wait..."; waiting_view(settings, text, true, style::Text::Default) } - LoadingState::FindingPhones => if self.is_adb_satisfied { - waiting_view( - settings, - "Finding connected devices...", - false, - style::Text::Default, - ) - } else { - waiting_view( - settings, - "ADB is not installed on your system, install ADB and relaunch application.", - false, - style::Text::Danger, - ) + LoadingState::FindingPhones => { + if self.is_adb_satisfied { + waiting_view( + settings, + "Finding connected devices...", + false, + style::Text::Default, + ) + } else { + waiting_view( + settings, + "ADB is not installed on your system, install ADB and relaunch application.", + false, + style::Text::Danger, + ) + } } LoadingState::LoadingPackages => { let text = "Pulling packages from the device. Please wait..."; From d8e20b522e3a56782e99f8d2b2044ffeca042a9c Mon Sep 17 00:00:00 2001 From: Frigyes Erdosi-Szucs Date: Fri, 22 Mar 2024 10:19:53 -0700 Subject: [PATCH 3/3] refactor(app): remove redundant code --- src/gui/mod.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 3ac7f119..f67fb2af 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -344,15 +344,9 @@ impl Application for UadGui { } Message::ADBSatisfied(result) => { self.adb_satisfied = result; - if result { - self.update(Message::AppsAction(AppsMessage::ADBSatisfied( - self.adb_satisfied, - ))) - } else { - self.update(Message::AppsAction(AppsMessage::ADBSatisfied( - self.adb_satisfied, - ))) - } + self.update(Message::AppsAction(AppsMessage::ADBSatisfied( + self.adb_satisfied, + ))) } Message::Nothing => Command::none(), }