diff --git a/Samples/Common/Sources/SampleUI/Screens/ReportingView.swift b/Samples/Common/Sources/SampleUI/Screens/ReportingView.swift index c72749c3..84519f8f 100644 --- a/Samples/Common/Sources/SampleUI/Screens/ReportingView.swift +++ b/Samples/Common/Sources/SampleUI/Screens/ReportingView.swift @@ -33,6 +33,7 @@ struct ReportingView: View { var body: some View { List { + Text("Pending reports: \(store.reportCount)") Button("Log To Console") { store.logToConsole() } diff --git a/Sources/KSCrashRecording/KSCrashReportStore.m b/Sources/KSCrashRecording/KSCrashReportStore.m index 2d3b8fda..70b7792b 100644 --- a/Sources/KSCrashRecording/KSCrashReportStore.m +++ b/Sources/KSCrashRecording/KSCrashReportStore.m @@ -75,6 +75,11 @@ - (void)dealloc KSCrashReportStoreCConfiguration_Release(&_cConfig); } +- (NSInteger)reportCount +{ + return kscrs_getReportCount(&_cConfig); +} + - (void)sendAllReportsWithCompletion:(KSCrashReportFilterCompletion)onCompletion { NSArray *reports = [self allReports]; @@ -108,11 +113,6 @@ - (void)deleteReportWithID:(int64_t)reportID #pragma mark - Private API -- (NSInteger)reportCount -{ - return kscrs_getReportCount(&_cConfig); -} - - (void)sendReports:(NSArray> *)reports onCompletion:(KSCrashReportFilterCompletion)onCompletion { if ([reports count] == 0) { diff --git a/Sources/KSCrashRecording/include/KSCrash.h b/Sources/KSCrashRecording/include/KSCrash.h index 229c5aaf..20c06e34 100644 --- a/Sources/KSCrashRecording/include/KSCrash.h +++ b/Sources/KSCrashRecording/include/KSCrash.h @@ -85,9 +85,6 @@ NS_ASSUME_NONNULL_BEGIN /** If true, the application crashed on the previous launch. */ @property(nonatomic, readonly, assign) BOOL crashedLastLaunch; -/** The total number of unsent reports. Note: This is an expensive operation. */ -@property(nonatomic, readonly, assign) NSInteger reportCount; - /** Information about the operating system and environment. * * @note `bootTime` and `storageSize` are not populated in this property. diff --git a/Sources/KSCrashRecording/include/KSCrashReportStore.h b/Sources/KSCrashRecording/include/KSCrashReportStore.h index c43f20e7..e6105fc9 100644 --- a/Sources/KSCrashRecording/include/KSCrashReportStore.h +++ b/Sources/KSCrashRecording/include/KSCrashReportStore.h @@ -91,6 +91,10 @@ NS_SWIFT_NAME(CrashReportStore) */ @property(nonatomic, assign) KSCrashReportCleanupPolicy reportCleanupPolicy; +/** The total number of unsent reports. Note: This is an expensive operation. + */ +@property(nonatomic, readonly, assign) NSInteger reportCount; + #pragma mark - Reports API /** Get all unsent report IDs. */