diff options
author | Paul Beusterien <paulbeusterien@google.com> | 2018-05-30 19:19:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-30 19:19:10 -0700 |
commit | 1bbac8d26eceba8837327f726b187e3207435202 (patch) | |
tree | da3b9956db4974bb98f19a7a28657addbf2763e3 | |
parent | ed5c3217e89aafb25b6c11793cc0ab4a1c9d8d5c (diff) | |
parent | 196f5d28cc24a1d76752e0ba7ec5e862bcd073a6 (diff) |
Merge pull request #1360 from firebase/pb-auth-to-52
Include FirebaseAuth 5.0.1 in Firebase 5.2.0
-rw-r--r-- | Firebase/Auth/CHANGELOG.md | 5 | ||||
-rw-r--r-- | Firebase/Auth/Source/FIRAuth.m | 14 | ||||
-rw-r--r-- | Firebase/Auth/Source/FIRAuthAppDelegateProxy.m | 14 | ||||
-rw-r--r-- | Firebase/Auth/Source/FIRAuthDefaultUIDelegate.m | 15 | ||||
-rw-r--r-- | FirebaseAuth.podspec | 2 | ||||
-rwxr-xr-x | scripts/push-pods.sh | 4 | ||||
-rwxr-xr-x | scripts/update-tags.sh | 6 |
7 files changed, 49 insertions, 11 deletions
diff --git a/Firebase/Auth/CHANGELOG.md b/Firebase/Auth/CHANGELOG.md index 5a3fcef..292f8bd 100644 --- a/Firebase/Auth/CHANGELOG.md +++ b/Firebase/Auth/CHANGELOG.md @@ -1,9 +1,12 @@ +# v5.0.1 +- Restore 4.x level of support for extensions (#1357). + # v5.0.0 - Adds APIs for phone Auth testing to bypass the verification flow (#1192). - Changes the callback block signature for sign in and create user methods to provide an AuthDataResult that includes the user and user info (#1123, #1186). - Removes GoogleToolboxForMac dependency (#1175). -- Removes misc. deprecated APIs (#1188, #1200) +- Removes miscellaneous deprecated APIs (#1188, #1200). # v4.6.1 - Fixes crash which occurred when certain Firebase IDTokens were being parsed (#1076). diff --git a/Firebase/Auth/Source/FIRAuth.m b/Firebase/Auth/Source/FIRAuth.m index c83a19a..81008ca 100644 --- a/Firebase/Auth/Source/FIRAuth.m +++ b/Firebase/Auth/Source/FIRAuth.m @@ -19,6 +19,7 @@ #import "FIRAuth_Internal.h" #import <FirebaseCore/FIRAppAssociationRegistration.h> +#import <FirebaseCore/FIRAppEnvironmentUtil.h> #import <FirebaseCore/FIRAppInternal.h> #import <FirebaseCore/FIRLogger.h> #import <FirebaseCore/FIROptions.h> @@ -438,7 +439,18 @@ static NSMutableDictionary *gKeychainServiceNameForAppName; _settings = [[FIRAuthSettings alloc] init]; _firebaseAppName = [appName copy]; #if TARGET_OS_IOS - UIApplication *application = [UIApplication sharedApplication]; + + static Class applicationClass = nil; + // iOS App extensions should not call [UIApplication sharedApplication], even if UIApplication + // responds to it. + if (![FIRAppEnvironmentUtil isAppExtension]) { + Class cls = NSClassFromString(@"UIApplication"); + if (cls && [cls respondsToSelector:NSSelectorFromString(@"sharedApplication")]) { + applicationClass = cls; + } + } + UIApplication *application = [applicationClass sharedApplication]; + // Initialize the shared FIRAuthAppDelegateProxy instance in the main thread if not already. [FIRAuthAppDelegateProxy sharedInstance]; #endif diff --git a/Firebase/Auth/Source/FIRAuthAppDelegateProxy.m b/Firebase/Auth/Source/FIRAuthAppDelegateProxy.m index f13e94f..3289b4e 100644 --- a/Firebase/Auth/Source/FIRAuthAppDelegateProxy.m +++ b/Firebase/Auth/Source/FIRAuthAppDelegateProxy.m @@ -16,6 +16,8 @@ #import "FIRAuthAppDelegateProxy.h" +#import <FirebaseCore/FIRAppEnvironmentUtil.h> + #import <objc/runtime.h> NS_ASSUME_NONNULL_BEGIN @@ -200,8 +202,18 @@ static BOOL isIOS9orLater() { + (nullable instancetype)sharedInstance { static dispatch_once_t onceToken; static FIRAuthAppDelegateProxy *_Nullable sharedInstance; + // iOS App extensions should not call [UIApplication sharedApplication], even if UIApplication + // responds to it. + static Class applicationClass = nil; + if (![FIRAppEnvironmentUtil isAppExtension]) { + Class cls = NSClassFromString(@"UIApplication"); + if (cls && [cls respondsToSelector:NSSelectorFromString(@"sharedApplication")]) { + applicationClass = cls; + } + } + UIApplication *application = [applicationClass sharedApplication]; dispatch_once(&onceToken, ^{ - sharedInstance = [[self alloc] initWithApplication:[UIApplication sharedApplication]]; + sharedInstance = [[self alloc] initWithApplication:application]; }); return sharedInstance; } diff --git a/Firebase/Auth/Source/FIRAuthDefaultUIDelegate.m b/Firebase/Auth/Source/FIRAuthDefaultUIDelegate.m index a00d0e9..e5aa7f4 100644 --- a/Firebase/Auth/Source/FIRAuthDefaultUIDelegate.m +++ b/Firebase/Auth/Source/FIRAuthDefaultUIDelegate.m @@ -16,6 +16,8 @@ #import "FIRAuthDefaultUIDelegate.h" +#import <FirebaseCore/FIRAppEnvironmentUtil.h> + NS_ASSUME_NONNULL_BEGIN @interface FIRAuthDefaultUIDelegate () @@ -58,8 +60,17 @@ NS_ASSUME_NONNULL_BEGIN } + (id<FIRAuthUIDelegate>)defaultUIDelegate { - UIViewController *topViewController = - [UIApplication sharedApplication].keyWindow.rootViewController; + // iOS App extensions should not call [UIApplication sharedApplication], even if UIApplication + // responds to it. + static Class applicationClass = nil; + if (![FIRAppEnvironmentUtil isAppExtension]) { + Class cls = NSClassFromString(@"UIApplication"); + if (cls && [cls respondsToSelector:NSSelectorFromString(@"sharedApplication")]) { + applicationClass = cls; + } + } + UIApplication *application = [applicationClass sharedApplication]; + UIViewController *topViewController = application.keyWindow.rootViewController; while (true){ if (topViewController.presentedViewController) { topViewController = topViewController.presentedViewController; diff --git a/FirebaseAuth.podspec b/FirebaseAuth.podspec index 48a9354..754e172 100644 --- a/FirebaseAuth.podspec +++ b/FirebaseAuth.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'FirebaseAuth' - s.version = '5.0.0' + s.version = '5.0.1' s.summary = 'The official iOS client for Firebase Authentication (plus community support for macOS and tvOS)' s.description = <<-DESC diff --git a/scripts/push-pods.sh b/scripts/push-pods.sh index 73d2f48..ed34d79 100755 --- a/scripts/push-pods.sh +++ b/scripts/push-pods.sh @@ -22,7 +22,7 @@ # investigation. pod cache clean FirebaseCore --all -#pod cache clean FirebaseAuth --all +pod cache clean FirebaseAuth --all #pod cache clean FirebaseDatabase --all pod cache clean FirebaseFirestore --all #pod cache clean FirebaseFunctions --all @@ -30,7 +30,7 @@ pod cache clean FirebaseMessaging --all #pod cache clean FirebaseStorage --all pod repo push cpdc-internal-spec FirebaseCore.podspec -#pod repo push cpdc-internal-spec FirebaseAuth.podspec +pod repo push cpdc-internal-spec FirebaseAuth.podspec #pod repo push cpdc-internal-spec FirebaseDatabase.podspec pod repo push cpdc-internal-spec FirebaseFirestore.podspec --allow-warnings #pod repo push cpdc-internal-spec FirebaseFunctions.podspec diff --git a/scripts/update-tags.sh b/scripts/update-tags.sh index 47ffa13..d29fb5c 100755 --- a/scripts/update-tags.sh +++ b/scripts/update-tags.sh @@ -29,7 +29,7 @@ git push --delete origin '5.2.0' git push --delete origin 'Core-5.0.3' -#git push --delete origin 'Auth-5.0.0' +git push --delete origin 'Auth-5.0.1' #git push --delete origin 'Database-5.0.1' git push --delete origin 'Firestore-0.12.3' #git push --delete origin 'Functions-2.0.0' @@ -40,7 +40,7 @@ git push --delete origin 'Messaging-3.0.2' git tag --delete '5.2.0' git tag --delete 'Core-5.0.3' -#git tag --delete 'Auth-5.0.0' +git tag --delete 'Auth-5.0.1' #git tag --delete 'Database-5.0.1' git tag --delete 'Firestore-0.12.3' #git tag --delete 'Functions-2.0.0' @@ -51,7 +51,7 @@ git tag --delete 'Messaging-3.0.2' git tag '5.2.0' git tag 'Core-5.0.3' -#git tag 'Auth-5.0.0' +git tag 'Auth-5.0.1' # git tag 'Database-5.0.1' git tag 'Firestore-0.12.3' #git tag 'Functions-2.0.0' |