deliver/lib/deliver/upload_screenshots.rb in fastlane-2.161.0 vs deliver/lib/deliver/upload_screenshots.rb in fastlane-2.162.0
- old
+ new
@@ -124,14 +124,20 @@
rescue => error
UI.error(error)
end
end
- number_of_screenshots = 0
+ # Each app_screenshot_set can have only 10 images
+ number_of_screenshots_per_set = {}
+ total_number_of_screenshots = 0
+
iterator = AppScreenshotIterator.new(localizations)
- iterator.each_local_screenshot(screenshots_per_language) do |localization, app_screenshot_set, screenshot, index|
- if index >= 10
+ iterator.each_local_screenshot(screenshots_per_language) do |localization, app_screenshot_set, screenshot|
+ # Initialize counter on each app screenshot set
+ number_of_screenshots_per_set[app_screenshot_set] ||= (app_screenshot_set.app_screenshots || []).count
+
+ if number_of_screenshots_per_set[app_screenshot_set] >= 10
UI.error("Too many screenshots found for device '#{screenshot.device_type}' in '#{screenshot.language}', skipping this one (#{screenshot.path})")
next
end
checksum = UploadScreenshots.calculate_checksum(screenshot.path)
@@ -139,24 +145,26 @@
# Enqueue uploading job if it's not duplicated otherwise screenshot will be skipped
if duplicate
UI.message("Previous uploaded. Skipping '#{screenshot.path}'...")
else
+ UI.verbose("Queued uplaod sceeenshot job for #{localization.locale} #{app_screenshot_set.screenshot_display_type} #{screenshot.path}")
worker.enqueue(UploadScreenshotJob.new(app_screenshot_set, screenshot.path))
+ number_of_screenshots_per_set[app_screenshot_set] += 1
end
- number_of_screenshots += 1
+ total_number_of_screenshots += 1
end
worker.start
UI.verbose('Uploading jobs are completed')
Helper.show_loading_indicator("Waiting for all the screenshots processed...")
states = wait_for_complete(iterator)
Helper.hide_loading_indicator
- retry_upload_screenshots_if_needed(iterator, states, number_of_screenshots, tries, localizations, screenshots_per_language)
+ retry_upload_screenshots_if_needed(iterator, states, total_number_of_screenshots, tries, localizations, screenshots_per_language)
UI.message("Successfully uploaded all screenshots")
end
# Verify all screenshots have been processed
@@ -201,15 +209,24 @@
# Return `true` if all the local screenshots are uploaded to App Store Connect
def verify_local_screenshots_are_uploaded(iterator, screenshots_per_language)
# Check if local screenshots' checksum exist on App Store Connect
checksum_to_app_screenshot = iterator.each_app_screenshot.map { |_, _, app_screenshot| [app_screenshot.source_file_checksum, app_screenshot] }.to_h
- missing_local_screenshots = iterator.each_local_screenshot(screenshots_per_language).select do |_, _, local_screenshot, index|
+ number_of_screenshots_per_set = {}
+ missing_local_screenshots = iterator.each_local_screenshot(screenshots_per_language).select do |_, app_screenshot_set, local_screenshot|
+ number_of_screenshots_per_set[app_screenshot_set] ||= (app_screenshot_set.app_screenshots || []).count
checksum = UploadScreenshots.calculate_checksum(local_screenshot.path)
- checksum_to_app_screenshot[checksum].nil? && index < 10 # if index is more than 10, it's skipped
+
+ if checksum_to_app_screenshot[checksum]
+ next(false)
+ else
+ is_missing = number_of_screenshots_per_set[app_screenshot_set] < 10 # if it's more than 10, it's skipped
+ number_of_screenshots_per_set[app_screenshot_set] += 1
+ next(is_missing)
+ end
end
- missing_local_screenshots.each do |_, _, screenshot, _|
+ missing_local_screenshots.each do |_, _, screenshot|
UI.error("#{screenshot.path} is missing on App Store Connect.")
end
missing_local_screenshots.empty?
end