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 |
NS_ASSUME_NONNULL_BEGIN
|
|
|
20 |
|
|
|
21 |
@interface RCNUserDefaultsManager : NSObject
|
|
|
22 |
|
|
|
23 |
/// The last eTag received from the backend.
|
|
|
24 |
@property(nonatomic, assign) NSString *lastETag;
|
|
|
25 |
/// The time of the last eTag update.
|
|
|
26 |
@property(nonatomic, assign) NSTimeInterval lastETagUpdateTime;
|
|
|
27 |
/// The time of the last successful fetch.
|
|
|
28 |
@property(nonatomic, assign) NSTimeInterval lastFetchTime;
|
|
|
29 |
/// The time of the last successful fetch.
|
|
|
30 |
@property(nonatomic, assign) NSString *lastFetchStatus;
|
|
|
31 |
/// Boolean indicating if the last (one or more) fetch(es) was/were unsuccessful, in which case we
|
|
|
32 |
/// are in an exponential backoff mode.
|
|
|
33 |
@property(nonatomic, assign) BOOL isClientThrottledWithExponentialBackoff;
|
|
|
34 |
/// Time when the next request can be made while being throttled.
|
|
|
35 |
@property(nonatomic, assign) NSTimeInterval throttleEndTime;
|
|
|
36 |
/// The retry interval increases exponentially for cumulative fetch failures. Refer to
|
|
|
37 |
/// go/rc-client-throttling for details.
|
|
|
38 |
@property(nonatomic, assign) NSTimeInterval currentThrottlingRetryIntervalSeconds;
|
|
|
39 |
|
|
|
40 |
/// Designated initializer.
|
|
|
41 |
- (instancetype)initWithAppName:(NSString *)appName
|
|
|
42 |
bundleID:(NSString *)bundleIdentifier
|
|
|
43 |
namespace:(NSString *)firebaseNamespace NS_DESIGNATED_INITIALIZER;
|
|
|
44 |
|
|
|
45 |
// NOLINTBEGIN
|
|
|
46 |
/// Use `initWithAppName:bundleID:namespace:` instead.
|
|
|
47 |
- (instancetype)init
|
|
|
48 |
__attribute__((unavailable("Use `initWithAppName:bundleID:namespace:` instead.")));
|
|
|
49 |
// NOLINTEND
|
|
|
50 |
|
|
|
51 |
/// Delete all saved userdefaults for this instance.
|
|
|
52 |
- (void)resetUserDefaults;
|
|
|
53 |
@end
|
|
|
54 |
|
|
|
55 |
NS_ASSUME_NONNULL_END
|