b0VIM 8.1_ZjoshJoshs-Mac-mini.local~josh/Projects/fastlane/fastlane/deliver/lib/deliver/upload_screenshots.rb 3210#"! Utp_W`NIad^_tT)(y87 ^  @ ? { z Q   l k F ( a  SIHts( yQ9hwvE # Sometimes API requests will fail but screenshots will still be deleted # Verify all screenshots have been deleted worker.start end worker.enqueue(DeleteScreenshotJob.new(app_screenshot, localization, app_screenshot_set)) UI.verbose("Queued delete sceeenshot job for #{localization.locale} #{app_screenshot_set.screenshot_display_type} #{app_screenshot.id}") next unless screenshots_per_language.keys.include?(localization.locale) # Only delete screenshots if trying to upload iterator.each_app_screenshot do |localization, app_screenshot_set, app_screenshot| iterator = AppScreenshotIterator.new(localizations) end end UI.error(error.message) UI.error("Failed to delete screenshot #{target} - (#{Time.now - start_time} secs)") rescue => error UI.message("Deleted '#{target}' - (#{Time.now - start_time} secs)") job.app_screenshot.delete! UI.verbose("Deleting '#{target}'") begin target = "#{job.localization.locale} #{job.app_screenshot_set.screenshot_display_type} #{job.app_screenshot.id}" start_time = Time.now worker = QueueWorker.new do |job| tries -= 1 def delete_screenshots(localizations, screenshots_per_language, tries: 5) end UI.success("Successfully uploaded screenshots to App Store Connect") Helper.hide_loading_indicator sort_screenshots(localizations) Helper.show_loading_indicator("Sorting screenshots uploaded...") upload_screenshots(localizations, screenshots_per_language) end localizations = version.get_app_store_version_localizations # 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 delete_screenshots(localizations, screenshots_per_language) 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 = options[:app] return if options[:edit_live] return if options[:skip_screenshots] def upload(options, screenshots) UploadScreenshotJob = Struct.new(:app_screenshot_set, :path) DeleteScreenshotJob = Struct.new(:app_screenshot, :localization, :app_screenshot_set) class UploadScreenshots # upload screenshots to App Store Connectmodule Deliverrequire_relative 'app_screenshot_iterator'require_relative 'queue_worker'require_relative 'loader'require_relative 'module'require_relative 'app_screenshot'require 'digest/md5'require 'spaceship/tunes/tunes'adiIlba2 L + * # " m a `   @ IQ;jI]UT%end end end Digest::MD5.hexdigest(bytes) bytes = File.binread(path) def self.calculate_checksum(path) # helper method to mock this step in tests end Deliver::Languages::ALL_LANGUAGES # Update with Spaceship::Tunes.client.available_languages.sort (as long as endpoint is avilable) # 2020-08-24 - Available locales are not available as an endpoint in App Store Connect 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] = lang available_languages = UploadScreenshots.available_languages.each_with_object({}) do |lang, lang_hash|