From 7bc31b633e2f55f40dd3b2057fbbd3e3c9eb4388 Mon Sep 17 00:00:00 2001 From: Xiangtian Dai Date: Fri, 22 Sep 2017 10:52:53 -0700 Subject: [PATCH 1/3] Logs the presence of Firebase Auth UI in Auth server requests. --- FirebaseAuthUI/FUIAuth.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/FirebaseAuthUI/FUIAuth.m b/FirebaseAuthUI/FUIAuth.m index 4c891c76e2d..03d18ced141 100644 --- a/FirebaseAuthUI/FUIAuth.m +++ b/FirebaseAuthUI/FUIAuth.m @@ -44,6 +44,23 @@ */ static NSString *const kErrorUserInfoEmailKey = @"FIRAuthErrorUserInfoEmailKey"; +/** @var kFirebaseAuthUIFrameworkMarker + @brief The marker in the HTTP header that indicates the presence of Firebase Auth UI. + */ +static NSString *const kFirebaseAuthUIFrameworkMarker = @"FirebaseUI-iOS"; + +/** @category FIRAuth(InternalInterface) + @brief Reclares the internal interface not publicly exposed in FIRAuth. + */ +@interface FIRAuth (InternalInterface) + +/** @property additionalFrameworkMarker + @brief Additional framework marker that will be added as part of the header of every request. + */ +@property(nonatomic, copy, nullable) NSString *additionalFrameworkMarker; + +@end + @interface FUIAuth () /** @fn initWithAuth: @@ -72,6 +89,7 @@ + (nullable FUIAuth *)authUIWithAuth:(FIRAuth *)auth { authUI = [[FUIAuth alloc] initWithAuth:auth]; objc_setAssociatedObject(auth, &kAuthAssociationKey, authUI, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + auth.additionalFrameworkMarker = kFirebaseAuthUIFrameworkMarker; } return authUI; } From b8ffec08dd7e65a44ce986a4163e77a1d1a3177f Mon Sep 17 00:00:00 2001 From: Xiangtian Dai Date: Fri, 22 Sep 2017 10:55:58 -0700 Subject: [PATCH 2/3] Fixes a typo. --- FirebaseAuthUI/FUIAuth.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FirebaseAuthUI/FUIAuth.m b/FirebaseAuthUI/FUIAuth.m index 03d18ced141..98a6c99867d 100644 --- a/FirebaseAuthUI/FUIAuth.m +++ b/FirebaseAuthUI/FUIAuth.m @@ -50,7 +50,7 @@ static NSString *const kFirebaseAuthUIFrameworkMarker = @"FirebaseUI-iOS"; /** @category FIRAuth(InternalInterface) - @brief Reclares the internal interface not publicly exposed in FIRAuth. + @brief Redeclares the internal interface not publicly exposed in FIRAuth. */ @interface FIRAuth (InternalInterface) From da8097b3395b52a813ffd72d6bb059a566953d6e Mon Sep 17 00:00:00 2001 From: Xiangtian Dai Date: Fri, 22 Sep 2017 14:25:53 -0700 Subject: [PATCH 3/3] Adds a check for the presence of the internal method to be cautious. --- FirebaseAuthUI/FUIAuth.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/FirebaseAuthUI/FUIAuth.m b/FirebaseAuthUI/FUIAuth.m index 98a6c99867d..a95523bed05 100644 --- a/FirebaseAuthUI/FUIAuth.m +++ b/FirebaseAuthUI/FUIAuth.m @@ -89,7 +89,9 @@ + (nullable FUIAuth *)authUIWithAuth:(FIRAuth *)auth { authUI = [[FUIAuth alloc] initWithAuth:auth]; objc_setAssociatedObject(auth, &kAuthAssociationKey, authUI, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - auth.additionalFrameworkMarker = kFirebaseAuthUIFrameworkMarker; + if ([auth respondsToSelector:@selector(setAdditionalFrameworkMarker:)]) { + auth.additionalFrameworkMarker = kFirebaseAuthUIFrameworkMarker; + } } return authUI; }