2 * Copyright 2017 Google
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #import <Foundation/Foundation.h>
20 * Register the device with Checkin Service and get back the `authID`, `secret token` etc. for the
21 * client. Checkin results are cached in the `FIRMessagingDefaultsManager` and periodically refreshed to
22 * prevent them from being stale. Each client needs to register with checkin before registering
25 @interface FIRMessagingCheckinService : NSObject
27 @property(nonatomic, readonly, strong) NSString *deviceAuthID;
28 @property(nonatomic, readonly, strong) NSString *secretToken;
29 @property(nonatomic, readonly, strong) NSString *versionInfo;
30 @property(nonatomic, readonly, assign) BOOL hasValidCheckinInfo;
33 * Verify if valid checkin preferences have been loaded in memory.
35 * @return YES if valid checkin preferences exist in memory else NO.
37 - (BOOL)hasValidCheckinInfo;
40 * Try to load prefetched checkin preferences from the cache. This supports the use case where
41 * InstanceID library has already obtained a valid checkin and we should be using that.
43 * This should be used as a last gasp effort to retreive any cached checkin preferences before
44 * hitting the FIRMessaging backend to retrieve new preferences.
46 * Note this is only required because InstanceID and FIRMessaging both require checkin preferences which
47 * need to be synced with each other.
49 * @return YES if successfully loaded cached checkin preferences into memory else NO.
51 - (BOOL)tryToLoadPrefetchedCheckinPreferences;