Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bamx23 committed Sep 8, 2024
1 parent f4317cf commit 1421abd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
26 changes: 13 additions & 13 deletions Sources/KSCrashInstallations/KSCrashInstallation.m
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,6 @@ - (void)sendAllReportsWithCompletion:(KSCrashReportFilterCompletion)onCompletion
return;
}

NSMutableArray *sinkFilters = [@[
self.prependedFilters,
sink,
] mutableCopy];
if (self.isDoctorEnabled) {
[sinkFilters insertObject:[KSCrashReportFilterDoctor new] atIndex:0];
}
if (self.isDemangleEnabled) {
[sinkFilters insertObject:[KSCrashReportFilterDemangle new] atIndex:0];
}
sink = [[KSCrashReportFilterPipeline alloc] initWithFilters:sinkFilters];

KSCrashReportStore *store = [KSCrash sharedInstance].reportStore;
if (store == nil) {
onCompletion(
Expand All @@ -337,7 +325,19 @@ - (void)sendAllReportsWithCompletion:(KSCrashReportFilterCompletion)onCompletion
return;
}

store.sink = sink;
NSMutableArray *installationFilters = [NSMutableArray array];
if (self.isDemangleEnabled) {
[installationFilters addObject:[KSCrashReportFilterDemangle new]];
}
if (self.isDoctorEnabled) {
[installationFilters addObject:[KSCrashReportFilterDoctor new]];
}
[installationFilters addObjectsFromArray:@[
self.prependedFilters,
sink,
]];
store.sink = [[KSCrashReportFilterPipeline alloc] initWithFilters:installationFilters];

[store sendAllReportsWithCompletion:onCompletion];
}

Expand Down
21 changes: 20 additions & 1 deletion Tests/KSCrashFiltersTests/KSTestModuleConfig.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
//
// KSTestModuleConfig.h
//
// Created by Nikolay Volosatov on 2024-09-08.
//
// Created by Alexander Cohen on 5/9/24.
// Copyright (c) 2012 Karl Stenerud. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall remain in place
// in this source code.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

#ifndef KSTestModuleConfig_h
Expand Down

0 comments on commit 1421abd

Please sign in to comment.