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

feat: iPhone 11 support #66

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Changes from all commits
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
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(())
}
}