Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[deliver] fetch live app info if no edit info is present, fixing scenario of having both macOS and iOS apps present #21472

Merged
merged 21 commits into from Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions deliver/lib/deliver/upload_metadata.rb
Expand Up @@ -90,7 +90,7 @@ def upload(options)

app_store_version_localizations = verify_available_version_languages!(options, app, enabled_languages) unless options[:edit_live]
app_info = fetch_edit_app_info(app)
app_info_localizations = verify_available_info_languages!(options, app, app_info, enabled_languages) unless options[:edit_live] || !updating_localised_app_info?(options, app, app_info)
app_info_localizations = verify_available_info_languages!(options, app, app_info, enabled_languages) unless options[:edit_live] || !updating_localized_app_info?(options, app, app_info)

if options[:edit_live]
# not all values are editable when using live_version
Expand Down Expand Up @@ -460,8 +460,8 @@ def retry_if_nil(message, tries: 5, wait_time: 10)
end

# Checking if the metadata to update includes localised App Info
def updating_localised_app_info?(options, app, app_info)
app_info = fetch_live_app_info(app) unless app_info
def updating_localized_app_info?(options, app, app_info)
app_info ||= fetch_live_app_info(app)
rogerluan marked this conversation as resolved.
Show resolved Hide resolved
unless app_info
UI.important("Can't find edit or live App info. Skipping upload.")
return false
Expand Down Expand Up @@ -490,14 +490,14 @@ def updating_localised_app_info?(options, app, app_info)
end
end

UI.message('No changes to localised App Info detected. Skipping upload.')
UI.message('No changes to localized App Info detected. Skipping upload.')
Copy link
Contributor

@owjsub owjsub Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that skipping upload here is causing a regression with editing the privacy url #21654

Is there a way we can force upload so that we can edit the privacy url even though none of the other localized app info will change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return false
end

# Finding languages to enable
def verify_available_info_languages!(options, app, app_info, languages)
unless app_info
UI.user_error!("Cannot update languages - could not find an editable info")
UI.user_error!("Cannot update languages - could not find an editable App info. Verify that your app is in one of the editable states in App Store Connect")
rogerluan marked this conversation as resolved.
Show resolved Hide resolved
return
end

Expand Down
11 changes: 4 additions & 7 deletions deliver/spec/upload_metadata_spec.rb
rogerluan marked this conversation as resolved.
Show resolved Hide resolved
Expand Up @@ -270,7 +270,7 @@ def create_metadata(path, text)
expect(app_info).to receive(:get_app_info_localizations).and_return([app_info_localization_en])

# Get app info localization English (Used to compare with data to upload)
expect(app_info_localization_en).to receive(:name).and_return("")
expect(app_info_localization_en).to receive(:name).and_return('App Name')

# Update version localization
expect(version_localization_en).to receive(:update).with(attributes: {
Expand Down Expand Up @@ -437,10 +437,8 @@ def create_metadata(path, text)

# Get number of versions (used for if whats_new should be sent)
expect(Spaceship::ConnectAPI).to receive(:get_app_store_versions).and_return(app_store_versions)

expect(version).to receive(:update).with(attributes: {})

# Get app info localization in English (used to compare with data to upload)
uploader.upload(options)
end

Expand All @@ -460,9 +458,8 @@ def create_metadata(path, text)
expect(version).to receive(:update).with(attributes: {})

# Get app info localization in English (used to compare with data to upload)
expect(app_info_localization_en).to receive(:name).and_return("App name")
expect(app_info_localization_en).to receive(:name).and_return('App name')

# Get app info localization in English (used to compare with data to upload)
uploader.upload(options)
end
end
Expand Down Expand Up @@ -494,10 +491,10 @@ def create_metadata(path, text)
expect(version).to receive(:get_app_store_version_localizations).and_return([version_localization_en])

# Get app info localization in English (used to compare with data to upload)
expect(app_info_localization_en).to receive(:name).and_return("App name")
expect(app_info_localization_en).to receive(:name).and_return('App name')

# Fail because app info can't be updated
expect(FastlaneCore::UI).to receive(:user_error!).with("Cannot update languages - could not find an editable info").and_call_original
expect(FastlaneCore::UI).to receive(:user_error!).with('Cannot update languages - could not find an editable App info. Verify that your app is in one of the editable states in App Store Connect').and_call_original
rogerluan marked this conversation as resolved.
Show resolved Hide resolved

# Get app info localization in English (used to compare with data to upload)
expect { uploader.upload(options) }.to raise_error(FastlaneCore::Interface::FastlaneError)
Expand Down