mirror of
https://github.com/nextcloud/android.git
synced 2024-12-18 06:51:55 +03:00
Add support for default credentials
This commit is contained in:
parent
2997b14eea
commit
528440e598
3 changed files with 22 additions and 0 deletions
|
@ -95,6 +95,14 @@ public class PassCodeManager {
|
|||
activity.startActivityForResult(i, PASSCODE_ACTIVITY);
|
||||
}
|
||||
|
||||
if (!sExemptOfPasscodeActivites.contains(activity.getClass()) && Build.VERSION.SDK_INT >=
|
||||
Build.VERSION_CODES.M && deviceCredentialsShouldBeRequested() &&
|
||||
!DeviceCredentialUtils.tryEncrypt()) {
|
||||
Intent i = new Intent(MainApp.getAppContext(), RequestCredentialsActivity.class);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
activity.startActivity(i);
|
||||
}
|
||||
|
||||
visibleActivitiesCounter++; // keep it AFTER passCodeShouldBeRequested was checked
|
||||
}
|
||||
|
||||
|
@ -134,4 +142,10 @@ public class PassCodeManager {
|
|||
(PreferenceManager.isUseFingerprint(MainApp.getAppContext())
|
||||
&& DeviceCredentialUtils.areCredentialsAvailable(activity));
|
||||
}
|
||||
|
||||
private boolean deviceCredentialsShouldBeRequested() {
|
||||
SharedPreferences appPrefs = PreferenceManager
|
||||
.getDefaultSharedPreferences(MainApp.getAppContext());
|
||||
return (appPrefs.getBoolean(Preferences.PREFERENCE_USE_DEVICE_CREDENTIALS, false));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,9 @@ public class Preferences extends PreferenceActivity
|
|||
public static final String LOCK_DEVICE_CREDENTIALS = "device_credentials";
|
||||
|
||||
public final static String PREFERENCE_USE_FINGERPRINT = "use_fingerprint";
|
||||
|
||||
public final static String PREFERENCE_USE_DEVICE_CREDENTIALS= "use_device_credentials";
|
||||
|
||||
public static final String PREFERENCE_EXPERT_MODE = "expert_mode";
|
||||
|
||||
private static final int ACTION_REQUEST_PASSCODE = 5;
|
||||
|
@ -520,6 +523,8 @@ public class Preferences extends PreferenceActivity
|
|||
|
||||
setupLockPreference(preferenceCategoryDetails, fPassCodeEnabled, fDeviceCredentialsEnabled);
|
||||
|
||||
setupDeviceCredentialsPreference(preferenceCategoryDetails, fDeviceCredentialsEnabled);
|
||||
|
||||
setupHiddenFilesPreference(preferenceCategoryDetails, fShowHiddenFilesEnabled);
|
||||
|
||||
setupExpertModePreference(preferenceCategoryDetails, fSyncedFolderLightEnabled);
|
||||
|
|
|
@ -44,6 +44,9 @@
|
|||
android:key="lock"
|
||||
android:dialogTitle="@string/prefs_lock_title"
|
||||
android:defaultValue="none"/>
|
||||
<com.owncloud.android.ui.ThemeableSwitchPreference
|
||||
android:title="@string/prefs_use_device_credentials"
|
||||
android:key="use_device_credentials"/>
|
||||
<com.owncloud.android.ui.ThemeableSwitchPreference
|
||||
android:title="@string/prefs_show_hidden_files"
|
||||
android:key="show_hidden_files"/>
|
||||
|
|
Loading…
Reference in a new issue