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

Fix issue 3195 #3201

Closed
wants to merge 3 commits into from
Closed

Conversation

luispacheco-dev
Copy link
Contributor

Pull Request (PR) Checklist

Please check if your pull request fulfills the following requirements:

  • The PR is submitted to the main branch.
  • I've read the Contribution Guidelines and my PR doesn't break the rules.
  • I've read and understand the Developer Guidelines.
  • I confirm that I've run the code locally and everything works as expected.
  • 🎬 I've attached a screen recoding of the changes.
Screen_recording_20240517_161255.mov

Discussion

  • The "Exchange Rate" screen doesn't use the same data source as the other screens.
  • A solution (used it in this draft) is to add the "ExchangeRatesRepo" to the screens that use the CurrencyModal.
  • But the exchange rates added to "Exchange Rate" screen doesn't have all the attributes that have IvyCurrency (e.g. name).
  • Then in the list this exchange rates are going to show without a name (Video).
  • And when the new Currency is set as Base Currency the balance go to zero (it needs the inverse exchange rate to work).
  • Also the inverse exchange rate creates duplicate if the currency exist.

Before continue for this path I want to ask your opinion @ILIYANGERMANOV , this is the better way to do it?.

I think maybe the Exchange Rate screen need to be re-write or we need to create a Currency screen.

Does this PR closes any GitHub Issues?

Check Ivy Wallet Issues.

Replace ISSUE_NUMBER with the number of the GitHub issue that this PR is fixing. If you've done that correctly, you'll see the issue title linked when previewing your PR description.

!Note: Do not link the PR number. Link the number/id of the GitHub Issue from issues.

Troubleshooting CI failures ❌

GitHub Actions failing? Read our CI Troubleshooting guide.

Copy link
Collaborator

@ILIYANGERMANOV ILIYANGERMANOV left a comment

Choose a reason for hiding this comment

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

Idk, I don't have much context on that. Here's my understanding:

  • Deprecate IvyCurrency
  • Create a AvailableCurrenciesUseCase
  • Make the CurrencyPicker accept a pre-computed currencies list

I'm not sure about the best path, what you did seems fine. You must handle the same for the account creation flow. If you think that it doesn't break anything we can merge it

@@ -12,5 +13,6 @@ data class SettingsState(
val hideIncome: Boolean,
val treatTransfersAsIncomeExpense: Boolean,
val startDateOfMonth: String,
val progressState: Boolean
val progressState: Boolean,
val manualExchangeRates: List<ExchangeRate>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This must be ImmutableList from kotlinx collections

@@ -66,6 +67,7 @@ import java.util.Locale
fun CurrencyPicker(
modifier: Modifier = Modifier,
initialSelectedCurrency: IvyCurrency?,
manualExchangeRates: List<ExchangeRate> = listOf(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally, the entire currency list (standard + manual) should come from the VM and not he computed in the UI. Also, your fix will work for Settings but not for the account creation flow

@github-actions github-actions bot added the Stale No activity, will be automatically closed soon. label May 20, 2024
@github-actions github-actions bot closed this May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale No activity, will be automatically closed soon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exchange rates unavailable in wallet
2 participants