aboutsummaryrefslogtreecommitdiffhomepage
path: root/Example
diff options
context:
space:
mode:
authorGravatar Zsika Phillip <protocol86@users.noreply.github.com>2018-04-25 21:50:19 -0700
committerGravatar Paul Beusterien <paulbeusterien@google.com>2018-04-26 06:55:00 -0700
commit5bb6e0f091b76ed8a02ce402d766cf4e26d33784 (patch)
treeb7bfb4575eff99c1b61bf2431d2b4a8b3867bb00 /Example
parent7707f37c770212c69d9ca4b36fba7e3ae193c108 (diff)
Adds new callback to createUse API (breaking change) (#1186)
Diffstat (limited to 'Example')
-rw-r--r--Example/Auth/Sample/MainViewController.m8
-rw-r--r--Example/Auth/SwiftSample/ViewController.swift4
-rw-r--r--Example/Auth/Tests/FIRAuthTests.m15
3 files changed, 16 insertions, 11 deletions
diff --git a/Example/Auth/Sample/MainViewController.m b/Example/Auth/Sample/MainViewController.m
index 4c9ec13..0da28c8 100644
--- a/Example/Auth/Sample/MainViewController.m
+++ b/Example/Auth/Sample/MainViewController.m
@@ -1884,7 +1884,8 @@ static NSDictionary<NSString *, NSString *> *parseURL(NSString *urlString) {
callback:(nullable FIRAuthResultCallback)callback {
[[AppManager auth] createUserWithEmail:email
password:password
- completion:^(FIRUser *_Nullable user, NSError *_Nullable error) {
+ completion:^(FIRAuthDataResult *_Nullable result,
+ NSError *_Nullable error) {
if (error) {
[self logFailure:@"sign-up with Email/Password failed" error:error];
if (callback) {
@@ -1893,7 +1894,7 @@ static NSDictionary<NSString *, NSString *> *parseURL(NSString *urlString) {
} else {
[self logSuccess:@"sign-up with Email/Password succeeded."];
if (callback) {
- callback(user, nil);
+ callback(result.user, nil);
}
}
[self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In" error:error];
@@ -2803,7 +2804,8 @@ static NSDictionary<NSString *, NSString *> *parseURL(NSString *urlString) {
[self showSpinner:^{
[[AppManager auth] createUserWithEmail:email
password:password
- completion:^(FIRUser *_Nullable user, NSError *_Nullable error) {
+ completion:^(FIRAuthDataResult *_Nullable result,
+ NSError *_Nullable error) {
if (error) {
[self logFailure:@"create user failed" error:error];
} else {
diff --git a/Example/Auth/SwiftSample/ViewController.swift b/Example/Auth/SwiftSample/ViewController.swift
index d902b38..05b0dd2 100644
--- a/Example/Auth/SwiftSample/ViewController.swift
+++ b/Example/Auth/SwiftSample/ViewController.swift
@@ -232,9 +232,9 @@ final class ViewController: UIViewController, UITextFieldDelegate, AuthUIDelegat
}
case .createUser:
Auth.auth().createUser(withEmail: emailField.text!, password: passwordField.text!) {
- user, error in
+ result, error in
self.ifNoError(error) {
- self.showAlert(title: "Signed In With Credential", message: user?.textDescription)
+ self.showAlert(title: "Signed In With Credential", message: result?.user.textDescription)
}
}
case .signOut:
diff --git a/Example/Auth/Tests/FIRAuthTests.m b/Example/Auth/Tests/FIRAuthTests.m
index d238057..34c0499 100644
--- a/Example/Auth/Tests/FIRAuthTests.m
+++ b/Example/Auth/Tests/FIRAuthTests.m
@@ -1592,9 +1592,9 @@ static const NSTimeInterval kWaitInterval = .5;
[[FIRAuth auth] signOut:NULL];
[[FIRAuth auth] createUserWithEmail:kEmail
password:kFakePassword
- completion:^(FIRUser *_Nullable user, NSError *_Nullable error) {
+ completion:^(FIRAuthDataResult *_Nullable result, NSError *_Nullable error) {
XCTAssertTrue([NSThread isMainThread]);
- [self assertUser:user];
+ [self assertUser:result.user];
XCTAssertNil(error);
[expectation fulfill];
}];
@@ -1614,9 +1614,10 @@ static const NSTimeInterval kWaitInterval = .5;
[[FIRAuth auth] signOut:NULL];
[[FIRAuth auth] createUserWithEmail:kEmail
password:kFakePassword
- completion:^(FIRUser *_Nullable user, NSError *_Nullable error) {
+ completion:^(FIRAuthDataResult *_Nullable result,
+ NSError *_Nullable error) {
XCTAssertTrue([NSThread isMainThread]);
- XCTAssertNil(user);
+ XCTAssertNil(result.user);
XCTAssertEqual(error.code, FIRAuthErrorCodeWeakPassword);
XCTAssertNotNil(error.userInfo[NSLocalizedDescriptionKey]);
XCTAssertEqualObjects(error.userInfo[NSLocalizedFailureReasonErrorKey], reason);
@@ -1700,7 +1701,8 @@ static const NSTimeInterval kWaitInterval = .5;
[[FIRAuth auth] signOut:NULL];
[[FIRAuth auth] createUserWithEmail:kEmail
password:@""
- completion:^(FIRUser *_Nullable user, NSError *_Nullable error) {
+ completion:^(FIRAuthDataResult *_Nullable result,
+ NSError *_Nullable error) {
XCTAssertTrue([NSThread isMainThread]);
XCTAssertEqual(error.code, FIRAuthErrorCodeWeakPassword);
[expectation fulfill];
@@ -1719,7 +1721,8 @@ static const NSTimeInterval kWaitInterval = .5;
[[FIRAuth auth] signOut:NULL];
[[FIRAuth auth] createUserWithEmail:@""
password:kFakePassword
- completion:^(FIRUser *_Nullable user, NSError *_Nullable error) {
+ completion:^(FIRAuthDataResult *_Nullable result,
+ NSError *_Nullable error) {
XCTAssertTrue([NSThread isMainThread]);
XCTAssertEqual(error.code, FIRAuthErrorCodeMissingEmail);
[expectation fulfill];