aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Messaging
diff options
context:
space:
mode:
Diffstat (limited to 'Firebase/Messaging')
-rw-r--r--Firebase/Messaging/FIRMessaging.m12
-rw-r--r--Firebase/Messaging/FIRMessagingPubSub.h4
-rw-r--r--Firebase/Messaging/Public/FIRMessaging.h81
3 files changed, 44 insertions, 53 deletions
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