1 |
efrain |
1 |
// Copyright 2021 Google LLC
|
|
|
2 |
//
|
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
|
5 |
// You may obtain a copy of the License at
|
|
|
6 |
//
|
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
8 |
//
|
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
12 |
// See the License for the specific language governing permissions and
|
|
|
13 |
// limitations under the License.
|
|
|
14 |
|
|
|
15 |
#import <Foundation/Foundation.h>
|
|
|
16 |
|
|
|
17 |
NS_ASSUME_NONNULL_BEGIN
|
|
|
18 |
|
|
|
19 |
@class FIRCLSManagerData;
|
|
|
20 |
@class FIRCLSReportUploader;
|
|
|
21 |
@class FIRCLSDataCollectionToken;
|
|
|
22 |
@class FIRCrashlyticsReport;
|
|
|
23 |
|
|
|
24 |
FOUNDATION_EXPORT NSUInteger const FIRCLSMaxUnsentReports;
|
|
|
25 |
|
|
|
26 |
@interface FIRCLSExistingReportManager : NSObject
|
|
|
27 |
|
|
|
28 |
/**
|
|
|
29 |
* Returns the number of unsent reports on the device, ignoring empty reports in
|
|
|
30 |
* the active folder, and ignoring any reports in "processing" or "prepared".
|
|
|
31 |
*
|
|
|
32 |
* In the past, this would count reports in the processed or prepared
|
|
|
33 |
* folders. This has been changed because reports in those paths have already
|
|
|
34 |
* been cleared for upload, so there isn't any point in asking for permission
|
|
|
35 |
* or possibly spamming end-users if a report gets stuck.
|
|
|
36 |
*
|
|
|
37 |
* The tricky part is, customers will NOT be alerted in `checkForUnsentReports`
|
|
|
38 |
* for reports in these paths, but when they choose `sendUnsentReports` / enable data
|
|
|
39 |
* collection, reports in those directories will be re-managed. This should be ok and
|
|
|
40 |
* just an edge case because reports should only be in processing or prepared for a split second as
|
|
|
41 |
* they do on-device symbolication and get converted into a GDTEvent. After a report is handed off
|
|
|
42 |
* to GoogleDataTransport, it is uploaded regardless of Crashlytics data collection.
|
|
|
43 |
*/
|
|
|
44 |
@property(nonatomic, readonly) NSUInteger unsentReportsCount;
|
|
|
45 |
|
|
|
46 |
/**
|
|
|
47 |
* This value needs to stay in sync with `numUnsentReports`, so if there is > 0 `numUnsentReports`,
|
|
|
48 |
* `newestUnsentReport` needs to return a value. Otherwise it needs to return nil.
|
|
|
49 |
*
|
|
|
50 |
* `FIRCLSContext` needs to be initialized before the `CrashlyticsReport` is instantiated.
|
|
|
51 |
*/
|
|
|
52 |
@property(nonatomic, readonly) FIRCrashlyticsReport *_Nullable newestUnsentReport;
|
|
|
53 |
|
|
|
54 |
- (instancetype)initWithManagerData:(FIRCLSManagerData *)managerData
|
|
|
55 |
reportUploader:(FIRCLSReportUploader *)reportUploader;
|
|
|
56 |
|
|
|
57 |
- (instancetype)init NS_UNAVAILABLE;
|
|
|
58 |
+ (instancetype)new NS_UNAVAILABLE;
|
|
|
59 |
|
|
|
60 |
/**
|
|
|
61 |
* This is important to call once, early in startup, before the
|
|
|
62 |
* new report for this run of the app has been created. Any
|
|
|
63 |
* reports in `ExistingReportManager` will be uploaded or deleted
|
|
|
64 |
* and we don't want to do that for the current run of the app.
|
|
|
65 |
*
|
|
|
66 |
* If there are over MAX_UNSENT_REPORTS valid reports, this will delete them.
|
|
|
67 |
*
|
|
|
68 |
* This methods is slow and should be called only once.
|
|
|
69 |
*/
|
|
|
70 |
- (void)collectExistingReports;
|
|
|
71 |
|
|
|
72 |
/**
|
|
|
73 |
* This is the side-effect of calling `deleteUnsentReports`, or collect_reports setting
|
|
|
74 |
* being false.
|
|
|
75 |
*/
|
|
|
76 |
- (void)deleteUnsentReports;
|
|
|
77 |
|
|
|
78 |
- (void)sendUnsentReportsWithToken:(FIRCLSDataCollectionToken *)dataCollectionToken
|
|
|
79 |
asUrgent:(BOOL)urgent;
|
|
|
80 |
|
|
|
81 |
@end
|
|
|
82 |
|
|
|
83 |
NS_ASSUME_NONNULL_END
|