Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(app): use if-else instead of match over booleans #369

Merged
merged 3 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/gui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,9 @@ impl Application for UadGui {
}
Message::ADBSatisfied(result) => {
self.adb_satisfied = result;
match result {
true => self.update(Message::AppsAction(AppsMessage::ADBSatisfied(
self.adb_satisfied,
))),
false => self.update(Message::AppsAction(AppsMessage::ADBSatisfied(
self.adb_satisfied,
))),
}
self.update(Message::AppsAction(AppsMessage::ADBSatisfied(
self.adb_satisfied,
)))
}
Message::Nothing => Command::none(),
}
Expand Down
31 changes: 17 additions & 14 deletions src/gui/views/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,20 +314,23 @@ 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(
settings,
"Finding connected devices...",
false,
style::Text::Default,
),
false => 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...";
waiting_view(settings, text, false, style::Text::Default)
Expand Down