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

External Pin + Loading Screen when Processing #172

Open
AlphaJuliettOmega opened this issue Feb 17, 2021 · 1 comment
Open

External Pin + Loading Screen when Processing #172

AlphaJuliettOmega opened this issue Feb 17, 2021 · 1 comment

Comments

@AlphaJuliettOmega
Copy link

AlphaJuliettOmega commented Feb 17, 2021

Hello,

I'm using this pinCode component purely for the neat buttons, theme-able interface and relative feature-completeness.
I have questions that I've tried to answer myself through searching the Issues / the web but cannot find an answer.

  1. It's not clear what format the pin can be stored in, unless the implication is that it can only be a 4 character string pin.
    This has consequences for me, means that I cannot use the Keychain functionality at all because the Pin I get to start with is hashed at least twice already.

This complicates the usage of this component to a great degree.

  1. What's the difference between endProcessFunction & finishProcess?

They seem to get called depending on which one is overwritten, and depending on whether the pin was input correctly or not, very strange.

I'm struggling with doing a State update to hide the pin component while an expensive comparison function runs, but React state updates are deferred until after all the Pincode callbacks complete, making it seemingly impossible to swap in a Loader.
I'm currently stuck between a hard-locked UI thread, a Possible Unhandled Promise rejection and Async Redux state setting loading:true after the Pin Screen is closed instead of at the start of finishProcess or endProcessFunction

  1. handleResultEnterPin

Function to be used to handle the PIN code entered by the user. To be used with the pinStatus props

3a. What does To be used mean here? Does the function have to return pinStatus or update a parent component and bubble a prop down to the pinCode with the correct new status?

3b. I'm not using handleResultEnterPin because state of the component is too hard to control, so I'm using
storePin={this.storePinFunction} // fires onPinScreenCompletion only for 'choose'

(saves Pin and closes pinscreen modal)

finishProcess={this.onPinScreenCompletion} // only for 'enter'

(hashcompare's pin + closes modal if it's a match)

Is there a better way to manage this?

  1. documented Functions that say any as input make for a confusing experience.
    really needs more clarity on the function / flow for using the component for an external pin setup - with no Keychain + external pin provider.

  2. Stored pin, does it only support a 4 character string?

Proposal for 3.00
Instead of all these odd function parameters, just:

  • comparisonFunction(pin):Promise
  • pinEntered(pin):Promise

I might be missing something obvious but the helpers for pinIsSet / currentPin aren't useful if using something other than a plain text pin.

linked / similar issues:
#155
#153

@AlphaJuliettOmega
Copy link
Author

Pretty happy about this PR: https://github.com/jarden-digital/react-native-pincode/pull/170/files
thank you for your work @leo-maidea

I will have to update and very carefully test & re-implement usage of the Pin Component.
So this is on the back-log for me.

Most of the questions above still stand.
Notably, question 1, 3 and 5 have been answered by the Pull request mentioned.

Pin must be un-encrypted 4 character string pin.
handleResultEnterPin can now be overridden to suit the use case of an encrypted pin being passed to the Application from an api request.

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

No branches or pull requests

1 participant