From cc628499177a3421b1f42d14fba636c54fe74ee2 Mon Sep 17 00:00:00 2001 From: nab138 Date: Thu, 14 Aug 2025 14:22:17 -0400 Subject: [PATCH] Patch for dev accounts --- Cargo.lock | 2 +- examples/minimal/.gitignore | 5 +++++ isideload/Cargo.toml | 2 +- isideload/src/developer_session.rs | 33 +++++++++++++++++++++--------- isideload/src/sideload.rs | 20 ++++++++++-------- 5 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 examples/minimal/.gitignore diff --git a/Cargo.lock b/Cargo.lock index d22b076..c014b3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1170,7 +1170,7 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "isideload" -version = "0.1.4" +version = "0.1.5" dependencies = [ "futures", "hex", diff --git a/examples/minimal/.gitignore b/examples/minimal/.gitignore new file mode 100644 index 0000000..7b09836 --- /dev/null +++ b/examples/minimal/.gitignore @@ -0,0 +1,5 @@ +.zsign_cache +keys +*.ipa +state.plist +*.mobileprovision diff --git a/isideload/Cargo.toml b/isideload/Cargo.toml index 5f1c222..9c8ce21 100644 --- a/isideload/Cargo.toml +++ b/isideload/Cargo.toml @@ -3,7 +3,7 @@ name = "isideload" description = "Sideload iOS/iPadOS applications" license = "MPL-2.0" authors = ["Nicholas Sharp "] -version = "0.1.4" +version = "0.1.5" edition = "2024" repository = "https://github.com/nab138/isideload" documentation = "https://docs.rs/isideload" diff --git a/isideload/src/developer_session.rs b/isideload/src/developer_session.rs index 3d6785a..66a0683 100644 --- a/isideload/src/developer_session.rs +++ b/isideload/src/developer_session.rs @@ -382,14 +382,27 @@ impl DeveloperSession { }); } - let max_quantity = response - .get("maxQuantity") - .and_then(|v| v.as_unsigned_integer()) - .ok_or(Error::Parse("maxQuantity".to_string()))?; - let available_quantity = response - .get("availableQuantity") - .and_then(|v| v.as_unsigned_integer()) - .ok_or(Error::Parse("availableQuantity".to_string()))?; + let max_quantity = if response.contains_key("maxQuantity") { + Some( + response + .get("maxQuantity") + .and_then(|v| v.as_unsigned_integer()) + .ok_or(Error::Parse("maxQuantity".to_string()))?, + ) + } else { + None + }; + + let available_quantity = if response.contains_key("availableQuantity") { + Some( + response + .get("availableQuantity") + .and_then(|v| v.as_unsigned_integer()) + .ok_or(Error::Parse("availableQuantity".to_string()))?, + ) + } else { + None + }; Ok(ListAppIdsResponse { app_ids: result, @@ -687,8 +700,8 @@ pub struct AppId { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ListAppIdsResponse { pub app_ids: Vec, - pub max_quantity: u64, - pub available_quantity: u64, + pub max_quantity: Option, + pub available_quantity: Option, } #[derive(Debug, Clone)] diff --git a/isideload/src/sideload.rs b/isideload/src/sideload.rs index 93fee7d..49670aa 100644 --- a/isideload/src/sideload.rs +++ b/isideload/src/sideload.rs @@ -165,15 +165,17 @@ pub async fn sideload_app( }) .collect::>(); - if app_ids_to_register.len() > list_app_id_response.available_quantity.try_into().unwrap() { - return error_and_return( - &logger, - Error::InvalidBundle(format!( - "This app requires {} app ids, but you only have {} available", - app_ids_to_register.len(), - list_app_id_response.available_quantity - )), - ); + if let Some(available) = list_app_id_response.available_quantity { + if app_ids_to_register.len() > available.try_into().unwrap() { + return error_and_return( + &logger, + Error::InvalidBundle(format!( + "This app requires {} app ids, but you only have {} available", + app_ids_to_register.len(), + available + )), + ); + } } for bundle in app_ids_to_register {