Skip to content

Commit

Permalink
Start of migration deliver to new app store review process
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdholtz committed Jan 24, 2022
1 parent bdf2336 commit a1bed36
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 5 deletions.
21 changes: 19 additions & 2 deletions deliver/lib/deliver/runner.rb
Expand Up @@ -197,8 +197,25 @@ def upload_binary
def reject_version_if_possible
app = Deliver.cache[:app]
platform = Spaceship::ConnectAPI::Platform.map(options[:platform])
if app.reject_version_if_possible!(platform: platform)
UI.success("Successfully rejected previous version!")

submission = app.get_in_progress_review_submission(platform: platform)
if submission
submission.cancel_submission()
UI.message("Review submission cancellation has been requested")

# An app version won't get removed from review instantly
# Polling until app version has a state of DEVELOPER_REJECT
loop do
version = app.get_edit_app_store_version(platform: platform)
if version.app_store_state == Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::DEVELOPER_REJECTED
break
end

UI.message("Waiting for cancellation to take effect...")
sleep(10)
end

UI.success("Successfully cancelled previous submission!")
end
end

Expand Down
26 changes: 23 additions & 3 deletions deliver/lib/deliver/submit_for_review.rb
Expand Up @@ -23,12 +23,32 @@ def submit!(options)
update_idfa(options, app, version)
update_submission_information(options, app)

version.create_app_store_version_submission

create_review_submission(options, app, version, platform)
UI.success("Successfully submitted the app for review!")
end

private def select_build(options, app, version, platform)
private

def create_review_submission(options, app, version, platform)
if app.get_in_progress_review_submission(platform: platform)
UI.user_error!("Cannot submit for review - A review submission is already in progress")
end

# TODO: I don't like this logic here
# Maybe error out if there are aleady items in this review?
submission = app.get_ready_review_submission(platform: platform, includes: "items")

if submission.nil?
submission = app.create_review_submission(platform: platform)
elsif !submission.items.empty?
UI.user_error!("Cannot submit for review - A review submission already exists with items not managed by fastlane. Please cancel or remove items from submission for the App Store Connect website")
end

submission.add_app_store_version_to_review_items(app_store_version_id: version.id)
submission.submit_for_review
end

def select_build(options, app, version, platform)
if options[:build_number] && options[:build_number] != "latest"
UI.message("Selecting existing build-number: #{options[:build_number]}")

Expand Down

0 comments on commit a1bed36

Please sign in to comment.