Added custom validity checking delegate method to PAPasscode
So the general idea behind PAPasscodeViewController:checkPasscodeValidityWithEntry: is to enable the developer to implement a custom validity test for the entered passcode using whatever arbitrary means they see fit.
The reason why we implemented this delegate method is because for our solution, we store the passcode as a one-way hash that we obviously cannot unhash. Using this delegate method, we can hash the candidate entry and see if the hashes match.
Hope this helps!
(this is attempt #2, where the first attempt was closed by me because it was half-baked )
Sorry, I can't accept the pull request in its current form. The feature idea is a good one, but I have a few issues with the pull request:
- Code unrelated to the feature shouldn't be included (like changing the navigation bar color)
- There are some other code formatting changes (moving braces to a new line) - it's better to remain consistent with the existing code.
- The use of the ternary operator in your new code makes it hard to read. A better approach would be to create a new local method to validate the passcode, which then uses the delegate or does a local comparision.
As I said, the idea is a good one so I'll give to thought to adding it. I'm also happy to consider another pull request.
Thanks, Denis
I'll try cleaning it up some and removing our implementation-specific stuff (such as our black navbar) when i have a minute. Thanks for the reply.
I was going to do a pull request for exactly the same reason. This is a great feature.
Closing as (extremely) stale.