summaryrefslogtreecommitdiff
path: root/autofill-parser/src/main/java
diff options
context:
space:
mode:
authorrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>2023-04-29 01:28:41 +0000
committerGitHub <noreply@github.com>2023-04-29 01:28:41 +0000
commitd04e1fa368115718a308c123a3b9c18e6626f5f1 (patch)
tree12dd5d3698e9d644bc588b2a58e76048dad7a244 /autofill-parser/src/main/java
parent251d94c9f3a9186385b5fae358e5384576ab36f2 (diff)
fix(deps): update dependency com.facebook:ktfmt to v0.44 (#2490)
* fix(deps): update dependency com.facebook:ktfmt to v0.44 * chore: reformat with ktfmt 0.44 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'autofill-parser/src/main/java')
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt1
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt8
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt3
-rw-r--r--autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt2
4 files changed, 14 insertions, 0 deletions
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt
index fc1fcca3..49c3b4c9 100644
--- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt
+++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt
@@ -21,6 +21,7 @@ import logcat.logcat
public sealed class FormOrigin(public open val identifier: String) {
public data class Web(override val identifier: String) : FormOrigin(identifier)
+
public data class App(override val identifier: String) : FormOrigin(identifier)
public companion object {
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt
index 9d620fe6..2670a77d 100644
--- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt
+++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt
@@ -199,12 +199,16 @@ internal data class ClassifiedAutofillScenario<T : Any>(
override val allPasswordFields
get() = currentPassword + newPassword
+
override val passwordFieldsToFillOnMatch
get() = currentPassword
+
override val passwordFieldsToFillOnSearch
get() = currentPassword
+
override val passwordFieldsToFillOnGenerate
get() = newPassword
+
override val passwordFieldsToSave
get() = newPassword.ifEmpty { currentPassword }
}
@@ -219,12 +223,16 @@ internal data class GenericAutofillScenario<T : Any>(
override val allPasswordFields
get() = genericPassword
+
override val passwordFieldsToFillOnMatch
get() = if (genericPassword.size == 1) genericPassword else emptyList()
+
override val passwordFieldsToFillOnSearch
get() = if (genericPassword.size == 1) genericPassword else emptyList()
+
override val passwordFieldsToFillOnGenerate
get() = genericPassword
+
override val passwordFieldsToSave
get() = genericPassword
}
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt
index dc03e82b..4d4dd218 100644
--- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt
+++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/FormField.kt
@@ -76,6 +76,7 @@ internal class FormField(
"com.google.android.material.textfield.TextInputEditText",
)
private const val ANDROID_WEB_VIEW_CLASS_NAME = "android.webkit.WebView"
+
private fun isPasswordInputType(inputType: Int): Boolean {
val typeClass = inputType and InputType.TYPE_MASK_CLASS
val typeVariation = inputType and InputType.TYPE_MASK_VARIATION
@@ -116,6 +117,7 @@ internal class FormField(
@RequiresApi(Build.VERSION_CODES.O)
private fun isSupportedHint(hint: String?) = hint in HINTS_FILLABLE
+
private val EXCLUDED_TERMS =
listOf(
"url_bar", // Chrome/Edge/Firefox address bar
@@ -157,6 +159,7 @@ internal class FormField(
private val List<String>.anyMatchesFieldInfo
get() = any { fieldId.contains(it) || hint.contains(it) || htmlName.contains(it) }
+
val autofillId: AutofillId = node.autofillId!!
// Information for heuristics and exclusion rules based only on the current field
diff --git a/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt b/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt
index b64b1b2f..97a2fbae 100644
--- a/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt
+++ b/autofill-parser/src/main/java/mozilla/components/lib/publicsuffixlist/PublicSuffixListData.kt
@@ -156,6 +156,8 @@ internal class PublicSuffixListData(
internal sealed class PublicSuffixOffset {
data class Offset(val value: Int) : PublicSuffixOffset()
+
object PublicSuffix : PublicSuffixOffset()
+
object PrevailingRule : PublicSuffixOffset()
}