Skip to content

Commit

Permalink
biometric
Browse files Browse the repository at this point in the history
  • Loading branch information
lucky committed Jul 10, 2022
1 parent f2bd587 commit fffaa5d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "me.lucky.duress"
minSdk 23
targetSdk 32
versionCode 6
versionName "1.0.5"
versionCode 7
versionName "1.0.6"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
21 changes: 14 additions & 7 deletions app/src/main/java/me/lucky/duress/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
init()
init1()
if (initBiometric()) return
init2()
setup()
if (prefs.isShowProminentDisclosure) showProminentDisclosure()
}
Expand All @@ -50,11 +51,14 @@ class MainActivity : AppCompatActivity() {
prefs.unregisterListener(prefsListener)
}

private fun init() {
private fun init1() {
prefs = Preferences(this)
prefsdb = Preferences(this, encrypted = false)
prefs.copyTo(prefsdb)
accessibilityManager = getSystemService(AccessibilityManager::class.java)
}

private fun init2() {
selectInterface()
binding.apply {
tabs.selectTab(tabs.getTabAt(prefs.mode))
Expand Down Expand Up @@ -94,15 +98,18 @@ class MainActivity : AppCompatActivity() {

override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
super.onAuthenticationSucceeded(result)
init2()
setup()
if (prefs.isShowProminentDisclosure) showProminentDisclosure()
}
})
prompt.authenticate(BiometricPrompt.PromptInfo.Builder()
.setTitle(getString(R.string.authentication))
.setConfirmationRequired(false)
.setAllowedAuthenticators(authenticators)
.build())
try {
prompt.authenticate(BiometricPrompt.PromptInfo.Builder()
.setTitle(getString(R.string.authentication))
.setConfirmationRequired(false)
.setAllowedAuthenticators(authenticators)
.build())
} catch (exc: Exception) { return false }
return true
}

Expand Down
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
biometric
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/7.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
biometric

0 comments on commit fffaa5d

Please sign in to comment.