Java Code Examples for com.github.ajalt.reprint.core.Reprint#hasFingerprintRegistered()

The following examples show how to use com.github.ajalt.reprint.core.Reprint#hasFingerprintRegistered() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IntroSeedFragment.java    From nano-wallet-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Confirm button listener
 *
 * @param view View
 */
public void onClickConfirm(View view) {
    createAndStoreCredentials(binding.introSeedSeed.getText().toString());
    accountService.open();

    sharedPreferencesUtil.setConfirmedSeedBackedUp(true);

    if (!Reprint.isHardwarePresent() || !Reprint.hasFingerprintRegistered()) {
        // if no fingerprint software is present or user has not registered
        // a fingerprint show pin screen
        showCreatePinScreen();
    } else {
        // otherwise, go on in
        goToHomeScreen();
    }
}
 
Example 2
Source File: SendConfirmDialogFragment.java    From natrium-android-wallet with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void onClickConfirm(View view) {
    Credentials credentials = realm.where(Credentials.class).findFirst();

    if (Reprint.isHardwarePresent() && Reprint.hasFingerprintRegistered() && sharedPreferencesUtil.getAuthMethod() == AuthMethod.FINGERPRINT) {
        // show fingerprint dialog
        LayoutInflater factory = LayoutInflater.from(getContext());
        @SuppressLint("InflateParams") final View viewFingerprint = factory.inflate(R.layout.view_fingerprint, null);
        showFingerprintDialog(viewFingerprint);
        com.github.ajalt.reprint.rxjava2.RxReprint.authenticate()
                .subscribe(result -> {
                    switch (result.status) {
                        case SUCCESS:
                            fingerprintDialog.dismiss();
                            executeSend();
                            break;
                        case NONFATAL_FAILURE:
                            showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint);
                            break;
                        case FATAL_FAILURE:
                            showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint);
                            break;
                    }
                });
    } else if (credentials != null && credentials.getPin() != null) {
        showPinScreen(getString(R.string.send_pin_description, wallet.getSendNanoAmount()));
    } else if (credentials != null && credentials.getPin() == null) {
        showCreatePinScreen();
    }
}
 
Example 3
Source File: SettingsFragment.java    From natrium-android-wallet with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void onClickBackupSeed(View view) {
    Credentials credentials = realm.where(Credentials.class).findFirst();

    if (Reprint.isHardwarePresent() && Reprint.hasFingerprintRegistered() && sharedPreferencesUtil.getAuthMethod() == AuthMethod.FINGERPRINT) {
        // show fingerprint dialog
        LayoutInflater factory = LayoutInflater.from(getContext());
        @SuppressLint("InflateParams") final View viewFingerprint = factory.inflate(R.layout.view_fingerprint, null);
        showFingerprintDialog(viewFingerprint);
        com.github.ajalt.reprint.rxjava2.RxReprint.authenticate()
                .subscribe(result -> {
                    switch (result.status) {
                        case SUCCESS:
                            fingerprintDialog.dismiss();
                            showBackupSeedDialog();
                            break;
                        case NONFATAL_FAILURE:
                            showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint);
                            break;
                        case FATAL_FAILURE:
                            showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint);
                            break;
                    }
                });
    } else if (credentials != null && credentials.getPin() != null) {
        backupSeedPinEntered = true;
        showPinScreen(getString(R.string.settings_pin_title));
    } else if (credentials != null && credentials.getPin() == null) {
        backupSeedPinEntered = true;
        showCreatePinScreen();
    }
}
 
Example 4
Source File: ChangeRepDialogFragment.java    From natrium-android-wallet with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void onClickChange(View view) {
    Address repAddress = new Address(binding.newRep.getText().toString());
    if (!repAddress.isValidAddress()) {
        showAddressError();
        return;
    }
    Credentials credentials = realm.where(Credentials.class).findFirst();

    if (Reprint.isHardwarePresent() && Reprint.hasFingerprintRegistered() && sharedPreferencesUtil.getAuthMethod() == AuthMethod.FINGERPRINT) {
        // show fingerprint dialog
        LayoutInflater factory = LayoutInflater.from(getContext());
        @SuppressLint("InflateParams") final View viewFingerprint = factory.inflate(R.layout.view_fingerprint, null);
        showFingerprintDialog(viewFingerprint);
        com.github.ajalt.reprint.rxjava2.RxReprint.authenticate()
                .subscribe(result -> {
                    switch (result.status) {
                        case SUCCESS:
                            fingerprintDialog.dismiss();
                            executeChange(binding.newRep.getText().toString());
                            break;
                        case NONFATAL_FAILURE:
                            showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint);
                            break;
                        case FATAL_FAILURE:
                            showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint);
                            break;
                    }
                });
    } else if (credentials != null && credentials.getPin() != null) {
        showPinScreen(getString(R.string.change_representative_pin));
    } else if (credentials != null && credentials.getPin() == null) {
        showCreatePinScreen();
    }
}
 
Example 5
Source File: SharedPreferencesUtil.java    From natrium-android-wallet with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public AuthMethod getAuthMethod() {
    if (Reprint.isHardwarePresent() && Reprint.hasFingerprintRegistered()) {
        return AuthMethod.valueOf(get(AUTH_METHOD, AuthMethod.FINGERPRINT.toString()));
    } else {
        return AuthMethod.PIN;
    }
}
 
Example 6
Source File: SendFragment.java    From nano-wallet-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void onClickSend(View view) {
    if (!validateRequest()) {
        return;
    }

    Credentials credentials = realm.where(Credentials.class).findFirst();

    if (Reprint.isHardwarePresent() && Reprint.hasFingerprintRegistered()) {
        // show fingerprint dialog
        LayoutInflater factory = LayoutInflater.from(getContext());
        @SuppressLint("InflateParams") final View viewFingerprint = factory.inflate(R.layout.view_fingerprint, null);
        showFingerprintDialog(viewFingerprint);
        com.github.ajalt.reprint.rxjava2.RxReprint.authenticate()
                .subscribe(result -> {
                    switch (result.status) {
                        case SUCCESS:
                            showFingerprintSuccess(viewFingerprint);
                            break;
                        case NONFATAL_FAILURE:
                            showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint);
                            break;
                        case FATAL_FAILURE:
                            showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint);
                            break;
                    }
                });
    } else if (credentials != null && credentials.getPin() != null) {
        showPinScreen(getString(R.string.send_pin_description, wallet.getSendNanoAmount()));
    } else if (credentials != null && credentials.getPin() == null) {
        showCreatePinScreen();
    }
}
 
Example 7
Source File: SettingsDialogFragment.java    From nano-wallet-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void showSeed() {
    Credentials credentials = realm.where(Credentials.class).findFirst();

    if (Reprint.isHardwarePresent() && Reprint.hasFingerprintRegistered()) {
        // show fingerprint dialog
        LayoutInflater factory = LayoutInflater.from(getContext());
        @SuppressLint("InflateParams") final View viewFingerprint = factory.inflate(R.layout.view_fingerprint, null);
        showFingerprintDialog(viewFingerprint);
        com.github.ajalt.reprint.rxjava2.RxReprint.authenticate()
                .subscribe(result -> {
                    switch (result.status) {
                        case SUCCESS:
                            showFingerprintSuccess(viewFingerprint);
                            break;
                        case NONFATAL_FAILURE:
                            showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint);
                            break;
                        case FATAL_FAILURE:
                            showFingerprintError(result.failureReason, result.errorMessage, viewFingerprint);
                            break;
                    }
                });
    } else if (credentials != null && credentials.getPin() != null) {
        showPinScreen(getString(R.string.settings_fingerprint_description));
    } else if (credentials != null && credentials.getPin() == null) {
        showCreatePinScreen();
    }
}