Skip to content

Commit

Permalink
feat: iPhone 11 support (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
matzuk authored Nov 18, 2024
1 parent 5d69304 commit 1720dd8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/cli/ios/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use crate::{errors::InputError, filtering};

#[derive(Debug, clap::ValueEnum, Clone, PartialEq, Eq)]
pub enum IosDevice {
#[clap(name = "iPhone-11")]
IPhone11,
#[clap(name = "iPhone-15")]
IPhone15,
#[clap(name = "iPhone-15-Pro")]
Expand All @@ -27,6 +29,7 @@ pub enum IosDevice {
impl Display for IosDevice {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
IosDevice::IPhone11 => f.write_str("com.apple.CoreSimulator.SimDeviceType.iPhone-11"),
IosDevice::IPhone15 => f.write_str("com.apple.CoreSimulator.SimDeviceType.iPhone-15"),
IosDevice::IPhone15Pro => {
f.write_str("com.apple.CoreSimulator.SimDeviceType.iPhone-15-Pro")
Expand Down Expand Up @@ -144,6 +147,11 @@ pub(crate) fn get_supported_configs(
Some(XcodeVersion::Xcode15_4),
Some(OsVersion::Ios17_5),
),
(
Some(IosDevice::IPhone11),
Some(XcodeVersion::Xcode15_4),
Some(OsVersion::Ios17_5),
),
]
}

Expand Down Expand Up @@ -244,6 +252,7 @@ Supported iOS settings combinations are:
--xcode-version 15.4 --os-version 17.5 --device iPhone-15 => Default
--xcode-version 15.4 --os-version 17.5 --device iPhone-15-Pro
--xcode-version 15.4 --os-version 17.5 --device iPhone-15-Pro-Max
--xcode-version 15.4 --os-version 17.5 --device iPhone-11
First example: If you choose --xcode-version 15.4 --device iPhone-15-Pro then the --os-version will be inferred (17.5).
Second example: If you choose --xcode-version 15.4 --os-version 17.5 then you will receive an error because --device param is ambiguous."
.into(),
Expand Down Expand Up @@ -420,4 +429,18 @@ mod tests {
let result = infer_parameters(None, provided_xcode_version, provided_os_version).await;
assert!(result.is_err());
}

#[tokio::test]
async fn test_infer_parameters_valid_for_iphone_11() -> Result<()> {
let provided_device = Some(IosDevice::IPhone11);

let (inferred_device, inferred_xcode_version, inferred_os_version) =
infer_parameters(provided_device, None, None).await?;

assert_eq!(inferred_device, IosDevice::IPhone11);
assert_eq!(inferred_xcode_version, XcodeVersion::Xcode15_4);
assert_eq!(inferred_os_version, OsVersion::Ios17_5);

Ok(())
}
}

0 comments on commit 1720dd8

Please sign in to comment.