added iOS source code
[wl-app.git] / iOS / Pods / FirebaseMessaging / Firebase / Messaging / FIRMessagingRegistrar.h
1 /*
2  * Copyright 2017 Google
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #import "FIRMessaging.h"
18 #import "FIRMessagingCheckinService.h"
19
20 @class FIRMessagingCheckinStore;
21 @class FIRMessagingPubSubRegistrar;
22
23 /**
24  *  Handle the registration process for the client. Fetch checkin information from the Checkin
25  *  service if not cached on the device and then try to register the client with FIRMessaging backend.
26  */
27 @interface FIRMessagingRegistrar : NSObject
28
29 @property(nonatomic, readonly, strong) FIRMessagingPubSubRegistrar *pubsubRegistrar;
30 @property(nonatomic, readonly, strong) NSString *deviceAuthID;
31 @property(nonatomic, readonly, strong) NSString *secretToken;
32
33 /**
34  *  Initialize a FIRMessaging Registrar.
35  *
36  *  @return A FIRMessaging Registrar object.
37  */
38 - (instancetype)init NS_DESIGNATED_INITIALIZER;
39
40 #pragma mark - Checkin
41
42 /**
43  *  Try to load checkin info from the disk if not currently loaded into memory.
44  *
45  *  @return YES if successfully loaded valid checkin info to memory else NO.
46  */
47 - (BOOL)tryToLoadValidCheckinInfo;
48
49 #pragma mark - Subscribe/Unsubscribe
50
51 /**
52  *  Update the subscription for a given topic for the client.
53  *
54  *  @param topic        The topic for which the subscription should be updated.
55  *  @param token        The registration token to be used by the client.
56  *  @param options      The extra options if any being passed as part of
57  *                      subscription request.
58  *  @param shouldDelete YES if we want to delete an existing subscription else NO
59  *                      if we want to create a new subscription.
60  *  @param handler      The handler to invoke once the subscription request is
61  *                      complete.
62  */
63 - (void)updateSubscriptionToTopic:(NSString *)topic
64                         withToken:(NSString *)token
65                           options:(NSDictionary *)options
66                      shouldDelete:(BOOL)shouldDelete
67                           handler:(FIRMessagingTopicOperationCompletion)handler;
68
69 /**
70  *  Cancel all subscription requests as well as any requests to checkin. Note if
71  *  there are subscription requests waiting on checkin to complete those requests
72  *  would be marked as stale and be NO-OP's if they happen in the future.
73  *
74  *  Also note this is a one time operation, you should only call this if you want
75  *  to immediately stop all requests and deallocate the registrar. After calling
76  *  this once you would no longer be able to use this registrar object.
77  */
78 - (void)cancelAllRequests;
79
80 @end