Skip to content

Commit

Permalink
add iPhone 14 Pro / 6.1" display type
Browse files Browse the repository at this point in the history
  • Loading branch information
snatchev committed Jul 14, 2023
1 parent 3d2d208 commit 750789f
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 29 deletions.
23 changes: 13 additions & 10 deletions deliver/lib/deliver/app_screenshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ module ScreenSize
IOS_55 = "iOS-5.5-in"
# iPhone XS
IOS_58 = "iOS-5.8-in"
# iPhone XR
# iPhone 14 Pro
IOS_61 = "iOS-6.1-in"
# iPhone XS Max
# iPhone 14 Plus, iPhone 13 Pro Max, iPhone 12 Pro Max, iPhone 11 Pro Max, iPhone 11, iPhone XS Max, iPhone XR
IOS_65 = "iOS-6.5-in"
# iPhone 14 Pro Max
IOS_67 = "iOS-6.7-in"
Expand All @@ -45,9 +45,9 @@ module ScreenSize
IOS_55_MESSAGES = "iOS-5.5-in-messages"
# iPhone XS iMessage
IOS_58_MESSAGES = "iOS-5.8-in-messages"
# iPhone XR iMessage
# iPhone 14 Pro iMessage
IOS_61_MESSAGES = "iOS-6.1-in-messages"
# iPhone XS Max iMessage
# iPhone 14 Plus, iPhone 13 Pro Max, iPhone 12 Pro Max, iPhone 11 Pro Max, iPhone 11, iPhone XS Max, iPhone XR iMessage
IOS_65_MESSAGES = "iOS-6.5-in-messages"
# iPhone 14 Pro Max iMessage
IOS_67_MESSAGES = "iOS-6.7-in-messages"
Expand Down Expand Up @@ -104,6 +104,7 @@ def device_type
ScreenSize::IOS_47 => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::APP_IPHONE_47, # also 7 & 8
ScreenSize::IOS_55 => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::APP_IPHONE_55, # also 7 Plus & 8 Plus
ScreenSize::IOS_58 => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::APP_IPHONE_58,
ScreenSize::IOS_61 => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::APP_IPHONE_61,
ScreenSize::IOS_65 => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::APP_IPHONE_65,
ScreenSize::IOS_67 => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::APP_IPHONE_67,
ScreenSize::IOS_IPAD => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::APP_IPAD_97,
Expand All @@ -115,6 +116,7 @@ def device_type
ScreenSize::IOS_47_MESSAGES => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::IMESSAGE_APP_IPHONE_47, # also 7 & 8
ScreenSize::IOS_55_MESSAGES => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::IMESSAGE_APP_IPHONE_55, # also 7 Plus & 8 Plus
ScreenSize::IOS_58_MESSAGES => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::IMESSAGE_APP_IPHONE_58,
ScreenSize::IOS_61_MESSAGES => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::IMESSAGE_APP_IPHONE_61,
ScreenSize::IOS_65_MESSAGES => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::IMESSAGE_APP_IPHONE_65,
ScreenSize::IOS_67_MESSAGES => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::IMESSAGE_APP_IPHONE_67,
ScreenSize::IOS_IPAD_MESSAGES => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::IMESSAGE_APP_IPAD_97,
Expand All @@ -139,7 +141,7 @@ def formatted_name
ScreenSize::IOS_47 => "iPhone 6", # also 7 & 8
ScreenSize::IOS_55 => "iPhone 6 Plus", # also 7 Plus & 8 Plus
ScreenSize::IOS_58 => "iPhone XS",
ScreenSize::IOS_61 => "iPhone XR",
ScreenSize::IOS_61 => "iPhone 14 Pro",
ScreenSize::IOS_65 => "iPhone XS Max",
ScreenSize::IOS_67 => "iPhone 14 Pro Max",
ScreenSize::IOS_IPAD => "iPad",
Expand All @@ -151,7 +153,7 @@ def formatted_name
ScreenSize::IOS_47_MESSAGES => "iPhone 6 (iMessage)", # also 7 & 8
ScreenSize::IOS_55_MESSAGES => "iPhone 6 Plus (iMessage)", # also 7 Plus & 8 Plus
ScreenSize::IOS_58_MESSAGES => "iPhone XS (iMessage)",
ScreenSize::IOS_61_MESSAGES => "iPhone XR (iMessage)",
ScreenSize::IOS_61_MESSAGES => "iPhone 14 Pro (iMessage)",
ScreenSize::IOS_65_MESSAGES => "iPhone XS Max (iMessage)",
ScreenSize::IOS_67_MESSAGES => "iPhone 14 Pro Max (iMessage)",
ScreenSize::IOS_IPAD_MESSAGES => "iPad (iMessage)",
Expand Down Expand Up @@ -182,6 +184,7 @@ def is_messages?
ScreenSize::IOS_47_MESSAGES,
ScreenSize::IOS_55_MESSAGES,
ScreenSize::IOS_58_MESSAGES,
ScreenSize::IOS_61_MESSAGES,
ScreenSize::IOS_65_MESSAGES,
ScreenSize::IOS_67_MESSAGES,
ScreenSize::IOS_IPAD_MESSAGES,
Expand All @@ -207,8 +210,8 @@ def self.device_messages
[2778, 1284]
],
ScreenSize::IOS_61_MESSAGES => [
[828, 1792],
[1792, 828]
[1179, 2556],
[2556, 1179]
],
ScreenSize::IOS_58_MESSAGES => [
[1125, 2436],
Expand Down Expand Up @@ -271,8 +274,8 @@ def self.devices
[2778, 1284]
],
ScreenSize::IOS_61 => [
[828, 1792],
[1792, 828]
[1179, 2556],
[2556, 1179]
],
ScreenSize::IOS_58 => [
[1125, 2436],
Expand Down
15 changes: 13 additions & 2 deletions deliver/spec/app_screenshot_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ def expect_screen_size_from_file(file)
expect_screen_size_from_file("iPhone12ProMax-Landscape{2778x1284}.jpg").to eq(ScreenSize::IOS_65)
end

it "should calculate all 6.1 inch iPhone resolutions" do
expect_screen_size_from_file("iPhone14Pro-Portrait{1179x2556}.jpg").to eq(ScreenSize::IOS_61)
expect_screen_size_from_file("iPhone14Pro-Landscape{2556x1179}.jpg").to eq(ScreenSize::IOS_61)
end

it "should calculate all 5.8 inch iPhone resolutions" do
expect_screen_size_from_file("iPhoneXS-Portrait{1125x2436}.jpg").to eq(ScreenSize::IOS_58)
expect_screen_size_from_file("iPhoneXS-Landscape{2436x1125}.jpg").to eq(ScreenSize::IOS_58)
Expand Down Expand Up @@ -165,6 +170,11 @@ def expect_screen_size_from_file(file)
expect_screen_size_from_file("iMessage/en-GB/iPhone12ProMax-Landscape{2778x1284}.jpg").to eq(ScreenSize::IOS_65_MESSAGES)
end

it "should calculate all 6.1 inch iPhone resolutions" do
expect_screen_size_from_file("iMessage/en-GB/iPhone14Pro-Portrait{1179x2556}.jpg").to eq(ScreenSize::IOS_61_MESSAGES)
expect_screen_size_from_file("iMessage/en-GB/iPhone14Pro-Landscape{2556x1179}.jpg").to eq(ScreenSize::IOS_61_MESSAGES)
end

it "should calculate all 5.8 inch iPhone resolutions" do
expect_screen_size_from_file("iMessage/en-GB/iPhoneXS-Portrait{1125x2436}.jpg").to eq(ScreenSize::IOS_58_MESSAGES)
expect_screen_size_from_file("iMessage/en-GB/iPhoneXS-Landscape{2436x1125}.jpg").to eq(ScreenSize::IOS_58_MESSAGES)
Expand Down Expand Up @@ -314,8 +324,9 @@ def app_screenshot_with(screen_size, path = '', language = 'en-US')
expect(app_screenshot_with(ScreenSize::IOS_55_MESSAGES).device_type).to eq("IMESSAGE_APP_IPHONE_55")
end

it "should return nil for 6.1 inch displays (iPhone XR)" do
expect(app_screenshot_with(ScreenSize::IOS_61).device_type).to be_nil
it "should return iphone14Pro for 6.1 inch displays (iPhone 14)" do
expect(app_screenshot_with(ScreenSize::IOS_61).device_type).to eq("APP_IPHONE_61")
expect(app_screenshot_with(ScreenSize::IOS_61_MESSAGES).device_type).to eq("IMESSAGE_APP_IPHONE_61")
end

it "should return iphone67 for 6.7 inch displays" do
Expand Down
10 changes: 0 additions & 10 deletions deliver/spec/app_screenshot_validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def expect_no_error(screenshot)

it 'should detect unacceptable screen size' do
expect_errors_to_include(app_screenshot_with('Unknown device'), Error::UNACCEPTABLE_DEVICE)
expect_errors_to_include(app_screenshot_with(ScreenSize::IOS_61), Error::UNACCEPTABLE_DEVICE)
end

it 'should detect invalid file extension' do
Expand All @@ -54,15 +53,6 @@ def expect_no_error(screenshot)
end
end

describe '.validate_device_type' do
it 'should give a validation error to skip uploading screenshot' do
errors_found = []
described_class.validate(app_screenshot_with(ScreenSize::IOS_61), errors_found)
error = errors_found.find { |e| e.type == Error::UNACCEPTABLE_DEVICE }
expect(error.to_skip).to be(true)
end
end

describe '.validate_file_extension_and_format' do
it 'should provide ideal filename to match content format' do
errors_found = []
Expand Down
6 changes: 0 additions & 6 deletions deliver/spec/loader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,6 @@ def collect_screenshots_from_dir(dir)
expect(screenshots.first.screen_size).to eq(Deliver::AppScreenshot::ScreenSize::IOS_47)
end

it "should not collect iPhone XR screenshots" do
add_screenshot("/Screenshots/en-GB/iPhoneXR-01First{828x1792}.jpg")
screenshots = collect_screenshots_from_dir("/Screenshots/")
expect(screenshots.count).to eq(0)
end

it "should find different languages" do
add_screenshot("/Screenshots/en-GB/iPhone8-01First{750x1334}.jpg")
add_screenshot("/Screenshots/fr-FR/iPhone8-01First{750x1334}.jpg")
Expand Down
2 changes: 1 addition & 1 deletion frameit/lib/frameit/device_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ module Devices
IPHONE_8_PLUS ||= Frameit::Device.new("iphone-8-plus", "Apple iPhone 8 Plus", 6, [[1242, 2208], [2208, 1242]], 401, Color::SPACE_GRAY)
IPHONE_X ||= Frameit::Device.new("iphone-X", "Apple iPhone X", 7, [[1125, 2436], [2436, 1125]], 458, Color::SPACE_GRAY, Platform::IOS, Deliver::AppScreenshot::ScreenSize::IOS_58, :use_legacy_iphonex)
IPHONE_XS ||= Frameit::Device.new("iphone-XS", "Apple iPhone XS", 8, [[1125, 2436], [2436, 1125]], 458, Color::SPACE_GRAY, Platform::IOS, Deliver::AppScreenshot::ScreenSize::IOS_58, :use_legacy_iphonexs)
IPHONE_XR ||= Frameit::Device.new("iphone-XR", "Apple iPhone XR", 8, [[828, 1792], [1792, 828]], 326, Color::SPACE_GRAY, Platform::IOS, Deliver::AppScreenshot::ScreenSize::IOS_61, :use_legacy_iphonexr)
IPHONE_XR ||= Frameit::Device.new("iphone-XR", "Apple iPhone XR", 8, [[828, 1792], [1792, 828]], 326, Color::SPACE_GRAY, Platform::IOS, Deliver::AppScreenshot::ScreenSize::IOS_65, :use_legacy_iphonexsmax)
IPHONE_XS_MAX ||= Frameit::Device.new("iphone-XS-Max", "Apple iPhone XS Max", 8, [[1242, 2688], [2688, 1242]], 458, Color::SPACE_GRAY, Platform::IOS, Deliver::AppScreenshot::ScreenSize::IOS_65, :use_legacy_iphonexsmax)
IPHONE_11 ||= Frameit::Device.new("iphone-11", "Apple iPhone 11", 9, [[828, 1792], [1792, 828]], 326, Color::BLACK, Platform::IOS)
IPHONE_11_PRO ||= Frameit::Device.new("iphone-11-pro", "Apple iPhone 11 Pro", 9, [[1125, 2436], [2436, 1125]], 458, Color::SPACE_GRAY, Platform::IOS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module DisplayType
APP_IPHONE_47 = "APP_IPHONE_47"
APP_IPHONE_55 = "APP_IPHONE_55"
APP_IPHONE_58 = "APP_IPHONE_58"
APP_IPHONE_61 = "APP_IPHONE_61"
APP_IPHONE_65 = "APP_IPHONE_65"
APP_IPHONE_67 = "APP_IPHONE_67"

Expand All @@ -29,6 +30,7 @@ module DisplayType
IMESSAGE_APP_IPHONE_47 = "IMESSAGE_APP_IPHONE_47"
IMESSAGE_APP_IPHONE_55 = "IMESSAGE_APP_IPHONE_55"
IMESSAGE_APP_IPHONE_58 = "IMESSAGE_APP_IPHONE_58"
IMESSAGE_APP_IPHONE_61 = "IMESSAGE_APP_IPHONE_61"
IMESSAGE_APP_IPHONE_65 = "IMESSAGE_APP_IPHONE_65"
IMESSAGE_APP_IPHONE_67 = "IMESSAGE_APP_IPHONE_67"

Expand All @@ -51,6 +53,7 @@ module DisplayType
IMESSAGE_APP_IPHONE_47,
IMESSAGE_APP_IPHONE_55,
IMESSAGE_APP_IPHONE_58,
IMESSAGE_APP_IPHONE_61,
IMESSAGE_APP_IPHONE_65,
IMESSAGE_APP_IPHONE_67,

Expand All @@ -67,6 +70,7 @@ module DisplayType
APP_IPHONE_47,
APP_IPHONE_55,
APP_IPHONE_58,
APP_IPHONE_61,
APP_IPHONE_65,
APP_IPHONE_67,

Expand All @@ -80,6 +84,7 @@ module DisplayType
IMESSAGE_APP_IPHONE_47,
IMESSAGE_APP_IPHONE_55,
IMESSAGE_APP_IPHONE_58,
IMESSAGE_APP_IPHONE_61,
IMESSAGE_APP_IPHONE_65,
IMESSAGE_APP_IPHONE_67,

Expand Down

0 comments on commit 750789f

Please sign in to comment.