22
22
#import " Crashlytics/Crashlytics/Models/FIRCLSFileManager.h"
23
23
#import " Crashlytics/Crashlytics/Models/FIRCLSInternalReport.h"
24
24
#import " Crashlytics/Crashlytics/Models/FIRCLSSettings.h"
25
+ #import " Crashlytics/Crashlytics/Private/FIRCLSOnDemandModel_Private.h"
25
26
#import " Crashlytics/Crashlytics/Private/FIRCrashlyticsReport_Private.h"
26
27
#import " Crashlytics/Crashlytics/Public/FirebaseCrashlytics/FIRCrashlyticsReport.h"
27
28
@@ -35,6 +36,7 @@ @interface FIRCLSExistingReportManager ()
35
36
@property (nonatomic , strong ) NSOperationQueue *operationQueue;
36
37
@property (nonatomic , strong ) FIRCLSSettings *settings;
37
38
@property (nonatomic , strong ) FIRCLSDataCollectionArbiter *dataArbiter;
39
+ @property (nonatomic , strong ) FIRCLSOnDemandModel *onDemandModel;
38
40
39
41
// This list of active reports excludes the brand new active report that will be created this run of
40
42
// the app.
@@ -60,6 +62,7 @@ - (instancetype)initWithManagerData:(FIRCLSManagerData *)managerData
60
62
_operationQueue = managerData.operationQueue ;
61
63
_dataArbiter = managerData.dataArbiter ;
62
64
_reportUploader = reportUploader;
65
+ _onDemandModel = managerData.onDemandModel ;
63
66
64
67
return self;
65
68
}
@@ -178,6 +181,13 @@ - (void)sendUnsentReportsWithToken:(FIRCLSDataCollectionToken *)dataCollectionTo
178
181
asUrgent: urgent];
179
182
}
180
183
184
+ for (NSString *path in self.onDemandModel .storedActiveReportPaths ) {
185
+ [self processExistingActiveReportPath: path
186
+ dataCollectionToken: dataCollectionToken
187
+ asUrgent: urgent];
188
+ }
189
+ [self .onDemandModel.storedActiveReportPaths removeAllObjects ];
190
+
181
191
// deal with stuff in processing more carefully - do not process again
182
192
[self .operationQueue addOperationWithBlock: ^{
183
193
for (NSString *path in self.processingReportPaths ) {
@@ -248,4 +258,14 @@ - (void)deleteUnsentReports {
248
258
}];
249
259
}
250
260
261
+ - (void )handleOnDemandReportUpload : (NSString *)path
262
+ dataCollectionToken : (FIRCLSDataCollectionToken *)dataCollectionToken
263
+ asUrgent : (BOOL )urgent {
264
+ dispatch_async (self.operationQueue .underlyingQueue , ^{
265
+ [self processExistingActiveReportPath: path
266
+ dataCollectionToken: dataCollectionToken
267
+ asUrgent: YES ];
268
+ });
269
+ }
270
+
251
271
@end
0 commit comments