Skip to content

Commit 6827e5d

Browse files
morganchen12Yue-Wang-Google
authored andcommitted
Add one-time code text content type to phone auth (#516)
1 parent c357b17 commit 6827e5d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

FirebasePhoneAuthUI/FUICodeField.m

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ - (void)setUpFromNib {
5959
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
6060
self.inputField.userInteractionEnabled = YES;
6161

62+
#if __IPHONE_OS_MIN_VERSION_REQUIRED > __IPHONE_12_0
63+
if (@available(iOS 12.0, *)) {
64+
self.inputField.textContentType = UITextContentTypeOneTimeCode;
65+
}
66+
#endif // __IPHONE_OS_MIN_VERSION_REQUIRED > __IPHONE_12_0
67+
6268
// Initialization code
6369
_codeEntry = [NSMutableString string];
6470

@@ -165,10 +171,18 @@ - (CGSize)inputFieldIntrinsicContentSize {
165171

166172
- (CGSize)intrinsicContentSize {
167173
CGSize textFieldSize = [self inputFieldIntrinsicContentSize];
168-
169174
return textFieldSize;
170175
}
171176

177+
- (UITextContentType)textContentType {
178+
#if __IPHONE_OS_MIN_VERSION_REQUIRED > __IPHONE_12_0
179+
if (@available(iOS 12.0, *)) {
180+
return UITextContentTypeOneTimeCode;
181+
}
182+
#endif // __IPHONE_OS_MIN_VERSION_REQUIRED > __IPHONE_12_0
183+
return nil;
184+
}
185+
172186
@end
173187

174188
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)