diff --git a/src/core/sync.rs b/src/core/sync.rs index 220db7c..de99321 100644 --- a/src/core/sync.rs +++ b/src/core/sync.rs @@ -1,5 +1,5 @@ use crate::core::uad_lists::PackageState; -use crate::core::utils::ANDROID_SERIAL; +use crate::core::utils::set_adb_serial; use crate::gui::views::list::PackageInfo; use crate::gui::widgets::package_row::PackageRow; use regex::Regex; @@ -7,14 +7,11 @@ use retry::{delay::Fixed, retry, OperationResult}; use serde::{Deserialize, Serialize}; use static_init::dynamic; use std::collections::HashSet; -use std::env; use std::process::Command; #[cfg(target_os = "windows")] use std::os::windows::process::CommandExt; -use super::utils::set_adb_serial; - const PM_LS_PKG: &str = "pm list packages"; const PM_C: &str = "pm clear"; diff --git a/src/core/utils.rs b/src/core/utils.rs index 85268f6..018f874 100644 --- a/src/core/utils.rs +++ b/src/core/utils.rs @@ -10,15 +10,8 @@ use std::path::PathBuf; use std::process::Command; use std::{fmt, fs}; -use super::sync::Phone; - /// Canonical shortened name of the application pub const NAME: &str = "UAD-ng"; -/// Global environment variable to keep -/// track of the current device serial. -/// -/// [More info](https://developer.android.com/tools/variables#adb) -pub const ANDROID_SERIAL: &str = "ANDROID_SERIAL"; pub const EXPORT_FILE_NAME: &str = "selection_export.txt"; pub const UNINSTALLED_PACKAGES_FILE_NAME: &str = "uninstalled_packages"; @@ -32,8 +25,9 @@ pub enum Error { clippy::semicolon_if_nothing_returned, reason = "fn must return whatever `set_var` returns" )] -pub unsafe fn set_adb_serial>(device: D) { - std::env::set_var(ANDROID_SERIAL, device) +pub unsafe fn set_adb_serial>(device_serial: D) { + // https://developer.android.com/tools/variables#adb + std::env::set_var("ANDROID_SERIAL", device_serial) } pub fn fetch_packages(uad_lists: &PackageHashMap, user_id: Option<&User>) -> Vec { diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 7d57111..cd219e7 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -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::{set_adb_serial, string_to_theme, ANDROID_SERIAL, NAME}; +use crate::core::utils::{set_adb_serial, string_to_theme, NAME}; use iced::advanced::graphics::image::image_rs::ImageFormat; use iced::font; @@ -21,7 +21,6 @@ use iced::{ window::Settings as Window, Alignment, Application, Command, Element, Length, Renderer, Settings, }; -use std::env; #[cfg(feature = "self-update")] use std::path::PathBuf;