blob: 1fb715e7c87cf366a73f8c2afcae43b665cc0196 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/*
* Copyright 2019 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 <Foundation/Foundation.h>
#import "FIRInstanceIDCheckinService.h"
@class FIRInstanceIDCheckinPreferences;
@class FIRInstanceIDStore;
/**
* FIRInstanceIDAuthService is responsible for retrieving, caching, and supplying checkin info
* for the rest of Instance ID. A checkin can be scheduled, meaning that it will keep retrying the
* checkin request until it is successful. A checkin can also be requested directly, with a
* completion handler.
*/
@interface FIRInstanceIDAuthService : NSObject
/**
* Used only for testing. In addition to taking a store (for locally caching the checkin info), it
* also takes a checkinService.
*/
- (instancetype)initWithCheckinService:(FIRInstanceIDCheckinService *)checkinService
store:(FIRInstanceIDStore *)store;
/**
* Initializes the auth service given a store (which provides the local caching of checkin info).
* This initializer will create its own instance of FIRInstanceIDCheckinService.
*/
- (instancetype)initWithStore:(FIRInstanceIDStore *)store;
#pragma mark - Checkin Service
/**
* Checks if the current deviceID and secret are valid or not.
*
* @return YES if the checkin credentials are valid else NO.
*/
- (BOOL)hasValidCheckinInfo;
/**
* Fetch checkin info from the server. This would usually refresh the existing
* checkin credentials for the current app.
*
* @param handler The completion handler to invoke once the checkin info has been
* refreshed.
*/
- (void)fetchCheckinInfoWithHandler:(FIRInstanceIDDeviceCheckinCompletion)handler;
/**
* Schedule checkin. Will hit the network only if the currently loaded checkin
* preferences are stale.
*
* @param immediately YES if we want it to be scheduled immediately else NO.
*/
- (void)scheduleCheckin:(BOOL)immediately;
/**
* Returns the checkin preferences currently loaded in memory. The Checkin preferences
* can be either valid or invalid.
*
* @return The checkin preferences loaded in memory.
*/
- (FIRInstanceIDCheckinPreferences *)checkinPreferences;
/**
* Cancels any ongoing checkin fetch, if any.
*/
- (void)stopCheckinRequest;
/**
* Resets the checkin information.
*
* @param handler The callback handler which is invoked when checkin reset is complete,
* with an error if there is any.
*/
- (void)resetCheckinWithHandler:(void (^)(NSError *error))handler;
@end
|