Skip to content

Commit

Permalink
fix(analyze): fix issues showed by analyze
Browse files Browse the repository at this point in the history
SUITEDEV-36440

Co-authored-by: megamegax <[email protected]>
Co-authored-by: davidSchuppa <[email protected]>
  • Loading branch information
3 people committed Aug 29, 2024
1 parent 84db3b6 commit 08aa2d9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Emarsys Sample/Emarsys-Sample/Views/MobileEngageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct MobileEngageView: View {

func convertEventPayloadToJson() -> Dictionary<String, String>? {
var eventAttributes: [String: String]?
if let attributes = self.customEventPayload {
if let attributes = self.customEventPayload, !attributes.isEmpty {
if let data = attributes.data(using: .utf8) {
do {
eventAttributes = try JSONSerialization.jsonObject(with: data, options: []) as? [String: String]
Expand Down
3 changes: 3 additions & 0 deletions Sources/Core/Crypto/EMSCrypto.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ - (BOOL)verifyContent:(NSData *)content
EMSLog(logEntry, LogLevelDebug);
}
}
if (publicKey) {
CFRelease(publicKey);
}
return result;
}

Expand Down
10 changes: 6 additions & 4 deletions Sources/Core/Store/EMSStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ - (void)setData:(nullable NSData *)data
forKey:key];

NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
parameters[@"data"] = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
if (data) {
parameters[@"data"] = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
}
parameters[@"key"] = key;
NSMutableDictionary *statusDict = [NSMutableDictionary dictionary];
statusDict[@"osStatus"] = @(status);
Expand Down Expand Up @@ -416,8 +418,8 @@ - (OSStatus)deleteValueForKey:(NSString *)key
__block OSStatus result;
__weak typeof(self) weakSelf = self;
[self.operationQueue addOperationWithBlock:^{
NSMutableDictionary *mutableQuery = [self createQueryWithKey:key
accessGroup:accessGroup];
NSMutableDictionary *mutableQuery = [weakSelf createQueryWithKey:key
accessGroup:accessGroup];
NSDictionary *query = [NSDictionary dictionaryWithDictionary:mutableQuery];
result = SecItemDelete((__bridge CFDictionaryRef) query);
}];
Expand Down
6 changes: 3 additions & 3 deletions Sources/Private/EMSProductBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ NS_ASSUME_NONNULL_BEGIN

- (instancetype)setCustomFields:(NSDictionary<NSString *, NSString *> *)customFields;

- (instancetype)setImageUrl:(NSURL *)imageUrl;
- (instancetype)setImageUrl:(nullable NSURL *)imageUrl;

- (instancetype)setZoomImageUrl:(NSURL *)zoomImageUrl;
- (instancetype)setZoomImageUrl:(nullable NSURL *)zoomImageUrl;

- (instancetype)setCategoryPath:(NSString *)categoryPath;

Expand All @@ -63,4 +63,4 @@ NS_ASSUME_NONNULL_BEGIN

@end

NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END

0 comments on commit 08aa2d9

Please sign in to comment.