aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Messaging/FIRMessaging.m
diff options
context:
space:
mode:
authorGravatar Oleksiy Ivanov <oleksiyi@google.com>2018-01-30 16:33:12 -0800
committerGravatar Oleksiy Ivanov <oleksiyi@google.com>2018-01-30 16:33:12 -0800
commit799a808de6ae2f2af4b4b331a841d7b001abacea (patch)
treebf608f8fecf4d77dfe824c84cceae19c13ca0af8 /Firebase/Messaging/FIRMessaging.m
parent3cbdbf2652202a3473271ed298ff50e5797cce68 (diff)
[FCM] Add completion handler to subscribe/unsubscribe topic actions
Added functionality not exposed in public header yet. I would leave to next FCM SDK owner to expose this functionality (and follow any required review process). Bugs: 72701086
Diffstat (limited to 'Firebase/Messaging/FIRMessaging.m')
-rw-r--r--Firebase/Messaging/FIRMessaging.m14
1 files changed, 12 insertions, 2 deletions
diff --git a/Firebase/Messaging/FIRMessaging.m b/Firebase/Messaging/FIRMessaging.m
index 11cacb3..d0edadf 100644
--- a/Firebase/Messaging/FIRMessaging.m
+++ b/Firebase/Messaging/FIRMessaging.m
@@ -683,10 +683,15 @@ static NSString *const kFIRMessagingPlistAutoInitEnabled =
}
- (void)subscribeToTopic:(NSString *)topic {
+ [self subscribeToTopic:topic completion:nil];
+}
+
+- (void)subscribeToTopic:(NSString *)topic
+ completion:(nullable FIRMessagingTopicOperationCompletion)completion {
if (self.defaultFcmToken.length && topic.length) {
NSString *normalizeTopic = [[self class ] normalizeTopic:topic];
if (normalizeTopic.length) {
- [self.pubsub subscribeToTopic:normalizeTopic];
+ [self.pubsub subscribeToTopic:normalizeTopic handler:completion];
} else {
FIRMessagingLoggerError(kFIRMessagingMessageCodeMessaging009,
@"Cannot parse topic name %@. Will not subscribe.", topic);
@@ -699,10 +704,15 @@ static NSString *const kFIRMessagingPlistAutoInitEnabled =
}
- (void)unsubscribeFromTopic:(NSString *)topic {
+ [self unsubscribeFromTopic:topic completion:nil];
+}
+
+- (void)unsubscribeFromTopic:(NSString *)topic
+ completion:(nullable FIRMessagingTopicOperationCompletion)completion {
if (self.defaultFcmToken.length && topic.length) {
NSString *normalizeTopic = [[self class] normalizeTopic:topic];
if (normalizeTopic.length) {
- [self.pubsub unsubscribeFromTopic:normalizeTopic];
+ [self.pubsub unsubscribeFromTopic:normalizeTopic handler:completion];
} else {
FIRMessagingLoggerError(kFIRMessagingMessageCodeMessaging011,
@"Cannot parse topic name %@. Will not unsubscribe.", topic);