Skip to content

Commit

Permalink
[deliver] add support to detecting and uploading 6.7" (iPhone 14 Pro …
Browse files Browse the repository at this point in the history
…Max) screenshots (#20694)

* upload 6.7inch screenshots

* Update deliver/spec/app_screenshot_spec.rb

Co-authored-by: Roger Oba <rogerluan.oba@gmail.com>

* fix

* fix

* Update deliver/lib/deliver/app_screenshot.rb

Co-authored-by: Kohki Miki <giginet.net@gmail.com>

* Update deliver/spec/app_screenshot_spec.rb

Co-authored-by: Kohki Miki <giginet.net@gmail.com>

* Update deliver/lib/deliver/app_screenshot.rb

Co-authored-by: Kohki Miki <giginet.net@gmail.com>

* Update deliver/lib/deliver/app_screenshot.rb

Co-authored-by: Kohki Miki <giginet.net@gmail.com>

* Update deliver/lib/deliver/app_screenshot.rb

Co-authored-by: Kohki Miki <giginet.net@gmail.com>

* revert Gemlock

* Fix indendation.

Co-authored-by: Roger Oba <rogerluan.oba@gmail.com>
Co-authored-by: Kohki Miki <giginet.net@gmail.com>
  • Loading branch information
3 people committed Sep 30, 2022
1 parent 2720634 commit 950bb82
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
17 changes: 17 additions & 0 deletions deliver/lib/deliver/app_screenshot.rb
Expand Up @@ -23,6 +23,8 @@ module ScreenSize
IOS_61 = "iOS-6.1-in"
# iPhone XS Max
IOS_65 = "iOS-6.5-in"
# iPhone 14 Pro Max
IOS_67 = "iOS-6.7-in"

# iPad
IOS_IPAD = "iOS-iPad"
Expand All @@ -47,6 +49,8 @@ module ScreenSize
IOS_61_MESSAGES = "iOS-6.1-in-messages"
# iPhone XS Max iMessage
IOS_65_MESSAGES = "iOS-6.5-in-messages"
# iPhone 14 Pro Max iMessage
IOS_67_MESSAGES = "iOS-6.7-in-messages"

# iPad iMessage
IOS_IPAD_MESSAGES = "iOS-iPad-messages"
Expand Down Expand Up @@ -101,6 +105,7 @@ def device_type
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_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,
ScreenSize::IOS_IPAD_10_5 => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::APP_IPAD_105,
ScreenSize::IOS_IPAD_11 => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::APP_IPAD_PRO_3GEN_11,
Expand All @@ -111,6 +116,7 @@ def device_type
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_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,
ScreenSize::IOS_IPAD_PRO_MESSAGES => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::IMESSAGE_APP_IPAD_PRO_129,
ScreenSize::IOS_IPAD_PRO_12_9_MESSAGES => Spaceship::ConnectAPI::AppScreenshotSet::DisplayType::IMESSAGE_APP_IPAD_PRO_3GEN_129,
Expand All @@ -135,6 +141,7 @@ def formatted_name
ScreenSize::IOS_58 => "iPhone XS",
ScreenSize::IOS_61 => "iPhone XR",
ScreenSize::IOS_65 => "iPhone XS Max",
ScreenSize::IOS_67 => "iPhone 14 Pro Max",
ScreenSize::IOS_IPAD => "iPad",
ScreenSize::IOS_IPAD_10_5 => "iPad 10.5",
ScreenSize::IOS_IPAD_11 => "iPad 11",
Expand All @@ -146,6 +153,7 @@ def formatted_name
ScreenSize::IOS_58_MESSAGES => "iPhone XS (iMessage)",
ScreenSize::IOS_61_MESSAGES => "iPhone XR (iMessage)",
ScreenSize::IOS_65_MESSAGES => "iPhone XS Max (iMessage)",
ScreenSize::IOS_67_MESSAGES => "iPhone 14 Pro Max (iMessage)",
ScreenSize::IOS_IPAD_MESSAGES => "iPad (iMessage)",
ScreenSize::IOS_IPAD_PRO_MESSAGES => "iPad Pro (iMessage)",
ScreenSize::IOS_IPAD_PRO_12_9_MESSAGES => "iPad Pro (12.9-inch) (3rd generation) (iMessage)",
Expand Down Expand Up @@ -175,6 +183,7 @@ def is_messages?
ScreenSize::IOS_55_MESSAGES,
ScreenSize::IOS_58_MESSAGES,
ScreenSize::IOS_65_MESSAGES,
ScreenSize::IOS_67_MESSAGES,
ScreenSize::IOS_IPAD_MESSAGES,
ScreenSize::IOS_IPAD_PRO_MESSAGES,
ScreenSize::IOS_IPAD_PRO_12_9_MESSAGES,
Expand All @@ -187,6 +196,10 @@ def self.device_messages
# This list does not include iPad Pro 12.9-inch (3rd generation)
# because it has same resoluation as IOS_IPAD_PRO and will clobber
return {
ScreenSize::IOS_67_MESSAGES => [
[1290, 2796],
[2796, 1290]
],
ScreenSize::IOS_65_MESSAGES => [
[1242, 2688],
[2688, 1242],
Expand Down Expand Up @@ -247,6 +260,10 @@ def self.devices
# This list does not include iPad Pro 12.9-inch (3rd generation)
# because it has same resoluation as IOS_IPAD_PRO and will clobber
return {
ScreenSize::IOS_67 => [
[1290, 2796],
[2796, 1290]
],
ScreenSize::IOS_65 => [
[1242, 2688],
[2688, 1242],
Expand Down
15 changes: 15 additions & 0 deletions deliver/spec/app_screenshot_spec.rb
Expand Up @@ -66,6 +66,11 @@ def expect_screen_size_from_file(file)
end

describe "valid screen sizes" do
it "should calculate all 6.7 inch iPhone resolutions" do
expect_screen_size_from_file("iPhone14ProMax-Portrait{1290x2796}.jpg").to eq(ScreenSize::IOS_67)
expect_screen_size_from_file("iPhone14ProMax-Landscape{2796x1290}.jpg").to eq(ScreenSize::IOS_67)
end

it "should calculate all 6.5 inch iPhone resolutions" do
expect_screen_size_from_file("iPhoneXSMax-Portrait{1242x2688}.jpg").to eq(ScreenSize::IOS_65)
expect_screen_size_from_file("iPhoneXSMax-Landscape{2688x1242}.jpg").to eq(ScreenSize::IOS_65)
Expand Down Expand Up @@ -148,6 +153,11 @@ def expect_screen_size_from_file(file)
end

describe "valid iMessage app screen sizes" do
it "should calculate all 6.7 inch iPhone resolutions" do
expect_screen_size_from_file("iMessage/en-GB/iPhone14ProMax-Portrait{1290x2796}.jpg").to eq(ScreenSize::IOS_67_MESSAGES)
expect_screen_size_from_file("iMessage/en-GB/iPhone14ProMax-Landscape{2796x1290}.jpg").to eq(ScreenSize::IOS_67_MESSAGES)
end

it "should calculate all 6.5 inch iPhone resolutions" do
expect_screen_size_from_file("iMessage/en-GB/iPhoneXSMax-Portrait{1242x2688}.jpg").to eq(ScreenSize::IOS_65_MESSAGES)
expect_screen_size_from_file("iMessage/en-GB/iPhoneXSMax-Landscape{2688x1242}.jpg").to eq(ScreenSize::IOS_65_MESSAGES)
Expand Down Expand Up @@ -308,6 +318,11 @@ def app_screenshot_with(screen_size, path = '', language = 'en-US')
expect(app_screenshot_with(ScreenSize::IOS_61).device_type).to be_nil
end

it "should return iphone67 for 6.7 inch displays" do
expect(app_screenshot_with(ScreenSize::IOS_67).device_type).to eq("APP_IPHONE_67")
expect(app_screenshot_with(ScreenSize::IOS_67_MESSAGES).device_type).to eq("IMESSAGE_APP_IPHONE_67")
end

it "should return iphone65 for 6.5 inch displays" do
expect(app_screenshot_with(ScreenSize::IOS_65).device_type).to eq("APP_IPHONE_65")
expect(app_screenshot_with(ScreenSize::IOS_65_MESSAGES).device_type).to eq("IMESSAGE_APP_IPHONE_65")
Expand Down
2 changes: 2 additions & 0 deletions deliver/spec/app_screenshot_validator_spec.rb
Expand Up @@ -30,6 +30,8 @@ def expect_no_error(screenshot)
it 'should return true for valid screenshot' do
expect_no_error(app_screenshot_with(ScreenSize::IOS_65, :png, 'image.png'))
expect_no_error(app_screenshot_with(ScreenSize::IOS_65, :jpeg, 'image.jpeg'))
expect_no_error(app_screenshot_with(ScreenSize::IOS_67, :png, 'image.png'))
expect_no_error(app_screenshot_with(ScreenSize::IOS_67, :jpeg, 'image.jpeg'))
end

it 'should detect valid size screenshot' do
Expand Down
Expand Up @@ -17,6 +17,7 @@ module DisplayType
APP_IPHONE_55 = "APP_IPHONE_55"
APP_IPHONE_58 = "APP_IPHONE_58"
APP_IPHONE_65 = "APP_IPHONE_65"
APP_IPHONE_67 = "APP_IPHONE_67"

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

IMESSAGE_APP_IPAD_97 = "IMESSAGE_APP_IPAD_97"
IMESSAGE_APP_IPAD_105 = "IMESSAGE_APP_IPAD_105"
Expand All @@ -50,6 +52,7 @@ module DisplayType
IMESSAGE_APP_IPHONE_55,
IMESSAGE_APP_IPHONE_58,
IMESSAGE_APP_IPHONE_65,
IMESSAGE_APP_IPHONE_67,

IMESSAGE_APP_IPAD_97,
IMESSAGE_APP_IPAD_105,
Expand All @@ -65,6 +68,7 @@ module DisplayType
APP_IPHONE_55,
APP_IPHONE_58,
APP_IPHONE_65,
APP_IPHONE_67,

APP_IPAD_97,
APP_IPAD_105,
Expand All @@ -77,6 +81,7 @@ module DisplayType
IMESSAGE_APP_IPHONE_55,
IMESSAGE_APP_IPHONE_58,
IMESSAGE_APP_IPHONE_65,
IMESSAGE_APP_IPHONE_67,

IMESSAGE_APP_IPAD_97,
IMESSAGE_APP_IPAD_105,
Expand Down

0 comments on commit 950bb82

Please sign in to comment.