1 |
efrain |
1 |
/*
|
|
|
2 |
* Copyright 2019 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 <Foundation/Foundation.h>
|
|
|
18 |
|
|
|
19 |
#import "FirebaseMessaging/Sources/FIRMessagingUtilities.h"
|
|
|
20 |
|
|
|
21 |
NS_ASSUME_NONNULL_BEGIN
|
|
|
22 |
|
|
|
23 |
// keys in Checkin preferences
|
|
|
24 |
FOUNDATION_EXPORT NSString *const kFIRMessagingDeviceAuthIdKey;
|
|
|
25 |
FOUNDATION_EXPORT NSString *const kFIRMessagingSecretTokenKey;
|
|
|
26 |
FOUNDATION_EXPORT NSString *const kFIRMessagingDigestStringKey;
|
|
|
27 |
FOUNDATION_EXPORT NSString *const kFIRMessagingLastCheckinTimeKey;
|
|
|
28 |
FOUNDATION_EXPORT NSString *const kFIRMessagingVersionInfoStringKey;
|
|
|
29 |
FOUNDATION_EXPORT NSString *const kFIRMessagingGServicesDictionaryKey;
|
|
|
30 |
FOUNDATION_EXPORT NSString *const kFIRMessagingDeviceDataVersionKey;
|
|
|
31 |
|
|
|
32 |
@class FIRMessagingCheckinPreferences;
|
|
|
33 |
|
|
|
34 |
/**
|
|
|
35 |
* Register the device with Checkin Service and get back the `authID`, `secret
|
|
|
36 |
* token` etc. for the client. Checkin results are cached in the
|
|
|
37 |
* `FIRMessagingCache` and periodically refreshed to prevent them from being stale.
|
|
|
38 |
* Each client needs to register with checkin before registering with InstanceID.
|
|
|
39 |
*/
|
|
|
40 |
@interface FIRMessagingCheckinService : NSObject
|
|
|
41 |
|
|
|
42 |
/**
|
|
|
43 |
* Execute a device checkin request to obtain an deviceID, secret token,
|
|
|
44 |
* gService data.
|
|
|
45 |
*
|
|
|
46 |
* @param existingCheckin An existing checkin preference object, if available.
|
|
|
47 |
* @param completion Completion hander called on success or failure of device checkin.
|
|
|
48 |
*/
|
|
|
49 |
- (void)checkinWithExistingCheckin:(nullable FIRMessagingCheckinPreferences *)existingCheckin
|
|
|
50 |
completion:
|
|
|
51 |
(void (^)(FIRMessagingCheckinPreferences *_Nullable checkinPreferences,
|
|
|
52 |
NSError *_Nullable error))completion;
|
|
|
53 |
|
|
|
54 |
/**
|
|
|
55 |
* This would stop any request that the service made to the checkin backend and also
|
|
|
56 |
* release any callback handlers that it holds.
|
|
|
57 |
*/
|
|
|
58 |
- (void)stopFetching;
|
|
|
59 |
|
|
|
60 |
@end
|
|
|
61 |
|
|
|
62 |
NS_ASSUME_NONNULL_END
|