commit | author | age
|
a6c014
|
1 |
/* |
L |
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 |
|
df1e8e
|
19 |
#import "GULHeartbeatDateStorable.h" |
L |
20 |
|
a6c014
|
21 |
NS_ASSUME_NONNULL_BEGIN |
L |
22 |
|
df1e8e
|
23 |
/// The name of the directory where the heartbeat data is stored. |
L |
24 |
extern NSString *const kGULHeartbeatStorageDirectory; |
|
25 |
|
a6c014
|
26 |
/// Stores either a date or a dictionary to a specified file. |
df1e8e
|
27 |
@interface GULHeartbeatDateStorage : NSObject <GULHeartbeatDateStorable> |
a6c014
|
28 |
|
L |
29 |
- (instancetype)init NS_UNAVAILABLE; |
|
30 |
|
|
31 |
@property(nonatomic, readonly) NSURL *fileURL; |
|
32 |
|
|
33 |
/** |
|
34 |
* Default initializer. |
|
35 |
* @param fileName The name of the file to store the date information. |
|
36 |
* exist, it will be created if needed. |
|
37 |
*/ |
|
38 |
- (instancetype)initWithFileName:(NSString *)fileName; |
|
39 |
|
|
40 |
/** |
|
41 |
* Reads the date from the specified file for the given tag. |
|
42 |
* @return Returns date if exists, otherwise `nil`. |
|
43 |
*/ |
|
44 |
- (nullable NSDate *)heartbeatDateForTag:(NSString *)tag; |
|
45 |
|
|
46 |
/** |
|
47 |
* Saves the date for the specified tag in the specified file. |
|
48 |
* @return YES on success, NO otherwise. |
|
49 |
*/ |
|
50 |
- (BOOL)setHearbeatDate:(NSDate *)date forTag:(NSString *)tag; |
|
51 |
|
|
52 |
@end |
|
53 |
|
|
54 |
NS_ASSUME_NONNULL_END |