diff options
Diffstat (limited to 'Firebase')
34 files changed, 167 insertions, 132 deletions
diff --git a/Firebase/Auth/Source/FIRAuth.m b/Firebase/Auth/Source/FIRAuth.m index ad363e0..ebca6c8 100644 --- a/Firebase/Auth/Source/FIRAuth.m +++ b/Firebase/Auth/Source/FIRAuth.m @@ -657,12 +657,29 @@ static NSMutableDictionary *gKeychainServiceNameForAppName; isReauthentication ? FIRAuthOperationTypeReauth : FIRAuthOperationTypeSignUpOrSignIn; [self signInWithPhoneCredential:phoneCredential operation:operation - callback:^(FIRUser *_Nullable user, + callback:^(FIRVerifyPhoneNumberResponse *_Nullable response, NSError *_Nullable error) { if (callback) { - FIRAuthDataResult *result = user ? - [[FIRAuthDataResult alloc] initWithUser:user additionalUserInfo:nil] : nil; - callback(result, error); + if (error) { + callback(nil, error); + return; + } + + [self completeSignInWithAccessToken:response.IDToken + accessTokenExpirationDate:response.approximateExpirationDate + refreshToken:response.refreshToken + anonymous:NO + callback:^(FIRUser *_Nullable user, NSError *_Nullable error) { + FIRAdditionalUserInfo *additionalUserInfo = + [[FIRAdditionalUserInfo alloc] initWithProviderID:FIRPhoneAuthProviderID + profile:nil + username:nil + isNewUser:response.isNewUser]; + FIRAuthDataResult *result = user ? + [[FIRAuthDataResult alloc] initWithUser:user + additionalUserInfo:additionalUserInfo] : nil; + callback(result, error); + }]; } }]; return; @@ -1143,14 +1160,14 @@ static NSMutableDictionary *gKeychainServiceNameForAppName; */ - (void)signInWithPhoneCredential:(FIRPhoneAuthCredential *)credential operation:(FIRAuthOperationType)operation - callback:(FIRAuthResultCallback)callback { + callback:(FIRVerifyPhoneNumberResponseCallback)callback { if (credential.temporaryProof.length && credential.phoneNumber.length) { FIRVerifyPhoneNumberRequest *request = [[FIRVerifyPhoneNumberRequest alloc] initWithTemporaryProof:credential.temporaryProof phoneNumber:credential.phoneNumber operation:operation requestConfiguration:_requestConfiguration]; - [self phoneNumberSignInWithRequest:request callback:callback]; + [FIRAuthBackend verifyPhoneNumber:request callback:callback]; return; } @@ -1167,32 +1184,9 @@ static NSMutableDictionary *gKeychainServiceNameForAppName; verificationCode:credential.verificationCode operation:operation requestConfiguration:_requestConfiguration]; - [self phoneNumberSignInWithRequest:request callback:callback]; + [FIRAuthBackend verifyPhoneNumber:request callback:callback]; } - -/** @fn phoneNumberSignInWithVerificationID:pasverificationCodesword:callback: - @brief Signs in using a FIRVerifyPhoneNumberRequest object. - @param request THe FIRVerifyPhoneNumberRequest request object. - @param callback A block which is invoked when the sign in finishes (or is cancelled.) Invoked - asynchronously on the global auth work queue in the future. - */ -- (void)phoneNumberSignInWithRequest:(FIRVerifyPhoneNumberRequest *)request - callback:(FIRAuthResultCallback)callback { - [FIRAuthBackend verifyPhoneNumber:request - callback:^(FIRVerifyPhoneNumberResponse *_Nullable response, - NSError *_Nullable error) { - if (error) { - callback(nil, error); - return; - } - [self completeSignInWithAccessToken:response.IDToken - accessTokenExpirationDate:response.approximateExpirationDate - refreshToken:response.refreshToken - anonymous:NO - callback:callback]; - }]; -} #endif /** @fn internalSignInAndRetrieveDataWithCustomToken:completion: diff --git a/Firebase/Auth/Source/FIRAuthAPNSTokenManager.m b/Firebase/Auth/Source/FIRAuthAPNSTokenManager.m index 7775305..215a391 100644 --- a/Firebase/Auth/Source/FIRAuthAPNSTokenManager.m +++ b/Firebase/Auth/Source/FIRAuthAPNSTokenManager.m @@ -73,7 +73,9 @@ static const NSTimeInterval kLegacyRegistrationTimeout = 30; } else { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" +#if TARGET_OS_IOS [_application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert]; +#endif // TARGET_OS_IOS #pragma clang diagnostic pop } }); diff --git a/Firebase/Auth/Source/RPCs/FIRCreateAuthURIResponse.m b/Firebase/Auth/Source/RPCs/FIRCreateAuthURIResponse.m index c6b9d03..12ef97c 100644 --- a/Firebase/Auth/Source/RPCs/FIRCreateAuthURIResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRCreateAuthURIResponse.m @@ -16,8 +16,6 @@ #import "FIRCreateAuthURIResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRCreateAuthURIResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRDeleteAccountResponse.m b/Firebase/Auth/Source/RPCs/FIRDeleteAccountResponse.m index 671a41f..ae98175 100644 --- a/Firebase/Auth/Source/RPCs/FIRDeleteAccountResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRDeleteAccountResponse.m @@ -16,8 +16,6 @@ #import "FIRDeleteAccountResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRDeleteAccountResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeResponse.m b/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeResponse.m index bd028f1..0b6c416 100644 --- a/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeResponse.m @@ -16,8 +16,6 @@ #import "FIRGetOOBConfirmationCodeResponse.h" -#import "FIRAuthErrorUtils.h" - NS_ASSUME_NONNULL_BEGIN /** @var kOOBCodeKey diff --git a/Firebase/Auth/Source/RPCs/FIRResetPasswordResponse.m b/Firebase/Auth/Source/RPCs/FIRResetPasswordResponse.m index 9a1556b..6092cfe 100644 --- a/Firebase/Auth/Source/RPCs/FIRResetPasswordResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRResetPasswordResponse.m @@ -16,8 +16,6 @@ #import "FIRResetPasswordResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRResetPasswordResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRSetAccountInfoResponse.m b/Firebase/Auth/Source/RPCs/FIRSetAccountInfoResponse.m index 6e228eb..ff9c7a6 100644 --- a/Firebase/Auth/Source/RPCs/FIRSetAccountInfoResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRSetAccountInfoResponse.m @@ -16,8 +16,6 @@ #import "FIRSetAccountInfoResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRSetAccountInfoResponseProviderUserInfo - (instancetype)initWithDictionary:(NSDictionary *)dictionary { diff --git a/Firebase/Auth/Source/RPCs/FIRSignUpNewUserResponse.m b/Firebase/Auth/Source/RPCs/FIRSignUpNewUserResponse.m index 7e58c5d..2071e07 100644 --- a/Firebase/Auth/Source/RPCs/FIRSignUpNewUserResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRSignUpNewUserResponse.m @@ -16,8 +16,6 @@ #import "FIRSignUpNewUserResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRSignUpNewUserResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRVerifyAssertionResponse.m b/Firebase/Auth/Source/RPCs/FIRVerifyAssertionResponse.m index 8c970c8..5ee39fa 100644 --- a/Firebase/Auth/Source/RPCs/FIRVerifyAssertionResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRVerifyAssertionResponse.m @@ -16,8 +16,6 @@ #import "FIRVerifyAssertionResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRVerifyAssertionResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRVerifyCustomTokenResponse.m b/Firebase/Auth/Source/RPCs/FIRVerifyCustomTokenResponse.m index 8a87141..b6c3818 100644 --- a/Firebase/Auth/Source/RPCs/FIRVerifyCustomTokenResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRVerifyCustomTokenResponse.m @@ -16,8 +16,6 @@ #import "FIRVerifyCustomTokenResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRVerifyCustomTokenResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRVerifyPasswordResponse.m b/Firebase/Auth/Source/RPCs/FIRVerifyPasswordResponse.m index d2c4a7c..71b4edd 100644 --- a/Firebase/Auth/Source/RPCs/FIRVerifyPasswordResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRVerifyPasswordResponse.m @@ -16,8 +16,6 @@ #import "FIRVerifyPasswordResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRVerifyPasswordResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Core/CHANGELOG.md b/Firebase/Core/CHANGELOG.md new file mode 100644 index 0000000..18e956d --- /dev/null +++ b/Firebase/Core/CHANGELOG.md @@ -0,0 +1,28 @@ +# Unreleased +- [changed] Removed AppKit dependency for community macOS build. + +# 2017-11-30 -- v4.0.12 -- M20.2 +- [fixed] Removed `FIR_SWIFT_NAME` macro, replaced with proper `NS_SWIFT_NAME`. + +# 2017-11-14 -- v4.0.11 -- M20.1 +- [feature] Added `-FIRLoggerForceSTDERR` launch argument flag to force STDERR + output for all Firebase logging + +# 2017-08-25 -- v4.0.6 -- M18.1 +- [changed] Removed unused method + +# 2017-08-09 -- v4.0.5 -- M18.0 +- [changed] Log an error for an incorrectly configured bundle ID instead of an info + message. + +# 2017-07-12 -- v4.0.4 -- M17.4 +- [changed] Switched to using the https://cocoapods.org/pods/nanopb pod instead of + linking nanopb in (preventing linker conflicts). + +# 2017-06-06 -- v4.0.1 -- M17.1 +- [fixed] Improved diagnostic messages for Swift + +# 2017-05-17 -- v4.0.0 -- M17 +- [changed] Update FIROptions to have a simpler constructor and mutable properties +- [feature] Swift naming update, FIR prefix dropped +- [changed] Internal cleanup for open source release diff --git a/Firebase/Core/FIRApp.m b/Firebase/Core/FIRApp.m index 800d180..b5e043f 100644 --- a/Firebase/Core/FIRApp.m +++ b/Firebase/Core/FIRApp.m @@ -368,7 +368,9 @@ static FIRApp *sDefaultApp; NSLocalizedRecoverySuggestionErrorKey : @"Check formatting and location of GoogleService-Info.plist." }; - return FIRCreateError(kFirebaseCoreErrorDomain, FIRErrorCodeInvalidPlistFile, errorDict); + return [NSError errorWithDomain:kFirebaseCoreErrorDomain + code:FIRErrorCodeInvalidPlistFile + userInfo:errorDict]; } + (NSError *)errorForSubspecConfigurationFailureWithDomain:(NSString *)domain @@ -379,7 +381,9 @@ static FIRApp *sDefaultApp; [NSString stringWithFormat:@"Configuration failed for service %@.", service]; NSDictionary *errorDict = @{NSLocalizedDescriptionKey : description, NSLocalizedFailureReasonErrorKey : reason}; - return FIRCreateError(domain, code, errorDict); + return [NSError errorWithDomain:domain + code:code + userInfo:errorDict]; } + (NSError *)errorForInvalidAppID { @@ -389,7 +393,9 @@ static FIRApp *sDefaultApp; @"Check formatting and location of GoogleService-Info.plist or GoogleAppID set in the " @"customized options." }; - return FIRCreateError(kFirebaseCoreErrorDomain, FIRErrorCodeInvalidAppID, errorDict); + return [NSError errorWithDomain:kFirebaseCoreErrorDomain + code:FIRErrorCodeInvalidAppID + userInfo:errorDict]; } + (BOOL)isDefaultAppConfigured { diff --git a/Firebase/Core/FIRErrors.m b/Firebase/Core/FIRErrors.m index 3c7e39a..6d6d52d 100644 --- a/Firebase/Core/FIRErrors.m +++ b/Firebase/Core/FIRErrors.m @@ -27,7 +27,3 @@ NSString *const kFirebaseDurableDeepLinkErrorDomain = @"com.firebase.durabledeep NSString *const kFirebaseInstanceIDErrorDomain = @"com.firebase.instanceid"; NSString *const kFirebasePerfErrorDomain = @"com.firebase.perf"; NSString *const kFirebaseStorageErrorDomain = @"com.firebase.storage"; - -NSError *FIRCreateError(NSString *domain, enum FIRErrorCode code, NSDictionary *userInfo) { - return [NSError errorWithDomain:domain code:code userInfo:userInfo]; -} diff --git a/Firebase/Core/FIRLogger.m b/Firebase/Core/FIRLogger.m index ba22bde..69929fd 100644 --- a/Firebase/Core/FIRLogger.m +++ b/Firebase/Core/FIRLogger.m @@ -15,6 +15,7 @@ #import "Private/FIRLogger.h" #import "FIRLoggerLevel.h" +#import "Private/FIRVersion.h" #import "third_party/FIRAppEnvironmentUtil.h" #include <asl.h> @@ -164,13 +165,13 @@ void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel) { return; } FIRLoggerInitializeASL(); - dispatch_async(sFIRClientQueue, ^{ - // We should not raise the logger level if we are running from App Store. - if (loggerLevel >= FIRLoggerLevelNotice && [FIRAppEnvironmentUtil isFromAppStore]) { - return; - } + // We should not raise the logger level if we are running from App Store. + if (loggerLevel >= FIRLoggerLevelNotice && [FIRAppEnvironmentUtil isFromAppStore]) { + return; + } - sFIRLoggerMaximumLevel = loggerLevel; + sFIRLoggerMaximumLevel = loggerLevel; + dispatch_async(sFIRClientQueue, ^{ asl_set_filter(sFIRLoggerClient, ASL_FILTER_MASK_UPTO(loggerLevel)); }); } @@ -229,7 +230,7 @@ void FIRLogBasic(FIRLoggerLevel level, NSCAssert(numberOfMatches == 1, @"Incorrect message code format."); #endif NSString *logMsg = [[NSString alloc] initWithFormat:message arguments:args_ptr]; - logMsg = [NSString stringWithFormat:@"%@[%@] %@", service, messageCode, logMsg]; + logMsg = [NSString stringWithFormat:@"%s - %@[%@] %@", FirebaseVersionString, service, messageCode, logMsg]; dispatch_async(sFIRClientQueue, ^{ asl_log(sFIRLoggerClient, NULL, level, "%s", logMsg.UTF8String); }); diff --git a/Firebase/Core/FIRNetworkURLSession.m b/Firebase/Core/FIRNetworkURLSession.m index d9c6f3a..c3da674 100644 --- a/Firebase/Core/FIRNetworkURLSession.m +++ b/Firebase/Core/FIRNetworkURLSession.m @@ -428,6 +428,7 @@ - (NSURLSessionConfiguration *)backgroundSessionConfigWithSessionID:(NSString *)sessionID { #if (TARGET_OS_OSX && defined(MAC_OS_X_VERSION_10_10) && \ MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10) || \ + TARGET_OS_TV || \ (TARGET_OS_IOS && defined(__IPHONE_8_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0) // iOS 8/10.10 builds require the new backgroundSessionConfiguration method name. diff --git a/Firebase/Core/FIROptions.m b/Firebase/Core/FIROptions.m index 841c70b..b60ccdd 100644 --- a/Firebase/Core/FIROptions.m +++ b/Firebase/Core/FIROptions.m @@ -42,7 +42,7 @@ NSString *const kFIRIsSignInEnabled = @"IS_SIGNIN_ENABLED"; NSString *const kFIRLibraryVersionID = @"4" // Major version (one or more digits) @"00" // Minor version (exactly 2 digits) - @"12" // Build number (exactly 2 digits) + @"13" // Build number (exactly 2 digits) @"000"; // Fixed "000" // Plist file name. NSString *const kServiceInfoFileName = @"GoogleService-Info"; diff --git a/Firebase/Core/FIRReachabilityChecker.m b/Firebase/Core/FIRReachabilityChecker.m index 733dffe..cac87ff 100644 --- a/Firebase/Core/FIRReachabilityChecker.m +++ b/Firebase/Core/FIRReachabilityChecker.m @@ -177,7 +177,7 @@ static NSString *const kFIRReachabilityDisconnectedStatus = @"Disconnected"; // Reachable flag is set. Check further flags. if (!(flags & kSCNetworkReachabilityFlagsConnectionRequired)) { // Connection required flag is not set, so we have connectivity. -#if TARGET_OS_IOS +#if TARGET_OS_IOS || TARGET_OS_TV status = (flags & kSCNetworkReachabilityFlagsIsWWAN) ? kFIRReachabilityViaCellular : kFIRReachabilityViaWifi; #elif TARGET_OS_OSX @@ -188,7 +188,7 @@ static NSString *const kFIRReachabilityDisconnectedStatus = @"Disconnected"; !(flags & kSCNetworkReachabilityFlagsInterventionRequired)) { // If the connection on demand or connection on traffic flag is set, and user intervention // is not required, we have connectivity. -#if TARGET_OS_IOS +#if TARGET_OS_IOS || TARGET_OS_TV status = (flags & kSCNetworkReachabilityFlagsIsWWAN) ? kFIRReachabilityViaCellular : kFIRReachabilityViaWifi; #elif TARGET_OS_OSX diff --git a/Firebase/Core/FIRVersion.m b/Firebase/Core/FIRVersion.m new file mode 100644 index 0000000..8186683 --- /dev/null +++ b/Firebase/Core/FIRVersion.m @@ -0,0 +1,39 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +#ifndef Firebase_VERSION +#error "Firebase_VERSION is not defined: add -DFirebase_VERSION=... to the build invocation" +#endif + +#ifndef FIRCore_VERSION +#error "FIRCore_VERSION is not defined: add -DFIRCore_VERSION=... to the build invocation" +#endif + + +// The following two macros supply the incantation so that the C +// preprocessor does not try to parse the version as a floating +// point number. See +// https://www.guyrutenberg.com/2008/12/20/expanding-macros-into-string-constants-in-c/ +#define STR(x) STR_EXPAND(x) +#define STR_EXPAND(x) #x + +const unsigned char *const FirebaseVersionString = + (const unsigned char *const)STR(Firebase_VERSION); + +const unsigned char *const FirebaseCoreVersionString = + (const unsigned char *const)STR(FIRCore_VERSION); diff --git a/Firebase/Core/Private/FIRErrors.h b/Firebase/Core/Private/FIRErrors.h index 9a03575..cf69252 100644 --- a/Firebase/Core/Private/FIRErrors.h +++ b/Firebase/Core/Private/FIRErrors.h @@ -31,13 +31,3 @@ extern NSString *const kFirebaseDurableDeepLinkErrorDomain; extern NSString *const kFirebaseInstanceIDErrorDomain; extern NSString *const kFirebasePerfErrorDomain; extern NSString *const kFirebaseStorageErrorDomain; - -/** - * Factory for a NSError in the Firebase error domain. - * - * @param domain Domain of Firebase error. - * @param code Error code that NSError should have. - * @param userInfo User info that NSError should have. - * @return An NSError in the Firebase domain. - */ -extern NSError *FIRCreateError(NSString *domain, FIRErrorCode code, NSDictionary *userInfo); diff --git a/Firebase/Core/Private/FIRVersion.h b/Firebase/Core/Private/FIRVersion.h new file mode 100644 index 0000000..f18f61f --- /dev/null +++ b/Firebase/Core/Private/FIRVersion.h @@ -0,0 +1,23 @@ +/* + * Copyright 2017 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import <Foundation/Foundation.h> + +/** The version of the Firebase SDK. */ +FOUNDATION_EXPORT const unsigned char *const FirebaseVersionString; + +/** The version of the FirebaseCore Component. */ +FOUNDATION_EXPORT const unsigned char *const FirebaseCoreVersionString; diff --git a/Firebase/Core/third_party/FIRAppEnvironmentUtil.h b/Firebase/Core/third_party/FIRAppEnvironmentUtil.h index 7ae9827..09ee504 100644 --- a/Firebase/Core/third_party/FIRAppEnvironmentUtil.h +++ b/Firebase/Core/third_party/FIRAppEnvironmentUtil.h @@ -16,12 +16,6 @@ #import <Foundation/Foundation.h> -#if TARGET_OS_IOS -#import <UIKit/UIKit.h> -#elif TARGET_OS_OSX -#import <AppKit/AppKit.h> -#endif - @interface FIRAppEnvironmentUtil : NSObject /// Indicates whether the app is from Apple Store or not. Returns NO if the app is on simulator, @@ -46,12 +40,4 @@ /// Indicates whether it is running inside an extension or an app. + (BOOL)isAppExtension; -#if TARGET_OS_IOS -/// Returns the [UIApplication sharedApplication] if it is running on an app, not an extension. -+ (UIApplication *)sharedApplication; -#elif TARGET_OS_OSX -/// Returns the [NSApplication sharedApplication]. -+ (NSApplication *)sharedApplication; -#endif - @end diff --git a/Firebase/Core/third_party/FIRAppEnvironmentUtil.m b/Firebase/Core/third_party/FIRAppEnvironmentUtil.m index fe4e23d..90e66f0 100644 --- a/Firebase/Core/third_party/FIRAppEnvironmentUtil.m +++ b/Firebase/Core/third_party/FIRAppEnvironmentUtil.m @@ -13,6 +13,9 @@ // limitations under the License. #import <Foundation/Foundation.h> +#if TARGET_OS_IOS || TARGET_OS_TV +#import <UIKit/UIKit.h> +#endif #import "FIRAppEnvironmentUtil.h" @@ -174,7 +177,7 @@ static BOOL isAppEncrypted() { } + (BOOL)hasEmbeddedMobileProvision { - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV return [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"].length > 0; #elif TARGET_OS_OSX return NO; @@ -182,7 +185,7 @@ static BOOL isAppEncrypted() { } + (BOOL)isSimulator { - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV NSString *platform = [FIRAppEnvironmentUtil deviceModel]; return [platform isEqual:@"x86_64"] || [platform isEqual:@"i386"]; #elif TARGET_OS_OSX @@ -204,7 +207,7 @@ static BOOL isAppEncrypted() { } + (NSString *)systemVersion { - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV return [UIDevice currentDevice].systemVersion; #elif TARGET_OS_OSX return [NSProcessInfo processInfo].operatingSystemVersionString; @@ -212,7 +215,7 @@ static BOOL isAppEncrypted() { } + (BOOL)isAppExtension { - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV // Documented by <a href="https://goo.gl/RRB2Up">Apple</a> BOOL appExtension = [[[NSBundle mainBundle] bundlePath] hasSuffix:@".appex"]; return appExtension; @@ -221,29 +224,10 @@ static BOOL isAppEncrypted() { #endif } -#if TARGET_OS_IOS -+ (UIApplication *)sharedApplication { - if ([FIRAppEnvironmentUtil isAppExtension]) { - return nil; - } - id sharedApplication = nil; - Class uiApplicationClass = NSClassFromString(@"UIApplication"); - if (uiApplicationClass && - [uiApplicationClass respondsToSelector:(NSSelectorFromString(@"sharedApplication"))]) { - sharedApplication = [uiApplicationClass sharedApplication]; - } - return sharedApplication; -} -#elif TARGET_OS_OSX -+ (NSApplication *)sharedApplication { - return [NSApplication sharedApplication]; -} -#endif - #pragma mark - Helper methods + (BOOL)hasSCInfoFolder { - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV NSString *bundlePath = [NSBundle mainBundle].bundlePath; NSString *scInfoPath = [bundlePath stringByAppendingPathComponent:@"SC_Info"]; return [[NSFileManager defaultManager] fileExistsAtPath:scInfoPath]; diff --git a/Firebase/Database/CHANGELOG.md b/Firebase/Database/CHANGELOG.md index 867def1..a878ebe 100644 --- a/Firebase/Database/CHANGELOG.md +++ b/Firebase/Database/CHANGELOG.md @@ -1,3 +1,6 @@ +# v4.1.3 +- [changed] Internal cleanup in the firebase-ios-sdk repository. Functionality of the RTDB SDK is not affected. + # v4.1.2 - [fixed] Addresses race condition that can occur during the initialization of empty snapshots. diff --git a/Firebase/Database/Core/FPersistentConnection.m b/Firebase/Database/Core/FPersistentConnection.m index 6f71d8b..870727c 100644 --- a/Firebase/Database/Core/FPersistentConnection.m +++ b/Firebase/Database/Core/FPersistentConnection.m @@ -925,7 +925,7 @@ static void reachabilityCallback(SCNetworkReachabilityRef ref, SCNetworkReachabi - (void) sendConnectStats { NSMutableDictionary *stats = [NSMutableDictionary dictionary]; - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV if (self.config.persistenceEnabled) { stats[@"persistence.ios.enabled"] = @1; } diff --git a/Firebase/Database/Core/FRepo.m b/Firebase/Database/Core/FRepo.m index 0935b44..1c4b956 100644 --- a/Firebase/Database/Core/FRepo.m +++ b/Firebase/Database/Core/FRepo.m @@ -53,7 +53,7 @@ #import "FValueEventRegistration.h" #import "FEmptyNode.h" -#if TARGET_OS_IOS +#if TARGET_OS_IOS || TARGET_OS_TV #import <UIKit/UIKit.h> #endif @@ -546,7 +546,7 @@ return; // Targetted compilation is ONLY for testing. UIKit is weak-linked in actual release build. - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV // The idea is to wait until any outstanding sets get written to disk. Since the sets might still be in our // dispatch queue, we wait for the dispatch queue to catch up and for persistence to catch up. // This may be undesirable though. The dispatch queue might just be processing a bunch of incoming data or diff --git a/Firebase/Database/Persistence/FLevelDBStorageEngine.m b/Firebase/Database/Persistence/FLevelDBStorageEngine.m index 490fb6c..7de9ebf 100644 --- a/Firebase/Database/Persistence/FLevelDBStorageEngine.m +++ b/Firebase/Database/Persistence/FLevelDBStorageEngine.m @@ -211,7 +211,7 @@ static NSString* trackedQueryKeysKey(NSUInteger trackedQueryId, NSString *key) { } + (NSString *) firebaseDir { - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDir = [dirPaths objectAtIndex:0]; return [documentsDir stringByAppendingPathComponent:@"firebase"]; diff --git a/Firebase/Database/Realtime/FWebSocketConnection.m b/Firebase/Database/Realtime/FWebSocketConnection.m index 0fd07e5..49d6bd8 100644 --- a/Firebase/Database/Realtime/FWebSocketConnection.m +++ b/Firebase/Database/Realtime/FWebSocketConnection.m @@ -25,7 +25,7 @@ #import "FStringUtilities.h" #import "FIRDatabase_Private.h" -#if TARGET_OS_IOS +#if TARGET_OS_IOS || TARGET_OS_TV #import <UIKit/UIKit.h> #endif @@ -85,7 +85,7 @@ BOOL hasUiDeviceClass = NO; // Targetted compilation is ONLY for testing. UIKit is weak-linked in actual release build. - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV Class uiDeviceClass = NSClassFromString(@"UIDevice"); if (uiDeviceClass) { systemVersion = [uiDeviceClass currentDevice].systemVersion; diff --git a/Firebase/Database/third_party/SocketRocket/FSRWebSocket.m b/Firebase/Database/third_party/SocketRocket/FSRWebSocket.m index a2c857b..c80dbb0 100644 --- a/Firebase/Database/third_party/SocketRocket/FSRWebSocket.m +++ b/Firebase/Database/third_party/SocketRocket/FSRWebSocket.m @@ -18,7 +18,7 @@ #import "FSRWebSocket.h" -#if TARGET_OS_IOS +#if TARGET_OS_IOS || TARGET_OS_TV #define HAS_ICU #endif @@ -28,7 +28,7 @@ #import <unicode/utf8.h> #endif -#if TARGET_OS_IOS +#if TARGET_OS_IOS || TARGET_OS_TV #import <Endian.h> #elif TARGET_OS_OSX #import <CoreServices/CoreServices.h> diff --git a/Firebase/Messaging/FIRMessaging.m b/Firebase/Messaging/FIRMessaging.m index 23feee9..782b779 100644 --- a/Firebase/Messaging/FIRMessaging.m +++ b/Firebase/Messaging/FIRMessaging.m @@ -384,6 +384,7 @@ NSString * const FIRMessagingRegistrationTokenRefreshedNotification = id<UIApplicationDelegate> appDelegate = application.delegate; SEL continueUserActivitySelector = @selector(application:continueUserActivity:restorationHandler:); + SEL openURLWithOptionsSelector = @selector(application:openURL:options:); SEL openURLWithSourceApplicationSelector = @selector(application:openURL:sourceApplication:annotation:); SEL handleOpenURLSelector = @selector(application:handleOpenURL:); @@ -402,7 +403,7 @@ NSString * const FIRMessagingRegistrationTokenRefreshedNotification = // Do nothing, as we don't support the app calling this block }]; - } else if (@available(iOS 9.0, *)) { + } else if ([appDelegate respondsToSelector:openURLWithOptionsSelector]) { [appDelegate application:application openURL:url options:@{}]; // Similarly, |application:openURL:sourceApplication:annotation:| will also always be called, due @@ -726,7 +727,7 @@ NSString * const FIRMessagingRegistrationTokenRefreshedNotification = - (void)receiver:(FIRMessagingReceiver *)receiver receivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage { - if (@available(iOS 10.0, *)) { + if ([self.delegate respondsToSelector:@selector(messaging:didReceiveMessage:)]) { [self.delegate messaging:self didReceiveMessage:remoteMessage]; } else if ([self.delegate respondsToSelector:@selector(applicationReceivedRemoteMessage:)]) { #pragma clang diagnostic push diff --git a/Firebase/Messaging/FIRMessagingContextManagerService.m b/Firebase/Messaging/FIRMessagingContextManagerService.m index dffd6ae..232587f 100644 --- a/Firebase/Messaging/FIRMessagingContextManagerService.m +++ b/Firebase/Messaging/FIRMessagingContextManagerService.m @@ -143,7 +143,7 @@ typedef NS_ENUM(NSUInteger, FIRMessagingContextManagerMessageType) { } if ([apsDictionary[kFIRMessagingContextManagerTitleKey] length]) { // |alertTitle| is iOS 8.2+, so check if we can set it - if (@available(iOS 8.2, *)) { + if ([notification respondsToSelector:@selector(setAlertTitle:)]) { notification.alertTitle = apsDictionary[kFIRMessagingContextManagerTitleKey]; } } diff --git a/Firebase/Messaging/FIRMessagingRmq2PersistentStore.m b/Firebase/Messaging/FIRMessagingRmq2PersistentStore.m index e468333..189f366 100644 --- a/Firebase/Messaging/FIRMessagingRmq2PersistentStore.m +++ b/Firebase/Messaging/FIRMessagingRmq2PersistentStore.m @@ -104,13 +104,9 @@ typedef void(^FCMOutgoingRmqMessagesTableHandler)(int64_t rmqId, int8_t tag, NSD // Utility to create an NSString from a sqlite3 result code NSString * _Nonnull FIRMessagingStringFromSQLiteResult(int result) { - const char *errorStr; - if (@available(iOS 8.2, *)) { - errorStr = sqlite3_errstr(result); - } else { - errorStr = "pre iOS 8.2"; - } - return [NSString stringWithFormat:@"%d - %s", result, errorStr]; + const char *errorStr = sqlite3_errstr(result); + NSString *errorString = [NSString stringWithFormat:@"%d - %s", result, errorStr]; + return errorString; } @interface FIRMessagingRmq2PersistentStore () { diff --git a/Firebase/Storage/CHANGELOG.md b/Firebase/Storage/CHANGELOG.md index 00fc3b7..3786de6 100644 --- a/Firebase/Storage/CHANGELOG.md +++ b/Firebase/Storage/CHANGELOG.md @@ -1,3 +1,6 @@ +# v2.1.1 +- [changed] Internal cleanup in the firebase-ios-sdk repository. Functionality of the Storage SDK is not affected. + # v2.1.0 - [added] Added 'md5Hash' to FIRStorageMetadata. diff --git a/Firebase/Storage/FIRStorageUtils.m b/Firebase/Storage/FIRStorageUtils.m index 216b4b6..bc517ff 100644 --- a/Firebase/Storage/FIRStorageUtils.m +++ b/Firebase/Storage/FIRStorageUtils.m @@ -14,7 +14,7 @@ #import <Foundation/Foundation.h> -#if TARGET_OS_IOS +#if TARGET_OS_IOS || TARGET_OS_TV #import <MobileCoreServices/MobileCoreServices.h> #elif TARGET_OS_OSX #import <CoreServices/CoreServices.h> |