Skip to content

Commit

Permalink
codecov: move serial environment variable name into constant
Browse files Browse the repository at this point in the history
  • Loading branch information
lavafroth committed Apr 28, 2024
1 parent b5cd560 commit 39cb07a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/core/sync.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::core::uad_lists::PackageState;
use crate::core::utils::ANDROID_SERIAL;
use crate::gui::views::list::PackageInfo;
use crate::gui::widgets::package_row::PackageRow;
use regex::Regex;
Expand Down Expand Up @@ -322,7 +323,7 @@ pub async fn get_devices_list() -> Vec<Phone> {
return OperationResult::Retry(vec![]);
}
for device in RE.captures_iter(&devices) {
env::set_var("ANDROID_SERIAL", &device[1]);
env::set_var(ANDROID_SERIAL, &device[1]);
device_list.push(Phone {
model: get_phone_brand(),
android_sdk: get_android_sdk(),
Expand Down
2 changes: 2 additions & 0 deletions src/core/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use std::path::PathBuf;
use std::process::Command;
use std::{fmt, fs};

pub const ANDROID_SERIAL: &str = "ANDROID_SERIAL";

pub fn fetch_packages(uad_lists: &PackageHashMap, user_id: Option<&User>) -> Vec<PackageRow> {
let all_system_packages = list_all_system_packages(user_id); // installed and uninstalled packages
let enabled_system_packages = hashset_system_packages(PackageState::Enabled, user_id);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::core::sync::{get_devices_list, initial_load, perform_adb_commands, Co
use crate::core::theme::Theme;
use crate::core::uad_lists::UadListState;
use crate::core::update::{get_latest_release, Release, SelfUpdateState, SelfUpdateStatus};
use crate::core::utils::string_to_theme;
use crate::core::utils::{string_to_theme, ANDROID_SERIAL};

use iced::advanced::graphics::image::image_rs::ImageFormat;
use iced::font;
Expand Down Expand Up @@ -261,7 +261,7 @@ impl Application for UadGui {
Message::DeviceSelected(s_device) => {
self.selected_device = Some(s_device.clone());
self.view = View::List;
env::set_var("ANDROID_SERIAL", s_device.adb_id);
env::set_var(ANDROID_SERIAL, s_device.adb_id);
info!("{:-^65}", "-");
info!(
"ANDROID_SDK: {} | DEVICE: {}",
Expand Down
3 changes: 2 additions & 1 deletion src/gui/views/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::core::uad_lists::{
};
use crate::core::utils::fetch_packages;
use crate::core::utils::open_url;
use crate::core::utils::ANDROID_SERIAL;
use crate::gui::style;
use crate::gui::widgets::navigation_menu::ICONS;
use std::env;
Expand Down Expand Up @@ -784,7 +785,7 @@ impl List {
let (uad_lists, _) = load_debloat_lists(remote);
match uad_lists {
Ok(list) => {
env::set_var("ANDROID_SERIAL", phone.adb_id.clone());
env::set_var(ANDROID_SERIAL, phone.adb_id.clone());
if phone.adb_id.is_empty() {
error!("AppsView ready but no phone found");
}
Expand Down

0 comments on commit 39cb07a

Please sign in to comment.