deliver/lib/deliver/upload_screenshots.rb in fastlane-2.37.0.beta.20170602010027 vs deliver/lib/deliver/upload_screenshots.rb in fastlane-2.37.0.beta.20170603010102
- old
+ new
@@ -73,10 +73,14 @@
def collect_screenshots_for_languages(path)
screenshots = []
extensions = '{png,jpg,jpeg}'
+ available_languages = Spaceship::Tunes.client.available_languages.each_with_object({}) do |lang, lang_hash|
+ lang_hash[lang.downcase] = lang
+ end
+
Loader.language_folders(path).each do |lng_folder|
language = File.basename(lng_folder)
# Check to see if we need to traverse multiple platforms or just a single platform
if language == Loader::APPLE_TV_DIR_NAME || language == Loader::IMESSAGE_DIR_NAME
@@ -89,10 +93,17 @@
prefer_framed = Dir.glob(File.join(lng_folder, "*_framed.#{extensions}"), File::FNM_CASEFOLD).count > 0
UI.important("Framed screenshots are detected! 🖼 Non-framed screenshot files may be skipped. 🏃") if prefer_framed
- language = File.basename(lng_folder)
+ language_dir_name = File.basename(lng_folder)
+
+ if available_languages[language_dir_name.downcase].nil?
+ 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.")
+ end
+
+ language = available_languages[language_dir_name.downcase]
+
files.each do |file_path|
is_framed = file_path.downcase.include?("_framed.")
is_watch = file_path.downcase.include?("watch")
if prefer_framed && !is_framed && !is_watch