-
Notifications
You must be signed in to change notification settings - Fork 6k
Add Support for autofill with textContentType #13878
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,13 @@ static UITextAutocapitalizationType ToUITextAutoCapitalizationType(NSDictionary* | |
| return UITextAutocapitalizationTypeNone; | ||
| } | ||
|
|
||
| @available iOS (11.0,*) | ||
| static UITextContentType ToUITextContentType(NSDictionary* type) { | ||
| NSString* contentType = type[@"textType"]; | ||
| if ([contentType isEqualToString:@"TextContent.username"]) | ||
| return UITextContentTypeUsername; | ||
| } | ||
|
|
||
| static UIReturnKeyType ToUIReturnKeyType(NSString* inputType) { | ||
| // Where did the term "unspecified" come from? iOS has a "default" and Android | ||
| // has "unspecified." These 2 terms seem to mean the same thing but we need | ||
|
|
@@ -149,6 +156,13 @@ @interface FlutterTextInputView : UIView <UITextInput> | |
| @property(nonatomic, strong) UITextRange* markedTextRange; | ||
| @property(nonatomic, copy) NSDictionary* markedTextStyle; | ||
| @property(nonatomic, assign) id<UITextInputDelegate> inputDelegate; | ||
| /** | ||
| This file is to make ios 11 or higher device using autofill | ||
|
|
||
| Reference to github.com/flutter/flutter/issues/33040 | ||
| **/ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this doc comment since it doesn't add anything that the reader can't look up from |
||
| @property(nonatomic) UITextContentType textContentType API_AVAILABLE(ios(11.0)); | ||
|
|
||
|
|
||
| // UITextInputTraits | ||
| @property(nonatomic) UITextAutocapitalizationType autocapitalizationType; | ||
|
|
@@ -191,6 +205,8 @@ - (instancetype)init { | |
| _enablesReturnKeyAutomatically = NO; | ||
| _keyboardAppearance = UIKeyboardAppearanceDefault; | ||
| _keyboardType = UIKeyboardTypeDefault; | ||
| if(@available iOS (11.0,*)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The syntax above should be: |
||
| _keyboardContentType = UITextContentType; | ||
| _returnKeyType = UIReturnKeyDone; | ||
| _secureTextEntry = NO; | ||
| } | ||
|
|
@@ -754,6 +770,8 @@ - (void)hideTextInput { | |
|
|
||
| - (void)setTextInputClient:(int)client withConfiguration:(NSDictionary*)configuration { | ||
| NSDictionary* inputType = configuration[@"inputType"]; | ||
| if(@available iOS (11.0,*)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The syntax above should be: |
||
| NSDictionary* contentType = configuration[@"contentType"]; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this is an unused variable.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This variable is referred by flutter/flutter#33040
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Maybe I will check CI After Exam Month |
||
| NSString* keyboardAppearance = configuration[@"keyboardAppearance"]; | ||
| if ([configuration[@"obscureText"] boolValue]) { | ||
| _activeView = _secureView; | ||
|
|
@@ -762,6 +780,8 @@ - (void)setTextInputClient:(int)client withConfiguration:(NSDictionary*)configur | |
| } | ||
|
|
||
| _activeView.keyboardType = ToUIKeyboardType(inputType); | ||
| if(@available iOS (11.0,*)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The syntax above should be: |
||
| _activeView.textContentType = ToUITextContentType(contentType); | ||
| _activeView.returnKeyType = ToUIReturnKeyType(configuration[@"inputAction"]); | ||
| _activeView.autocapitalizationType = ToUITextAutoCapitalizationType(configuration); | ||
| if ([keyboardAppearance isEqualToString:@"Brightness.dark"]) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above 3 lines have indentation problems. Indentation should be 2 spaces.