-
Notifications
You must be signed in to change notification settings - Fork 132
[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
Conversation
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
fastlane/Fastfile
Outdated
@@ -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') |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated on b8cec2d
…te the track name
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.