@@ -5,7 +5,7 @@ const prettier = require('prettier');
55main ( ) ;
66
77async function main ( ) {
8- const patchVersion = '2 ' ;
8+ const patchVersion = '3 ' ;
99 const flagFile = path . resolve ( __dirname , '../platforms/android/.flag_done' ) ;
1010 if ( fs . existsSync ( flagFile ) ) {
1111 const appliedVersion = fs . readFileSync ( flagFile , 'utf8' ) . trim ( ) ;
@@ -144,9 +144,7 @@ async function main() {
144144 if (type == NO_SUGGESTIONS) {
145145 outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
146146 } else if (type == NO_SUGGESTIONS_AGGRESSIVE) {
147- outAttrs.inputType =
148- InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS |
149- InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
147+ outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
150148 } else {
151149 outAttrs.inputType |= InputType.TYPE_NULL;
152150 }
@@ -380,6 +378,20 @@ async function main() {
380378 const contentToAddTo = contentToAdd [ file ] ;
381379 const text = removeComments ( content ) ;
382380 let newContent = await format ( text ) ;
381+
382+ if ( file === 'SystemWebView.java' ) {
383+ newContent = newContent . replace (
384+ / o u t A t t r s \\ .i n p u t T y p e \\ s * = \\ s * I n p u t T y p e \\ .T Y P E _ T E X T _ F L A G _ N O _ S U G G E S T I O N S \\ s * \\ | \\ s * I n p u t T y p e \\ .T Y P E _ T E X T _ V A R I A T I O N _ V I S I B L E _ P A S S W O R D \\ s * ; / g,
385+ 'outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;' ,
386+ ) ;
387+ }
388+
389+ if ( file === 'SystemWebView.java' ) {
390+ newContent = newContent . replace (
391+ / o u t A t t r s \. i n p u t T y p e \s * = \s * I n p u t T y p e \. T Y P E _ T E X T _ F L A G _ N O _ S U G G E S T I O N S \s * \| \s * I n p u t T y p e \. T Y P E _ T E X T _ V A R I A T I O N _ V I S I B L E _ P A S S W O R D \s * ; / g,
392+ 'outAttrs.inputType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;' ,
393+ ) ;
394+ }
383395 if ( contentToAddTo . import ) {
384396 const imports = contentToAddTo . import . map ( importStr => {
385397 return `import ${ importStr } ;` ;
@@ -400,9 +412,14 @@ async function main() {
400412 ) ;
401413 }
402414 if ( contentToAddTo . methods ) {
403- const methods = contentToAddTo . methods . map ( method => {
404- return getMethodString ( method ) ;
405- } ) . join ( '\n' ) ;
415+ if ( file === 'SystemWebView.java' ) {
416+ newContent = removeMethod ( newContent , 'onCreateInputConnection' ) ;
417+ }
418+
419+ const methods = contentToAddTo . methods
420+ . filter ( method => ! ( file === 'SystemWebView.java' && method . name === 'onCreateInputConnection' ) )
421+ . map ( method => getMethodString ( method ) )
422+ . join ( '\n' ) ;
406423
407424 if ( isInterface ( file , content ) ) {
408425 const regex = getInterfaceDeclarationRegex ( file ) ;
@@ -456,7 +473,16 @@ async function main() {
456473 } ) ;
457474 }
458475
459- function getMethodString ( method ) {
476+ function removeMethod ( content , methodName ) {
477+ const regex = new RegExp (
478+ `\\n\\s*@Override\\s*\\n\\s*public\\s+[^\\s]+\\s+${ methodName } \\s*\\([^)]*\\)\\s*\\{[^]*?\\n\\s*\\}` ,
479+ 'm' ,
480+ ) ;
481+
482+ return content . replace ( regex , '' ) ;
483+ }
484+
485+ function getMethodString ( method ) {
460486 const params = method . params . map ( param => {
461487 return `${ param . type } ${ param . name } ` ;
462488 } ) . join ( ', ' ) ;
0 commit comments