spaceship/lib/spaceship/du/du_client.rb in fastlane-2.121.0.beta.20190421200026 vs spaceship/lib/spaceship/du/du_client.rb in fastlane-2.121.0.beta.20190422200029

- old
+ new

@@ -1,6 +1,7 @@ require_relative '../client' +require_relative '../tunes/display_family' require_relative 'utilities' module Spaceship # This class is used to upload Digital files (Images, Videos, JSON files) onto the du-itc service. # Its implementation is tied to the tunes module (in particular using +AppVersion+ instances) @@ -94,67 +95,19 @@ end parse_upload_response(r) end - # You can find this by uploading an image in App Store Connect - # then look for the X-Apple-Upload-Validation-RuleSets value def picture_type_map - # rubocop:enable Layout/ExtraSpacing - { - ipad: "MZPFT.SortedTabletScreenShot", - ipad105: "MZPFT.SortedJ207ScreenShot", - ipadPro: "MZPFT.SortedJ99ScreenShot", - ipadPro11: "MZPFT.SortedJ317ScreenShot", - ipadPro129: "MZPFT.SortedJ320ScreenShot", - iphone35: "MZPFT.SortedScreenShot", - iphone4: "MZPFT.SortedN41ScreenShot", - iphone6: "MZPFT.SortedN61ScreenShot", - iphone6Plus: "MZPFT.SortedN56ScreenShot", - iphone58: "MZPFT.SortedD22ScreenShot", - iphone65: "MZPFT.SortedD33ScreenShot", - watch: "MZPFT.SortedN27ScreenShot", - watchSeries4: "MZPFT.SortedN131ScreenShot", - appleTV: "MZPFT.SortedATVScreenShot", - desktop: "MZPFT.SortedDesktopScreenShot" - } + Spaceship::Tunes::DisplayFamily.all.map { |v| [v.name.to_sym, v.picture_type] }.to_h end def messages_picture_type_map - # rubocop:enable Layout/ExtraSpacing - { - ipad: "MZPFT.SortedTabletMessagesScreenShot", - ipad105: "MZPFT.SortedJ207MessagesScreenShot", - ipadPro: "MZPFT.SortedJ99MessagesScreenShot", - ipadPro11: "MZPFT.SortedJ317MessagesScreenShot", - ipadPro129: "MZPFT.SortedJ320MessagesScreenShot", - iphone4: "MZPFT.SortedN41MessagesScreenShot", - iphone6: "MZPFT.SortedN61MessagesScreenShot", - iphone6Plus: "MZPFT.SortedN56MessagesScreenShot", - iphone58: "MZPFT.SortedD22MessagesScreenShot", - iphone65: "MZPFT.SortedD33MessagesScreenShot" - } + Spaceship::Tunes::DisplayFamily.all.select(&:messages_supported?).map { |v| [v.name.to_sym, v.messages_picture_type] }.to_h end def device_resolution_map - # rubocop:enable Layout/ExtraSpacing - { - watch: [[312, 390]], - watchSeries4: [[368, 448]], - ipad: [[1024, 748], [1024, 768], [2048, 1496], [2048, 1536], [768, 1004], [768, 1024], [1536, 2008], [1536, 2048]], - ipad105: [[1668, 2224], [2224, 1668]], - ipadPro: [[2048, 2732], [2732, 2048]], - ipadPro11: [[1668, 2388], [2388, 1668]], - ipadPro129: [[2048, 2732], [2732, 2048]], - iphone35: [[640, 960], [640, 920], [960, 600], [960, 640]], - iphone4: [[640, 1096], [640, 1136], [1136, 600], [1136, 640]], - iphone6: [[750, 1334], [1334, 750]], - iphone6Plus: [[1242, 2208], [2208, 1242]], - iphone58: [[1125, 2436], [2436, 1125]], - iphone65: [[1242, 2688], [2688, 1242]], - appleTV: [[1920, 1080], [3840, 2160]], - desktop: [[1280, 800], [1440, 900], [2560, 1600], [2880, 1800]] - } + Spaceship::Tunes::DisplayFamily.all.map { |v| [v.name.to_sym, v.screenshot_resolutions] }.to_h end def screenshot_picture_type(device, is_messages) map = is_messages ? messages_picture_type_map : picture_type_map device = device.to_sym