aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Messaging/FIRMessagingRegistrar.h
diff options
context:
space:
mode:
authorGravatar Paul Beusterien <paulbeusterien@google.com>2017-05-15 12:27:07 -0700
committerGravatar Paul Beusterien <paulbeusterien@google.com>2017-05-15 12:27:07 -0700
commit98ba64449a632518bd2b86fe8d927f4a960d3ddc (patch)
tree131d9c4272fa6179fcda6c5a33fcb3b1bd57ad2e /Firebase/Messaging/FIRMessagingRegistrar.h
parent32461366c9e204a527ca05e6e9b9404a2454ac51 (diff)
Initial
Diffstat (limited to 'Firebase/Messaging/FIRMessagingRegistrar.h')
-rw-r--r--Firebase/Messaging/FIRMessagingRegistrar.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/Firebase/Messaging/FIRMessagingRegistrar.h b/Firebase/Messaging/FIRMessagingRegistrar.h
new file mode 100644
index 0000000..5b60437
--- /dev/null
+++ b/Firebase/Messaging/FIRMessagingRegistrar.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import "FIRMessagingCheckinService.h"
+#import "FIRMessagingTopicsCommon.h"
+
+@class FIRMessagingCheckinStore;
+@class FIRMessagingPubSubRegistrar;
+
+/**
+ * Handle the registration process for the client. Fetch checkin information from the Checkin
+ * service if not cached on the device and then try to register the client with FIRMessaging backend.
+ */
+@interface FIRMessagingRegistrar : NSObject
+
+@property(nonatomic, readonly, strong) FIRMessagingPubSubRegistrar *pubsubRegistrar;
+@property(nonatomic, readonly, strong) NSString *deviceAuthID;
+@property(nonatomic, readonly, strong) NSString *secretToken;
+
+/**
+ * Initialize a FIRMessaging Registrar.
+ *
+ * @return A FIRMessaging Registrar object.
+ */
+- (instancetype)init NS_DESIGNATED_INITIALIZER;
+
+#pragma mark - Checkin
+
+/**
+ * Try to load checkin info from the disk if not currently loaded into memory.
+ *
+ * @return YES if successfully loaded valid checkin info to memory else NO.
+ */
+- (BOOL)tryToLoadValidCheckinInfo;
+
+/**
+ * Check if we have a valid checkin info in memory.
+ *
+ * @return YES if we have valid checkin info in memory else NO.
+ */
+- (BOOL)hasValidCheckinInfo;
+
+#pragma mark - Subscribe/Unsubscribe
+
+/**
+ * Update the subscription for a given topic for the client.
+ *
+ * @param topic The topic for which the subscription should be updated.
+ * @param token The registration token to be used by the client.
+ * @param options The extra options if any being passed as part of
+ * subscription request.
+ * @param shouldDelete YES if we want to delete an existing subscription else NO
+ * if we want to create a new subscription.
+ * @param handler The handler to invoke once the subscription request is
+ * complete.
+ */
+- (void)updateSubscriptionToTopic:(NSString *)topic
+ withToken:(NSString *)token
+ options:(NSDictionary *)options
+ shouldDelete:(BOOL)shouldDelete
+ handler:(FIRMessagingTopicOperationCompletion)handler;
+
+/**
+ * Cancel all subscription requests as well as any requests to checkin. Note if
+ * there are subscription requests waiting on checkin to complete those requests
+ * would be marked as stale and be NO-OP's if they happen in the future.
+ *
+ * Also note this is a one time operation, you should only call this if you want
+ * to immediately stop all requests and deallocate the registrar. After calling
+ * this once you would no longer be able to use this registrar object.
+ */
+- (void)cancelAllRequests;
+
+@end