Skip to content

Commit a0bc68f

Browse files
committed
Don't use password autofill if Performance is linked
1 parent ddd973c commit a0bc68f

File tree

8 files changed

+30
-11
lines changed

8 files changed

+30
-11
lines changed

Auth/FirebaseAuthUI/FUIAuthUtils.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,9 @@ extern NSString *const FUIAuthBundleName;
4949
*/
5050
+ (UIImage *)imageNamed:(NSString *)name fromBundle:(nullable NSBundle *)bundle;
5151

52+
/** @fn isFirebasePerformanceAvailable
53+
* @brief Used to work around https://github.com/firebase/firebase-ios-sdk/issues/2283
54+
*/
55+
+ (BOOL)isFirebasePerformanceAvailable;
56+
5257
@end

Auth/FirebaseAuthUI/FUIAuthUtils.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ + (UIImage *)imageNamed:(NSString *)name fromBundleNameOrNil:(nullable NSString
5656
return [UIImage imageWithContentsOfFile:path];
5757
}
5858

59+
+ (BOOL)isFirebasePerformanceAvailable {
60+
return NSClassFromString(@"FIRPerformance") != nil;
61+
}
62+
5963
@end

EmailAuth/FirebaseEmailAuthUI/FUIEmailEntryViewController.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
291291
cell.textField.returnKeyType = UIReturnKeyNext;
292292
cell.textField.keyboardType = UIKeyboardTypeEmailAddress;
293293
if (@available(iOS 11.0, *)) {
294-
cell.textField.textContentType = UITextContentTypeUsername;
294+
if (![FUIAuthUtils isFirebasePerformanceAvailable]) {
295+
cell.textField.textContentType = UITextContentTypeUsername;
296+
}
295297
}
296298
[cell.textField addTarget:self
297299
action:@selector(textFieldDidChange)

EmailAuth/FirebaseEmailAuthUI/FUIPasswordRecoveryViewController.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
182182
_emailField.autocorrectionType = UITextAutocorrectionTypeNo;
183183
_emailField.autocapitalizationType = UITextAutocapitalizationTypeNone;
184184
if (@available(iOS 11.0, *)) {
185-
_emailField.textContentType = UITextContentTypeUsername;
185+
if (![FUIAuthUtils isFirebasePerformanceAvailable]) {
186+
_emailField.textContentType = UITextContentTypeUsername;
187+
}
186188
}
187189
[cell.textField addTarget:self
188190
action:@selector(textFieldDidChange)

EmailAuth/FirebaseEmailAuthUI/FUIPasswordSignInViewController.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
258258
_emailField.autocorrectionType = UITextAutocorrectionTypeNo;
259259
_emailField.autocapitalizationType = UITextAutocapitalizationTypeNone;
260260
if (@available(iOS 11.0, *)) {
261-
_emailField.textContentType = UITextContentTypeUsername;
261+
if (![FUIAuthUtils isFirebasePerformanceAvailable]) {
262+
_emailField.textContentType = UITextContentTypeUsername;
263+
}
262264
}
263265
} else if (indexPath.row == 1) {
264266
cell.label.text = FUILocalizedString(kStr_Password);
@@ -268,7 +270,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
268270
_passwordField.returnKeyType = UIReturnKeyNext;
269271
_passwordField.keyboardType = UIKeyboardTypeDefault;
270272
if (@available(iOS 11.0, *)) {
271-
_passwordField.textContentType = UITextContentTypePassword;
273+
if (![FUIAuthUtils isFirebasePerformanceAvailable]) {
274+
_passwordField.textContentType = UITextContentTypePassword;
275+
}
272276
}
273277
}
274278
[cell.textField addTarget:self

EmailAuth/FirebaseEmailAuthUI/FUIPasswordSignUpViewController.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
268268
_emailField.autocorrectionType = UITextAutocorrectionTypeNo;
269269
_emailField.autocapitalizationType = UITextAutocapitalizationTypeNone;
270270
if (@available(iOS 11.0, *)) {
271-
_emailField.textContentType = UITextContentTypeUsername;
271+
if (![FUIAuthUtils isFirebasePerformanceAvailable]) {
272+
_emailField.textContentType = UITextContentTypeUsername;
273+
}
272274
}
273275
} else if (indexPath.row == 1) {
274276
cell.label.text = FUILocalizedString(kStr_Name);
@@ -292,7 +294,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
292294
_passwordField.returnKeyType = UIReturnKeyNext;
293295
_passwordField.keyboardType = UIKeyboardTypeDefault;
294296
if (@available(iOS 11.0, *)) {
295-
_passwordField.textContentType = UITextContentTypePassword;
297+
if (![FUIAuthUtils isFirebasePerformanceAvailable]) {
298+
_passwordField.textContentType = UITextContentTypePassword;
299+
}
296300
}
297301
}
298302
[cell.textField addTarget:self

EmailAuth/FirebaseEmailAuthUI/FUIPasswordVerificationViewController.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
222222
_passwordField.returnKeyType = UIReturnKeyNext;
223223
_passwordField.keyboardType = UIKeyboardTypeDefault;
224224
if (@available(iOS 11.0, *)) {
225-
_passwordField.textContentType = UITextContentTypePassword;
225+
if (![FUIAuthUtils isFirebasePerformanceAvailable]) {
226+
_passwordField.textContentType = UITextContentTypePassword;
227+
}
226228
}
227229
[cell.textField addTarget:self
228230
action:@selector(textFieldDidChange)

UITests/FirebaseUISample.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,8 +863,6 @@
863863
"\"leveldb\"",
864864
"-framework",
865865
"\"nanopb\"",
866-
"-framework",
867-
"\"openssl\"",
868866
);
869867
PRODUCT_BUNDLE_IDENTIFIER = com.firebase.FirebaseUISampleUITests;
870868
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -960,8 +958,6 @@
960958
"\"leveldb\"",
961959
"-framework",
962960
"\"nanopb\"",
963-
"-framework",
964-
"\"openssl\"",
965961
);
966962
PRODUCT_BUNDLE_IDENTIFIER = com.firebase.FirebaseUISampleUITests;
967963
PRODUCT_NAME = "$(TARGET_NAME)";

0 commit comments

Comments
 (0)