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

[MC-2430] Normalize event names #392

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CleverTapSDK/CTLocalDataStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,8 @@ - (BOOL)isEventLoggedFirstTime:(NSString*)eventName {
if (!self.dbHelper) {
self.dbHelper = [CTEventDatabase sharedInstanceWithConfig:self.config];
}
NSInteger count = [self.dbHelper getCountForEventName:eventName deviceID:self.deviceInfo.deviceId];
// TODO: Add normalized name here
NSInteger count = [self.dbHelper getEventCount:eventName deviceID:self.deviceInfo.deviceId];
if (count > 1) {
@synchronized (self.userEventLogs) {
[self.userEventLogs addObject:eventName];
Expand Down
2 changes: 2 additions & 0 deletions CleverTapSDK/CleverTapEventDetail.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
@interface CleverTapEventDetail : NSObject

@property (nonatomic, strong) NSString *eventName;
@property (nonatomic, strong) NSString *normalizedEventName;
@property (nonatomic) NSTimeInterval firstTime;
@property (nonatomic) NSTimeInterval lastTime;
@property (nonatomic) NSUInteger count;
@property (nonatomic, strong) NSString *deviceID;

@end
4 changes: 2 additions & 2 deletions CleverTapSDK/CleverTapEventDetail.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
@implementation CleverTapEventDetail

- (NSString*) description {
return [NSString stringWithFormat:@"CleverTapEventDetail (event name = %@; first time = %d, last time = %d; count = %lu)",
self.eventName, (int) self.firstTime, (int) self.lastTime, (unsigned long)self.count];
return [NSString stringWithFormat:@"CleverTapEventDetail (event name = %@; normalized event name = %@; first time = %d, last time = %d; count = %lu; device ID = %@)",
self.eventName, self.normalizedEventName, (int) self.firstTime, (int) self.lastTime, (unsigned long)self.count, self.deviceID];
}

@end
25 changes: 13 additions & 12 deletions CleverTapSDK/EventDatabase/CTEventDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,27 @@

- (NSInteger)getDatabaseVersion;

- (BOOL)insertData:(NSString *)eventName
deviceID:(NSString *)deviceID;
- (BOOL)insertEvent:(NSString *)eventName
normalizedEventName:(NSString *)normalizedEventName
deviceID:(NSString *)deviceID;

- (BOOL)updateEvent:(NSString *)eventName
- (BOOL)updateEvent:(NSString *)normalizedEventName
forDeviceID:(NSString *)deviceID;

- (BOOL)eventExists:(NSString *)eventName
- (BOOL)eventExists:(NSString *)normalizedEventName
forDeviceID:(NSString *)deviceID;

- (NSInteger)getCountForEventName:(NSString *)eventName
deviceID:(NSString *)deviceID;
- (NSInteger)getEventCount:(NSString *)normalizedEventName
deviceID:(NSString *)deviceID;

- (NSInteger)getFirstTimestampForEventName:(NSString *)eventName
deviceID:(NSString *)deviceID;
- (NSInteger)getFirstTimestamp:(NSString *)normalizedEventName
deviceID:(NSString *)deviceID;

- (NSInteger)getLastTimestampForEventName:(NSString *)eventName
deviceID:(NSString *)deviceID;
- (NSInteger)getLastTimestamp:(NSString *)normalizedEventName
deviceID:(NSString *)deviceID;

- (CleverTapEventDetail *)getEventDetailForEventName:(NSString *)eventName
deviceID:(NSString *)deviceID;
- (CleverTapEventDetail *)getEventDetail:(NSString *)normalizedEventName
deviceID:(NSString *)deviceID;

- (NSArray<CleverTapEventDetail *> *)getAllEventsForDeviceID:(NSString *)deviceID;

Expand Down
Loading