aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Messaging
diff options
context:
space:
mode:
authorGravatar Morgan Chen <morganchen12@gmail.com>2018-05-23 11:37:10 -0700
committerGravatar GitHub <noreply@github.com>2018-05-23 11:37:10 -0700
commit7ecd3d1266539001666f802ee05f9ffc3af6d028 (patch)
treed91897c12ca81580d44e73999da105248e05153e /Firebase/Messaging
parent6e95680ba80166a967abc63d0e79a5ffcc1525f5 (diff)
parente345eb39dec29d6163763170ff84a77da3abce2b (diff)
Merge pull request #1312 from alexames/master
Warn when topic format is incorrect.
Diffstat (limited to 'Firebase/Messaging')
-rw-r--r--Firebase/Messaging/FIRMMessageCode.h4
-rw-r--r--Firebase/Messaging/FIRMessaging.m10
2 files changed, 12 insertions, 2 deletions
diff --git a/Firebase/Messaging/FIRMMessageCode.h b/Firebase/Messaging/FIRMMessageCode.h
index c1b8ffb..8850f98 100644
--- a/Firebase/Messaging/FIRMMessageCode.h
+++ b/Firebase/Messaging/FIRMMessageCode.h
@@ -27,8 +27,8 @@ typedef NS_ENUM(NSInteger, FIRMessagingMessageCode) {
kFIRMessagingMessageCodeMessaging003 = 2003, // I-FCM002003
kFIRMessagingMessageCodeMessaging004 = 2004, // I-FCM002004
kFIRMessagingMessageCodeMessaging005 = 2005, // I-FCM002005
- kFIRMessagingMessageCodeMessaging006 = 2006, // I-FCM002006 - no longer used
- kFIRMessagingMessageCodeMessaging007 = 2007, // I-FCM002007 - no longer used
+ kFIRMessagingMessageCodeMessaging006 = 2006, // I-FCM002006
+ kFIRMessagingMessageCodeMessaging007 = 2007, // I-FCM002007
kFIRMessagingMessageCodeMessaging008 = 2008, // I-FCM002008 - no longer used
kFIRMessagingMessageCodeMessaging009 = 2009, // I-FCM002009
kFIRMessagingMessageCodeMessaging010 = 2010, // I-FCM002010
diff --git a/Firebase/Messaging/FIRMessaging.m b/Firebase/Messaging/FIRMessaging.m
index cb5559f..ec73474 100644
--- a/Firebase/Messaging/FIRMessaging.m
+++ b/Firebase/Messaging/FIRMessaging.m
@@ -693,6 +693,11 @@ NSString *const kFIRMessagingPlistAutoInitEnabled =
completion:(nullable FIRMessagingTopicOperationCompletion)completion {
if (self.defaultFcmToken.length && topic.length) {
NSString *normalizeTopic = [[self class ] normalizeTopic:topic];
+ if ([FIRMessagingPubSub hasTopicsPrefix:topic]) {
+ FIRMessagingLoggerWarn(kFIRMessagingMessageCodeMessaging006,
+ @"Format '%@' is deprecated. Only '%@' should be used in "
+ @"subscribeToTopic.", topic, normalizeTopic);
+ }
if (normalizeTopic.length) {
[self.pubsub subscribeToTopic:normalizeTopic handler:completion];
} else {
@@ -714,6 +719,11 @@ NSString *const kFIRMessagingPlistAutoInitEnabled =
completion:(nullable FIRMessagingTopicOperationCompletion)completion {
if (self.defaultFcmToken.length && topic.length) {
NSString *normalizeTopic = [[self class] normalizeTopic:topic];
+ if ([FIRMessagingPubSub hasTopicsPrefix:topic]) {
+ FIRMessagingLoggerWarn(kFIRMessagingMessageCodeMessaging007,
+ @"Format '%@' is deprecated. Only '%@' should be used in "
+ @"unsubscribeFromTopic.", topic, normalizeTopic);
+ }
if (normalizeTopic.length) {
[self.pubsub unsubscribeFromTopic:normalizeTopic handler:completion];
} else {