pwittchen / RxBiometric

☝️ RxJava and RxKotlin bindings for Biometric Prompt (Fingerprint Scanner) on Android
Apache License 2.0
302 stars 27 forks source link

onComplete is not being called #16

Open natiginfo opened 5 years ago

natiginfo commented 5 years ago

When I try to authenticate via fingerprint, onComplete is being invoked. After that, if I try to authenticate again successfully, onComplete is not being invoked.

pwittchen commented 5 years ago

Hi,

Thanks for reporting that. Hm, I'm not sure if this is a bug. Actually, once you're authenticated and onComplete is invoked, then stream is finished, so it will no longer be active. When you restart Activity or invoke this in another Activity, it should work fine. I think, invoking onComplete twice on the same stream within the same Activity (without restarting/stopping/resuming Activity) doesn't really make sense.

natiginfo commented 5 years ago

Hi, In single activity apps, it’s not possible to authenticate more than once, and it’s a problem.

pwittchen commented 5 years ago

It's done like that by design. Do you have a use case, in which you're authenticating user twice within a single activity? Can you explain situation your app? If it will make sense, then we can think about re-designing the library.

natiginfo commented 5 years ago

Sure. In our case, we use biometric authentication for login. However, user can choose to logout later and in that case app shows login view again. So, app has single activity and we use fragments. I believe, it’s possible use case for many apps, which use single activity approach, as navigation components has already stable versions too.

pwittchen commented 5 years ago

Ok, I'll have a look how to update the library to make it work for your case.