Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android) null check and new check properties #309

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Oct 7, 2022

Resolves #301

  • adding a null check
  • adding hasFingerprintScanner, hasFaceScanner and hasIrisScanner properties
var win = Ti.UI.createWindow();
var TiIdentity = require('ti.identity');
TiIdentity.authenticationPolicy = TiIdentity.AUTHENTICATION_POLICY_BIOMETRICS;

var supported = TiIdentity.isSupported();
console.log("is supported: ", supported);

console.log("hasFingerprintScanner: ", TiIdentity.hasFingerprintScanner);
console.log("hasFaceScanner: ", TiIdentity.hasFaceScanner);
console.log("hasIrisScanner: ", TiIdentity.hasIrisScanner);

if (TiIdentity.authenticationPolicy === TiIdentity.AUTHENTICATION_POLICY_BIOMETRICS) {
		authPhrase = 'Touch ID';
} else if (TiIdentity.authenticationPolicy === TiIdentity.AUTHENTICATION_POLICY_PASSCODE) {
	authPhrase = 'Device Passcode';
}
Ti.API.info("AUTPHRASE: " + authPhrase);


function onOpen(e) {
	if (!supported) {
		alert('Authentication is not supported on this device!');
		return;
	}
	TiIdentity.authenticate({
		reason: 'Can we access this content?',
		callback: function(e) {
			Ti.API.info(e);
		}
	});
}

win.addEventListener("open", onOpen)
win.open();

ti.identity-android-3.1.1.zip

@m1ga m1ga changed the title fix(android) null check feat(android) null check and new check properties Feb 7, 2023
@m1ga
Copy link
Contributor Author

m1ga commented Feb 7, 2023

a bit confused why I have to add the github actions again 🤔 but it thinks the master has the old actions 🤷

@jordanbisato
Copy link

After using this version, i didn't get the #301 error anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: CryptoObject cannot be null
2 participants