mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
fix: Back UI
This commit is contained in:
@@ -234,16 +234,5 @@ class AutofillLauncherActivity : DatabaseModeActivity() {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
fun launchForRegistration(
|
||||
context: Context,
|
||||
registerInfo: RegisterInfo
|
||||
) {
|
||||
val intent = Intent(context, AutofillLauncherActivity::class.java)
|
||||
intent.addSpecialMode(SpecialMode.REGISTRATION)
|
||||
intent.addRegisterInfo(registerInfo)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,13 +144,20 @@ class AutofillLauncherViewModel(application: Application): CredentialLauncherVie
|
||||
}
|
||||
}
|
||||
|
||||
fun manageSelectionResult(activityResult: ActivityResult) {
|
||||
mSelectionResult = activityResult
|
||||
override fun manageSelectionResult(activityResult: ActivityResult) {
|
||||
// Waiting for the database if needed
|
||||
when (activityResult.resultCode) {
|
||||
RESULT_OK -> {
|
||||
mSelectionResult = activityResult
|
||||
mDatabase?.let { database ->
|
||||
manageSelectionResult(database, activityResult)
|
||||
}
|
||||
}
|
||||
RESULT_CANCELED -> {
|
||||
cancelResult()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun manageSelectionResult(
|
||||
database: ContextualDatabase,
|
||||
@@ -259,9 +266,8 @@ class AutofillLauncherViewModel(application: Application): CredentialLauncherVie
|
||||
}
|
||||
}
|
||||
|
||||
fun manageRegistrationResult(
|
||||
activityResult: ActivityResult
|
||||
) {
|
||||
override fun manageRegistrationResult(activityResult: ActivityResult) {
|
||||
isResultLauncherRegistered = false
|
||||
viewModelScope.launch(CoroutineExceptionHandler { _, e ->
|
||||
Log.e(TAG, "Unable to create registration response for autofill", e)
|
||||
showError(e)
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.app.Activity.RESULT_OK
|
||||
import android.app.Application
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import androidx.activity.result.ActivityResult
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.kunzisoft.keepass.credentialprovider.SpecialMode
|
||||
@@ -58,6 +59,10 @@ abstract class CredentialLauncherViewModel(application: Application): AndroidVie
|
||||
mDatabase = database
|
||||
}
|
||||
|
||||
abstract fun manageSelectionResult(activityResult: ActivityResult)
|
||||
|
||||
abstract fun manageRegistrationResult(activityResult: ActivityResult)
|
||||
|
||||
open fun onExceptionOccurred(e: Throwable) {
|
||||
showError(e)
|
||||
}
|
||||
|
||||
@@ -303,9 +303,7 @@ class PasskeyLauncherViewModel(application: Application): CredentialLauncherView
|
||||
}
|
||||
}
|
||||
|
||||
fun manageSelectionResult(
|
||||
activityResult: ActivityResult
|
||||
) {
|
||||
override fun manageSelectionResult(activityResult: ActivityResult) {
|
||||
val intent = activityResult.data
|
||||
viewModelScope.launch(CoroutineExceptionHandler { _, e ->
|
||||
Log.e(TAG, "Unable to create selection response for passkey", e)
|
||||
@@ -455,7 +453,7 @@ class PasskeyLauncherViewModel(application: Application): CredentialLauncherView
|
||||
}
|
||||
}
|
||||
|
||||
fun manageRegistrationResult(activityResult: ActivityResult) {
|
||||
override fun manageRegistrationResult(activityResult: ActivityResult) {
|
||||
val intent = activityResult.data
|
||||
viewModelScope.launch(CoroutineExceptionHandler { _, e ->
|
||||
Log.e(TAG, "Unable to create registration response for passkey", e)
|
||||
|
||||
Reference in New Issue
Block a user