b0VIM 8.1u^R<joshJoshs-Mac-mini.local~josh/Projects/fastlane/fastlane/deliver/lib/deliver/upload_screenshots.rbutf-8 3210#"! Utp[R\DadC[tsd8e*) - , @ ?  G r q 7 C  XBv21hG[MA76z\$O4' # Refresh version localizations Helper.hide_loading_indicator end }) locale: locale version.create_app_store_version_localization(attributes: { locales_to_enable.each do |locale| Helper.show_loading_indicator("Activating #{lng_text} #{locales_to_enable.join(', ')}...") lng_text += "s" if locales_to_enable.count != 1 lng_text = "language" if locales_to_enable.count > 0 locales_to_enable = languages - localizations.map(&:locale) languages = screenshots_per_language.keys # Finding languages to enable end end end UI.crash!(errors.map(&:message).join("\n")) unless errors.empty? # Crash if any errors happen while deleting end Helper.hide_loading_indicator unless FastlaneCore::Globals.verbose? threads.each(&:join) Helper.show_loading_indicator("Waiting for screenshots to be deleted for '#{localization.locale}'... (might be slow)") unless FastlaneCore::Globals.verbose? unless threads.empty? sleep(1) # Feels bad but sleeping a bit to let the threads catchup end end end end errors << error UI.verbose("Failed to delete screenshot - #{localization.locale} #{screenshot_set.screenshot_display_type} #{screenshot.id}") rescue => error UI.verbose("Deleted screenshot - #{localization.locale} #{screenshot_set.screenshot_display_type} #{screenshot.id}") screenshot.delete! begin threads << Thread.new do UI.verbose("Deleting screenshot - #{localization.locale} #{screenshot_set.screenshot_display_type} #{screenshot.id}") screenshot_set.app_screenshots.each do |screenshot| UI.message("Removing all previously uploaded screenshots for '#{localization.locale}' '#{screenshot_set.screenshot_display_type}'...") screenshot_sets.each do |screenshot_set| errors = [] threads = [] # Multi threading delete on single localization screenshot_sets = localization.get_app_screenshot_sets # Iterate over all screenshots for each set and delete next unless screenshots_per_language.keys.include?(localization.locale) # Only delete screenshots if trying to upload localizations.each do |localization| # Get localizations on version if options[:overwrite_screenshots] localizations = version.get_app_store_version_localizations screenshots_per_language = screenshots.group_by(&:language) UI.message("Starting with the upload of screenshots...") UI.important("Will begin uploading snapshots for '#{version.version_string}' on App Store Connect") UI.user_error!("Could not find a version to edit for app '#{app.name}' for '#{platform}'") unless version version = app.get_edit_app_store_version(platform: platform) platform = Spaceship::ConnectAPI::Platform.map(options[:platform]) app = Spaceship::ConnectAPI::App.get(app_id: app_id) app_id = legacy_app.apple_id legacy_app = options[:app] return if options[:edit_live] return if options[:skip_screenshots] def upload(options, screenshots) class UploadScreenshots # upload screenshots to App Store Connectmodule Deliverrequire_relative 'loader'require_relative 'module'require_relative 'app_screenshot'require 'digest/md5'require 'spaceship/tunes/tunes'adDTS0!   X W  f ( d S E D  k;sgXNM4,+pe1'end end end end Spaceship::Tunes.client.available_languages else FastlaneCore::Languages::ALL_LANGUAGES if Helper.test? def self.available_languages # helper method so Spaceship::Tunes.client.available_languages is easier to test end return screenshots end exists end UI.important("🏃 Skipping screenshot file: #{screenshot.path} - Not an accepted App Store Connect device...") unaccepted_device_shown = true UI.important("Unaccepted device screenshots are detected! 🚫 Screenshot file will be skipped. 🏃") unless unaccepted_device_shown unless exists exists = !screenshot.device_type.nil? screenshots.select! do |screenshot| unaccepted_device_shown = false # to have it in there for frameit support # Ex: iPhone 6.1 inch isn't supported in App Store Connect but need # Checking if the device type exists in spaceship end end screenshots << AppScreenshot.new(file_path, language) end next UI.important("🏃 Skipping screenshot file: #{file_path}") if framed_screenshots_found && !is_framed && !is_watch is_watch = file_path.downcase.include?("watch") is_framed = file_path.downcase.include?("_framed.") files.each do |file_path| language = available_languages[language_dir_name.downcase] end UI.user_error!("#{language_dir_name} is not an available language. Please verify that your language codes are available in iTunesConnect. See https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/AppStoreTerritories.html for more information.") if available_languages[language_dir_name.downcase].nil? language_dir_name = File.basename(lng_folder) UI.important("Framed screenshots are detected! 🖼 Non-framed screenshot files may be skipped. 🏃") if framed_screenshots_found framed_screenshots_found = Dir.glob(File.join(lng_folder, "*_framed.#{extensions}"), File::FNM_CASEFOLD).count > 0 next if files.count == 0 files = Dir.glob(File.join(lng_folder, "*.#{extensions}"), File::FNM_CASEFOLD).sort end next screenshots.concat(collect_screenshots_for_languages(File.join(path, language), ignore_validation)) if language == Loader::APPLE_TV_DIR_NAME || language == Loader::IMESSAGE_DIR_NAME # Check to see if we need to traverse multiple platforms or just a single platform language = File.basename(lng_folder) Loader.language_folders(path, ignore_validation).each do |lng_folder| end lang_hash[lang.downcase] = langad( WON)xw4 v available_langua available_languages = UploadScreenshots.available_languages.each_with_object({}) do |lang, lang_hash| extensions = '{png,jpg,jpeg}' screenshots = [] def collect_screenshots_for_languages(path, ignore_validation) end return collect_screenshots_for_languages(options[:screenshots_path], options[:ignore_language_directory_validation]) return [] if options[:skip_screenshots] def collect_screenshots(options) end UI.success("Successfully uploaded screenshots to App Store Connect") end end end set.upload_screenshot(path: screenshot.path)ad"Rogf"S"  s r F E  c ~ B (   V J I { E D % > zbF8*) ,+d('ogfAL5 available_languages = UploadScreenshots.available_languages.each_with_object({}) do |lang, lang_hash| extensions = '{png,jpg,jpeg}' screenshots = [] def collect_screenshots_for_languages(path, ignore_validation) end return collect_screenshots_for_languages(options[:screenshots_path], options[:ignore_language_directory_validation]) return [] if options[:skip_screenshots] def collect_screenshots(options) end UI.success("Succe image.write(screenshot.path) image.strip image = MiniMagick::Image.open(screenshot.path) require 'mini_magick' UI.message("Uploading '#{screenshot.path}'...") indized[localization.locale][set.screenshot_display_type][:count] += 1 else UI.message("Previous uploaded. Skipping '#{screenshot.path}'...") if duplicate duplicate = indized[localization.locale][set.screenshot_display_type][:checksums].include?(checksum) checksum = Digest::MD5.hexdigest(bytes) bytes = File.binread(screenshot.path) end next UI.error("Too many screenshots found for device '#{screenshot.device_type}' in '#{screenshot.language}', skipping this one (#{screenshot.path})") if index >= 10 index = indized[localization.locale][set.screenshot_display_type][:count] end } checksums: [] count: 0, indized[localization.locale][set.screenshot_display_type] = { app_screenshot_sets_map[display_type] = set }) screenshotDisplayType: display_type set = localization.create_app_screenshot_set(attributes: { unless set end next UI.error("Error... Screenshot size #{screenshot.screen_size} not valid for App Store Connect") if display_type.nil? set = app_screenshot_sets_map[display_type] display_type = screenshot.device_type screenshots_for_language.each do |screenshot| UI.message("Uploading #{screenshots_for_language.length} screenshots for language #{language}") end indized[localization.locale][app_screenshot_set.screenshot_display_type][:checksums] = checksums checksums = app_screenshot_set.app_screenshots.map(&:source_file_checksum).uniq } checksums: [] count: app_screenshot_set.app_screenshots.size, indized[localization.locale][app_screenshot_set.screenshot_display_type] ||= { # Set initial screnshot count app_screenshot_sets_map[app_screenshot_set.screenshot_display_type] = app_screenshot_set app_screenshot_sets.each do |app_screenshot_set| app_screenshot_sets = localization.get_app_screenshot_sets app_screenshot_sets_map = {} # Create map to find screenshot set to add screenshot to indized[localization.locale] ||= {} end next UI.error("Couldn't find localization on version for #{language}") unless localization end l.locale == language localization = localizations.find do |l| # Find localization to upload screenshots to screenshots_per_language.each do |language, screenshots_for_language| indized = {} # per language and device type # Upload screenshots def upload_screenshots(screenshots_per_language, localizations) end upload_screenshots(screenshots_per_language, localizations) end localizations = version.get_app_store_version_localizations