diff --git a/README.md b/README.md index 2382984..81f650c 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,15 @@ On your application config.xml file set one, or all, of the following preference ``` + +### Customizing behavior +The plugin default behavior checks if the phone has a password,pin or pattern defined. To deactivate this, change the preference `CheckPattern`. +On your application config.xml file set one, or all, of the following preferences: + +```xml + +``` + ## License ``` diff --git a/package.json b/package.json index 1711988..96e212e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "outsystems-secure-device", - "version": "2.0.0.os", + "version": "2.0.0-os2", "description": "Stops app from running if device is not secure, i.e. it is jailbroken, rooted, or doesn't have a passcode set.", "cordova": { "id": "outsystems-secure-device", diff --git a/plugin.xml b/plugin.xml index 4945198..e317fe7 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,5 +1,5 @@ - + secureDevice Stops app from running if device is not secure, i.e. it is jailbroken, rooted, or doesn't have a passcode set. André Vieira diff --git a/src/android/secureDevice.java b/src/android/secureDevice.java index 2b2915b..d47d325 100644 --- a/src/android/secureDevice.java +++ b/src/android/secureDevice.java @@ -17,7 +17,6 @@ package com.outsystemscloud.andrevieira; import android.annotation.SuppressLint; -import android.app.Activity; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.KeyguardManager; @@ -42,6 +41,7 @@ public class secureDevice extends CordovaPlugin { public static final String DIALOG_CLOSE_LABEL = "SecurePluginDialogCloseLabel"; public static final String ROOTED_DEVICE_STRING = "SecurePluginRootedDeviceString"; public static final String NO_LOCK_DEVICE_STRING = "SecurePluginNoLockSafetyString"; + public static final String CHECK_PATTERN = "CheckPattern"; CordovaInterface cordova; CordovaWebView view; @@ -62,8 +62,9 @@ public void onResume(boolean multiTasking) { private void checkDevice() { boolean _isDeviceRooted = isDeviceRooted(); boolean _isPasscodeSet = doesDeviceHaveSecuritySetup(this.cordova.getActivity()); + boolean _checkPattern = this.preferences.getBoolean(CHECK_PATTERN, true); - if (_isDeviceRooted || !_isPasscodeSet) { + if (_isDeviceRooted || (_checkPattern && !_isPasscodeSet)) { // Remove View View v = this.view.getView(); if (v != null) { @@ -170,7 +171,7 @@ private static boolean isPassOrPinSet(Context context) { */ private synchronized void alert(final String message, final String buttonLabel) { final CordovaInterface cordova = this.cordova; - + Runnable runnable = new Runnable() { public void run() { diff --git a/src/ios/secureDevice.m b/src/ios/secureDevice.m index 97c49f5..11c9ce1 100644 --- a/src/ios/secureDevice.m +++ b/src/ios/secureDevice.m @@ -40,8 +40,9 @@ - (void) checkDevice { BOOL jailbroken = [UIDevice currentDevice].isJB; LNPasscodeStatus status = [UIDevice currentDevice].passcodeStatus; - - if (jailbroken || status == LNPasscodeStatusDisabled || status == LNPasscodeStatusUnknown) { + BOOL checkPattern = ![(NSString* )[self.commandDelegate.settings objectForKey:@"checkpattern"] isEqualToString:@"false"]; + + if (jailbroken || ( checkPattern && (status == LNPasscodeStatusDisabled || status == LNPasscodeStatusUnknown))) { NSString* alertMessage = @"This application does not run on a device that is rooted."; NSString* customAlertCloseButtonText = [self.commandDelegate.settings objectForKey:@"secureplugindialogcloselabel"];