diff options
Diffstat (limited to 'Firebase')
-rw-r--r-- | Firebase/Auth/Source/Public/FIRAuth.h | 2 | ||||
-rw-r--r-- | Firebase/Core/CHANGELOG.md | 2 | ||||
-rw-r--r-- | Firebase/Core/FIRApp.m | 24 | ||||
-rw-r--r-- | Firebase/Core/FIRConfiguration.m | 6 | ||||
-rw-r--r-- | Firebase/Core/FIROptions.m | 39 | ||||
-rw-r--r-- | Firebase/Core/Public/FIRApp.h | 13 | ||||
-rw-r--r-- | Firebase/Core/Public/FIRConfiguration.h | 28 | ||||
-rw-r--r-- | Firebase/Core/Public/FIROptions.h | 19 | ||||
-rw-r--r-- | Firebase/Core/third_party/FIRAppEnvironmentUtil.m | 7 | ||||
-rw-r--r-- | Firebase/Database/Core/FPersistentConnection.m | 16 | ||||
-rw-r--r-- | Firebase/Database/Core/FRepo.m | 4 | ||||
-rw-r--r-- | Firebase/Messaging/FIRMessaging.m | 12 | ||||
-rw-r--r-- | Firebase/Messaging/FIRMessagingPubSub.h | 4 | ||||
-rw-r--r-- | Firebase/Messaging/Public/FIRMessaging.h | 81 |
14 files changed, 59 insertions, 198 deletions
diff --git a/Firebase/Auth/Source/Public/FIRAuth.h b/Firebase/Auth/Source/Public/FIRAuth.h index 7d5ea42..236dd10 100644 --- a/Firebase/Auth/Source/Public/FIRAuth.h +++ b/Firebase/Auth/Source/Public/FIRAuth.h @@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN /** @typedef FIRUserUpdateCallback - @brief The type of block invoked when a request to update a current user is completed. + @brief The type of block invoked when a request to update the current user is completed. */ typedef void (^FIRUserUpdateCallback)(NSError *_Nullable error) NS_SWIFT_NAME(UserUpdateCallback); diff --git a/Firebase/Core/CHANGELOG.md b/Firebase/Core/CHANGELOG.md index 4289cae..f4707ea 100644 --- a/Firebase/Core/CHANGELOG.md +++ b/Firebase/Core/CHANGELOG.md @@ -1,4 +1,6 @@ # Unreleased +- [changed] Removed `UIKit` import from `FIRApp.h`. +- [changed] Removed deprecated methods. # 2018-03-06 -- v4.0.16 -- M22 - [changed] Addresses CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF warnings that surface in newer versions of Xcode and CocoaPods. diff --git a/Firebase/Core/FIRApp.m b/Firebase/Core/FIRApp.m index c2ce28e..c43db6e 100644 --- a/Firebase/Core/FIRApp.m +++ b/Firebase/Core/FIRApp.m @@ -133,23 +133,6 @@ static NSMutableDictionary *sLibraryVersions; [FIRApp sendNotificationsToSDKs:sDefaultApp]; sDefaultApp.alreadySentConfigureNotification = YES; } - - if (![FIRAppEnvironmentUtil isFromAppStore]) { - // Support for iOS 7 has been deprecated, but will continue to function for the time being. - // Log a notice for developers who are still targeting iOS 7 as the minimum OS version - // supported. - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ - NSDictionary<NSString *, id> *info = [[NSBundle mainBundle] infoDictionary]; - - NSString *minVersion = info[@"MinimumOSVersion"]; - if ([minVersion hasPrefix:@"7."]) { - FIRLogNotice(kFIRLoggerCore, @"I-COR000026", - @"Support for iOS 7 is deprecated and will " - @"stop working in the future. Please upgrade your app to target iOS 8 or " - @"above."); - } - }); - } } } @@ -315,13 +298,6 @@ static NSMutableDictionary *sLibraryVersions; return NO; } - if (NSClassFromString(@"FIRAppIndexing") != nil) { - FIRLogDebug(kFIRLoggerCore, @"I-COR000024", - @"Firebase App Indexing on iOS is deprecated. " - @"You don't need to take any action at this time. Learn more about Firebase App " - @"Indexing at https://firebase.google.com/docs/app-indexing/."); - } - // Initialize the Analytics once there is a valid options under default app. Analytics should // always initialize first by itself before the other SDKs. if ([self.name isEqualToString:kFIRDefaultAppName]) { diff --git a/Firebase/Core/FIRConfiguration.m b/Firebase/Core/FIRConfiguration.m index 02617ef..cd64862 100644 --- a/Firebase/Core/FIRConfiguration.m +++ b/Firebase/Core/FIRConfiguration.m @@ -35,12 +35,6 @@ extern void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel); return self; } -// This is deprecated, use setLoggerLevel instead. -- (void)setLogLevel:(FIRLogLevel)logLevel { - NSAssert(logLevel <= kFIRLogLevelMax, @"Invalid log level, %ld", (long)logLevel); - _logLevel = logLevel; -} - - (void)setLoggerLevel:(FIRLoggerLevel)loggerLevel { NSAssert(loggerLevel <= FIRLoggerLevelMax && loggerLevel >= FIRLoggerLevelMin, @"Invalid logger level, %ld", (long)loggerLevel); diff --git a/Firebase/Core/FIROptions.m b/Firebase/Core/FIROptions.m index 52c254e..5546297 100644 --- a/Firebase/Core/FIROptions.m +++ b/Firebase/Core/FIROptions.m @@ -194,45 +194,6 @@ static NSDictionary *sDefaultOptionsDictionary = nil; #pragma mark - Public instance methods -- (instancetype)initWithGoogleAppID:(NSString *)googleAppID - bundleID:(NSString *)bundleID - GCMSenderID:(NSString *)GCMSenderID - APIKey:(NSString *)APIKey - clientID:(NSString *)clientID - trackingID:(NSString *)trackingID - androidClientID:(NSString *)androidClientID - databaseURL:(NSString *)databaseURL - storageBucket:(NSString *)storageBucket - deepLinkURLScheme:(NSString *)deepLinkURLScheme { - self = [super init]; - if (self) { - if (!googleAppID) { - [NSException raise:kFirebaseCoreErrorDomain format:@"Please specify a valid Google App ID."]; - } else if (!GCMSenderID) { - [NSException raise:kFirebaseCoreErrorDomain format:@"Please specify a valid GCM Sender ID."]; - } - - // `bundleID` is a required property, default to the main `bundleIdentifier` if it's `nil`. - if (!bundleID) { - bundleID = [[NSBundle mainBundle] bundleIdentifier]; - } - - NSMutableDictionary *mutableOptionsDict = [NSMutableDictionary dictionary]; - [mutableOptionsDict setValue:googleAppID forKey:kFIRGoogleAppID]; - [mutableOptionsDict setValue:bundleID forKey:kFIRBundleID]; - [mutableOptionsDict setValue:GCMSenderID forKey:kFIRGCMSenderID]; - [mutableOptionsDict setValue:APIKey forKey:kFIRAPIKey]; - [mutableOptionsDict setValue:clientID forKey:kFIRClientID]; - [mutableOptionsDict setValue:trackingID forKey:kFIRTrackingID]; - [mutableOptionsDict setValue:androidClientID forKey:kFIRAndroidClientID]; - [mutableOptionsDict setValue:databaseURL forKey:kFIRDatabaseURL]; - [mutableOptionsDict setValue:storageBucket forKey:kFIRStorageBucket]; - self.optionsDictionary = mutableOptionsDict; - self.deepLinkURLScheme = deepLinkURLScheme; - } - return self; -} - - (instancetype)initWithContentsOfFile:(NSString *)plistPath { self = [super init]; if (self) { diff --git a/Firebase/Core/Public/FIRApp.h b/Firebase/Core/Public/FIRApp.h index 9610455..fb18b75 100644 --- a/Firebase/Core/Public/FIRApp.h +++ b/Firebase/Core/Public/FIRApp.h @@ -16,11 +16,6 @@ #import <Foundation/Foundation.h> -#if TARGET_OS_IOS -// TODO: Remove UIKit import on next breaking change release -#import <UIKit/UIKit.h> -#endif - @class FIROptions; NS_ASSUME_NONNULL_BEGIN @@ -90,19 +85,11 @@ NS_SWIFT_NAME(FirebaseApp) */ + (nullable FIRApp *)appNamed:(NSString *)name NS_SWIFT_NAME(app(name:)); -#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 /** * Returns the set of all extant FIRApp instances, or nil if there are no FIRApp instances. This * method is thread safe. */ @property(class, readonly, nullable) NSDictionary<NSString *, FIRApp *> *allApps; -#else -/** - * Returns the set of all extant FIRApp instances, or nil if there are no FIRApp instances. This - * method is thread safe. - */ -+ (nullable NSDictionary<NSString *, FIRApp *> *)allApps NS_SWIFT_NAME(allApps()); -#endif // defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 /** * Cleans up the current FIRApp, freeing associated data and returning its name to the pool for diff --git a/Firebase/Core/Public/FIRConfiguration.h b/Firebase/Core/Public/FIRConfiguration.h index 05bd261..95bba5e 100644 --- a/Firebase/Core/Public/FIRConfiguration.h +++ b/Firebase/Core/Public/FIRConfiguration.h @@ -19,25 +19,6 @@ #import "FIRAnalyticsConfiguration.h" #import "FIRLoggerLevel.h" -/** - * The log levels used by FIRConfiguration. - */ -typedef NS_ENUM(NSInteger, FIRLogLevel) { - /** Error */ - kFIRLogLevelError __deprecated = 0, - /** Warning */ - kFIRLogLevelWarning __deprecated, - /** Info */ - kFIRLogLevelInfo __deprecated, - /** Debug */ - kFIRLogLevelDebug __deprecated, - /** Assert */ - kFIRLogLevelAssert __deprecated, - /** Max */ - kFIRLogLevelMax __deprecated = kFIRLogLevelAssert -} DEPRECATED_MSG_ATTRIBUTE( - "Use -FIRDebugEnabled and -FIRDebugDisabled or setLoggerLevel. See FIRApp.h for more details."); - NS_ASSUME_NONNULL_BEGIN /** @@ -47,21 +28,12 @@ NS_ASSUME_NONNULL_BEGIN NS_SWIFT_NAME(FirebaseConfiguration) @interface FIRConfiguration : NSObject -#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 /** Returns the shared configuration object. */ @property(class, nonatomic, readonly) FIRConfiguration *sharedInstance NS_SWIFT_NAME(shared); -#else -/** Returns the shared configuration object. */ -+ (FIRConfiguration *)sharedInstance NS_SWIFT_NAME(shared()); -#endif // defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 /** The configuration class for Firebase Analytics. */ @property(nonatomic, readwrite) FIRAnalyticsConfiguration *analyticsConfiguration; -/** Global log level. Defaults to kFIRLogLevelError. */ -@property(nonatomic, readwrite, assign) FIRLogLevel logLevel DEPRECATED_MSG_ATTRIBUTE( - "Use -FIRDebugEnabled and -FIRDebugDisabled or setLoggerLevel. See FIRApp.h for more details."); - /** * Sets the logging level for internal Firebase logging. Firebase will only log messages * that are logged at or below loggerLevel. The messages are logged both to the Xcode diff --git a/Firebase/Core/Public/FIROptions.h b/Firebase/Core/Public/FIROptions.h index b4e3b3b..87a01dd 100644 --- a/Firebase/Core/Public/FIROptions.h +++ b/Firebase/Core/Public/FIROptions.h @@ -91,25 +91,6 @@ NS_SWIFT_NAME(FirebaseOptions) @property(nonatomic, copy, nullable) NSString *storageBucket; /** - * Initializes a customized instance of FIROptions with keys. googleAppID, bundleID and GCMSenderID - * are required. Other keys may required for configuring specific services. - */ -- (instancetype)initWithGoogleAppID:(NSString *)googleAppID - bundleID:(NSString *)bundleID - GCMSenderID:(NSString *)GCMSenderID - APIKey:(NSString *)APIKey - clientID:(NSString *)clientID - trackingID:(NSString *)trackingID - androidClientID:(NSString *)androidClientID - databaseURL:(NSString *)databaseURL - storageBucket:(NSString *)storageBucket - deepLinkURLScheme:(NSString *)deepLinkURLScheme - DEPRECATED_MSG_ATTRIBUTE( - "Use `-[[FIROptions alloc] initWithGoogleAppID:GCMSenderID:]` " - "(`FirebaseOptions(googleAppID:gcmSenderID:)` in Swift)` and property " - "setters instead."); - -/** * Initializes a customized instance of FIROptions from the file at the given plist file path. This * will read the file synchronously from disk. * For example, diff --git a/Firebase/Core/third_party/FIRAppEnvironmentUtil.m b/Firebase/Core/third_party/FIRAppEnvironmentUtil.m index 90e66f0..faee38b 100644 --- a/Firebase/Core/third_party/FIRAppEnvironmentUtil.m +++ b/Firebase/Core/third_party/FIRAppEnvironmentUtil.m @@ -13,9 +13,6 @@ // limitations under the License. #import <Foundation/Foundation.h> -#if TARGET_OS_IOS || TARGET_OS_TV -#import <UIKit/UIKit.h> -#endif #import "FIRAppEnvironmentUtil.h" @@ -207,11 +204,7 @@ static BOOL isAppEncrypted() { } + (NSString *)systemVersion { - #if TARGET_OS_IOS || TARGET_OS_TV - return [UIDevice currentDevice].systemVersion; - #elif TARGET_OS_OSX return [NSProcessInfo processInfo].operatingSystemVersionString; - #endif } + (BOOL)isAppExtension { diff --git a/Firebase/Database/Core/FPersistentConnection.m b/Firebase/Database/Core/FPersistentConnection.m index 870727c..c32d18c 100644 --- a/Firebase/Database/Core/FPersistentConnection.m +++ b/Firebase/Database/Core/FPersistentConnection.m @@ -735,18 +735,22 @@ static void reachabilityCallback(SCNetworkReachabilityRef ref, SCNetworkReachabi } - (void) cancelSentTransactions { - NSMutableArray* toPrune = [[NSMutableArray alloc] init]; + NSMutableDictionary<NSNumber*, FOutstandingPut*>* cancelledOutstandingPuts = [[NSMutableDictionary alloc] init]; + for (NSNumber* index in self.outstandingPuts) { FOutstandingPut* put = self.outstandingPuts[index]; if (put.request[kFWPRequestHash] && put.sent) { - // This is a sent transaction put - put.onCompleteBlock(kFTransactionDisconnect, @"Client was disconnected while running a transaction"); - [toPrune addObject:index]; + // This is a sent transaction put. + cancelledOutstandingPuts[index] = put; } } - for (NSNumber* index in toPrune) { + + [cancelledOutstandingPuts enumerateKeysAndObjectsUsingBlock:^(NSNumber *index, FOutstandingPut *outstandingPut, BOOL *stop) { + // `onCompleteBlock:` may invoke `rerunTransactionsForPath:` and enqueue new writes. We defer calling + // it until we have finished enumerating all existing writes. + outstandingPut.onCompleteBlock(kFTransactionDisconnect, @"Client was disconnected while running a transaction"); [self.outstandingPuts removeObjectForKey:index]; - } + }]; } - (void) onDataPushWithAction:(NSString *)action andBody:(NSDictionary *)body { diff --git a/Firebase/Database/Core/FRepo.m b/Firebase/Database/Core/FRepo.m index 1c4b956..ae1d8e8 100644 --- a/Firebase/Database/Core/FRepo.m +++ b/Firebase/Database/Core/FRepo.m @@ -513,11 +513,11 @@ } - (void)onConnect:(FPersistentConnection *)fpconnection { - [self updateInfo:kDotInfoConnected withValue:@true]; + [self updateInfo:kDotInfoConnected withValue:@YES]; } - (void)onDisconnect:(FPersistentConnection *)fpconnection { - [self updateInfo:kDotInfoConnected withValue:@false]; + [self updateInfo:kDotInfoConnected withValue:@NO]; [self runOnDisconnectEvents]; } diff --git a/Firebase/Messaging/FIRMessaging.m b/Firebase/Messaging/FIRMessaging.m index e02a125..15561d5 100644 --- a/Firebase/Messaging/FIRMessaging.m +++ b/Firebase/Messaging/FIRMessaging.m @@ -142,7 +142,9 @@ FIRInstanceIDAPNSTokenType FIRIIDAPNSTokenTypeFromAPNSTokenType(FIRMessagingAPNS @end @interface FIRMessaging ()<FIRMessagingClientDelegate, FIRMessagingReceiverDelegate, - FIRReachabilityDelegate> + FIRReachabilityDelegate> { + BOOL _shouldEstablishDirectChannel; +} // FIRApp properties @property(nonatomic, readwrite, copy) NSString *fcmSenderID; @@ -206,14 +208,6 @@ FIRInstanceIDAPNSTokenType FIRIIDAPNSTokenTypeFromAPNSTokenType(FIRMessagingAPNS [self teardown]; } -- (void)setRemoteMessageDelegate:(id<FIRMessagingDelegate>)delegate { - _delegate = delegate; -} - -- (id<FIRMessagingDelegate>)remoteMessageDelegate { - return self.delegate; -} - #pragma mark - Config - (void)start { diff --git a/Firebase/Messaging/FIRMessagingPubSub.h b/Firebase/Messaging/FIRMessagingPubSub.h index a2141e4..b249866 100644 --- a/Firebase/Messaging/FIRMessagingPubSub.h +++ b/Firebase/Messaging/FIRMessagingPubSub.h @@ -16,6 +16,8 @@ #import "FIRMessaging.h" +NS_ASSUME_NONNULL_BEGIN + @class FIRMessagingClient; @class FIRMessagingPubSubCache; @@ -155,3 +157,5 @@ + (BOOL)isValidTopicWithPrefix:(NSString *)topic; @end + +NS_ASSUME_NONNULL_END diff --git a/Firebase/Messaging/Public/FIRMessaging.h b/Firebase/Messaging/Public/FIRMessaging.h index 479f68e..e5c27ea 100644 --- a/Firebase/Messaging/Public/FIRMessaging.h +++ b/Firebase/Messaging/Public/FIRMessaging.h @@ -16,6 +16,8 @@ #import <Foundation/Foundation.h> +NS_ASSUME_NONNULL_BEGIN + /** * @related FIRMessaging * @@ -78,7 +80,7 @@ typedef void(^FIRMessagingConnectCompletion)(NSError * __nullable error) * successfully to the server. The notification object will be the messageID * of the successfully delivered message. */ -FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingSendSuccessNotification +FOUNDATION_EXPORT const NSNotificationName FIRMessagingSendSuccessNotification NS_SWIFT_NAME(MessagingSendSuccess); /** @@ -87,7 +89,7 @@ FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingSendSuccessNoti * message. The userInfo dictionary will contain the relevant error * information for the failure. */ -FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingSendErrorNotification +FOUNDATION_EXPORT const NSNotificationName FIRMessagingSendErrorNotification NS_SWIFT_NAME(MessagingSendError); /** @@ -98,7 +100,7 @@ FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingSendErrorNotifi * It is recommended to retrieve any missing messages directly from the * server. */ -FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingMessagesDeletedNotification +FOUNDATION_EXPORT const NSNotificationName FIRMessagingMessagesDeletedNotification NS_SWIFT_NAME(MessagingMessagesDeleted); /** @@ -106,7 +108,7 @@ FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingMessagesDeleted * an FCM socket connection. You can query the connection state in this * notification by checking the `isDirectChannelEstablished` property of FIRMessaging. */ -FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingConnectionStateChangedNotification +FOUNDATION_EXPORT const NSNotificationName FIRMessagingConnectionStateChangedNotification NS_SWIFT_NAME(MessagingConnectionStateChanged); /** @@ -114,7 +116,7 @@ FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingConnectionState * FIRMessaging delegate method `messaging:didReceiveRegistrationToken:` to receive current and * updated tokens. */ -FOUNDATION_EXPORT const NSNotificationName __nonnull +FOUNDATION_EXPORT const NSNotificationName FIRMessagingRegistrationTokenRefreshedNotification NS_SWIFT_NAME(MessagingRegistrationTokenRefreshed); #else @@ -123,7 +125,7 @@ FOUNDATION_EXPORT const NSNotificationName __nonnull * successfully to the server. The notification object will be the messageID * of the successfully delivered message. */ -FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingSendSuccessNotification +FOUNDATION_EXPORT NSString *const FIRMessagingSendSuccessNotification NS_SWIFT_NAME(MessagingSendSuccessNotification); /** @@ -132,7 +134,7 @@ FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingSendSuccessNotification * message. The userInfo dictionary will contain the relevant error * information for the failure. */ -FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingSendErrorNotification +FOUNDATION_EXPORT NSString *const FIRMessagingSendErrorNotification NS_SWIFT_NAME(MessagingSendErrorNotification); /** @@ -143,7 +145,7 @@ FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingSendErrorNotification * It is recommended to retrieve any missing messages directly from the * server. */ -FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingMessagesDeletedNotification +FOUNDATION_EXPORT NSString *const FIRMessagingMessagesDeletedNotification NS_SWIFT_NAME(MessagingMessagesDeletedNotification); /** @@ -151,7 +153,7 @@ FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingMessagesDeletedNotifica * an FCM socket connection. You can query the connection state in this * notification by checking the `isDirectChannelEstablished` property of FIRMessaging. */ -FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingConnectionStateChangedNotification +FOUNDATION_EXPORT NSString *const FIRMessagingConnectionStateChangedNotification NS_SWIFT_NAME(MessagingConnectionStateChangedNotification); /** @@ -159,7 +161,7 @@ FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingConnectionStateChangedN * FIRMessaging delegate method `messaging:didReceiveRegistrationToken:` to receive current and * updated tokens. */ -FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingRegistrationTokenRefreshedNotification +FOUNDATION_EXPORT NSString *const FIRMessagingRegistrationTokenRefreshedNotification NS_SWIFT_NAME(MessagingRegistrationTokenRefreshedNotification); #endif // defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 @@ -232,7 +234,7 @@ NS_SWIFT_NAME(MessagingRemoteMessage) @interface FIRMessagingRemoteMessage : NSObject /// The downstream message received by the application. -@property(nonatomic, readonly, strong, nonnull) NSDictionary *appData; +@property(nonatomic, readonly, strong) NSDictionary *appData; @end @class FIRMessaging; @@ -253,15 +255,15 @@ NS_SWIFT_NAME(MessagingDelegate) /// * Uploading the FCM token to your application server, so targeted notifications can be sent. /// /// * Subscribing to any topics. -- (void)messaging:(nonnull FIRMessaging *)messaging - didReceiveRegistrationToken:(nonnull NSString *)fcmToken +- (void)messaging:(FIRMessaging *)messaging + didReceiveRegistrationToken:(NSString *)fcmToken NS_SWIFT_NAME(messaging(_:didReceiveRegistrationToken:)); /// This method will be called whenever FCM receives a new, default FCM token for your /// Firebase project's Sender ID. This method is deprecated. Please use /// `messaging:didReceiveRegistrationToken:`. -- (void)messaging:(nonnull FIRMessaging *)messaging - didRefreshRegistrationToken:(nonnull NSString *)fcmToken +- (void)messaging:(FIRMessaging *)messaging + didRefreshRegistrationToken:(NSString *)fcmToken NS_SWIFT_NAME(messaging(_:didRefreshRegistrationToken:)) __deprecated_msg("Please use messaging:didReceiveRegistrationToken:, which is called for both \ current and refreshed tokens."); @@ -269,13 +271,13 @@ NS_SWIFT_NAME(MessagingDelegate) /// This method is called on iOS 10 devices to handle data messages received via FCM through its /// direct channel (not via APNS). For iOS 9 and below, the FCM data message is delivered via the /// UIApplicationDelegate's -application:didReceiveRemoteNotification: method. -- (void)messaging:(nonnull FIRMessaging *)messaging - didReceiveMessage:(nonnull FIRMessagingRemoteMessage *)remoteMessage +- (void)messaging:(FIRMessaging *)messaging + didReceiveMessage:(FIRMessagingRemoteMessage *)remoteMessage NS_SWIFT_NAME(messaging(_:didReceive:)) __IOS_AVAILABLE(10.0); /// The callback to handle data message received via FCM for devices running iOS 10 or above. -- (void)applicationReceivedRemoteMessage:(nonnull FIRMessagingRemoteMessage *)remoteMessage +- (void)applicationReceivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage NS_SWIFT_NAME(application(received:)) __deprecated_msg("Use FIRMessagingDelegate’s -messaging:didReceiveMessage:"); @@ -300,35 +302,24 @@ NS_SWIFT_NAME(Messaging) @property(nonatomic, weak, nullable) id<FIRMessagingDelegate> delegate; /** - * Delegate to handle remote data messages received via FCM for devices running iOS 10 or above. - */ -@property(nonatomic, weak, nullable) id<FIRMessagingDelegate> remoteMessageDelegate - __deprecated_msg("Use 'delegate' property"); - -/** * When set to `YES`, Firebase Messaging will automatically establish a socket-based, direct * channel to the FCM server. Enable this only if you are sending upstream messages or * receiving non-APNS, data-only messages in foregrounded apps. * Default is `NO`. */ -@property(nonatomic) BOOL shouldEstablishDirectChannel; - -/** - * Returns `YES` if the direct channel to the FCM server is active, and `NO` otherwise. - */ -@property(nonatomic, readonly) BOOL isDirectChannelEstablished; +@property(nonatomic, assign, getter=isDirectChannelEstablished) BOOL shouldEstablishDirectChannel; /** * FIRMessaging * * @return An instance of FIRMessaging. */ -+ (nonnull instancetype)messaging NS_SWIFT_NAME(messaging()); ++ (instancetype)messaging NS_SWIFT_NAME(messaging()); /** * Unavailable. Use +messaging instead. */ -- (nonnull instancetype)init __attribute__((unavailable("Use +messaging instead."))); +- (instancetype)init __attribute__((unavailable("Use +messaging instead."))); #pragma mark - APNS @@ -358,7 +349,7 @@ NS_SWIFT_NAME(Messaging) * FIRMessagingAPNSTokenTypeUnknown to have the type automatically * detected based on your provisioning profile. */ -- (void)setAPNSToken:(nonnull NSData *)apnsToken type:(FIRMessagingAPNSTokenType)type; +- (void)setAPNSToken:(NSData *)apnsToken type:(FIRMessagingAPNSTokenType)type; #pragma mark - FCM Tokens @@ -413,8 +404,8 @@ NS_SWIFT_NAME(Messaging) * @param senderID The Sender ID for a particular Firebase project. * @param completion The completion handler to handle the token request. */ -- (void)retrieveFCMTokenForSenderID:(nonnull NSString *)senderID - completion:(nonnull FIRMessagingFCMTokenFetchCompletion)completion +- (void)retrieveFCMTokenForSenderID:(NSString *)senderID + completion:(FIRMessagingFCMTokenFetchCompletion)completion NS_SWIFT_NAME(retrieveFCMToken(forSenderID:completion:)); @@ -425,8 +416,8 @@ NS_SWIFT_NAME(Messaging) * @param senderID The senderID for a particular Firebase project. * @param completion The completion handler to handle the token deletion. */ -- (void)deleteFCMTokenForSenderID:(nonnull NSString *)senderID - completion:(nonnull FIRMessagingDeleteFCMTokenCompletion)completion +- (void)deleteFCMTokenForSenderID:(NSString *)senderID + completion:(FIRMessagingDeleteFCMTokenCompletion)completion NS_SWIFT_NAME(deleteFCMToken(forSenderID:completion:)); @@ -444,7 +435,7 @@ NS_SWIFT_NAME(Messaging) * the same time, FIRMessaging performs exponential backoff to retry * establishing a connection and invoke the handler when successful. */ -- (void)connectWithCompletion:(nonnull FIRMessagingConnectCompletion)handler +- (void)connectWithCompletion:(FIRMessagingConnectCompletion)handler NS_SWIFT_NAME(connect(handler:)) __deprecated_msg("Please use the shouldEstablishDirectChannel property instead."); @@ -466,7 +457,7 @@ NS_SWIFT_NAME(Messaging) * * @param topic The name of the topic, for example, @"sports". */ -- (void)subscribeToTopic:(nonnull NSString *)topic NS_SWIFT_NAME(subscribe(toTopic:)); +- (void)subscribeToTopic:(NSString *)topic NS_SWIFT_NAME(subscribe(toTopic:)); /** * Asynchronously subscribe to the provided topic, retrying on failure. @@ -484,7 +475,7 @@ NS_SWIFT_NAME(Messaging) * * @param topic The name of the topic, for example @"sports". */ -- (void)unsubscribeFromTopic:(nonnull NSString *)topic NS_SWIFT_NAME(unsubscribe(fromTopic:)); +- (void)unsubscribeFromTopic:(NSString *)topic NS_SWIFT_NAME(unsubscribe(fromTopic:)); /** * Asynchronously unsubscribe from the provided topic, retrying on failure. @@ -522,9 +513,9 @@ NS_SWIFT_NAME(Messaging) * if the message has been dropped because of TTL; this can happen * on the server side, and it would require extra communication. */ -- (void)sendMessage:(nonnull NSDictionary *)message - to:(nonnull NSString *)receiver - withMessageID:(nonnull NSString *)messageID +- (void)sendMessage:(NSDictionary *)message + to:(NSString *)receiver + withMessageID:(NSString *)messageID timeToLive:(int64_t)ttl; #pragma mark - Analytics @@ -540,6 +531,8 @@ NS_SWIFT_NAME(Messaging) * * @return Information about the downstream message. */ -- (nonnull FIRMessagingMessageInfo *)appDidReceiveMessage:(nonnull NSDictionary *)message; +- (FIRMessagingMessageInfo *)appDidReceiveMessage:(NSDictionary *)message; @end + +NS_ASSUME_NONNULL_END |