Skip to content

Commit

Permalink
Fix report count property (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
bamx23 committed Sep 3, 2024
1 parent a96174d commit f15e88f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct ReportingView: View {

var body: some View {
List {
Text("Pending reports: \(store.reportCount)")
Button("Log To Console") {
store.logToConsole()
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/KSCrashRecording/KSCrashReportStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ - (void)dealloc
KSCrashReportStoreCConfiguration_Release(&_cConfig);
}

- (NSInteger)reportCount
{
return kscrs_getReportCount(&_cConfig);
}

- (void)sendAllReportsWithCompletion:(KSCrashReportFilterCompletion)onCompletion
{
NSArray *reports = [self allReports];
Expand Down Expand Up @@ -108,11 +113,6 @@ - (void)deleteReportWithID:(int64_t)reportID

#pragma mark - Private API

- (NSInteger)reportCount
{
return kscrs_getReportCount(&_cConfig);
}

- (void)sendReports:(NSArray<id<KSCrashReport>> *)reports onCompletion:(KSCrashReportFilterCompletion)onCompletion
{
if ([reports count] == 0) {
Expand Down
3 changes: 0 additions & 3 deletions Sources/KSCrashRecording/include/KSCrash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions Sources/KSCrashRecording/include/KSCrashReportStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit f15e88f

Please sign in to comment.