TypeScript
fix(mobile): Android composer no longer accepts autofill (#27489)
Julius Marminge61c76011004d
diff --git a/apps/mobile/modules/t3-composer-editor/android/src/main/java/expo/modules/t3composereditor/T3ComposerEditorView.kt b/apps/mobile/modules/t3-composer-editor/android/src/main/java/expo/modules/t3composereditor/T3ComposerEditorView.ktindex e9a15a07d2f..0fab5b17da8 100644--- a/apps/mobile/modules/t3-composer-editor/android/src/main/java/expo/modules/t3composereditor/T3ComposerEditorView.kt+++ b/apps/mobile/modules/t3-composer-editor/android/src/main/java/expo/modules/t3composereditor/T3ComposerEditorView.kt@@ -23,6 +23,7 @@ import android.view.Gravityimport android.view.GestureDetectorimport android.view.MotionEventimport android.view.KeyEvent+import android.view.Viewimport android.view.ViewGroupimport android.view.inputmethod.EditorInfoimport android.view.inputmethod.InputConnection@@ -596,6 +597,9 @@ internal class SelectionAwareEditText(var maxInputChars = Int.MAX_VALUEvar clipboardFragment = ""+ // Keeps autofill services such as SMS verification codes from writing into the draft.+ override fun getAutofillType(): Int = View.AUTOFILL_TYPE_NONE+/*** Editable TextView hints do not ellipsize, so long placeholders wrap and grow the composer.* Truncate the hint to the measured width instead.diff --git a/apps/mobile/modules/t3-composer-editor/android/src/test/java/expo/modules/t3composereditor/ComposerPasteTest.kt b/apps/mobile/modules/t3-composer-editor/android/src/test/java/expo/modules/t3composereditor/ComposerPasteTest.ktindex 441154f3e1b..22b21676586 100644--- a/apps/mobile/modules/t3-composer-editor/android/src/test/java/expo/modules/t3composereditor/ComposerPasteTest.kt+++ b/apps/mobile/modules/t3-composer-editor/android/src/test/java/expo/modules/t3composereditor/ComposerPasteTest.kt@@ -180,6 +180,15 @@ class ComposerPasteTest {assertNull(intercepted)}+ @Test+ fun autofillCannotWriteIntoTheDraft() {+ assertEquals(+ "Autofill services such as SMS verification codes must not target the composer",+ View.AUTOFILL_TYPE_NONE,+ editor.autofillType,+ )+ }+private fun dropEditor(): SelectionAwareEditText {val activity = Robolectric.buildActivity(Activity::class.java).setup().get()return SelectionAwareEditText(activity).apply {