thunderbiscuit / padawan-wallet

The bitcoin wallet trainer on Android.
https://padawanwallet.com/
Apache License 2.0
116 stars 50 forks source link

added progress bar while generating new address #294

Closed yellowHatpro closed 1 year ago

yellowHatpro commented 1 year ago

Fixed: #289

yellowHatpro commented 1 year ago

@darkvoid32 I have made the required change, but I doubt it won't be effective until the address changes, which as of now, doesn't change.

yellowHatpro commented 1 year ago

@darkvoid32 the Generate a new address button does not seem to generate new address. Is it intentional, or a bug?

fivetran-tangyetong commented 1 year ago

Good question, the Generate a New Address button is using the BDKWallet's getLastUnusedAddress(), so it is not actually generating a new address but simply retrieving one I think. So you are right in that it does not actually create a new QR Code since it is not creating a new address.

This is probably intentional, but I am not too sure why. Will have to wait for @thunderbiscuit 's thoughts on this!

thunderbiscuit commented 1 year ago

Yes the "generate new address" button will pull an unused address from the wallet. As long as a given address at a given index has not been used, the wallet will keep giving you that address. If you send coins to this address and sync the wallet, your next call will generate a brand new address.

If you wish to test your progress bar locally, you can fix up the code in theWallet object to generate a brand new address every time using getAddress(AddressIndex.New).

yellowHatpro commented 1 year ago

Ok got it. In that case, we should show a toast/snackbar, that will tell the user that the address is unused, and new won't be generated until this one is used, or something like that. Does that sound good?

fivetran-tangyetong commented 1 year ago

I think simply renaming it would suffice for now, something like Retrieve Last Unused Address? What do you think @thunderbiscuit .

yellowHatpro commented 1 year ago

Yeah that looks like a clean fix

thunderbiscuit commented 1 year ago

I can't seem to see the effect of this on my emulator or device. Is it because it's happening too fast? Lots about this screen is wrong, but I don't know if this is the fix we need.

thunderbiscuit commented 1 year ago

I will close this for now because it's mostly inactive but feel free to reopen if you're interested in working on this @yellowHatpro! What I would need is basically to hardcode a waiting period (not long, maybe 200ms) to show the progress bar and give a standard UX for different devices (the fast ones and the slow ones).