lib/deliver/app_screenshot.rb in deliver-1.15.1 vs lib/deliver/app_screenshot.rb in deliver-1.16.0
- old
+ new
@@ -15,10 +15,20 @@
IOS_55 = "iOS-5.5-in"
# iPad
IOS_IPAD = "iOS-iPad"
# iPad Pro
IOS_IPAD_PRO = "iOS-iPad-Pro"
+ # iPhone 5 iMessage
+ IOS_40_MESSAGES = "iOS-4-in-messages"
+ # iPhone 6 iMessage
+ IOS_47_MESSAGES = "iOS-4.7-in-messages"
+ # iPhone 6 Plus iMessage
+ IOS_55_MESSAGES = "iOS-5.5-in-messages"
+ # iPad iMessage
+ IOS_IPAD_MESSAGES = "iOS-iPad-messages"
+ # iPad Pro iMessage
+ IOS_IPAD_PRO_MESSAGES = "iOS-iPad-Pro-messages"
# Apple Watch
IOS_APPLE_WATCH = "iOS-Apple-Watch"
# Mac
MAC = "Mac"
# Apple TV
@@ -54,10 +64,15 @@
ScreenSize::IOS_40 => "iphone4",
ScreenSize::IOS_47 => "iphone6",
ScreenSize::IOS_55 => "iphone6Plus",
ScreenSize::IOS_IPAD => "ipad",
ScreenSize::IOS_IPAD_PRO => "ipadPro",
+ ScreenSize::IOS_40_MESSAGES => "iphone4",
+ ScreenSize::IOS_47_MESSAGES => "iphone6",
+ ScreenSize::IOS_55_MESSAGES => "iphone6Plus",
+ ScreenSize::IOS_IPAD_MESSAGES => "ipad",
+ ScreenSize::IOS_IPAD_PRO_MESSAGES => "ipadPro",
ScreenSize::MAC => "desktop",
ScreenSize::IOS_APPLE_WATCH => "watch",
ScreenSize::APPLE_TV => "appleTV"
}
return matching[self.screen_size]
@@ -70,10 +85,15 @@
ScreenSize::IOS_40 => "iPhone 5",
ScreenSize::IOS_47 => "iPhone 6",
ScreenSize::IOS_55 => "iPhone 6 Plus",
ScreenSize::IOS_IPAD => "iPad",
ScreenSize::IOS_IPAD_PRO => "iPad Pro",
+ ScreenSize::IOS_40_MESSAGES => "iPhone 5 (iMessage)",
+ ScreenSize::IOS_47_MESSAGES => "iPhone 6 (iMessage)",
+ ScreenSize::IOS_55_MESSAGES => "iPhone 6 Plus (iMessage)",
+ ScreenSize::IOS_IPAD_MESSAGES => "iPad (iMessage)",
+ ScreenSize::IOS_IPAD_PRO_MESSAGES => "iPad Pro (iMessage)",
ScreenSize::MAC => "Mac",
ScreenSize::IOS_APPLE_WATCH => "Watch",
ScreenSize::APPLE_TV => "Apple TV"
}
return matching[self.screen_size]
@@ -84,10 +104,45 @@
return false unless ["png", "PNG", "jpg", "JPG", "jpeg", "JPEG"].include?(self.path.split(".").last)
return self.screen_size == self.class.calculate_screen_size(self.path)
end
+ def is_messages?
+ return [ScreenSize::IOS_40_MESSAGES, ScreenSize::IOS_47_MESSAGES, ScreenSize::IOS_55_MESSAGES, ScreenSize::IOS_IPAD_MESSAGES, ScreenSize::IOS_IPAD_PRO_MESSAGES].include?(self.screen_size)
+ end
+
+ def self.device_messages
+ return {
+ ScreenSize::IOS_55_MESSAGES => [
+ [1080, 1920],
+ [1242, 2208]
+ ],
+ ScreenSize::IOS_47_MESSAGES => [
+ [750, 1334]
+ ],
+ ScreenSize::IOS_40_MESSAGES => [
+ [640, 1136],
+ [640, 1096],
+ [1136, 600] # landscape status bar is smaller
+ ],
+ ScreenSize::IOS_IPAD_MESSAGES => [
+ [1024, 748],
+ [1024, 768],
+ [2048, 1496],
+ [2048, 1536],
+ [768, 1004],
+ [768, 1024],
+ [1536, 2008],
+ [1536, 2048]
+ ],
+ ScreenSize::IOS_IPAD_PRO_MESSAGES => [
+ [2732, 2048],
+ [2048, 2732]
+ ]
+ }
+ end
+
def self.devices
return {
ScreenSize::IOS_55 => [
[1080, 1920],
[1242, 2208]
@@ -143,10 +198,13 @@
path_component = Pathname.new(path).each_filename.to_a[-3]
if path_component.eql? "appleTV"
skip_landscape = true
end
- self.devices.each do |device_type, array|
+ # iMessage screenshots have same resolution as app screenshots so we need to distinguish them
+ devices = path_component.eql?("iMessage") ? self.device_messages : self.devices
+
+ devices.each do |device_type, array|
array.each do |resolution|
if skip_landscape
if size[0] == resolution[0] and size[1] == resolution[1] # portrait
return device_type
end