Skip to content

Commit

Permalink
Merge pull request #245 from CleverTap/develop
Browse files Browse the repository at this point in the history
Release v4.2.2
  • Loading branch information
akashvercetti authored Apr 3, 2023
2 parents b3066ed + a8caa0b commit 60d0a3f
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 30 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Change Log
All notable changes to this project will be documented in this file.

### [Version 4.2.2](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/4.2.2) (April 03, 2023)

#### Fixed
- Fixed compilation errors in xcode 14.3+.
- Added guard rails to prevent crashes for background state tasks.

### [Version 4.2.1](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/4.2.1) (March 22, 2023)

#### Added
Expand Down
2 changes: 1 addition & 1 deletion CleverTap-iOS-SDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "CleverTap-iOS-SDK"
s.version = "4.2.1"
s.version = "4.2.2"
s.summary = "The CleverTap iOS SDK for App Analytics and Engagement."
s.homepage = "https://github.com/CleverTap/clevertap-ios-sdk"
s.license = { :type => "MIT" }
Expand Down
1 change: 0 additions & 1 deletion CleverTapSDK/CTDeviceInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
- (void)forceNewDeviceID;
- (void)forceUpdateCustomDeviceID:(NSString *)cleverTapID;
- (BOOL)isErrorDeviceID;
- (void)setDirectCallSDKVersion: (NSString *)version;
- (void)incrementLocalInAppCount;
- (int)getLocalInAppCount;
- (void)setSignedCallSDKVersion: (NSString *)version;
Expand Down
3 changes: 3 additions & 0 deletions CleverTapSDK/CTLocalDataStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ - (NSDictionary*)syncWithRemoteData:(NSDictionary *)responseData {
return nil;
}
}
else {
return nil;
}
} @catch (NSException *e) {
CleverTapLogInternal(self.config.logLevel, @"%@: Failed to process data sync from upstream: %@", self, e.debugDescription);
return nil;
Expand Down
2 changes: 1 addition & 1 deletion CleverTapSDK/CTPlistInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
+ (instancetype _Nullable)sharedInstance;
- (void)setCredentialsWithAccountID:(NSString * _Nonnull)accountID token:(NSString * _Nonnull)token region:(NSString * _Nullable)region;
- (void)setCredentialsWithAccountID:(NSString * _Nonnull)accountID token:(NSString * _Nonnull)token proxyDomain:(NSString * _Nonnull)proxyDomain;
- (void)setCredentialsWithAccountID:(NSString * _Nonnull)accountID token:(NSString * _Nonnull)token proxyDomain:(NSString * _Nonnull)proxyDomain spikyProxyDomain:(NSString * _Nonnull)spikyProxyDomain;
- (void)setCredentialsWithAccountID:(NSString * _Nonnull)accountID token:(NSString * _Nonnull)token proxyDomain:(NSString * _Nonnull)proxyDomain spikyProxyDomain:(NSString * _Nullable)spikyProxyDomain;

@end
2 changes: 1 addition & 1 deletion CleverTapSDK/CTPlistInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ - (void)setCredentialsWithAccountID:(NSString *)accountID token:(NSString *)toke
_proxyDomain = proxyDomain;
}

- (void)setCredentialsWithAccountID:(NSString *)accountID token:(NSString *)token proxyDomain:(NSString *)proxyDomain spikyProxyDomain:(NSString *)spikyProxyDomain {
- (void)setCredentialsWithAccountID:(NSString * _Nonnull)accountID token:(NSString * _Nonnull)token proxyDomain:(NSString * _Nonnull)proxyDomain spikyProxyDomain:(NSString * _Nullable)spikyProxyDomain {
_accountId = accountID;
_accountToken = token;
_proxyDomain = proxyDomain;
Expand Down
8 changes: 4 additions & 4 deletions CleverTapSDK/CTPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

+ (void)putInt:(long)resetValue forKey:(NSString *_Nonnull)key;

+ (NSString *_Nonnull)getStringForKey:(NSString *_Nonnull)key withResetValue:(NSString *_Nullable)resetValue;
+ (NSString *_Nullable)getStringForKey:(NSString *_Nonnull)key withResetValue:(NSString *_Nullable)resetValue;

+ (void)putString:(NSString *_Nonnull)resetValue forKey:(NSString *_Nonnull)key;

Expand All @@ -17,12 +17,12 @@

+ (void)removeObjectForKey:(NSString *_Nonnull)key;

+ (id _Nonnull)unarchiveFromFile:(NSString *_Nonnull)filename ofType:(Class _Nonnull)cls removeFile:(BOOL)remove;
+ (id _Nullable)unarchiveFromFile:(NSString *_Nonnull)filename ofType:(Class _Nonnull)cls removeFile:(BOOL)remove;

+ (id _Nonnull)unarchiveFromFile:(NSString *_Nonnull)filename ofTypes:(nonnull NSSet<Class> *)classes removeFile:(BOOL)remove;
+ (id _Nullable)unarchiveFromFile:(NSString *_Nonnull)filename ofTypes:(nonnull NSSet<Class> *)classes removeFile:(BOOL)remove;

+ (BOOL)archiveObject:(id _Nonnull)object forFileName:(NSString *_Nonnull)fileName;

+ (NSString *)storageKeyWithSuffix: (NSString *)suffix config: (CleverTapInstanceConfig*)config;
+ (NSString * _Nonnull)storageKeyWithSuffix: (NSString * _Nonnull)suffix config: (CleverTapInstanceConfig* _Nonnull)config;

@end
8 changes: 4 additions & 4 deletions CleverTapSDK/CTPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ + (void)putInt:(long)resetValue forKey:(NSString *)key {
[defaults synchronize];
}

+ (NSString *)getStringForKey:(NSString *)key withResetValue:(NSString *)resetValue {
+ (NSString *_Nullable)getStringForKey:(NSString *_Nonnull)key withResetValue:(NSString *_Nullable)resetValue {
key = [NSString stringWithFormat:@"%@%@", PREF_PREFIX, key];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
id value = [defaults objectForKey:key];
Expand Down Expand Up @@ -92,7 +92,7 @@ + (void)logUnarchiveError:(NSError *)error filePath:(NSString *)filePath removeF
}
}

+ (id)unarchiveFromFile:(NSString *)filename ofTypes:(nonnull NSSet<Class> *)classes removeFile:(BOOL)remove {
+ (id _Nullable)unarchiveFromFile:(NSString *_Nonnull)filename ofTypes:(nonnull NSSet<Class> *)classes removeFile:(BOOL)remove {
id data = nil;
NSError *error = nil;
NSString *filePath = [self filePathfromFileName:filename];
Expand All @@ -119,7 +119,7 @@ + (id)unarchiveFromFile:(NSString *)filename ofTypes:(nonnull NSSet<Class> *)cla
return data;
}

+ (id)unarchiveFromFile:(NSString *)filename ofType:(Class)cls removeFile:(BOOL)remove {
+ (id _Nullable)unarchiveFromFile:(NSString *_Nonnull)filename ofType:(Class _Nonnull)cls removeFile:(BOOL)remove{
id data = nil;
NSError *error = nil;

Expand Down Expand Up @@ -177,7 +177,7 @@ + (BOOL)archiveObject:(id)object forFileName:(NSString *)filename {
return success;
}

+ (NSString *)storageKeyWithSuffix: (NSString *)suffix config: (CleverTapInstanceConfig*)config {
+ (NSString * _Nonnull)storageKeyWithSuffix: (NSString * _Nonnull)suffix config: (CleverTapInstanceConfig* _Nonnull)config {
return [NSString stringWithFormat:@"%@:%@", config.accountId, suffix];
}

Expand Down
2 changes: 1 addition & 1 deletion CleverTapSDK/CleverTap.h
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ extern NSString * _Nonnull const CleverTapProfileDidInitializeNotification;
#if defined(CLEVERTAP_HOST_WATCHOS)
/** HostWatchOS
*/
- (BOOL)handleMessage:(NSDictionary<NSString *, id> *)message forWatchSession:(WCSession *)session API_AVAILABLE(ios(9.0));
- (BOOL)handleMessage:(NSDictionary<NSString *, id> *_Nonnull)message forWatchSession:(WCSession *_Nonnull)session API_AVAILABLE(ios(9.0));
#endif

/*!
Expand Down
37 changes: 24 additions & 13 deletions CleverTapSDK/CleverTap.m
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,12 @@ - (void)_appEnteredBackground {
[self persistQueues];
}
[self runSerialAsync:^{
[self updateSessionTime:(long) [[NSDate date] timeIntervalSince1970]];
@try {
[self updateSessionTime:(long) [[NSDate date] timeIntervalSince1970]];
}
@catch (NSException *exception) {
CleverTapLogDebug(self.config.logLevel, @"%@: Exception caught: %@", self, [exception reason]);
}
}];
}

Expand Down Expand Up @@ -2805,12 +2810,17 @@ - (void)clearNotificationsQueue {

- (void)persistQueues {
[self runSerialAsync:^{
if ([self isMuted]) {
[self clearQueues];
} else {
[self persistProfileQueue];
[self persistEventsQueue];
[self persistNotificationsQueue];
@try {
if ([self isMuted]) {
[self clearQueues];
} else {
[self persistProfileQueue];
[self persistEventsQueue];
[self persistNotificationsQueue];
}
}
@catch (NSException *exception) {
CleverTapLogDebug(self.config.logLevel, @"%@: Exception caught: %@", self, [exception reason]);
}
}];
}
Expand Down Expand Up @@ -4030,13 +4040,14 @@ + (void)setCredentialsWithAccountID:(NSString *)accountID token:(NSString *)toke
+ (void)setCredentialsWithAccountID:(NSString *)accountID token:(NSString *)token proxyDomain:(NSString *)proxyDomain spikyProxyDomain:(NSString *)spikyProxyDomain {
[self _setCredentialsWithAccountID:accountID token:token proxyDomain:proxyDomain];

NSString *spikyProxyDomainResult;
if (spikyProxyDomain != nil && ![spikyProxyDomain isEqualToString:@""]) {
spikyProxyDomain = [spikyProxyDomain stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if (spikyProxyDomain.length <= 0) {
spikyProxyDomain = nil;
spikyProxyDomainResult = [spikyProxyDomain stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if (spikyProxyDomainResult.length <= 0) {
spikyProxyDomainResult = nil;
}
}
[_plistInfo setCredentialsWithAccountID:accountID token:token proxyDomain:proxyDomain spikyProxyDomain:spikyProxyDomain];
[_plistInfo setCredentialsWithAccountID:accountID token:token proxyDomain:proxyDomain spikyProxyDomain:spikyProxyDomainResult];
}

+ (void)enablePersonalization {
Expand Down Expand Up @@ -4216,7 +4227,7 @@ - (CleverTapUTMDetail *)getUTMDetails {
}

#if defined(CLEVERTAP_HOST_WATCHOS)
- (BOOL)handleMessage:(NSDictionary<NSString *, id> *)message forWatchSession:(WCSession *)session {
- (BOOL)handleMessage:(NSDictionary<NSString *, id> *_Nonnull)message forWatchSession:(WCSession *_Nonnull)session {
NSString *type = [message objectForKey:@"clevertap_type"];

BOOL handled = (type != nil);
Expand Down Expand Up @@ -4562,7 +4573,7 @@ - (BOOL)didHandleInboxMessageTestFromPushNotificaton:(NSDictionary*)notification
NSMutableDictionary *message = [NSMutableDictionary dictionary];
[message setObject:nowEpoch forKey:@"_id"];
[message setObject:[NSNumber numberWithLong:expireTime] forKey:@"wzrk_ttl"];
[message addEntriesFromDictionary:msg];
[message addEntriesFromDictionary:msg ?: @{}];

NSMutableArray<NSDictionary*> *inboxMsg = [NSMutableArray new];
[inboxMsg addObject:message];
Expand Down
2 changes: 1 addition & 1 deletion CleverTapSDK/CleverTapBuildInfo.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

#define WR_SDK_REVISION @"40201"
#define WR_SDK_REVISION @"40202"

2 changes: 1 addition & 1 deletion CleverTapSDK/Inbox/models/CTUserMO+CoreDataProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ NS_ASSUME_NONNULL_BEGIN

@interface CTUserMO (CoreDataProperties)

+ (instancetype)fetchOrCreateFromJSON:(NSDictionary *)json forContext:(NSManagedObjectContext *)context;
+ (instancetype _Nullable)fetchOrCreateFromJSON:(NSDictionary *)json forContext:(NSManagedObjectContext *)context;
- (BOOL)updateMessages:(NSArray<NSDictionary*> *)messages forContext:(NSManagedObjectContext *)context;

@property (nullable, nonatomic, copy) NSString *accountId;
Expand Down
4 changes: 2 additions & 2 deletions CleverTapSDK/Inbox/models/CTUserMO+CoreDataProperties.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ - (void)removeMessages:(NSOrderedSet<CTMessageMO *> *)values;

@implementation CTUserMO (CoreDataProperties)

+ (instancetype)fetchOrCreateFromJSON:(NSDictionary *)json forContext:(NSManagedObjectContext *)context {
+ (instancetype _Nullable)fetchOrCreateFromJSON:(NSDictionary *)json forContext:(NSManagedObjectContext *)context {
CTUserMO *_user;
@try {
NSString *identifier = json[@"identifier"];

if (!identifier) {
CleverTapLogStaticInternal(@"CTUserMO fetchOrCreate for: %@ requires an identifier returning nil", json);
CleverTapLogStaticInternal(@"CTUserMO fetchOrCreate for: %@ requires an identifier. Returning nil", json);
return nil;
}

Expand Down

0 comments on commit 60d0a3f

Please sign in to comment.