EddyVerbruggen / nativescript-fingerprint-auth

:nail_care: 👱‍♂️ Forget passwords, use a fingerprint scanner or facial recognition!
MIT License
134 stars 33 forks source link

Conflict with RadListView (Vue)? #76

Open jdavidbakr opened 4 years ago

jdavidbakr commented 4 years ago

I have a page that is protected by the fingerprint auth controller, and has a RadListView with sliders. When I install the fingerprint auth on the page, the RadListView slider functionality disappears. I'm using a helper class, which looks like this:

import { FingerprintAuth } from "nativescript-fingerprint-auth";

export default class TouchIdChecker {

    validate() {
        return new Promise((resolve, reject) => {
            var fingerprintAuth = new FingerprintAuth()
            fingerprintAuth
                .verifyFingerprint({
                    title: "Please authenticate to continue",
                    message: "Enter your device password or scan your finger.",
                    authenticationValidityDuration: 10
                })
                .then(() => {
                    resolve();
                })
                .catch(err => {
                    console.log(JSON.stringify(err))
                    reject()
                })
        });
    }

}

and my Vue page has this in the mounted() section:

        mounted() {
            SelectedPageService.getInstance().updateSelectedPage("Events");
            var touchid = new TouchIdChecker;
            touchid.validate()
                .then(function() {
                    this.authenticated = true;
                    this.loadData();
                }.bind(this)) 
                .catch(function() {
                    this.$navigateBack();
                }.bind(this))
        },

If I change my FingerprintAuth to just call resolve(), like this, then the sliders work on the RadListView:

    validate() {
        return new Promise((resolve, reject) => {
            resolve();
        });
    }

so, something is conflicting with RadListView when I use the plugin. Any ideas? I'm working on Android, not sure if the issue would continue in iOS.

jdavidbakr commented 4 years ago

As a follow-up, I did get it to work but my solution is not optimal. An additional factor is that the 'authenticated' value drives whether or not the parent object containing the RadListView is visible. By making this.authenticated = true at the start, the RadListView works, apparently because it is painted before switching to the fingerprint auth.