From 9da843779b61c6414334aa94a3851ff1d959359b Mon Sep 17 00:00:00 2001 From: Morgan Chen Date: Thu, 5 Apr 2018 16:16:24 -0700 Subject: add NS_ASSUME_NONNULL macros to messaging --- Firebase/Messaging/FIRMessagingPubSub.h | 4 ++ Firebase/Messaging/Public/FIRMessaging.h | 72 +++++++++++++++++--------------- 2 files changed, 42 insertions(+), 34 deletions(-) (limited to 'Firebase/Messaging') 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..160ada6 100644 --- a/Firebase/Messaging/Public/FIRMessaging.h +++ b/Firebase/Messaging/Public/FIRMessaging.h @@ -16,6 +16,8 @@ #import +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:"); @@ -323,12 +325,12 @@ NS_SWIFT_NAME(Messaging) * * @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 +360,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 +415,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 +427,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 +446,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 +468,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. @@ -476,7 +478,7 @@ NS_SWIFT_NAME(Messaging) * In case of success, nil error is returned. Otherwise, an * appropriate error object is returned. */ -- (void)subscribeToTopic:(nonnull NSString *)topic +- (void)subscribeToTopic:(NSString *)topic completion:(nullable FIRMessagingTopicOperationCompletion)completion; /** @@ -484,7 +486,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. @@ -494,7 +496,7 @@ NS_SWIFT_NAME(Messaging) * In case of success, nil error is returned. Otherwise, an * appropriate error object is returned. */ -- (void)unsubscribeFromTopic:(nonnull NSString *)topic +- (void)unsubscribeFromTopic:(NSString *)topic completion:(nullable FIRMessagingTopicOperationCompletion)completion; #pragma mark - Upstream @@ -522,9 +524,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 +542,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 -- cgit v1.2.3