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: extract UNINSTALLED_PACKAGES_FILE_NAME_FORMAT into a const #799

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 2 additions & 3 deletions src/core/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub const NAME: &str = "UAD-ng";
/// [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";
pub const UNINSTALLED_PACKAGES_FILE_NAME_FORMAT: &str = "uninstalled_packages_{}.csv";

#[derive(Debug, Clone)]
pub enum Error {
Expand Down Expand Up @@ -184,8 +184,7 @@ pub async fn export_packages(
phone_packages: Vec<Vec<PackageRow>>,
) -> Result<bool, String> {
let backup_file = format!(
"{}_{}.csv",
UNINSTALLED_PACKAGES_FILE_NAME,
UNINSTALLED_PACKAGES_FILE_NAME_FORMAT,
Local::now().format("%Y%m%d")
);

Expand Down
5 changes: 2 additions & 3 deletions src/gui/views/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::core::sync::{get_android_sdk, perform_adb_commands, CommandType, Phon
use crate::core::theme::Theme;
use crate::core::utils::{
export_packages, open_folder, open_url, string_to_theme, DisplayablePath,
UNINSTALLED_PACKAGES_FILE_NAME,
UNINSTALLED_PACKAGES_FILE_NAME_FORMAT,
};
use crate::gui::style;
use crate::gui::views::list::{List as AppsView, PackageInfo};
Expand Down Expand Up @@ -544,8 +544,7 @@ impl Settings {
].padding(20);

let file_row = row![text(format!(
"{}_{}.csv",
UNINSTALLED_PACKAGES_FILE_NAME,
UNINSTALLED_PACKAGES_FILE_NAME_FORMAT,
chrono::Local::now().format("%Y%m%d")
))
.style(style::Text::Commentary)]
Expand Down
Loading