Skip to content

Commit

Permalink
Merge pull request #202 from CleverTap/task/SDK-2259_signed_call
Browse files Browse the repository at this point in the history
SDK-2259 Rename DirectCall to SignedCall
  • Loading branch information
akashvercetti committed Oct 11, 2022
2 parents 8fcd8b4 + cc80260 commit 3460b20
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 42 deletions.
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
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

0 comments on commit 3460b20

Please sign in to comment.