Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v4.1.3 #203

Merged
merged 12 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
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.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" }
Expand Down
6 changes: 3 additions & 3 deletions CleverTapSDK/CTConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions CleverTapSDK/CTDeviceInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
@property (atomic, readwrite) NSString *library;
@property (assign, readonly) BOOL wifi;
@property (strong, readonly) NSMutableArray<CTValidationResult*>* 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
10 changes: 5 additions & 5 deletions CleverTapSDK/CTDeviceInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion CleverTapSDK/CTEventBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
forGeofenceDetails:(NSDictionary * _Nonnull)geofenceDetails
completionHandler:(void(^ _Nonnull)(NSDictionary * _Nullable event, NSArray<CTValidationResult*> * _Nullable errors))completion;

+ (void)buildDirectCallEvent:(int)eventRawValue
+ (void)buildSignedCallEvent:(int)eventRawValue
forCallDetails:(NSDictionary * _Nonnull)callDetails
completionHandler:(void(^ _Nonnull)(NSDictionary * _Nullable event, NSArray<CTValidationResult*> * _Nullable errors))completion;

Expand Down
26 changes: 13 additions & 13 deletions CleverTapSDK/CTEventBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -423,48 +423,48 @@ + (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<CTValidationResult*> * _Nullable errors))completion {
NSMutableArray<CTValidationResult*> *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];
[notif addEntriesFromDictionary:callDetails];

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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion CleverTapSDK/CTInAppDisplayViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
20 changes: 11 additions & 9 deletions CleverTapSDK/CTLocalDataStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
22 changes: 11 additions & 11 deletions CleverTapSDK/CleverTap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;


/* ------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions CleverTapSDK/CleverTap.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<CTValidationResult *> * _Nullable errors) {
[CTEventBuilder buildSignedCallEvent: eventRawValue forCallDetails:calldetails completionHandler:^(NSDictionary * _Nullable event, NSArray<CTValidationResult *> * _Nullable errors) {
if (event) {
[self queueEvent:event withType:CleverTapEventTypeRaised];
};
Expand All @@ -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<CleverTapDomainDelegate>)delegate {
Expand Down Expand Up @@ -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;
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 @"40102"
#define WR_SDK_REVISION @"40103"