diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a6c4e65831..21b8217669 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1383,7 +1383,6 @@ Authorization failed Absolute insulin Master password is used for backup encryption and to override security in application. Remember it or store on a safe place. - Passwords don\'t match Current master password Status lights Copy settings from NS diff --git a/core/build.gradle b/core/build.gradle index e74a2eae73..6c0c4ee32a 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -44,6 +44,7 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.appcompat:appcompat:1.1.0' implementation "androidx.preference:preference-ktx:1.1.1" + implementation 'androidx.biometric:biometric:1.0.1' implementation "androidx.activity:activity:${activityVersion}" implementation "androidx.activity:activity-ktx:${activityVersion}" implementation 'com.google.android.material:material:1.1.0' diff --git a/app/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt b/core/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt similarity index 98% rename from app/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt rename to core/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt index c58b5628d1..22ef6a1b4a 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/protection/BiometricCheck.kt @@ -3,7 +3,7 @@ package info.nightscout.androidaps.utils.protection import androidx.biometric.BiometricConstants import androidx.biometric.BiometricPrompt import androidx.fragment.app.FragmentActivity -import info.nightscout.androidaps.R +import info.nightscout.androidaps.core.R import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.extensions.runOnUiThread import java.util.concurrent.Executors diff --git a/app/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt b/core/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt similarity index 99% rename from app/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt rename to core/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt index 5f80c54480..04399eb95f 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/protection/PasswordCheck.kt @@ -7,7 +7,7 @@ import android.view.LayoutInflater import android.view.View import android.widget.EditText import androidx.annotation.StringRes -import info.nightscout.androidaps.R +import info.nightscout.androidaps.core.R import info.nightscout.androidaps.utils.CryptoUtil import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.alertDialogs.AlertDialogHelper diff --git a/app/src/main/java/info/nightscout/androidaps/utils/protection/ProtectionCheck.kt b/core/src/main/java/info/nightscout/androidaps/utils/protection/ProtectionCheck.kt similarity index 79% rename from app/src/main/java/info/nightscout/androidaps/utils/protection/ProtectionCheck.kt rename to core/src/main/java/info/nightscout/androidaps/utils/protection/ProtectionCheck.kt index e8dd73d7fb..ca0a3402a6 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/protection/ProtectionCheck.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/protection/ProtectionCheck.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.utils.protection import androidx.fragment.app.FragmentActivity -import info.nightscout.androidaps.R +import info.nightscout.androidaps.core.R import info.nightscout.androidaps.utils.sharedPreferences.SP import javax.inject.Inject import javax.inject.Singleton @@ -42,10 +42,10 @@ class ProtectionCheck @Inject constructor( fun isLocked(protection: Protection): Boolean { return when (ProtectionType.values()[sp.getInt(protectionTypeResourceIDs[protection.ordinal], ProtectionType.NONE.ordinal)]) { - ProtectionType.NONE -> false - ProtectionType.BIOMETRIC -> true - ProtectionType.MASTER_PASSWORD -> sp.getString(R.string.key_master_password, "") != "" - ProtectionType.CUSTOM_PASSWORD -> sp.getString(passwordsResourceIDs[protection.ordinal], "") != "" + ProtectionType.NONE -> false + ProtectionType.BIOMETRIC -> true + ProtectionType.MASTER_PASSWORD -> sp.getString(R.string.key_master_password, "") != "" + ProtectionType.CUSTOM_PASSWORD -> sp.getString(passwordsResourceIDs[protection.ordinal], "") != "" } } @@ -53,13 +53,13 @@ class ProtectionCheck @Inject constructor( fun queryProtection(activity: FragmentActivity, protection: Protection, ok: Runnable?, cancel: Runnable? = null, fail: Runnable? = null) { when (ProtectionType.values()[sp.getInt(protectionTypeResourceIDs[protection.ordinal], ProtectionType.NONE.ordinal)]) { - ProtectionType.NONE -> + ProtectionType.NONE -> ok?.run() - ProtectionType.BIOMETRIC -> + ProtectionType.BIOMETRIC -> BiometricCheck.biometricPrompt(activity, titleResourceIDs[protection.ordinal], ok, cancel, fail, passwordCheck) - ProtectionType.MASTER_PASSWORD -> + ProtectionType.MASTER_PASSWORD -> passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { ok?.run() }, { cancel?.run() }, { fail?.run() }) - ProtectionType.CUSTOM_PASSWORD -> + ProtectionType.CUSTOM_PASSWORD -> passwordCheck.queryPassword(activity, titleResourceIDs[protection.ordinal], passwordsResourceIDs[protection.ordinal], { ok?.run() }, { cancel?.run() }, { fail?.run() }) } } diff --git a/app/src/main/res/drawable/ic_header_key.xml b/core/src/main/res/drawable/ic_header_key.xml similarity index 100% rename from app/src/main/res/drawable/ic_header_key.xml rename to core/src/main/res/drawable/ic_header_key.xml diff --git a/app/src/main/res/layout/passwordprompt.xml b/core/src/main/res/layout/passwordprompt.xml similarity index 100% rename from app/src/main/res/layout/passwordprompt.xml rename to core/src/main/res/layout/passwordprompt.xml diff --git a/app/src/main/res/values-af-rZA/protection.xml b/core/src/main/res/values-af-rZA/protection.xml similarity index 100% rename from app/src/main/res/values-af-rZA/protection.xml rename to core/src/main/res/values-af-rZA/protection.xml diff --git a/app/src/main/res/values-ar-rSA/protection.xml b/core/src/main/res/values-ar-rSA/protection.xml similarity index 100% rename from app/src/main/res/values-ar-rSA/protection.xml rename to core/src/main/res/values-ar-rSA/protection.xml diff --git a/app/src/main/res/values-bg-rBG/protection.xml b/core/src/main/res/values-bg-rBG/protection.xml similarity index 100% rename from app/src/main/res/values-bg-rBG/protection.xml rename to core/src/main/res/values-bg-rBG/protection.xml diff --git a/app/src/main/res/values-cs-rCZ/protection.xml b/core/src/main/res/values-cs-rCZ/protection.xml similarity index 100% rename from app/src/main/res/values-cs-rCZ/protection.xml rename to core/src/main/res/values-cs-rCZ/protection.xml diff --git a/app/src/main/res/values-cy-rGB/protection.xml b/core/src/main/res/values-cy-rGB/protection.xml similarity index 100% rename from app/src/main/res/values-cy-rGB/protection.xml rename to core/src/main/res/values-cy-rGB/protection.xml diff --git a/app/src/main/res/values-de-rDE/protection.xml b/core/src/main/res/values-de-rDE/protection.xml similarity index 100% rename from app/src/main/res/values-de-rDE/protection.xml rename to core/src/main/res/values-de-rDE/protection.xml diff --git a/app/src/main/res/values-el-rGR/protection.xml b/core/src/main/res/values-el-rGR/protection.xml similarity index 100% rename from app/src/main/res/values-el-rGR/protection.xml rename to core/src/main/res/values-el-rGR/protection.xml diff --git a/app/src/main/res/values-es-rES/protection.xml b/core/src/main/res/values-es-rES/protection.xml similarity index 100% rename from app/src/main/res/values-es-rES/protection.xml rename to core/src/main/res/values-es-rES/protection.xml diff --git a/app/src/main/res/values-fi-rFI/protection.xml b/core/src/main/res/values-fi-rFI/protection.xml similarity index 100% rename from app/src/main/res/values-fi-rFI/protection.xml rename to core/src/main/res/values-fi-rFI/protection.xml diff --git a/app/src/main/res/values-fr-rFR/protection.xml b/core/src/main/res/values-fr-rFR/protection.xml similarity index 100% rename from app/src/main/res/values-fr-rFR/protection.xml rename to core/src/main/res/values-fr-rFR/protection.xml diff --git a/app/src/main/res/values-ga-rIE/protection.xml b/core/src/main/res/values-ga-rIE/protection.xml similarity index 100% rename from app/src/main/res/values-ga-rIE/protection.xml rename to core/src/main/res/values-ga-rIE/protection.xml diff --git a/app/src/main/res/values-hr-rHR/protection.xml b/core/src/main/res/values-hr-rHR/protection.xml similarity index 100% rename from app/src/main/res/values-hr-rHR/protection.xml rename to core/src/main/res/values-hr-rHR/protection.xml diff --git a/app/src/main/res/values-it-rIT/protection.xml b/core/src/main/res/values-it-rIT/protection.xml similarity index 100% rename from app/src/main/res/values-it-rIT/protection.xml rename to core/src/main/res/values-it-rIT/protection.xml diff --git a/app/src/main/res/values-iw-rIL/protection.xml b/core/src/main/res/values-iw-rIL/protection.xml similarity index 100% rename from app/src/main/res/values-iw-rIL/protection.xml rename to core/src/main/res/values-iw-rIL/protection.xml diff --git a/app/src/main/res/values-ja-rJP/protection.xml b/core/src/main/res/values-ja-rJP/protection.xml similarity index 100% rename from app/src/main/res/values-ja-rJP/protection.xml rename to core/src/main/res/values-ja-rJP/protection.xml diff --git a/app/src/main/res/values-ko-rKR/protection.xml b/core/src/main/res/values-ko-rKR/protection.xml similarity index 100% rename from app/src/main/res/values-ko-rKR/protection.xml rename to core/src/main/res/values-ko-rKR/protection.xml diff --git a/app/src/main/res/values-lt-rLT/protection.xml b/core/src/main/res/values-lt-rLT/protection.xml similarity index 100% rename from app/src/main/res/values-lt-rLT/protection.xml rename to core/src/main/res/values-lt-rLT/protection.xml diff --git a/app/src/main/res/values-nl-rNL/protection.xml b/core/src/main/res/values-nl-rNL/protection.xml similarity index 100% rename from app/src/main/res/values-nl-rNL/protection.xml rename to core/src/main/res/values-nl-rNL/protection.xml diff --git a/app/src/main/res/values-pl-rPL/protection.xml b/core/src/main/res/values-pl-rPL/protection.xml similarity index 100% rename from app/src/main/res/values-pl-rPL/protection.xml rename to core/src/main/res/values-pl-rPL/protection.xml diff --git a/app/src/main/res/values-pt-rBR/protection.xml b/core/src/main/res/values-pt-rBR/protection.xml similarity index 100% rename from app/src/main/res/values-pt-rBR/protection.xml rename to core/src/main/res/values-pt-rBR/protection.xml diff --git a/app/src/main/res/values-pt-rPT/protection.xml b/core/src/main/res/values-pt-rPT/protection.xml similarity index 100% rename from app/src/main/res/values-pt-rPT/protection.xml rename to core/src/main/res/values-pt-rPT/protection.xml diff --git a/app/src/main/res/values-ro-rRO/protection.xml b/core/src/main/res/values-ro-rRO/protection.xml similarity index 100% rename from app/src/main/res/values-ro-rRO/protection.xml rename to core/src/main/res/values-ro-rRO/protection.xml diff --git a/app/src/main/res/values-ru-rRU/protection.xml b/core/src/main/res/values-ru-rRU/protection.xml similarity index 100% rename from app/src/main/res/values-ru-rRU/protection.xml rename to core/src/main/res/values-ru-rRU/protection.xml diff --git a/app/src/main/res/values-sk-rSK/protection.xml b/core/src/main/res/values-sk-rSK/protection.xml similarity index 100% rename from app/src/main/res/values-sk-rSK/protection.xml rename to core/src/main/res/values-sk-rSK/protection.xml diff --git a/app/src/main/res/values-sl-rSI/protection.xml b/core/src/main/res/values-sl-rSI/protection.xml similarity index 100% rename from app/src/main/res/values-sl-rSI/protection.xml rename to core/src/main/res/values-sl-rSI/protection.xml diff --git a/app/src/main/res/values-sv-rSE/protection.xml b/core/src/main/res/values-sv-rSE/protection.xml similarity index 100% rename from app/src/main/res/values-sv-rSE/protection.xml rename to core/src/main/res/values-sv-rSE/protection.xml diff --git a/app/src/main/res/values-tr-rTR/protection.xml b/core/src/main/res/values-tr-rTR/protection.xml similarity index 100% rename from app/src/main/res/values-tr-rTR/protection.xml rename to core/src/main/res/values-tr-rTR/protection.xml diff --git a/app/src/main/res/values-zh-rCN/protection.xml b/core/src/main/res/values-zh-rCN/protection.xml similarity index 100% rename from app/src/main/res/values-zh-rCN/protection.xml rename to core/src/main/res/values-zh-rCN/protection.xml diff --git a/app/src/main/res/values/protection.xml b/core/src/main/res/values/protection.xml similarity index 100% rename from app/src/main/res/values/protection.xml rename to core/src/main/res/values/protection.xml diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index af37bbf430..7ee787c54d 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -127,6 +127,10 @@ m d + + Wrong password + Passwords don\'t match + Basal values not aligned to hours: %1$s Basal value replaced by minimal supported value: %1$s diff --git a/dana/src/main/res/values/strings.xml b/dana/src/main/res/values/strings.xml index bf26707ffc..d086aab28f 100644 --- a/dana/src/main/res/values/strings.xml +++ b/dana/src/main/res/values/strings.xml @@ -67,7 +67,6 @@ Updating basal rates Setting temp basal Waiting for time synchronization (%1$d sec) - Wrong password Wrong pump password! Alarms Basal Hours