deliver/lib/deliver/app_screenshot.rb in fastlane_hotfix-2.165.1 vs deliver/lib/deliver/app_screenshot.rb in fastlane_hotfix-2.187.0

- old
+ new

@@ -80,19 +80,16 @@ attr_accessor :language # @param path (String) path to the screenshot file # @param language (String) Language of this screenshot (e.g. English) # @param screen_size (Deliver::AppScreenshot::ScreenSize) the screen size, which - # will automatically be calculated when you don't set it. + # will automatically be calculated when you don't set it. (Deprecated) def initialize(path, language, screen_size = nil) + UI.deprecated('`screen_size` for Deliver::AppScreenshot.new is deprecated in favor of the default behavior to calculate size automatically. Passed value is no longer validated.') if screen_size self.path = path self.language = language - screen_size ||= self.class.calculate_screen_size(path) - - self.screen_size = screen_size - - UI.error("Looks like the screenshot given (#{path}) does not match the requirements of #{screen_size}") unless self.is_valid? + self.screen_size = screen_size || self.class.calculate_screen_size(path) end # The iTC API requires a different notation for the device def device_type matching = { @@ -159,10 +156,11 @@ return matching[self.screen_size] end # Validates the given screenshots (size and format) def is_valid? + UI.deprecated('Deliver::AppScreenshot#is_valid? is deprecated in favor of Deliver::AppScreenshotValidator') 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 @@ -185,19 +183,23 @@ # 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_65_MESSAGES => [ [1242, 2688], - [2688, 1242] + [2688, 1242], + [1284, 2778], + [2778, 1284] ], ScreenSize::IOS_61_MESSAGES => [ [828, 1792], [1792, 828] ], ScreenSize::IOS_58_MESSAGES => [ [1125, 2436], - [2436, 1125] + [2436, 1125], + [1170, 2532], + [2532, 1170] ], ScreenSize::IOS_55_MESSAGES => [ [1242, 2208], [2208, 1242] ], @@ -241,19 +243,23 @@ # 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_65 => [ [1242, 2688], - [2688, 1242] + [2688, 1242], + [1284, 2778], + [2778, 1284] ], ScreenSize::IOS_61 => [ [828, 1792], [1792, 828] ], ScreenSize::IOS_58 => [ [1125, 2436], - [2436, 1125] + [2436, 1125], + [1170, 2532], + [2532, 1170] ], ScreenSize::IOS_55 => [ [1242, 2208], [2208, 1242] ], @@ -344,10 +350,10 @@ filename = Pathname.new(path).basename.to_s return resolve_ipadpro_conflict_if_needed(screen_size, filename) end end - UI.user_error!("Unsupported screen size #{size} for path '#{path}'") + nil end end ScreenSize = AppScreenshot::ScreenSize end