fix: Back UI

This commit is contained in:
J-Jamet
2025-09-28 23:49:08 +02:00
parent abfa7a3f47
commit 6f3e065ad1
4 changed files with 20 additions and 22 deletions

View File

@@ -234,16 +234,5 @@ class AutofillLauncherActivity : DatabaseModeActivity() {
return null 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)
}
} }
} }

View File

@@ -144,11 +144,18 @@ class AutofillLauncherViewModel(application: Application): CredentialLauncherVie
} }
} }
fun manageSelectionResult(activityResult: ActivityResult) { override fun manageSelectionResult(activityResult: ActivityResult) {
mSelectionResult = activityResult
// Waiting for the database if needed // Waiting for the database if needed
mDatabase?.let { database -> when (activityResult.resultCode) {
manageSelectionResult(database, activityResult) RESULT_OK -> {
mSelectionResult = activityResult
mDatabase?.let { database ->
manageSelectionResult(database, activityResult)
}
}
RESULT_CANCELED -> {
cancelResult()
}
} }
} }
@@ -259,9 +266,8 @@ class AutofillLauncherViewModel(application: Application): CredentialLauncherVie
} }
} }
fun manageRegistrationResult( override fun manageRegistrationResult(activityResult: ActivityResult) {
activityResult: ActivityResult isResultLauncherRegistered = false
) {
viewModelScope.launch(CoroutineExceptionHandler { _, e -> viewModelScope.launch(CoroutineExceptionHandler { _, e ->
Log.e(TAG, "Unable to create registration response for autofill", e) Log.e(TAG, "Unable to create registration response for autofill", e)
showError(e) showError(e)

View File

@@ -5,6 +5,7 @@ import android.app.Activity.RESULT_OK
import android.app.Application import android.app.Application
import android.content.Intent import android.content.Intent
import android.util.Log import android.util.Log
import androidx.activity.result.ActivityResult
import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.kunzisoft.keepass.credentialprovider.SpecialMode import com.kunzisoft.keepass.credentialprovider.SpecialMode
@@ -58,6 +59,10 @@ abstract class CredentialLauncherViewModel(application: Application): AndroidVie
mDatabase = database mDatabase = database
} }
abstract fun manageSelectionResult(activityResult: ActivityResult)
abstract fun manageRegistrationResult(activityResult: ActivityResult)
open fun onExceptionOccurred(e: Throwable) { open fun onExceptionOccurred(e: Throwable) {
showError(e) showError(e)
} }

View File

@@ -303,9 +303,7 @@ class PasskeyLauncherViewModel(application: Application): CredentialLauncherView
} }
} }
fun manageSelectionResult( override fun manageSelectionResult(activityResult: ActivityResult) {
activityResult: ActivityResult
) {
val intent = activityResult.data val intent = activityResult.data
viewModelScope.launch(CoroutineExceptionHandler { _, e -> viewModelScope.launch(CoroutineExceptionHandler { _, e ->
Log.e(TAG, "Unable to create selection response for passkey", 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 val intent = activityResult.data
viewModelScope.launch(CoroutineExceptionHandler { _, e -> viewModelScope.launch(CoroutineExceptionHandler { _, e ->
Log.e(TAG, "Unable to create registration response for passkey", e) Log.e(TAG, "Unable to create registration response for passkey", e)