Skip to content

[Tooling] Fix Wear app Google Play Console app prefix #11773

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

Merged
merged 2 commits into from
Jun 24, 2024

Conversation

iangmaia
Copy link
Contributor

Ref: https://developers.google.com/android-publisher/tracks#ff-track-name

Changing the Wear app track name to use wear: instead of the app name.

@iangmaia iangmaia added the category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. label Jun 24, 2024
@iangmaia iangmaia requested review from AliSoftware and ThomazFB June 24, 2024 09:30
@iangmaia iangmaia self-assigned this Jun 24, 2024
@dangermattic
Copy link
Collaborator

dangermattic commented Jun 24, 2024

1 Warning
⚠️ This PR is assigned to the milestone 19.2 ❄️. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jun 24, 2024

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitb8cec2d
Direct Downloadwoocommerce-wear-prototype-build-pr11773-b8cec2d.apk

@iangmaia iangmaia enabled auto-merge June 24, 2024 09:36
@iangmaia iangmaia added this to the 19.2 ❄️ milestone Jun 24, 2024
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jun 24, 2024

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitb8cec2d
Direct Downloadwoocommerce-prototype-build-pr11773-b8cec2d.apk

@@ -1180,7 +1180,7 @@ platform :android do
# @param [String] app The type of app (`MOBILE_APP` or `WEAR_APP`)
# @param [String] track_name The track name, e.g. `'beta'` or `'production'`
def track(app:, track_name:)
prefix = app == MOBILE_APP ? '' : "#{app}:"
prefix = { WEAR_APP => 'wear:', MOBILE_APP => '' }.fetch(app, 'unknown')
Copy link
Contributor

@AliSoftware AliSoftware Jun 24, 2024

Choose a reason for hiding this comment

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

I feel it would be better to UI.user_error! if the app is unknown there rather than have the track name ending up being unknown:beta and have the Google API fail with cryptic errors.

You could write the UI.user_error! in here for a quick fix, but I think it'd be better to use the get_app_param! (since that would DRY the error message from all calls site that checks that), after adjusting it so that it can accept the app value directly (so that it can support both lanes still using options and lanes using keyword-syntax parameters as its call sites); something like:

def get_app_param!(options)
  app = options.is_a?(String) ? options : options[:app]
  if [MOBILE_APP, WEAR_APP].include?(app)
    app
  else
    UI.user_error!("Invalid or missing `app:`. Please provide one of `app:#{MOBILE_APP}` or `app:#{WEAR_APP}`")
  end
end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps we could also extract get_app_param! validation so that it can be used separately?
To me it feels more natural than allowing options to be a String in some cases:

def validate_app_param!(app)
  unless [MOBILE_APP, WEAR_APP].include?(app)
    UI.user_error!("Invalid or missing `app:`. Please provide one of `app:#{MOBILE_APP}` or `app:#{WEAR_APP}`")
  end
end

def get_app_param!(options)
  validate_app_param!(options[:app])
  options[:app]
end

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea, WFM.

Also once all our lanes will be converted to keywords params over time in the future, we'd then be able to just remove get_app_param! to only keep validate_app_param!, so that's nice to already do that separation 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated on b8cec2d

@iangmaia iangmaia merged commit 6cfad7d into release/19.2 Jun 24, 2024
15 checks passed
@iangmaia iangmaia deleted the iangmaia/fix-track-prefix branch June 24, 2024 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants