Skip to content

Commit

Permalink
Fix failing tests and nullability warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
GLinnik21 committed Jun 21, 2024
1 parent 6ea521c commit 3199f5a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
5 changes: 2 additions & 3 deletions Sources/KSCrashFilters/KSCrashReportFilterBasic.m
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,14 @@ - (instancetype) initWithFiltersArray:(NSArray*) filters
[expandedFilters addObject:filter];
}
}
self.filters = expandedFilters;
self.filters = [expandedFilters copy];
}
return self;
}

- (void) addFilter:(id<KSCrashReportFilter>) filter
{
NSMutableArray* mutableFilters = (NSMutableArray*)self.filters; // Shh! Don't tell anyone!
[mutableFilters insertObject:filter atIndex:0];
self.filters = [@[filter] arrayByAddingObjectsFromArray:self.filters];
}

- (void) filterReports:(NSArray*) reports
Expand Down
2 changes: 1 addition & 1 deletion Sources/KSCrashInstallations/include/KSCrashInstallation.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ NS_SWIFT_NAME(Installation)
* when using this method. The callback will be internally managed to ensure proper integration
* with the backend.
*/
- (void) installWithConfiguration:(KSCrashConfiguration*) configuration;
- (void) installWithConfiguration:(nullable KSCrashConfiguration*) configuration;

/** Convenience method to call -[KSCrash sendAllReportsWithCompletion:].
* This method will set the KSCrash sink and then send all outstanding reports.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ NS_SWIFT_NAME(InstallationBaseQuincyHockey)
// The above properties will be written to the user section report using the
// following keys.

@property(nonatomic,readwrite,copy) NSString* userIDKey;
@property(nonatomic,readwrite,copy) NSString* userNameKey;
@property(nonatomic,readwrite,copy) NSString* contactEmailKey;
@property(nonatomic,readwrite,copy) NSString* crashDescriptionKey;
@property(nonatomic,readwrite,copy,nullable) NSString* userIDKey;
@property(nonatomic,readwrite,copy,nullable) NSString* userNameKey;
@property(nonatomic,readwrite,copy,nullable) NSString* contactEmailKey;
@property(nonatomic,readwrite,copy,nullable) NSString* crashDescriptionKey;

/** Data stored under these keys will be appended to the description
* (in JSON format) before sending to Quincy/Hockey.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ NS_SWIFT_NAME(InstallationVictory)
/** The URL to connect to. */
@property(nonatomic,readwrite,strong) NSURL* url;
/** The user name of crash information *required*. If value is nil it will be replaced with UIDevice.currentDevice.name */
@property(nonatomic,readwrite,copy) NSString* userName;
@property(nonatomic,readwrite,copy,nullable) NSString* userName;
/** The user email of crash information *optional* */
@property(nonatomic,readwrite,copy,nullable) NSString* userEmail;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ - (void) testInstall
- (void) testInstallInvalid
{
KSCrashInstallationEmail* installation = [KSCrashInstallationEmail sharedInstance];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
installation.recipients = nil;
installation.subject = nil;
installation.message = nil;
installation.filenameFmt = nil;
#pragma clang diagnostic pop
[installation addUnconditionalAlertWithTitle:@"title" message:@"message" dismissButtonText:@"dismiss"];
[installation installWithConfiguration:nil];
[installation sendAllReportsWithCompletion:^(__unused NSArray *filteredReports, BOOL completed, NSError *error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ - (void) testQuincyInstall
- (void) testQuincyInstallMissingProperties
{
KSCrashInstallationQuincy* installation = [KSCrashInstallationQuincy sharedInstance];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
installation.url = nil;
#pragma clang diagnostic pop
[installation installWithConfiguration:nil];
[installation sendAllReportsWithCompletion:^(__unused NSArray *filteredReports, BOOL completed, NSError *error)
{
Expand Down

0 comments on commit 3199f5a

Please sign in to comment.