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: DarthCoin rant #2898

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nicolasburtey
Copy link
Member

@nicolasburtey nicolasburtey commented Dec 8, 2023

aka: saving unit of account used when typing an amount

@nicolasburtey nicolasburtey requested review from sandipndev and UncleSamtoshi and removed request for sandipndev December 8, 2023 19:06
@Darth-Coin
Copy link

The force is strong with this one

@ekzyis
Copy link

ekzyis commented Dec 9, 2023

This just did go down in bitcoin history :)

@ralyodio
Copy link

ralyodio commented Dec 9, 2023

i approve of this message.

@nicolasburtey nicolasburtey force-pushed the feat--saving-unit-of-account-when-adding-an-amount branch from 63bbe9b to c589d38 Compare December 11, 2023 21:28
}
}, [secondaryNewAmount, setNumberPadAmount, client, swapDefaultUnitOfAccount])

useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this cause a flicker allowing it to render the initial amount and then on the next render switching to the default? I wonder if the change needs to be made before getting to this component, so that the first time it renders it is rendering the correct money amount.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have not seen any flicker in my simulator. I think there were to do some calculation before rendering but I don't remember what it was anymore, I'll look for it

Copy link
Member Author

Choose a reason for hiding this comment

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

nothing obvious coming to mind from my convo with GPT4. let's merge and see how it behaves and this is an issue?

secondaryNewAmount &&
(() => {
const client = useApolloClient()
const swapDefaultUnitOfAccount =
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 implementation may have a bug. Its not a given that the primary amount is always the display currency or always the settlement currency. If swap was set to true and one use of the component passes in a display amount and another use of the component passes in a settlement amount, they would both end up swapping . A more accurate name would be useDisplayAmountAsInitialAmount and then you could explicitly handle the amount currencies before they reach this component.

Copy link
Member Author

Choose a reason for hiding this comment

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

in what scenario would we not have a display currency or settlement currency? ie: what would make it that the order would be different?

Copy link
Contributor

@UncleSamtoshi UncleSamtoshi Dec 11, 2023

Choose a reason for hiding this comment

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

If on receive screen the initial primary amount was set to 0 Display as the default and if on the send flow the primary amount was set to 0 BTC as the default. This isn't what we do now, but we dont have anything in place to prevent someone from misusing the component.

Right now I believe we leave the amounts as undefined and then the initial amount is set in this line https://github.com/GaloyMoney/galoy-mobile/blob/c7c81a1f9d2df633e76752b964ab1a82555c3041/app/components/amount-input-screen/amount-input-screen.tsx#L147 with the zeroDisplayAmount. We could get rid of needSwapCurrencyInit and in this line use the value useDisplayAmountAsDefaultAmount to decide between zeroDisplayAmount and zeroSettlementAmount as the default.

@Darth-Coin
Copy link

I just want to make some additional comments here, to clear up a bit.
I was talking about this screen, when user have to input the amount for the invoice.
image

I myself I did several times the mistake to input let's say 10000 in that field forgetting that is set automatically to EUR/fiat.
And twice I was even trying to pay that invoice that wasn't 10k sats but millions and wonder why is not going out.
Imagine my surprise when I found out going back Blink and see that the input was in fiat not in sats.

If I could make that mistake, imagine how a total noob could do it. And this can end up in big mistakes.
Yes, there's the switch button between fiat/sats but you have to press all the time before you input the amount.

If I set Blink in settings to display in BTC, I suppose to be displayed on all screens in BTC and not in fiat. Including the main top screen, that it display ONLY in fiat.

Make it optional: who wants to deal in fiat, fine, display in fiat all. But also I want to use it only in sats. I don't care too much about fiat.

I hope this comment make some clarifications and make your life easier with the changes.

@nicolasburtey
Copy link
Member Author

If I could make that mistake, imagine how a total noob could do it. And this can end up in big mistakes.

Actually the reason we have fiat as default is because we consider the noob scenario as a key thing here. noob will always set their price in fiat term, so if we always have fiat by default, they're less likely to enter an amount under a wrong denomination

my assumption is this is a feature for a power user that want to have sats as the default unit of account when they type an amount

@Darth-Coin
Copy link

Education of noobs start by changing their mindset, slowly, from fiat to BTC.
By making their life easier with displaying everything in fiat, you are not making anything else than a new Paypal over LN and they will never ever learn the lesson.
You are literally pushing the use of fiat doing that. Please don't say that is to help them. You are not helping them towards a Bitcoin standard.

Who wants to live in the fiat standard, fine. They can keep displaying fiat.
But many wants to move forward and break the fiat chains and embrace the Bitcoin standard.

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.

5 participants