Skip to content

Add Remote Config conditions to template #489

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 4 commits into from
Oct 27, 2020

Conversation

lahirumaramba
Copy link
Member

@lahirumaramba lahirumaramba commented Oct 16, 2020

  • Add Remote Config Conditions
  • Add unit tests

Related Issue: #446

@lahirumaramba lahirumaramba self-assigned this Oct 16, 2020
@lahirumaramba lahirumaramba marked this pull request as ready for review October 20, 2020 17:38
Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

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

Looks great. Just a few nits.

* @param name A non-null, non-empty, and unique name of this condition.
* @param expression A non-null and non-empty expression of this condition.
*/
public Condition(@NonNull String name, @NonNull String expression) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need a constructor that accepts the color as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a constructor with color. Should we amend the API proposal as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Feel free to include a note. Looks like an oversight if it's not already there.

Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

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

It's getting there. Lets add some more tests, and clean up the implementation logic a bit.

* @param name A non-null, non-empty, and unique name of this condition.
* @param expression A non-null and non-empty expression of this condition.
*/
public Condition(@NonNull String name, @NonNull String expression) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Feel free to include a note. Looks like an oversight if it's not already there.

* @param expression A non-null and non-empty expression of this condition.
* @param tagColor A non-null tag color of this condition.
*/
public Condition(@NonNull String name, @NonNull String expression, @NonNull TagColor tagColor) {
Copy link
Contributor

Choose a reason for hiding this comment

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

TagColor should be nullable.

Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

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

Thanks. LGTM!


import org.junit.Test;

public class ConditionTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this could be a good place to add more Condition class specific tests (constructors, getter, setters etc). But feel free to add them in future PRs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call. This makes me wonder... should we add test classes for all other types, too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense to me.

@lahirumaramba
Copy link
Member Author

Hi @egilmorez! Please take a look at the docs when you get a chance. Thank you!

Copy link
Contributor

@egilmorez egilmorez left a comment

Choose a reason for hiding this comment

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

LG! Possible nits about clarifying color/display.

*
* @param name A non-null, non-empty, and unique name of this condition.
* @param expression A non-null and non-empty expression of this condition.
* @param tagColor A tag color of this condition.
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we might even want to clarify that this affects how the condition is displayed in the parameter list in the Firebase console. That's true, right? Outside the console, it is irrelevant?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah kind of like you did for the setter below. Do you agree it would be good in both places? For creating and setting; not so much for getting I think.

  • The color associated with this condition for display purposes in the Firebase Console.

  • Not specifying this value results in the console picking an arbitrary color to associate
  • with the condition.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call! I updated the docs here. Thanks!

Copy link
Contributor

@egilmorez egilmorez left a comment

Choose a reason for hiding this comment

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

Thanks Lahiru!

@lahirumaramba lahirumaramba merged commit e4bde99 into remote-config Oct 27, 2020
@lahirumaramba lahirumaramba deleted the lm-rc-conditions branch October 27, 2020 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants