Skip to content

Commit e844908

Browse files
committed
Update FirebaseUI/Auth 2.0, synced @122168651
Change-Id: Ib5e1df011ef5178c4d981521232325fc41f03a3f
1 parent 858c353 commit e844908

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

FirebaseUI/Auth/AuthProviderUI/Facebook/Source/FIRFacebookAuthUI.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#import <FirebaseAuth/FIRFacebookAuthProvider.h>
2020
#import <FirebaseAuth/FIRUserInfo.h>
21-
#import <FirebaseAuth/FIRUser_Internal.h>
2221
#import "FIRAuthUIErrorUtils.h"
2322
#import <FBSDKCoreKit/FBSDKCoreKit.h>
2423
#import <FBSDKLoginKit/FBSDKLoginKit.h>

FirebaseUI/Auth/AuthUI/Source/FIRAuthUI.m

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#import <objc/runtime.h>
2020

2121
#import <FirebaseAnalytics/FIRApp.h>
22-
#import <FirebaseAnalytics/FIRAppAssociationRegistration.h>
2322
#import <FirebaseAuth/FIRAuth.h>
2423
#import "FIRAuthPickerViewController.h"
2524
#import "FIRAuthUI_Internal.h"
@@ -29,6 +28,12 @@
2928
*/
3029
static NSString *const kAppNameCodingKey = @"appName";
3130

31+
/** @var kAuthAssociationKey
32+
@brief The address of this variable is used as the key for associating FIRAuthUI instances with
33+
root FIRAuth objects.
34+
*/
35+
static const char kAuthAssociationKey;
36+
3237
@interface FIRAuthUI ()
3338

3439
/** @fn initWithAuth:
@@ -49,11 +54,16 @@ + (nullable FIRAuthUI *)authUI {
4954
}
5055

5156
+ (nullable FIRAuthUI *)authUIWithAuth:(FIRAuth *)auth {
52-
return [FIRAppAssociationRegistration registeredObjectWithHost:auth
53-
key:NSStringFromClass(self)
54-
creationBlock:^FIRAuthUI *_Nullable() {
55-
return [[FIRAuthUI alloc] initWithAuth:auth];
56-
}];
57+
@synchronized (self) {
58+
// Let the FIRAuth instance retain the FIRAuthUI instance.
59+
FIRAuthUI *authUI = objc_getAssociatedObject(auth, &kAuthAssociationKey);
60+
if (!authUI) {
61+
authUI = [[FIRAuthUI alloc] initWithAuth:auth];
62+
objc_setAssociatedObject(auth, &kAuthAssociationKey, authUI,
63+
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
64+
}
65+
return authUI;
66+
}
5767
}
5868

5969
- (nullable instancetype)initWithAuth:(FIRAuth *)auth {

FirebaseUI/Auth/AuthUI/Source/FIRAuthUIErrors.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ typedef NS_ENUM(NSUInteger, FIRAuthUIErrorCode) {
3333
/** @var FIRAuthUIErrorCodeUserCancelledSignIn
3434
@brief Indicates the user cancelled a sign-in flow.
3535
*/
36-
FIRAuthUIErrorCodeUserCancelledSignIn,
36+
FIRAuthUIErrorCodeUserCancelledSignIn = 1,
3737
/** @var FIRAuthUIErrorCodeProviderError
3838
@brief Indicates there's an error from the identity provider. The
3939
@c FIRAuthUIErrorUserInfoProviderIDKey field in the @c NError.userInfo dictionary will
4040
contain the ID of the identity provider.
4141
*/
42-
FIRAuthUIErrorCodeProviderError,
42+
FIRAuthUIErrorCodeProviderError = 2,
4343
};

FirebaseUI/Auth/AuthUI/Source/FIRAuthUIUtils.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
#import <CoreText/CoreText.h>
2020

21-
#import <FirebaseAuth/FIRAuth_Internal.h>
22-
2321
@implementation FIRAuthUIUtils
2422

2523
+ (NSBundle *)frameworkBundle {

FirebaseUI/Auth/AuthUI/Source/FirebaseAuthUI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#import "FIRAuthProviderUI.h"
1919
#import "FIRAuthUI.h"
2020
#import "FIRAuthUIBaseViewController.h"
21+
#import "FIRAuthUIErrors.h"
2122

2223
/** @var FirebaseAuthUIVersionNumber
2324
@brief Version number for FirebaseAuthUI.

0 commit comments

Comments
 (0)