precheck/lib/precheck/runner.rb in fastlane_hotfix-2.165.1 vs precheck/lib/precheck/runner.rb in fastlane_hotfix-2.187.0
- old
+ new
@@ -16,24 +16,35 @@
FastlaneCore::PrintTable.print_values(config: Precheck.config,
hide_keys: [:output_path],
title: "Summary for precheck #{Fastlane::VERSION}")
+ api_token = if (token = Spaceship::ConnectAPI::Token.from(hash: Precheck.config[:api_key], filepath: Precheck.config[:api_key_path]))
+ UI.message("Creating authorization token for App Store Connect API")
+ token
+ elsif (token = Spaceship::ConnectAPI.token)
+ UI.message("Using existing authorization token for App Store Connect API")
+ token
+ end
+
if api_token
# As of 2020-09-15, App Store Connect API does not have support for IAPs yet
# This means that API Key will fail if checking for IAPs.
#
# There is also a check in Deliver::Runner for this.
# Please remove check in Deliver when the API support IAPs.
if Precheck.config[:include_in_app_purchases]
- UI.user_error!("Precheck cannot check In-app purchases with the App Store Connect API Key (yet). Exclude In-app purchases from precheck or use Apple ID login")
+ UI.user_error!("Precheck cannot check In-app purchases with the App Store Connect API Key (yet). Exclude In-app purchases from precheck, disable the precheck step in your build step, or use Apple ID login")
end
- UI.message("Creating authorization token for App Store Connect API")
Spaceship::ConnectAPI.token = api_token
elsif Spaceship::Tunes.client.nil?
+ # Username is now optional since addition of App Store Connect API Key
+ # Force asking for username to prompt user if not already set
+ Precheck.config.fetch(:username, force_ask: true)
+
# Team selection passed though FASTLANE_ITC_TEAM_ID and FASTLANE_ITC_TEAM_NAME environment variables
# Prompts select team if multiple teams and none specified
UI.message("Starting login with user '#{Precheck.config[:username]}'")
Spaceship::ConnectAPI.login(Precheck.config[:username], use_portal: false, use_tunes: true)
@@ -69,16 +80,10 @@
end
return true
end
- def api_token
- @api_token ||= Spaceship::ConnectAPI::Token.create(Precheck.config[:api_key]) if Precheck.config[:api_key]
- @api_token ||= Spaceship::ConnectAPI::Token.from_json_file(Precheck.config[:api_key_path]) if Precheck.config[:api_key_path]
- return @api_token
- end
-
def print_items_not_checked(processor_result: nil)
names = processor_result.items_not_checked.map(&:friendly_name)
UI.message("😶 Metadata fields not checked by any rule: #{names.join(', ')}".yellow) if names.length > 0
end
@@ -183,10 +188,10 @@
Spaceship::ConnectAPI::App.find(Precheck.config[:app_identifier])
end
def latest_app_version
platform = Spaceship::ConnectAPI::Platform.map(Precheck.config[:platform])
- @latest_version ||= app.get_edit_app_store_version(platform: platform)
+ @latest_version ||= Precheck.config[:use_live] ? app.get_live_app_store_version(platform: platform) : app.get_latest_app_store_version(platform: platform)
end
# Makes sure the current App ID exists. If not, it will show an appropriate error message
def ensure_app_exists!
return if app