diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ca504e5..74d6392a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log All notable changes to this project will be documented in this file. +### [Version 4.1.3](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/4.1.3) (October 11, 2022) + +##### Fixed +- Fixes the value of `wzrk_c2a` key for image-only in-app notification CTAs. +- Possible fix for crashes related to profile caches. +- Updates support for CleverTap Signed Call iOS SDK. + ### [Version 4.1.2](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/4.1.2) (September 16, 2022) ##### Fixed diff --git a/CleverTap-iOS-SDK.podspec b/CleverTap-iOS-SDK.podspec index be042a95..081df57d 100644 --- a/CleverTap-iOS-SDK.podspec +++ b/CleverTap-iOS-SDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CleverTap-iOS-SDK" -s.version = "4.1.2" +s.version = "4.1.3" s.summary = "The CleverTap iOS SDK for App Analytics and Engagement." s.homepage = "https://github.com/CleverTap/clevertap-ios-sdk" s.license = { :type => "MIT" } diff --git a/CleverTapSDK/CTConstants.h b/CleverTapSDK/CTConstants.h index 4716b3a8..91f38adc 100644 --- a/CleverTapSDK/CTConstants.h +++ b/CleverTapSDK/CTConstants.h @@ -30,9 +30,9 @@ extern NSString *const kCTNotifViewedApiDomain; #define CLTAP_GEOFENCE_ENTERED_EVENT_NAME @"Geocluster Entered" #define CLTAP_GEOFENCE_EXITED_EVENT_NAME @"Geocluster Exited" -#define CLTAP_DIRECT_CALL_OUTGOING_EVENT_NAME @"DCOutgoing" -#define CLTAP_DIRECT_CALL_INCOMING_EVENT_NAME @"DCIncoming" -#define CLTAP_DIRECT_CALL_END_EVENT_NAME @"DCEnd" +#define CLTAP_SIGNED_CALL_OUTGOING_EVENT_NAME @"SCOutgoing" +#define CLTAP_SIGNED_CALL_INCOMING_EVENT_NAME @"SCIncoming" +#define CLTAP_SIGNED_CALL_END_EVENT_NAME @"SCEnd" #define CLTAP_PREFS_LAST_DAILY_PUSHED_EVENTS_DATE @"lastDailyEventsPushedDate" #define CLTAP_SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) diff --git a/CleverTapSDK/CTDeviceInfo.h b/CleverTapSDK/CTDeviceInfo.h index 023d0df3..78e10058 100644 --- a/CleverTapSDK/CTDeviceInfo.h +++ b/CleverTapSDK/CTDeviceInfo.h @@ -25,12 +25,12 @@ @property (atomic, readwrite) NSString *library; @property (assign, readonly) BOOL wifi; @property (strong, readonly) NSMutableArray* validationErrors; -@property (strong, readonly) NSString *directCallSDKVersion; +@property (strong, readonly) NSString *signedCallSDKVersion; - (instancetype)initWithConfig:(CleverTapInstanceConfig *)config andCleverTapID:(NSString *)cleverTapID; - (void)forceUpdateDeviceID:(NSString *)newDeviceID; - (void)forceNewDeviceID; - (void)forceUpdateCustomDeviceID:(NSString *)cleverTapID; - (BOOL)isErrorDeviceID; -- (void)setDirectCallSDKVersion: (NSString *)version; +- (void)setSignedCallSDKVersion: (NSString *)version; @end diff --git a/CleverTapSDK/CTDeviceInfo.m b/CleverTapSDK/CTDeviceInfo.m index f552b7ca..7ad74088 100644 --- a/CleverTapSDK/CTDeviceInfo.m +++ b/CleverTapSDK/CTDeviceInfo.m @@ -39,7 +39,7 @@ static NSString *_radio; static NSString *_deviceWidth; static NSString *_deviceHeight; -static NSString *_directCallSDKVersion; +static NSString *_signedCallSDKVersion; #if !CLEVERTAP_NO_REACHABILITY_SUPPORT SCNetworkReachabilityRef _reachability; @@ -470,12 +470,12 @@ - (NSString *)getCurrentRadioAccessTechnology { } #endif -- (void)setDirectCallSDKVersion: (NSString *)version { - _directCallSDKVersion = version; +- (void)setSignedCallSDKVersion: (NSString *)version { + _signedCallSDKVersion = version; } -- (NSString *)directCallSDKVersion { - return _directCallSDKVersion; +- (NSString *)signedCallSDKVersion { + return _signedCallSDKVersion; } @end diff --git a/CleverTapSDK/CTEventBuilder.h b/CleverTapSDK/CTEventBuilder.h index c0de1cff..d3a84635 100644 --- a/CleverTapSDK/CTEventBuilder.h +++ b/CleverTapSDK/CTEventBuilder.h @@ -38,7 +38,7 @@ forGeofenceDetails:(NSDictionary * _Nonnull)geofenceDetails completionHandler:(void(^ _Nonnull)(NSDictionary * _Nullable event, NSArray * _Nullable errors))completion; -+ (void)buildDirectCallEvent:(int)eventRawValue ++ (void)buildSignedCallEvent:(int)eventRawValue forCallDetails:(NSDictionary * _Nonnull)callDetails completionHandler:(void(^ _Nonnull)(NSDictionary * _Nullable event, NSArray * _Nullable errors))completion; diff --git a/CleverTapSDK/CTEventBuilder.m b/CleverTapSDK/CTEventBuilder.m index d9ffb131..c3715256 100644 --- a/CleverTapSDK/CTEventBuilder.m +++ b/CleverTapSDK/CTEventBuilder.m @@ -423,15 +423,15 @@ + (void)buildGeofenceStateEvent:(BOOL)entered } /** - * Raises and logs Direct Call system events + * Raises and logs Signed Call system events */ -+ (void)buildDirectCallEvent:(int)eventRawValue ++ (void)buildSignedCallEvent:(int)eventRawValue forCallDetails:(NSDictionary * _Nonnull)callDetails completionHandler:(void(^ _Nonnull)(NSDictionary * _Nullable event, NSArray * _Nullable errors))completion { NSMutableArray *errors = [NSMutableArray new]; CTValidationResult *error = [[CTValidationResult alloc] init]; [error setErrorCode: 524]; - [error setErrorDesc: @"Direct Call does not have any field"]; + [error setErrorDesc: @"Signed Call does not have any field"]; @try { NSMutableDictionary *eventDic = [NSMutableDictionary new]; NSMutableDictionary *notif = [NSMutableDictionary new]; @@ -439,32 +439,32 @@ + (void)buildDirectCallEvent:(int)eventRawValue if ([notif count] == 0) { [errors addObject: error]; - CleverTapLogStaticDebug(@"Direct Call does not have any field"); + CleverTapLogStaticDebug(@"Signed Call does not have any field"); } - NSString *directCallEvent; + NSString *signedCallEvent; switch (eventRawValue) { case 0: - directCallEvent = CLTAP_DIRECT_CALL_OUTGOING_EVENT_NAME; + signedCallEvent = CLTAP_SIGNED_CALL_OUTGOING_EVENT_NAME; case 1: - directCallEvent = CLTAP_DIRECT_CALL_INCOMING_EVENT_NAME; + signedCallEvent = CLTAP_SIGNED_CALL_INCOMING_EVENT_NAME; case 2: - directCallEvent = CLTAP_DIRECT_CALL_END_EVENT_NAME; + signedCallEvent = CLTAP_SIGNED_CALL_END_EVENT_NAME; default: break; } - if (directCallEvent) { - eventDic[@"evtName"] = directCallEvent; + if (signedCallEvent) { + eventDic[@"evtName"] = signedCallEvent; eventDic[@"evtData"] = notif; completion(eventDic, errors); } else { CTValidationResult *error = [[CTValidationResult alloc] init]; [error setErrorCode: 525]; - [error setErrorDesc: @"Direct Call did not specify event name"]; + [error setErrorDesc: @"Signed Call did not specify event name"]; [errors addObject: error]; - CleverTapLogStaticDebug(@"Direct Call did not specify event name"); + CleverTapLogStaticDebug(@"Signed Call did not specify event name"); completion(nil, errors); } } @catch (NSException *e) { - CleverTapLogStaticDebug(@"Unable to build direct call event: %@", e.debugDescription); + CleverTapLogStaticDebug(@"Unable to build signed call event: %@", e.debugDescription); completion(nil, errors); } } diff --git a/CleverTapSDK/CTInAppDisplayViewController.m b/CleverTapSDK/CTInAppDisplayViewController.m index 5a05fc1c..bd65a5a3 100644 --- a/CleverTapSDK/CTInAppDisplayViewController.m +++ b/CleverTapSDK/CTInAppDisplayViewController.m @@ -207,7 +207,7 @@ - (void)handleButtonClickFromIndex:(int)index { - (void)handleImageTapGesture { CTNotificationButton *button = self.notification.buttons[0]; NSURL *buttonCTA = button.actionURL; - NSString *buttonText = @"image"; + NSString *buttonText = @""; NSString *campaignId = self.notification.campaignId; NSDictionary *buttonCustomExtras = button.customExtras; diff --git a/CleverTapSDK/CTLocalDataStore.m b/CleverTapSDK/CTLocalDataStore.m index b18c72ed..135ef93a 100644 --- a/CleverTapSDK/CTLocalDataStore.m +++ b/CleverTapSDK/CTLocalDataStore.m @@ -625,16 +625,18 @@ - (NSMutableDictionary *)_inflateLocalProfile { } - (void)persistLocalProfileIfRequired { - BOOL shouldPersist = NO; - double now = [[[NSDate alloc] init] timeIntervalSince1970]; - @synchronized (lastProfilePersistenceTime) { - if (now > (lastProfilePersistenceTime.doubleValue + kProfilePersistenceIntervalSeconds)) { - shouldPersist = YES; + [self runOnBackgroundQueue:^{ + BOOL shouldPersist = NO; + double now = [[[NSDate alloc] init] timeIntervalSince1970]; + @synchronized (self->lastProfilePersistenceTime) { + if (now > (self->lastProfilePersistenceTime.doubleValue + kProfilePersistenceIntervalSeconds)) { + shouldPersist = YES; + } } - } - if (shouldPersist) { - [self _persistLocalProfileAsync]; - } + if (shouldPersist) { + [self _persistLocalProfileAsync]; + } + }]; } - (void)_persistLocalProfileAsync { diff --git a/CleverTapSDK/CleverTap.h b/CleverTapSDK/CleverTap.h index 1beb194b..e9fda1c7 100644 --- a/CleverTapSDK/CleverTap.h +++ b/CleverTapSDK/CleverTap.h @@ -47,10 +47,10 @@ typedef NS_ENUM(int, CleverTapChannel) { CleverTapInAppNotification = 2 }; -typedef NS_ENUM(int, CTDirectCallEvent) { - DIRECT_CALL_OUTGOING_EVENT = 0, - DIRECT_CALL_INCOMING_EVENT, - DIRECT_CALL_END_EVENT +typedef NS_ENUM(int, CTSignedCallEvent) { + SIGNED_CALL_OUTGOING_EVENT = 0, + SIGNED_CALL_INCOMING_EVENT, + SIGNED_CALL_END_EVENT }; @interface CleverTap : NSObject @@ -68,9 +68,9 @@ typedef NS_ENUM(int, CTDirectCallEvent) { @property (nonatomic, strong, readonly, nonnull) CleverTapInstanceConfig *config; /** - CleverTap region/ domain value for direct call domain setup + CleverTap region/ domain value for signed call domain setup */ -@property (nonatomic, strong, readwrite, nullable) NSString *directCallDomain; +@property (nonatomic, strong, readwrite, nullable) NSString *signedCallDomain; /* ------------------------------------------------------------------------------------------------------ @@ -1257,21 +1257,21 @@ extern NSString * _Nonnull const CleverTapProfileDidInitializeNotification; @method @abstract - Record Direct Call System Events. + Record Signed Call System Events. @param calldetails call details dictionary */ -- (void)recordDirectCallEvent:(int)eventRawValue forCallDetails:(NSDictionary *_Nonnull)calldetails; +- (void)recordSignedCallEvent:(int)eventRawValue forCallDetails:(NSDictionary *_Nonnull)calldetails; /*! @method @abstract - Record Direct Call SDK version. + Record Signed Call SDK version. - @param version Direct call SDK version + @param version Signed call SDK version */ -- (void)setDirectCallVersion:(NSString* _Nullable)version; +- (void)setSignedCallVersion:(NSString* _Nullable)version; /*! @method diff --git a/CleverTapSDK/CleverTap.m b/CleverTapSDK/CleverTap.m index 99c03f3e..3f21a452 100644 --- a/CleverTapSDK/CleverTap.m +++ b/CleverTapSDK/CleverTap.m @@ -1154,7 +1154,7 @@ - (NSArray *)insertHeader:(NSDictionary *)header inBatch:(NSArray *)batch { - (NSDictionary *)generateAppFields { NSMutableDictionary *evtData = [NSMutableDictionary new]; - evtData[@"dcv"] = self.deviceInfo.directCallSDKVersion; + evtData[@"scv"] = self.deviceInfo.signedCallSDKVersion; evtData[@"Version"] = self.deviceInfo.appVersion; @@ -4863,12 +4863,12 @@ - (void)_buildGeofenceStateEvent:(BOOL)entered forGeofenceDetails:(NSDictionary #endif } -#pragma mark - Direct Call Public APIs +#pragma mark - Signed Call Public APIs -- (void)recordDirectCallEvent:(int)eventRawValue forCallDetails:(NSDictionary *)calldetails { +- (void)recordSignedCallEvent:(int)eventRawValue forCallDetails:(NSDictionary *)calldetails { #if !defined(CLEVERTAP_TVOS) [self runSerialAsync:^{ - [CTEventBuilder buildDirectCallEvent: eventRawValue forCallDetails:calldetails completionHandler:^(NSDictionary * _Nullable event, NSArray * _Nullable errors) { + [CTEventBuilder buildSignedCallEvent: eventRawValue forCallDetails:calldetails completionHandler:^(NSDictionary * _Nullable event, NSArray * _Nullable errors) { if (event) { [self queueEvent:event withType:CleverTapEventTypeRaised]; }; @@ -4880,8 +4880,8 @@ - (void)recordDirectCallEvent:(int)eventRawValue forCallDetails:(NSDictionary *) #endif } -- (void)setDirectCallVersion:(NSString *)version { - [self.deviceInfo setDirectCallSDKVersion: version]; +- (void)setSignedCallVersion:(NSString *)version { + [self.deviceInfo setSignedCallSDKVersion: version]; } - (void)setDomainDelegate:(id)delegate { @@ -4920,7 +4920,7 @@ - (NSString *)getDomainString { NSString *dotString = [@"." stringByAppendingString: listItems[i]]; domainItem = [domainItem stringByAppendingString: dotString]; } - self.directCallDomain = domainItem; + self.signedCallDomain = domainItem; return domainItem; } else { return nil; diff --git a/CleverTapSDK/CleverTapBuildInfo.h b/CleverTapSDK/CleverTapBuildInfo.h index 8950ee87..cc163e95 100644 --- a/CleverTapSDK/CleverTapBuildInfo.h +++ b/CleverTapSDK/CleverTapBuildInfo.h @@ -1,3 +1,3 @@ -#define WR_SDK_REVISION @"40102" +#define WR_SDK_REVISION @"40103"