Code Monkey home page Code Monkey logo

Comments (10)

jariz avatar jariz commented on July 17, 2024

Not really sure what you're asking here.
isCancelled gets set to false every time the authentication starts.
isCancelled means the authentication was explicitly cancelled, either by the application itself, or by the system for whatever reason.
It does not indicate whether authentication has already started yes/no.
If you want to check if authentication has started, you can easily keep track of this in your own application state. (for example, by keeping a reference to the promise returned by authenticate(); if it still exists, clear the reference & cancel authentication)
Hope that helps.

from react-native-fingerprint-android.

WeIio avatar WeIio commented on July 17, 2024

Thanks for your answer.
You seems not really understand what I say.
In your codes,there is a line :boolean isCancelled = false;
So If I call isAuthenticationCanceled before start authenticate , it return false , and application will trade it as authenticate is started, but not actually

from react-native-fingerprint-android.

nathan-k avatar nathan-k commented on July 17, 2024

@jariz Is there a reason why you use the boolean isCancelled instead of cancellationSignal.isCanceled()?

from react-native-fingerprint-android.

nathan-k avatar nathan-k commented on July 17, 2024

Thought I would quickly mention that I had to make a small change in order to get cancellation to work consistently. Line 147 of FingerprintModule.java sometimes gets executed, throwing a "this shouldn't happen" AssertionError. This is because promise is sometimes null when errorCode == FINGERPRINT_ERROR_CANCELED

from react-native-fingerprint-android.

WeIio avatar WeIio commented on July 17, 2024

@jariz
[AssertionError. This is because promise is sometimes null when errorCode == FINGERPRINT_ERROR_CANCELED]
Maybe nathan-k said is why I asked you to change isCancelled variable. When cancel authenticate which is not started actually, 'null' error will happen.(Now initial isCancelled is false, so application will treat it as authenticate is already running)

from react-native-fingerprint-android.

nathan-k avatar nathan-k commented on July 17, 2024

@WeIio He gave you a good solution to the problem that you were describing.

from react-native-fingerprint-android.

WeIio avatar WeIio commented on July 17, 2024

@nathan-k
Thanks.
I had figured out what he said. He had give me a solution that how to judge authentication status by keeping a reference to the promise returned by authenticate() and check it if I need.But I don't think it's a good choice.
In general, In init phase of a class, we always set variables to disabled. For example, there is an OpenFile class. Set isopen variable to false in init, When call openFile function or method, set isopen to true, that looks make sense.
Additionally, users who take this repository won't need to update or add much more codes to check whether authentication is started

from react-native-fingerprint-android.

nathan-k avatar nathan-k commented on July 17, 2024

@WeIio Ok, I see your point. I don't see the behavior that you describe in the docs for FingerprintManagerCompat, which is probably why it's not in this package:

React Native Fingerprint Android is mostly just a set of bindings to Android FingerprintManager.
Alas, it's very low level.

from react-native-fingerprint-android.

jariz avatar jariz commented on July 17, 2024

@nathan-k
I honestly can't remember why I'm not using cancellationSignal.isCancelled.
If you're in the mood to file a PR, I'd gladly accept it. (please test if everything works well with the example app)

@WeIio
Still can't really decipher what you're talking about, but we're gonna get rid of isCancelled completely, so I'm guessing that solves the problem you're having.

from react-native-fingerprint-android.

CHGHA avatar CHGHA commented on July 17, 2024

i find this probleme
Error:(68, 0) Could not read script 'F:\react-native-fingerprint-android-master\example\node_modules\react-native\react.gradle' as it does not exist.

from react-native-fingerprint-android.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.