mirror of
https://github.com/Universal-Debloater-Alliance/universal-android-debloater-next-generation.git
synced 2026-08-28 10:18:09 +02:00
style: revert rename of Phone to Device (now "Phone")
Partially reverts cf054c8808
Reason: out-of-scope for PR #757
This commit is contained in:
parent
a1762c20c9
commit
09f3ce1ebd
7 changed files with 32 additions and 33 deletions
|
|
@ -1,5 +1,5 @@
|
|||
use crate::core::config::{Config, DeviceSettings};
|
||||
use crate::core::sync::{apply_pkg_state_commands, CorePackage, Device, User};
|
||||
use crate::core::sync::{apply_pkg_state_commands, CorePackage, Phone, User};
|
||||
use crate::core::utils::DisplayablePath;
|
||||
use crate::gui::widgets::package_row::PackageRow;
|
||||
use crate::CACHE_DIR;
|
||||
|
|
@ -112,7 +112,7 @@ pub struct BackupPackage {
|
|||
}
|
||||
|
||||
pub fn restore_backup(
|
||||
selected_device: &Device,
|
||||
selected_device: &Phone,
|
||||
packages: &[Vec<PackageRow>],
|
||||
settings: &DeviceSettings,
|
||||
) -> Result<Vec<BackupPackage>, String> {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use std::os::windows::process::CommandExt;
|
|||
|
||||
/// An Android device, typically a phone
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Device {
|
||||
pub struct Phone {
|
||||
/// Non-market name
|
||||
pub model: String, // could be `Copy`
|
||||
/// Android API level version
|
||||
|
|
@ -26,7 +26,7 @@ pub struct Device {
|
|||
pub adb_id: String, // could be `Copy`
|
||||
}
|
||||
|
||||
impl Default for Device {
|
||||
impl Default for Phone {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
model: "fetching devices...".to_string(),
|
||||
|
|
@ -37,7 +37,7 @@ impl Default for Device {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Device {
|
||||
impl std::fmt::Display for Phone {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.model)
|
||||
}
|
||||
|
|
@ -181,7 +181,7 @@ pub fn apply_pkg_state_commands(
|
|||
package: &CorePackage,
|
||||
wanted_state: PackageState,
|
||||
selected_user: User,
|
||||
dev: &Device,
|
||||
dev: &Phone,
|
||||
) -> Vec<String> {
|
||||
// https://github.com/Universal-Debloater-Alliance/universal-android-debloater/wiki/ADB-reference
|
||||
// ALWAYS PUT THE COMMAND THAT CHANGES THE PACKAGE STATE FIRST!
|
||||
|
|
@ -283,7 +283,7 @@ pub const MULTI_USER_SDK: u8 = 21;
|
|||
|
||||
/// Check if it supports multi-user mode, by comparing SDK version.
|
||||
#[must_use]
|
||||
pub const fn supports_multi_user(dev: &Device) -> bool {
|
||||
pub const fn supports_multi_user(dev: &Phone) -> bool {
|
||||
dev.android_sdk >= MULTI_USER_SDK
|
||||
}
|
||||
|
||||
|
|
@ -330,18 +330,18 @@ pub fn ls_users_parsed(device_serial: &str) -> Vec<User> {
|
|||
|
||||
/// This matches serials (`getprop ro.serialno`)
|
||||
/// that are authorized by the user.
|
||||
pub async fn get_devices_list() -> Vec<Device> {
|
||||
pub async fn get_devices_list() -> Vec<Phone> {
|
||||
retry(
|
||||
Fixed::from_millis(500).take(if cfg!(debug_assertions) { 3 } else { 120 }),
|
||||
|| match AdbCommand::new().devices() {
|
||||
Ok(devices) => {
|
||||
let mut device_list: Vec<Device> = vec![];
|
||||
let mut device_list: Vec<Phone> = vec![];
|
||||
if devices.iter().all(|(_, stat)| stat != "device") {
|
||||
return OperationResult::Retry(vec![]);
|
||||
}
|
||||
for device in devices {
|
||||
let serial = &device.0;
|
||||
device_list.push(Device {
|
||||
device_list.push(Phone {
|
||||
model: format!("{} {}", get_device_brand(serial), get_device_model(serial)),
|
||||
android_sdk: get_android_sdk(serial),
|
||||
user_list: ls_users_parsed(serial),
|
||||
|
|
@ -352,7 +352,7 @@ pub async fn get_devices_list() -> Vec<Device> {
|
|||
}
|
||||
Err(err) => {
|
||||
error!("get_device_list() -> {}", err);
|
||||
let test: Vec<Device> = vec![];
|
||||
let test: Vec<Phone> = vec![];
|
||||
OperationResult::Retry(test)
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ pub mod style;
|
|||
pub mod views;
|
||||
pub mod widgets;
|
||||
|
||||
use crate::core::sync::{adb_shell_command, get_devices_list, initial_load, CommandType, Device};
|
||||
use crate::core::sync::{adb_shell_command, get_devices_list, initial_load, CommandType, Phone};
|
||||
use crate::core::theme::{Theme, OS_COLOR_SCHEME};
|
||||
use crate::core::uad_lists::UadListState;
|
||||
use crate::core::update::{get_latest_release, Release, SelfUpdateState, SelfUpdateStatus};
|
||||
|
|
@ -47,9 +47,9 @@ pub struct UadGui {
|
|||
apps_view: AppsView,
|
||||
about_view: AboutView,
|
||||
settings_view: SettingsView,
|
||||
devices_list: Vec<Device>,
|
||||
devices_list: Vec<Phone>,
|
||||
/// index of `devices_list`
|
||||
selected_device: Option<Device>,
|
||||
selected_device: Option<Phone>,
|
||||
update_state: UpdateState,
|
||||
nb_running_async_adb_commands: u32,
|
||||
adb_satisfied: bool,
|
||||
|
|
@ -61,13 +61,13 @@ pub enum Message {
|
|||
AboutPressed,
|
||||
SettingsPressed,
|
||||
AppsPress,
|
||||
DeviceSelected(Device),
|
||||
DeviceSelected(Phone),
|
||||
AboutAction(AboutMessage),
|
||||
AppsAction(AppsMessage),
|
||||
SettingsAction(SettingsMessage),
|
||||
RefreshButtonPressed,
|
||||
RebootButtonPressed,
|
||||
LoadDevices(Vec<Device>),
|
||||
LoadDevices(Vec<Phone>),
|
||||
#[cfg(feature = "self-update")]
|
||||
_NewReleaseDownloaded(Result<(PathBuf, PathBuf), ()>),
|
||||
GetLatestRelease(Result<Option<Release>, ()>),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::core::config::DeviceSettings;
|
||||
use crate::core::helpers::button_primary;
|
||||
use crate::core::sync::{
|
||||
adb_shell_command, apply_pkg_state_commands, AdbError, CommandType, Device, User,
|
||||
adb_shell_command, apply_pkg_state_commands, AdbError, CommandType, Phone, User,
|
||||
};
|
||||
use crate::core::theme::Theme;
|
||||
use crate::core::uad_lists::{
|
||||
|
|
@ -114,7 +114,7 @@ impl List {
|
|||
pub fn update(
|
||||
&mut self,
|
||||
settings: &mut Settings,
|
||||
selected_device: &mut Device,
|
||||
selected_device: &mut Phone,
|
||||
list_update_state: &mut UadListState,
|
||||
message: Message,
|
||||
) -> Command<Message> {
|
||||
|
|
@ -360,7 +360,7 @@ impl List {
|
|||
pub fn view(
|
||||
&self,
|
||||
settings: &Settings,
|
||||
selected_device: &Device,
|
||||
selected_device: &Phone,
|
||||
) -> Element<Message, Theme, Renderer> {
|
||||
match &self.loading_state {
|
||||
LoadingState::DownloadingList => waiting_view(
|
||||
|
|
@ -406,7 +406,7 @@ impl List {
|
|||
}
|
||||
}
|
||||
|
||||
fn control_panel(&self, selected_device: &Device) -> Element<Message, Theme, Renderer> {
|
||||
fn control_panel(&self, selected_device: &Phone) -> Element<Message, Theme, Renderer> {
|
||||
let search_packages = text_input("Search packages...", &self.input_value)
|
||||
.width(Length::Fill)
|
||||
.on_input(Message::SearchInputChanged)
|
||||
|
|
@ -470,7 +470,7 @@ impl List {
|
|||
fn ready_view(
|
||||
&self,
|
||||
settings: &Settings,
|
||||
selected_device: &Device,
|
||||
selected_device: &Phone,
|
||||
) -> Element<Message, Theme, Renderer> {
|
||||
let packages = self
|
||||
.filtered_packages
|
||||
|
|
@ -629,7 +629,7 @@ impl List {
|
|||
#[allow(clippy::too_many_lines)]
|
||||
fn apply_selection_modal(
|
||||
&self,
|
||||
device: &Device,
|
||||
device: &Phone,
|
||||
settings: &Settings,
|
||||
packages: &[PackageRow],
|
||||
) -> Element<Message, Theme, Renderer> {
|
||||
|
|
@ -874,7 +874,7 @@ impl List {
|
|||
}
|
||||
|
||||
#[expect(clippy::unused_async, reason = "1 call-site")]
|
||||
async fn init_apps_view(remote: bool, device: Device) -> (PackageHashMap, UadListState) {
|
||||
async fn init_apps_view(remote: bool, device: Phone) -> (PackageHashMap, UadListState) {
|
||||
let uad_lists = load_debloat_lists(remote);
|
||||
match uad_lists {
|
||||
Ok(list) => {
|
||||
|
|
@ -950,7 +950,7 @@ fn waiting_view<'a>(
|
|||
|
||||
fn build_action_pkg_commands(
|
||||
packages: &[Vec<PackageRow>],
|
||||
device: &Device,
|
||||
device: &Phone,
|
||||
settings: &DeviceSettings,
|
||||
selection: (usize, usize),
|
||||
) -> Vec<Command<Message>> {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ use crate::core::{
|
|||
helpers::button_primary,
|
||||
save::{backup_phone, list_available_backup_user, list_available_backups, restore_backup},
|
||||
sync::{
|
||||
adb_shell_command, get_android_sdk, supports_multi_user, AdbError, CommandType, Device,
|
||||
User,
|
||||
adb_shell_command, get_android_sdk, supports_multi_user, AdbError, CommandType, Phone, User,
|
||||
},
|
||||
theme::Theme,
|
||||
utils::{
|
||||
|
|
@ -74,7 +73,7 @@ impl Settings {
|
|||
#[allow(clippy::too_many_lines)]
|
||||
pub fn update(
|
||||
&mut self,
|
||||
phone: &Device,
|
||||
phone: &Phone,
|
||||
packages: &[Vec<PackageRow>],
|
||||
nb_running_async_adb_commands: &mut u32,
|
||||
msg: Message,
|
||||
|
|
@ -270,7 +269,7 @@ impl Settings {
|
|||
|
||||
// TODO: refactor later
|
||||
#[allow(clippy::too_many_lines)]
|
||||
pub fn view(&self, phone: &Device, apps_view: &AppsView) -> Element<Message, Theme, Renderer> {
|
||||
pub fn view(&self, phone: &Phone, apps_view: &AppsView) -> Element<Message, Theme, Renderer> {
|
||||
let radio_btn_theme = Theme::ALL
|
||||
.iter()
|
||||
.fold(row![].spacing(10), |column, option| {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::core::helpers::button_primary;
|
||||
pub use crate::core::sync::Device;
|
||||
pub use crate::core::sync::Phone;
|
||||
use crate::core::theme::Theme;
|
||||
use crate::core::update::{SelfUpdateState, SelfUpdateStatus};
|
||||
pub use crate::gui::views::about::Message as AboutMessage;
|
||||
|
|
@ -15,8 +15,8 @@ pub const ICONS: Font = Font {
|
|||
};
|
||||
|
||||
pub fn nav_menu<'a>(
|
||||
device_list: &'a [Device],
|
||||
selected_device: Option<Device>,
|
||||
device_list: &'a [Phone],
|
||||
selected_device: Option<Phone>,
|
||||
apps_view: &AppsView,
|
||||
self_update_state: &SelfUpdateState,
|
||||
) -> Element<'a, Message, Theme, Renderer> {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::core::sync::Device;
|
||||
use crate::core::sync::Phone;
|
||||
use crate::core::theme::Theme;
|
||||
use crate::core::uad_lists::{PackageState, Removal, UadList};
|
||||
use crate::gui::style;
|
||||
|
|
@ -50,7 +50,7 @@ impl PackageRow {
|
|||
Command::none()
|
||||
}
|
||||
|
||||
pub fn view(&self, settings: &Settings, _phone: &Device) -> Element<Message, Theme, Renderer> {
|
||||
pub fn view(&self, settings: &Settings, _phone: &Phone) -> Element<Message, Theme, Renderer> {
|
||||
//let trash_svg = format!("{}/resources/assets/trash.svg", env!("CARGO_MANIFEST_DIR"));
|
||||
//let restore_svg = format!("{}/resources/assets/rotate.svg", env!("CARGO_MANIFEST_DIR"));
|
||||
let button_style;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue