Proyectos de Subversion Iphone Microlearning

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
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
#import "FirebaseMessaging/Sources/Token/FIRMessagingCheckinService.h"
19
 
20
NS_ASSUME_NONNULL_BEGIN
21
 
22
@class FIRMessagingCheckinPreferences;
23
/**
24
 *  @related FIRInstanceIDCheckinService
25
 *
26
 *  The completion handler invoked once the fetch from Checkin server finishes.
27
 *  For successful fetches we returned checkin information by the checkin service
28
 *  and `nil` error, else we return the appropriate error object as reported by the
29
 *  Checkin Service.
30
 *
31
 *  @param checkinPreferences The checkin preferences as fetched from the server.
32
 *  @param error              The error object which fetching GServices data.
33
 */
34
typedef void (^FIRMessagingDeviceCheckinCompletion)(
35
    FIRMessagingCheckinPreferences *_Nullable checkinPreferences, NSError *_Nullable error);
36
/**
37
 *  FIRMessagingAuthService is responsible for retrieving, caching, and supplying checkin info
38
 *  for the rest of Instance ID. A checkin can be scheduled, meaning that it will keep retrying the
39
 *  checkin request until it is successful. A checkin can also be requested directly, with a
40
 *  completion handler.
41
 */
42
@interface FIRMessagingAuthService : NSObject
43
 
44
#pragma mark - Checkin Service
45
 
46
- (BOOL)hasCheckinPlist;
47
 
48
/**
49
 *  Checks if the current deviceID and secret are valid or not.
50
 *
51
 *  @return YES if the checkin credentials are valid else NO.
52
 */
53
- (BOOL)hasValidCheckinInfo;
54
 
55
/**
56
 *  Fetch checkin info from the server. This would usually refresh the existing
57
 *  checkin credentials for the current app.
58
 *
59
 *  @param handler The completion handler to invoke once the checkin info has been
60
 *                 refreshed.
61
 */
62
- (void)fetchCheckinInfoWithHandler:(nullable FIRMessagingDeviceCheckinCompletion)handler;
63
 
64
/**
65
 *  Schedule checkin. Will hit the network only if the currently loaded checkin
66
 *  preferences are stale.
67
 *
68
 *  @param immediately YES if we want it to be scheduled immediately else NO.
69
 */
70
- (void)scheduleCheckin:(BOOL)immediately;
71
 
72
/**
73
 *  Returns the checkin preferences currently loaded in memory. The Checkin preferences
74
 *  can be either valid or invalid.
75
 *
76
 *  @return The checkin preferences loaded in memory.
77
 */
78
- (FIRMessagingCheckinPreferences *)checkinPreferences;
79
 
80
/**
81
 *  Cancels any ongoing checkin fetch, if any.
82
 */
83
- (void)stopCheckinRequest;
84
 
85
/**
86
 *  Resets the checkin information.
87
 *
88
 *  @param handler       The callback handler which is invoked when checkin reset is complete,
89
 *                       with an error if there is any.
90
 */
91
- (void)resetCheckinWithHandler:(void (^)(NSError *error))handler;
92
 
93
@end
94
 
95
NS_ASSUME_NONNULL_END