Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/krausefx/deliver
Browse files Browse the repository at this point in the history
  • Loading branch information
KrauseFx committed Dec 2, 2015
2 parents deca3f0 + 248a4de commit 2636dba
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions lib/deliver/upload_screenshots.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,33 @@ def upload(options, screenshots)

# Now, fill in the new ones
indized = {} # per language and device type
screenshots.each do |screenshot|
indized[screenshot.language] ||= {}
indized[screenshot.language][screenshot.device_type] ||= 0
indized[screenshot.language][screenshot.device_type] += 1 # we actually start with 1... wtf iTC

index = indized[screenshot.language][screenshot.device_type]
screenshots_per_language = screenshots.group_by(&:language)
screenshots_per_language.each do |language, screenshots_for_language|
Helper.log.info "Uploading #{screenshots_for_language.length} screenshots for language #{language}"
screenshots_for_language.each do |screenshot|
indized[screenshot.language] ||= {}
indized[screenshot.language][screenshot.device_type] ||= 0
indized[screenshot.language][screenshot.device_type] += 1 # we actually start with 1... wtf iTC

if index > 5
Helper.log.error "Too many screenshots found for device '#{screenshot.device_type}' in '#{screenshot.language}'"
next
end
index = indized[screenshot.language][screenshot.device_type]

Helper.log.info "Uploading '#{screenshot.path}'..."
v.upload_screenshot!(screenshot.path,
index,
screenshot.language,
screenshot.device_type)
end
if index > 5
Helper.log.error "Too many screenshots found for device '#{screenshot.device_type}' in '#{screenshot.language}'"
next
end

Helper.log.info "Saving changes"
v.save!
Helper.log.info "Uploading '#{screenshot.path}'..."
v.upload_screenshot!(screenshot.path,
index,
screenshot.language,
screenshot.device_type)
end
# ideally we should only save once, but itunes server can't cope it seems
# so we save per language. See issue #349
Helper.log.info "Saving changes"
v.save!
end
Helper.log.info "Successfully uploaded screenshots to iTunes Connect".green
end

Expand Down

0 comments on commit 2636dba

Please sign in to comment.