No protection by default

This commit is contained in:
Milos Kozak 2020-04-20 01:18:10 +02:00
parent 335a9c75c5
commit 228bd76e78
4 changed files with 21 additions and 10 deletions

View file

@ -51,7 +51,7 @@ import info.nightscout.androidaps.tabs.TabPageAdapter
import info.nightscout.androidaps.utils.AndroidPermission
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.LocaleHelper.update
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.show
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
import info.nightscout.androidaps.utils.extensions.isRunningRealPumpTest
import info.nightscout.androidaps.utils.protection.ProtectionCheck
@ -160,7 +160,13 @@ class MainActivity : NoSplashAppCompatActivity() {
override fun onResume() {
super.onResume()
protectionCheck.queryProtection(this, ProtectionCheck.Protection.APPLICATION, null, Runnable { finish() }, Runnable { finish() })
protectionCheck.queryProtection(this, ProtectionCheck.Protection.APPLICATION, null,
Runnable {
OKDialog.show(this, "", resourceHelper.gs(R.string.authorizationfailed), Runnable { finish() })
},
Runnable {
OKDialog.show(this, "", resourceHelper.gs(R.string.authorizationfailed), Runnable { finish() })
})
}
private fun setWakeLock() {
@ -226,7 +232,7 @@ class MainActivity : NoSplashAppCompatActivity() {
if (ActivityCompat.checkSelfPermission(this, permissions[0]) == PackageManager.PERMISSION_GRANTED) {
when (requestCode) {
AndroidPermission.CASE_STORAGE -> //show dialog after permission is granted
show(this, "", resourceHelper.gs(R.string.alert_dialog_storage_permission_text))
OKDialog.show(this, "", resourceHelper.gs(R.string.alert_dialog_storage_permission_text))
AndroidPermission.CASE_LOCATION, AndroidPermission.CASE_SMS, AndroidPermission.CASE_BATTERY, AndroidPermission.CASE_PHONE_STATE, AndroidPermission.CASE_SYSTEM_WINDOW -> {
}

View file

@ -28,10 +28,14 @@ object BiometricCheck {
BiometricConstants.ERROR_NEGATIVE_BUTTON ->
cancel?.run()
BiometricConstants.ERROR_NO_DEVICE_CREDENTIAL ->
// call ok, because it's not possible to bypass it when biometrics is setup, hw not present and no pin set
ok?.run()
BiometricConstants.ERROR_NO_SPACE,
BiometricConstants.ERROR_HW_UNAVAILABLE,
BiometricConstants.ERROR_HW_NOT_PRESENT,
BiometricConstants.ERROR_NO_DEVICE_CREDENTIAL,
BiometricConstants.ERROR_NO_BIOMETRICS ->
// call ok, because it's not possible to bypass it when biometrics fail
// ok?.run()

View file

@ -1803,4 +1803,5 @@
<string name="overview_show_predictions">Predictions</string>
<string name="overview_show_deviationslope">Deviation slope</string>
<string name="key_graphconfig" translatable="false">graphconfig</string>
<string name="authorizationfailed">Authorization failed</string>
</resources>

View file

@ -37,7 +37,7 @@
/>
<ListPreference
android:defaultValue="1"
android:defaultValue="0"
android:entries="@array/protectiontype"
android:entryValues="@array/protectiontypeValues"
android:key="@string/key_settings_protection"
@ -49,7 +49,7 @@
android:title="@string/settings_password" />
<ListPreference
android:defaultValue="1"
android:defaultValue="0"
android:entries="@array/protectiontype"
android:entryValues="@array/protectiontypeValues"
android:key="@string/key_application_protection"
@ -61,7 +61,7 @@
android:title="@string/application_password" />
<ListPreference
android:defaultValue="1"
android:defaultValue="0"
android:entries="@array/protectiontype"
android:entryValues="@array/protectiontypeValues"
android:key="@string/key_bolus_protection"