aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Messaging/Public
diff options
context:
space:
mode:
authorGravatar Ryan Wilson <wilsonryan@google.com>2017-11-28 06:59:07 -0800
committerGravatar GitHub <noreply@github.com>2017-11-28 06:59:07 -0800
commit7386f00178be4fe1f8d8f749049d25cbf0533e6a (patch)
tree02ba61c9cda5c439b4b991c7286f93ea8512bbea /Firebase/Messaging/Public
parent7459be46ffb27bc95e155a1b267f91093f1a62b0 (diff)
Replacing FIR_SWIFT_NAME macro with NS_SWIFT_NAME. (#476)
* Replacing FIR_SWIFT_NAME macro with NS_SWIFT_NAME. This pushes the minimum Xcode version to 7.3, as NS_SWIFT_NAME was limited before that version (which is why the macro was introduced in the first place). * Fixed FIRMessaging header
Diffstat (limited to 'Firebase/Messaging/Public')
-rw-r--r--Firebase/Messaging/Public/FIRMessaging.h75
1 files changed, 32 insertions, 43 deletions
diff --git a/Firebase/Messaging/Public/FIRMessaging.h b/Firebase/Messaging/Public/FIRMessaging.h
index 65a9d06..7cd7b19 100644
--- a/Firebase/Messaging/Public/FIRMessaging.h
+++ b/Firebase/Messaging/Public/FIRMessaging.h
@@ -16,17 +16,6 @@
#import <Foundation/Foundation.h>
-
-// NS_SWIFT_NAME can only translate factory methods before the iOS 9.3 SDK.
-// Wrap it in our own macro if it's a non-compatible SDK.
-#ifndef FIR_SWIFT_NAME
-#ifdef __IPHONE_9_3
-#define FIR_SWIFT_NAME(X) NS_SWIFT_NAME(X)
-#else
-#define FIR_SWIFT_NAME(X) // Intentionally blank.
-#endif // #ifdef __IPHONE_9_3
-#endif // #ifndef FIR_SWIFT_NAME
-
/**
* @related FIRMessaging
*
@@ -40,7 +29,7 @@
*/
typedef void(^FIRMessagingFCMTokenFetchCompletion)(NSString * _Nullable FCMToken,
NSError * _Nullable error)
- FIR_SWIFT_NAME(MessagingFCMTokenFetchCompletion);
+ NS_SWIFT_NAME(MessagingFCMTokenFetchCompletion);
/**
@@ -54,7 +43,7 @@ typedef void(^FIRMessagingFCMTokenFetchCompletion)(NSString * _Nullable FCMToken
* will match a value from the FIRMessagingError enumeration.
*/
typedef void(^FIRMessagingDeleteFCMTokenCompletion)(NSError * _Nullable error)
- FIR_SWIFT_NAME(MessagingDeleteFCMTokenCompletion);
+ NS_SWIFT_NAME(MessagingDeleteFCMTokenCompletion);
/**
* The completion handler invoked once the data connection with FIRMessaging is
@@ -69,7 +58,7 @@ typedef void(^FIRMessagingDeleteFCMTokenCompletion)(NSError * _Nullable error)
* to FIRMessaging failed.
*/
typedef void(^FIRMessagingConnectCompletion)(NSError * __nullable error)
- FIR_SWIFT_NAME(MessagingConnectCompletion)
+ NS_SWIFT_NAME(MessagingConnectCompletion)
__deprecated_msg("Please listen for the FIRMessagingConnectionStateChangedNotification "
"NSNotification instead.");
@@ -80,7 +69,7 @@ typedef void(^FIRMessagingConnectCompletion)(NSError * __nullable error)
* of the successfully delivered message.
*/
FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingSendSuccessNotification
- FIR_SWIFT_NAME(MessagingSendSuccess);
+ NS_SWIFT_NAME(MessagingSendSuccess);
/**
* Notification sent when the upstream message was failed to be sent to the
@@ -89,7 +78,7 @@ FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingSendSuccessNoti
* information for the failure.
*/
FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingSendErrorNotification
- FIR_SWIFT_NAME(MessagingSendError);
+ NS_SWIFT_NAME(MessagingSendError);
/**
* Notification sent when the Firebase messaging server deletes pending
@@ -100,7 +89,7 @@ FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingSendErrorNotifi
* server.
*/
FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingMessagesDeletedNotification
- FIR_SWIFT_NAME(MessagingMessagesDeleted);
+ NS_SWIFT_NAME(MessagingMessagesDeleted);
/**
* Notification sent when Firebase Messaging establishes or disconnects from
@@ -108,7 +97,7 @@ FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingMessagesDeleted
* notification by checking the `isDirectChannelEstablished` property of FIRMessaging.
*/
FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingConnectionStateChangedNotification
- FIR_SWIFT_NAME(MessagingConnectionStateChanged);
+ NS_SWIFT_NAME(MessagingConnectionStateChanged);
/**
* Notification sent when the FCM registration token has been refreshed. Please use the
@@ -117,7 +106,7 @@ FOUNDATION_EXPORT const NSNotificationName __nonnull FIRMessagingConnectionState
*/
FOUNDATION_EXPORT const NSNotificationName __nonnull
FIRMessagingRegistrationTokenRefreshedNotification
- FIR_SWIFT_NAME(MessagingRegistrationTokenRefreshed);
+ NS_SWIFT_NAME(MessagingRegistrationTokenRefreshed);
#else
/**
* Notification sent when the upstream message has been delivered
@@ -125,7 +114,7 @@ FOUNDATION_EXPORT const NSNotificationName __nonnull
* of the successfully delivered message.
*/
FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingSendSuccessNotification
- FIR_SWIFT_NAME(MessagingSendSuccessNotification);
+ NS_SWIFT_NAME(MessagingSendSuccessNotification);
/**
* Notification sent when the upstream message was failed to be sent to the
@@ -134,7 +123,7 @@ FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingSendSuccessNotification
* information for the failure.
*/
FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingSendErrorNotification
- FIR_SWIFT_NAME(MessagingSendErrorNotification);
+ NS_SWIFT_NAME(MessagingSendErrorNotification);
/**
* Notification sent when the Firebase messaging server deletes pending
@@ -145,7 +134,7 @@ FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingSendErrorNotification
* server.
*/
FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingMessagesDeletedNotification
- FIR_SWIFT_NAME(MessagingMessagesDeletedNotification);
+ NS_SWIFT_NAME(MessagingMessagesDeletedNotification);
/**
* Notification sent when Firebase Messaging establishes or disconnects from
@@ -153,7 +142,7 @@ FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingMessagesDeletedNotifica
* notification by checking the `isDirectChannelEstablished` property of FIRMessaging.
*/
FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingConnectionStateChangedNotification
- FIR_SWIFT_NAME(MessagingConnectionStateChangedNotification);
+ NS_SWIFT_NAME(MessagingConnectionStateChangedNotification);
/**
* Notification sent when the FCM registration token has been refreshed. Please use the
@@ -161,7 +150,7 @@ FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingConnectionStateChangedN
* updated tokens.
*/
FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingRegistrationTokenRefreshedNotification
- FIR_SWIFT_NAME(MessagingRegistrationTokenRefreshedNotification);
+ NS_SWIFT_NAME(MessagingRegistrationTokenRefreshedNotification);
#endif // defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
/**
@@ -188,7 +177,7 @@ typedef NS_ENUM(NSUInteger, FIRMessagingError) {
/// Some parameters of the request were invalid.
FIRMessagingErrorInvalidRequest = 7,
-} FIR_SWIFT_NAME(MessagingError);
+} NS_SWIFT_NAME(MessagingError);
/// Status for the downstream message received by the app.
typedef NS_ENUM(NSInteger, FIRMessagingMessageStatus) {
@@ -196,7 +185,7 @@ typedef NS_ENUM(NSInteger, FIRMessagingMessageStatus) {
FIRMessagingMessageStatusUnknown,
/// New downstream message received by the app.
FIRMessagingMessageStatusNew,
-} FIR_SWIFT_NAME(MessagingMessageStatus);
+} NS_SWIFT_NAME(MessagingMessageStatus);
/**
* The APNS token type for the app. If the token type is set to `UNKNOWN`
@@ -212,10 +201,10 @@ typedef NS_ENUM(NSInteger, FIRMessagingAPNSTokenType) {
FIRMessagingAPNSTokenTypeSandbox,
/// Production token type.
FIRMessagingAPNSTokenTypeProd,
-} FIR_SWIFT_NAME(MessagingAPNSTokenType);
+} NS_SWIFT_NAME(MessagingAPNSTokenType);
/// Information about a downstream message received by the app.
-FIR_SWIFT_NAME(MessagingMessageInfo)
+NS_SWIFT_NAME(MessagingMessageInfo)
@interface FIRMessagingMessageInfo : NSObject
/// The status of the downstream message
@@ -229,7 +218,7 @@ FIR_SWIFT_NAME(MessagingMessageInfo)
* This is only for devices running iOS 10 or above. To support devices running iOS 9 or below, use
* the local and remote notifications handlers defined in UIApplicationDelegate protocol.
*/
-FIR_SWIFT_NAME(MessagingRemoteMessage)
+NS_SWIFT_NAME(MessagingRemoteMessage)
@interface FIRMessagingRemoteMessage : NSObject
/// The downstream message received by the application.
@@ -243,7 +232,7 @@ FIR_SWIFT_NAME(MessagingRemoteMessage)
* To support devices running iOS 9 or below, use the local and remote notifications handlers
* defined in UIApplicationDelegate protocol.
*/
-FIR_SWIFT_NAME(MessagingDelegate)
+NS_SWIFT_NAME(MessagingDelegate)
@protocol FIRMessagingDelegate <NSObject>
@optional
@@ -256,14 +245,14 @@ FIR_SWIFT_NAME(MessagingDelegate)
/// * Subscribing to any topics.
- (void)messaging:(nonnull FIRMessaging *)messaging
didReceiveRegistrationToken:(nonnull NSString *)fcmToken
- FIR_SWIFT_NAME(messaging(_:didReceiveRegistrationToken:));
+ 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
- FIR_SWIFT_NAME(messaging(_:didRefreshRegistrationToken:))
+ NS_SWIFT_NAME(messaging(_:didRefreshRegistrationToken:))
__deprecated_msg("Please use messaging:didReceiveRegistrationToken:, which is called for both \
current and refreshed tokens.");
@@ -272,12 +261,12 @@ FIR_SWIFT_NAME(MessagingDelegate)
/// UIApplicationDelegate's -application:didReceiveRemoteNotification: method.
- (void)messaging:(nonnull FIRMessaging *)messaging
didReceiveMessage:(nonnull FIRMessagingRemoteMessage *)remoteMessage
- FIR_SWIFT_NAME(messaging(_:didReceive:))
+ 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
- FIR_SWIFT_NAME(application(received:))
+ NS_SWIFT_NAME(application(received:))
__deprecated_msg("Use FIRMessagingDelegate’s -messaging:didReceiveMessage:");
@end
@@ -291,7 +280,7 @@ FIR_SWIFT_NAME(MessagingDelegate)
*
* In order to receive FIRMessaging messages, declare `application:didReceiveRemoteNotification:`.
*/
-FIR_SWIFT_NAME(Messaging)
+NS_SWIFT_NAME(Messaging)
@interface FIRMessaging : NSObject
/**
@@ -325,7 +314,7 @@ FIR_SWIFT_NAME(Messaging)
*
* @return An instance of FIRMessaging.
*/
-+ (nonnull instancetype)messaging FIR_SWIFT_NAME(messaging());
++ (nonnull instancetype)messaging NS_SWIFT_NAME(messaging());
/**
* Unavailable. Use +messaging instead.
@@ -347,7 +336,7 @@ FIR_SWIFT_NAME(Messaging)
* If you would like to set the type of the APNS token, rather than relying on
* automatic detection, see: `-setAPNSToken:type:`.
*/
-@property(nonatomic, copy, nullable) NSData *APNSToken FIR_SWIFT_NAME(apnsToken);
+@property(nonatomic, copy, nullable) NSData *APNSToken NS_SWIFT_NAME(apnsToken);
/**
* Set APNS token for the application. This APNS token will be used to register
@@ -377,7 +366,7 @@ FIR_SWIFT_NAME(Messaging)
* Once you have an FCM token, you should send it to your application server, so it can use
* the FCM token to send notifications to your device.
*/
-@property(nonatomic, readonly, nullable) NSString *FCMToken FIR_SWIFT_NAME(fcmToken);
+@property(nonatomic, readonly, nullable) NSString *FCMToken NS_SWIFT_NAME(fcmToken);
/**
@@ -398,7 +387,7 @@ FIR_SWIFT_NAME(Messaging)
*/
- (void)retrieveFCMTokenForSenderID:(nonnull NSString *)senderID
completion:(nonnull FIRMessagingFCMTokenFetchCompletion)completion
- FIR_SWIFT_NAME(retrieveFCMToken(forSenderID:completion:));
+ NS_SWIFT_NAME(retrieveFCMToken(forSenderID:completion:));
/**
@@ -410,7 +399,7 @@ FIR_SWIFT_NAME(Messaging)
*/
- (void)deleteFCMTokenForSenderID:(nonnull NSString *)senderID
completion:(nonnull FIRMessagingDeleteFCMTokenCompletion)completion
- FIR_SWIFT_NAME(deleteFCMToken(forSenderID:completion:));
+ NS_SWIFT_NAME(deleteFCMToken(forSenderID:completion:));
#pragma mark - Connect
@@ -428,7 +417,7 @@ FIR_SWIFT_NAME(Messaging)
* establishing a connection and invoke the handler when successful.
*/
- (void)connectWithCompletion:(nonnull FIRMessagingConnectCompletion)handler
- FIR_SWIFT_NAME(connect(handler:))
+ NS_SWIFT_NAME(connect(handler:))
__deprecated_msg("Please use the shouldEstablishDirectChannel property instead.");
/**
@@ -449,14 +438,14 @@ FIR_SWIFT_NAME(Messaging)
*
* @param topic The name of the topic, for example, @"sports".
*/
-- (void)subscribeToTopic:(nonnull NSString *)topic FIR_SWIFT_NAME(subscribe(toTopic:));
+- (void)subscribeToTopic:(nonnull NSString *)topic NS_SWIFT_NAME(subscribe(toTopic:));
/**
* Asynchronously unsubscribe from a topic.
*
* @param topic The name of the topic, for example @"sports".
*/
-- (void)unsubscribeFromTopic:(nonnull NSString *)topic FIR_SWIFT_NAME(unsubscribe(fromTopic:));
+- (void)unsubscribeFromTopic:(nonnull NSString *)topic NS_SWIFT_NAME(unsubscribe(fromTopic:));
#pragma mark - Upstream