From fa145e71daa3c60d32c0f5b8f577b7c90201f8a7 Mon Sep 17 00:00:00 2001 From: M3DZIK Date: Sat, 13 Jan 2024 23:47:51 +0100 Subject: [PATCH] Add webDomain to result --- .../android/autofill/StructureParser.kt | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/dev/medzik/librepass/android/autofill/StructureParser.kt b/app/src/main/java/dev/medzik/librepass/android/autofill/StructureParser.kt index ba93259d..7a30c207 100644 --- a/app/src/main/java/dev/medzik/librepass/android/autofill/StructureParser.kt +++ b/app/src/main/java/dev/medzik/librepass/android/autofill/StructureParser.kt @@ -37,21 +37,12 @@ class StructureParser(private val structure: AssistStructure) { } private fun parseViewNode(node: AssistStructure.ViewNode): Boolean { - var webDomain: String? = null -// var webScheme: String? = null - var returnValue = false node.webDomain?.let { - webDomain = it - Log.d(TAG, "Autofill domain: $webDomain") + result.webDomain = it + Log.d(TAG, "Autofill domain: $it") } -// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { -// node.webDomain?.let { -// webScheme = it -// Log.d(TAG, "Autofill scheme: $webScheme") -// } -// } if (node.visibility == View.VISIBLE) { if (node.autofillId != null) { @@ -66,14 +57,14 @@ class StructureParser(private val structure: AssistStructure) { } } - if (webDomain?.isNotEmpty() == true && returnValue) + if (result.webDomain?.isNotEmpty() == true && returnValue) return true // process each node for (i in 0 until node.childCount) { if (parseViewNode(node.getChildAt(i))) returnValue = true - if (webDomain?.isNotEmpty() == true && returnValue) + if (result.webDomain?.isNotEmpty() == true && returnValue) return true } } @@ -203,6 +194,7 @@ class StructureParser(private val structure: AssistStructure) { } data class AutofillResult( + var webDomain: String? = null, var usernameId: AutofillId? = null, var usernameValue: AutofillValue? = null, var passwordId: AutofillId? = null,