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

[deliver] add support to detecting and uploading 6.7" (iPhone 14 Pro Max) screenshots #20694

Merged
merged 12 commits into from Sep 30, 2022
24 changes: 12 additions & 12 deletions Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
fastlane (2.210.1)
fastlane (2.210.2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you revert Gemfile.lock?
This file should not be changed by this PR.

CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand Down Expand Up @@ -51,8 +51,8 @@ GEM
ast (2.4.2)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.630.0)
aws-sdk-core (3.147.0)
aws-partitions (1.638.0)
aws-sdk-core (3.156.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1)
Expand Down Expand Up @@ -117,7 +117,7 @@ GEM
unf (>= 0.0.5, < 1.0.0)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.92.4)
excon (0.92.5)
fakefs (1.2.3)
faraday (1.4.1)
faraday-excon (~> 1.1)
Expand All @@ -142,9 +142,9 @@ GEM
gh_inspector (1.1.3)
git (1.8.1)
rchardet (~> 1.8)
google-apis-androidpublisher_v3 (0.26.0)
google-apis-core (>= 0.7, < 2.a)
google-apis-core (0.7.2)
google-apis-androidpublisher_v3 (0.28.0)
google-apis-core (>= 0.9.0, < 2.a)
google-apis-core (0.9.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
Expand All @@ -153,10 +153,10 @@ GEM
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-iamcredentials_v1 (0.13.0)
google-apis-core (>= 0.7, < 2.a)
google-apis-playcustomapp_v1 (0.10.0)
google-apis-core (>= 0.7, < 2.a)
google-apis-iamcredentials_v1 (0.15.0)
google-apis-core (>= 0.9.0, < 2.a)
google-apis-playcustomapp_v1 (0.11.0)
google-apis-core (>= 0.9.0, < 2.a)
google-apis-storage_v1 (0.17.0)
google-apis-core (>= 0.7, < 2.a)
google-cloud-core (1.6.0)
Expand All @@ -165,7 +165,7 @@ GEM
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.3.0)
google-cloud-storage (1.40.0)
google-cloud-storage (1.42.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
Expand Down
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],
cherpake marked this conversation as resolved.
Show resolved Hide resolved
],
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],
cherpake marked this conversation as resolved.
Show resolved Hide resolved
],
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