Skip to content

Conversation

@alvarocampioni
Copy link

implements #2886

  1. Adds default currency option to settings

Copy link
Member

@TheLastProject TheLastProject left a comment

Choose a reason for hiding this comment

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

Didn't do a full depth review but I see multiple severe bugs. Please make sure to test your implementation well.

private void formatBalanceCurrencyField(Currency balanceType) {
if (balanceType == null) {
balanceCurrencyField.setText(getString(R.string.points));
Currency defaultCurrency = new Settings(getApplicationContext()).getCurrency();
Copy link
Member

Choose a reason for hiding this comment

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

Won't this keep changing Points to the "Default currency" every time someone opens the edit view, thus changing it away from Points? Making it impossible to keep using points unless you keep setting it back?

Seems to me the only sensible moment is to only ever set it once for a new card.

Copy link
Author

Choose a reason for hiding this comment

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

Completly agree. I refactored the code to identify new cards creation, removing the ambiguity related to "currency == null", separating new cards from points option.

}

public Currency getCurrency() {
String value = getString(R.string.settings_key_default_currency, "Points");
Copy link
Member

Choose a reason for hiding this comment

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

You cannot use the string "Points" as this is translatable, will break for anything but English by default.

- Correctly assigned symbols to currency codes for respectively entries and entrieValues

- Removed hardcoded string "Points"

- Only select default currency at the creation of a new card (when its required field is empty)
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.

2 participants