From 5ccfe2d46ac6eac4d2ada2ca4c9ba3f15e824772 Mon Sep 17 00:00:00 2001 From: Jackson Coxson Date: Thu, 6 Feb 2025 15:30:34 -0700 Subject: [PATCH] Add progress option for mounting personalized --- Cargo.lock | 2 +- idevice/Cargo.toml | 2 +- idevice/src/mounter.rs | 32 +++++++++++++++++++++++++++++--- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 145fd8e..8e7f54a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -874,7 +874,7 @@ dependencies = [ [[package]] name = "idevice" -version = "0.1.18" +version = "0.1.19" dependencies = [ "async-recursion", "base64", diff --git a/idevice/Cargo.toml b/idevice/Cargo.toml index c55ecdc..f783ecb 100644 --- a/idevice/Cargo.toml +++ b/idevice/Cargo.toml @@ -2,7 +2,7 @@ name = "idevice" description = "A Rust library to interact with services on iOS devices." authors = ["Jackson Coxson"] -version = "0.1.18" +version = "0.1.19" edition = "2021" license = "MIT" documentation = "https://docs.rs/idevice" diff --git a/idevice/src/mounter.rs b/idevice/src/mounter.rs index 4ddc90b..9b47618 100644 --- a/idevice/src/mounter.rs +++ b/idevice/src/mounter.rs @@ -311,8 +311,6 @@ impl ImageMounter { Ok(()) } - /// Calling this has the potential of closing the socket, - /// so a provider is required for this abstraction. pub async fn mount_personalized( &mut self, provider: &dyn crate::provider::IdeviceProvider, @@ -322,6 +320,34 @@ impl ImageMounter { info_plist: Option, unique_chip_id: u64, ) -> Result<(), IdeviceError> { + self.mount_personalized_with_callback( + provider, + image, + trust_cache, + build_manifest, + info_plist, + unique_chip_id, + |_| async {}, + ) + .await + } + + /// Calling this has the potential of closing the socket, + /// so a provider is required for this abstraction. + #[allow(clippy::too_many_arguments)] // literally nobody asked + pub async fn mount_personalized_with_callback( + &mut self, + provider: &dyn crate::provider::IdeviceProvider, + image: Vec, + trust_cache: Vec, + build_manifest: &[u8], + info_plist: Option, + unique_chip_id: u64, + callback: impl Fn((usize, usize)) -> Fut, + ) -> Result<(), IdeviceError> + where + Fut: std::future::Future, + { // Try to fetch personalization manifest let mut hasher = Sha384::new(); hasher.update(&image); @@ -345,7 +371,7 @@ impl ImageMounter { }; debug!("Uploading imaage"); - self.upload_image("Personalized", &image, manifest.clone()) + self.upload_image_with_progress("Personalized", &image, manifest.clone(), callback) .await?; debug!("Mounting image");