Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated APIs #2723

Merged
merged 4 commits into from Apr 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Example/Auth/ApiTests/FacebookAuthTests.m
Expand Up @@ -54,7 +54,7 @@ - (void)testSignInWithFaceboook {
XCTestExpectation *expectation = [self expectationWithDescription:@"Facebook sign-in finished."];

[auth signInWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
completion:^(FIRAuthDataResult *result, NSError *error) {
if (error) {
NSLog(@"Facebook sign in error: %@", error);
}
Expand Down Expand Up @@ -94,7 +94,7 @@ - (void)testLinkAnonymousAccountToFacebookAccount {

XCTestExpectation *expectation = [self expectationWithDescription:@"Facebook linking finished."];
[auth.currentUser linkWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
completion:^(FIRAuthDataResult *result, NSError *error) {
if (error) {
NSLog(@"Link to Facebok error: %@", error);
}
Expand Down
2 changes: 1 addition & 1 deletion Example/Auth/ApiTests/GoogleAuthTests.m
Expand Up @@ -48,7 +48,7 @@ - (void)testSignInWithGoogle {
XCTestExpectation *expectation =
[self expectationWithDescription:@"Signing in with Google finished."];
[auth signInWithCredential:credential
completion:^(FIRUser *user, NSError *error) {
completion:^(FIRAuthDataResult *result, NSError *error) {
if (error) {
NSLog(@"Signing in with Google had error: %@", error);
}
Expand Down
2 changes: 1 addition & 1 deletion Example/Auth/ApiTests/GoogleAuthTests.swift
Expand Up @@ -35,7 +35,7 @@ class GoogleAuthTestsSwift: FIRAuthApiTestsBase {
let credential = GoogleAuthProvider.credential(withIDToken: googleIdToken, accessToken: googleAccessToken)

let expectation = self.expectation(description: "Signing in with Google finished.")
auth.signInAndRetrieveData(with: credential) { _, error in
auth.signIn(with: credential) { _, error in
if error != nil {
print("Signing in with Google had error: %@", error!)
}
Expand Down
95 changes: 50 additions & 45 deletions Example/Auth/Sample/MainViewController.m
Expand Up @@ -1131,8 +1131,9 @@ - (void)signInWithProvider:(nonnull id<AuthProvider>)provider callback:(void(^)(
[self logFailedTest:@"The test needs a valid credential to continue."];
return;
}
[[AppManager auth] signInWithCredential:credential completion:^(FIRUser *_Nullable user,
NSError *_Nullable error) {
[[AppManager auth] signInAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
if (error) {
[self logFailure:@"sign-in with provider failed" error:error];
[self logFailedTest:@"Sign-in should succeed"];
Expand Down Expand Up @@ -1283,9 +1284,9 @@ - (void)automatedEmailSignUp {
[auth signOut:NULL];
FIRAuthCredential *credential = [FIREmailAuthProvider credentialWithEmail:kFakeEmail
password:kFakePassword];
[auth signInWithCredential:credential
completion:^(FIRUser *_Nullable user,
NSError *_Nullable error) {
[auth signInAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
if (error) {
[self logFailure:@"sign-in with Email/Password failed" error:error];
[self logFailedTest:@"sign-in with Email/Password should succeed."];
Expand Down Expand Up @@ -1381,8 +1382,10 @@ - (void)automatedAccountLinking {
callback:^(FIRAuthCredential *credential,
NSError *error) {
if (credential) {
[result.user linkWithCredential:credential completion:^(FIRUser *user,
[result.user linkAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *result,
NSError *error) {
FIRUser *user = result.user;
if (error) {
[self logFailure:@"link auth provider failed" error:error];
[self logFailedTest:@"Account needs to be linked to complete the test."];
Expand Down Expand Up @@ -1573,9 +1576,9 @@ - (void)updateEmailPasswordWithCompletion:(void(^)(void))completion {
[auth signOut:NULL];
FIRAuthCredential *credential =
[FIREmailAuthProvider credentialWithEmail:kFakeEmail password:kFakePassword];
[auth signInWithCredential:credential
completion:^(FIRUser *_Nullable user,
NSError *_Nullable error) {
[auth signInAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
if (error) {
[self logFailure:@"sign-in with Email/Password failed" error:error];
[self logFailedTest:@"sign-in with Email/Password should succeed."];
Expand Down Expand Up @@ -2003,9 +2006,9 @@ - (void)signInEmailPassword {
[FIREmailAuthProvider credentialWithEmail:email
password:password];
[self showSpinner:^{
[[AppManager auth] signInWithCredential:credential
completion:^(FIRUser *_Nullable user,
NSError *_Nullable error) {
[[AppManager auth] signInAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
[self hideSpinner:^{
if (error) {
[self logFailure:@"sign-in with Email/Password failed" error:error];
Expand Down Expand Up @@ -2033,10 +2036,10 @@ - (void)signInEmailPasswordAuthDataResult {
return;
}
[self showSpinner:^{
[[AppManager auth] signInAndRetrieveDataWithEmail:email
password:password
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[[AppManager auth] signInWithEmail:email
password:password
completion:^(FIRAuthDataResult *_Nullable authResult,
NSError *_Nullable error) {
[self hideSpinner:^{
if (error) {
[self logFailure:@"sign-in with Email/Password failed" error:error];
Expand Down Expand Up @@ -2270,8 +2273,9 @@ - (void)reauthenticateEmailPassword {
}
[self showEmailPasswordDialogWithCompletion:^(FIRAuthCredential *credential) {
[self showSpinner:^{
[[self user] reauthenticateWithCredential:credential
completion:^(NSError *_Nullable error) {
[[self user] reauthenticateAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
if (error) {
[self logFailure:@"reauthicate with email/password failed" error:error];
} else {
Expand Down Expand Up @@ -2321,13 +2325,14 @@ - (void)reauthenticate:(id<AuthProvider>)authProvider retrieveData:(BOOL)retriev
}
[self showTypicalUIForUserUpdateResultsWithTitle:@"Reauthenticate" error:error];
};
FIRUserProfileChangeCallback callback = ^(NSError *_Nullable error) {
FIRAuthDataResultCallback callback = ^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
completion(nil, error);
};
if (retrieveData) {
[user reauthenticateAndRetrieveDataWithCredential:credential completion:completion];
} else {
[user reauthenticateWithCredential:credential completion:callback];
[user reauthenticateAndRetrieveDataWithCredential:credential completion:callback];
}
}
}];
Expand Down Expand Up @@ -2367,14 +2372,14 @@ - (void)signinWithProvider:(id<AuthProvider>)authProvider retrieveData:(BOOL)ret
}
[self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In" error:error];
};
FIRAuthResultCallback callback = ^(FIRUser *_Nullable user,
NSError *_Nullable error) {
FIRAuthDataResultCallback callback = ^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
completion(nil, error);
};
if (retrieveData) {
[auth signInAndRetrieveDataWithCredential:credential completion:completion];
} else {
[auth signInWithCredential:credential completion:callback];
[auth signInAndRetrieveDataWithCredential:credential completion:callback];
}
}
}];
Expand Down Expand Up @@ -2551,14 +2556,14 @@ - (void)linkWithAuthProvider:(id<AuthProvider>)authProvider retrieveData:(BOOL)r
[self showTypicalUIForUserUpdateResultsWithTitle:@"Link Account" error:error];
}
};
FIRAuthResultCallback callback = ^(FIRUser *_Nullable user,
NSError *_Nullable error) {
FIRAuthDataResultCallback callback = ^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
completion(nil, error);
};
if (retrieveData) {
[user linkAndRetrieveDataWithCredential:credential completion:completion];
} else {
[user linkWithCredential:credential completion:callback];
[user linkAndRetrieveDataWithCredential:credential completion:callback];
}
}
}];
Expand Down Expand Up @@ -2602,8 +2607,8 @@ - (void)linkWithFacebookAndRetrieveData {
- (void)linkWithEmailPassword {
[self showEmailPasswordDialogWithCompletion:^(FIRAuthCredential *credential) {
[self showSpinner:^{
[[self user] linkWithCredential:credential
completion:^(FIRUser *user, NSError *_Nullable error) {
[[self user] linkAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *result, NSError *error) {
if (error) {
[self logFailure:@"link Email/Password failed" error:error];
} else {
Expand Down Expand Up @@ -3108,10 +3113,10 @@ - (void)createUserAuthDataResult {
}

[self showSpinner:^{
[[AppManager auth] createUserAndRetrieveDataWithEmail:email
password:password
completion:^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
[[AppManager auth] createUserWithEmail:email
password:password
completion:^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
if (error) {
[self logFailure:@"create user failed" error:error];
} else {
Expand Down Expand Up @@ -3378,9 +3383,9 @@ - (void)linkPhoneNumber:(NSString *_Nullable)phoneNumber
FIRPhoneAuthCredential *credential =
[[AppManager phoneAuthProvider] credentialWithVerificationID:verificationID
verificationCode:verificationCode];
[[self user] linkWithCredential:credential
completion:^(FIRUser *_Nullable user,
NSError *_Nullable error) {
[[self user] linkAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
[self hideSpinner:^{
if (error) {
if (error.code == FIRAuthErrorCodeCredentialAlreadyInUse) {
Expand All @@ -3396,9 +3401,9 @@ - (void)linkPhoneNumber:(NSString *_Nullable)phoneNumber
[self showSpinner:^{
FIRPhoneAuthCredential *credential =
error.userInfo[FIRAuthErrorUserInfoUpdatedCredentialKey];
[[AppManager auth] signInWithCredential:credential
completion:^(FIRUser *_Nullable user,
NSError *_Nullable error) {
[[AppManager auth] signInAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
[self hideSpinner:^{
if (error) {
[self logFailure:@"failed to verify phone number" error:error];
Expand Down Expand Up @@ -3467,7 +3472,7 @@ - (void)signInAnonymously {
success.
*/
- (void)signInAnonymouslyAuthDataResult {
[[AppManager auth] signInAnonymouslyAndRetrieveDataWithCompletion:
[[AppManager auth] signInAnonymouslyWithCompletion:
^(FIRAuthDataResult *_Nullable authResult, NSError *_Nullable error) {
if (error) {
[self logFailure:@"sign-in anonymously failed" error:error];
Expand All @@ -3492,9 +3497,9 @@ - (void)signInWithGitHub {
FIROAuthCredential *credential =
[FIROAuthProvider credentialWithProviderID:FIRGitHubAuthProviderID accessToken:accessToken];
if (credential) {
[[AppManager auth] signInWithCredential:credential
completion:^(FIRUser *_Nullable result,
NSError *_Nullable error) {
[[AppManager auth] signInAndRetrieveDataWithCredential:credential
completion:^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
if (error) {
[self logFailure:@"sign-in with provider failed" error:error];
} else {
Expand Down Expand Up @@ -3660,9 +3665,9 @@ - (void)doSignInWithCustomToken:(NSString *_Nullable)userEnteredTokenText {
}

- (void)doSignInAndRetrieveDataWithCustomToken:(NSString *_Nullable)userEnteredTokenText {
[[AppManager auth] signInAndRetrieveDataWithCustomToken:userEnteredTokenText
completion:^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
[[AppManager auth] signInWithCustomToken:userEnteredTokenText
completion:^(FIRAuthDataResult *_Nullable result,
NSError *_Nullable error) {
if (error) {
[self logFailure:@"sign-in with custom token failed" error:error];
[self showMessagePromptWithTitle:kSignInErrorAlertTitle
Expand Down