Skip to content

Commit f10d6d2

Browse files
authored
Merge pull request #112 from FirebasePrivate/add_auth_language_chooser
Add auth language chooser to facilitate manual testing.
2 parents dfab8bc + 09c029d commit f10d6d2

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

AuthSamples/Sample/SettingsViewController.m

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,11 @@ - (void)loadTableView {
210210
action:^{
211211
[weakSelf clearAppCredential];
212212
}],
213+
[StaticContentTableViewCell cellWithTitle:@"Auth Language"
214+
value:[FIRAuth auth].languageCode ?: @"[none]"
215+
action:^{
216+
[weakSelf showLanguageInput];
217+
}],
213218
]],
214219
]];
215220
}
@@ -333,4 +338,18 @@ - (void)clearAppCredential {
333338
}];
334339
}
335340

341+
/** @fn showLanguageInput
342+
@brief Show language code input field.
343+
*/
344+
- (void)showLanguageInput {
345+
[self showTextInputPromptWithMessage:@"Enter Language Code For Auth:"
346+
completionBlock:^(BOOL userPressedOK, NSString *_Nullable languageCode) {
347+
if (!userPressedOK) {
348+
return;
349+
}
350+
[FIRAuth auth].languageCode = languageCode.length ? languageCode : nil;
351+
[self loadTableView];
352+
}];
353+
}
354+
336355
@end

Firebase/Auth/Source/FIRAuth.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,10 @@ - (void)useAppLanguage {
966966
[bundle localizedStringForKey:kFirebaseLocaleStringKey value:nil table:@"FirebaseLocale"];
967967
}
968968

969+
- (NSString *)languageCode {
970+
return _requestConfiguration.languageCode;
971+
}
972+
969973
#if TARGET_OS_IOS
970974
- (NSData *)APNSToken {
971975
__block NSData *result = nil;

0 commit comments

Comments
 (0)