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

Multi Triggers -> Develop #395

Merged
merged 52 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d33ebd2
- Added trigger matching for "firstTimeOnly" property.
akashvercetti Oct 30, 2024
5f0aabd
- Storing profile key as events
akashvercetti Oct 30, 2024
ecc39c6
unit tests for data store
akashvercetti Nov 5, 2024
8a42161
feat(MC-2082) - Adds new event storage
nishant-clevertap Nov 5, 2024
16604fc
Added getter methods and added unit tests for each method.
nishant-clevertap Nov 6, 2024
f37f04b
added in-memory storage for first time events
akashvercetti Nov 11, 2024
97995aa
Merge pull request #382 from CleverTap/MC-2088-evaluate-first-time-pr…
akashvercetti Nov 19, 2024
29956b7
Merge pull request #381 from CleverTap/MC-2086-evaluate-first-time-ev…
akashvercetti Nov 19, 2024
0994524
Added get event details method
nishant-clevertap Dec 2, 2024
bd61452
feat(MC-2106): Add event storage limits
nishant-clevertap Dec 2, 2024
ea62587
Added createTable at start in initWithConfig
nishant-clevertap Dec 3, 2024
e2bda03
- optimised dbHelper creation
akashvercetti Dec 3, 2024
5438d1e
updated matchOnly logic to check for profile attribute name or event …
akashvercetti Dec 3, 2024
7a886f0
Added support for database schema version
nishant-clevertap Dec 3, 2024
0598ae1
Updated query to use sqlite3 bind methods instead of NSString.
nishant-clevertap Dec 3, 2024
5f42753
Added safety null check for database is open or not before every sql …
nishant-clevertap Dec 4, 2024
560afa7
added todo to CTLocalDataStore.m to add normalisation
akashvercetti Dec 4, 2024
652b79b
Merge pull request #384 from CleverTap/MC-2090-inmemory-storage-events
akashvercetti Dec 4, 2024
7b9c9d3
Added constants to CTConstants file
nishant-clevertap Dec 4, 2024
621cc6b
Updated delete sql to use sqlite3 bind method
nishant-clevertap Dec 4, 2024
7375e2f
Merge branch 'implement_new_event_storage' into event_storage_limits
nishant-clevertap Dec 4, 2024
0520cf3
Merge pull request #391 from CleverTap/event_storage_limits
nishant-clevertap Dec 4, 2024
21b615d
Merge pull request #380 from CleverTap/implement_new_event_storage
nishant-clevertap Dec 4, 2024
98c9fe9
Merge branch 'develop' of https://github.com/CleverTap/clevertap-ios-…
nishant-clevertap Dec 5, 2024
1865952
feat(MC-2430): Normalize event names and query based on normalized ev…
nishant-clevertap Dec 6, 2024
d715758
Fixes create table is not called on fresh install
nishant-clevertap Dec 6, 2024
807149a
Added upsert method to insert event if event not exists and update wh…
nishant-clevertap Dec 6, 2024
0668652
Merge pull request #392 from CleverTap/event_database_normalization
nishant-clevertap Dec 6, 2024
2ff114b
completed todos regarding connecting the first-time only matching cod…
akashvercetti Dec 6, 2024
74c4653
addressed review comments
akashvercetti Dec 8, 2024
ac5b66c
feat(MC-2429): Add new public apis to access database methods
nishant-clevertap Dec 9, 2024
f5729bb
added mutex lock flags to the open database command to make it atomic
akashvercetti Dec 9, 2024
8f6d3fb
Merge pull request #394 from CleverTap/add_new_public_apis
nishant-clevertap Dec 9, 2024
2f139d5
Merge branch 'feature_multi_triggers' of https://github.com/CleverTap…
nishant-clevertap Dec 9, 2024
95bba9a
Updated unit test to call new api.
nishant-clevertap Dec 9, 2024
ea243f0
Merge pull request #393 from CleverTap/complete-todos
akashvercetti Dec 9, 2024
8dccc29
Removed Todos.
akashvercetti Dec 11, 2024
d9c4f30
used normalised names for the in-memory set
akashvercetti Dec 11, 2024
844c8ed
removed todo comments
akashvercetti Dec 11, 2024
66c95b0
renamed getDatabaseVersion to databaseVersion
akashvercetti Dec 11, 2024
844c08b
nil checks when fetching eventName
akashvercetti Dec 11, 2024
cf27cce
Addressed review comments.
nishant-clevertap Dec 12, 2024
2384163
- Updated database query to use same Dispatch manager serial queue to…
nishant-clevertap Dec 17, 2024
27df035
- Addressed review comments.
nishant-clevertap Jan 9, 2025
06fbb18
Made init method private and used in tests.
nishant-clevertap Jan 9, 2025
26b6d4f
- Addressed lint and formatting review comments.
nishant-clevertap Jan 21, 2025
abc4731
- Fixes potential deadlock scenario by adding semaphore only when not…
nishant-clevertap Jan 21, 2025
bd55b09
Updated version to 7.1.0
nishant-clevertap Jan 21, 2025
4f2696a
Updated version in txt file
nishant-clevertap Jan 21, 2025
a9a74f4
Added changelog
nishant-clevertap Jan 21, 2025
f7f710c
Added CTEventDatabase into tvos source file and fixed tvos build issue.
nishant-clevertap Jan 21, 2025
46d72f3
Added EventDatabase files to support SPM
nishant-clevertap Jan 21, 2025
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
28 changes: 28 additions & 0 deletions CleverTapSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@
4808030E292EB4FB00C06E2F /* CleverTap+PushPermission.h in Headers */ = {isa = PBXBuildFile; fileRef = 4808030D292EB4FB00C06E2F /* CleverTap+PushPermission.h */; };
48080311292EB50D00C06E2F /* CTLocalInApp.h in Headers */ = {isa = PBXBuildFile; fileRef = 4808030F292EB50D00C06E2F /* CTLocalInApp.h */; settings = {ATTRIBUTES = (Public, ); }; };
48080312292EB50D00C06E2F /* CTLocalInApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 48080310292EB50D00C06E2F /* CTLocalInApp.m */; };
4847D16D2CCB90E0008DC327 /* CTEventDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 4847D16C2CCB90E0008DC327 /* CTEventDatabase.h */; };
4847D16F2CCB90F5008DC327 /* CTEventDatabase.m in Sources */ = {isa = PBXBuildFile; fileRef = 4847D16E2CCB90F5008DC327 /* CTEventDatabase.m */; };
4847D1722CDA17C2008DC327 /* CTEventDatabaseTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4847D1712CDA17C2008DC327 /* CTEventDatabaseTests.m */; };
487854072BF4BC4E00565685 /* CTFileDownloaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 487854062BF4BC4E00565685 /* CTFileDownloaderTests.m */; };
48A2C4B92BD67DDC006C61BC /* sampleTXTStub.txt in Resources */ = {isa = PBXBuildFile; fileRef = 48A2C4B72BD67DDB006C61BC /* sampleTXTStub.txt */; };
48A2C4BA2BD67DDC006C61BC /* samplePDFStub.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 48A2C4B82BD67DDB006C61BC /* samplePDFStub.pdf */; };
Expand Down Expand Up @@ -776,6 +779,9 @@
4808030D292EB4FB00C06E2F /* CleverTap+PushPermission.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CleverTap+PushPermission.h"; sourceTree = "<group>"; };
4808030F292EB50D00C06E2F /* CTLocalInApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTLocalInApp.h; sourceTree = "<group>"; };
48080310292EB50D00C06E2F /* CTLocalInApp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTLocalInApp.m; sourceTree = "<group>"; };
4847D16C2CCB90E0008DC327 /* CTEventDatabase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CTEventDatabase.h; sourceTree = "<group>"; };
4847D16E2CCB90F5008DC327 /* CTEventDatabase.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTEventDatabase.m; sourceTree = "<group>"; };
4847D1712CDA17C2008DC327 /* CTEventDatabaseTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTEventDatabaseTests.m; sourceTree = "<group>"; };
487854062BF4BC4E00565685 /* CTFileDownloaderTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTFileDownloaderTests.m; sourceTree = "<group>"; };
48A2C4B72BD67DDB006C61BC /* sampleTXTStub.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sampleTXTStub.txt; sourceTree = "<group>"; };
48A2C4B82BD67DDB006C61BC /* samplePDFStub.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = samplePDFStub.pdf; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1314,6 +1320,23 @@
name = Frameworks;
sourceTree = "<group>";
};
4847D16B2CCB9018008DC327 /* EventDatabase */ = {
isa = PBXGroup;
children = (
4847D16C2CCB90E0008DC327 /* CTEventDatabase.h */,
4847D16E2CCB90F5008DC327 /* CTEventDatabase.m */,
);
path = EventDatabase;
sourceTree = "<group>";
};
4847D1702CDA1788008DC327 /* EventDatabase */ = {
isa = PBXGroup;
children = (
4847D1712CDA17C2008DC327 /* CTEventDatabaseTests.m */,
);
path = EventDatabase;
sourceTree = "<group>";
};
495EA4BE25554718006CADFF /* resources */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1590,6 +1613,7 @@
D02AC2D9276044F70031C1BE /* CleverTapSDKTests */ = {
isa = PBXGroup;
children = (
4847D1702CDA1788008DC327 /* EventDatabase */,
6B9E95AD2C285F2F0002D557 /* FileDownload */,
4E2CF1432AC56D8F00441E8B /* CTEncryptionTests.m */,
6A4427C32AA6513C0098866F /* InApps */,
Expand Down Expand Up @@ -1717,6 +1741,7 @@
D0C7BBBF207D82C0001345EF /* CleverTapSDK */ = {
isa = PBXGroup;
children = (
4847D16B2CCB9018008DC327 /* EventDatabase */,
6B9E95B62C2AE6740002D557 /* FileDownload */,
3242D7DA2B1DDA2E00A5E37A /* PrivacyInfo.xcprivacy */,
4803951A2A7ABAD200C4D254 /* CTAES.h */,
Expand Down Expand Up @@ -1983,6 +2008,7 @@
4E25E3C1278887A70008C888 /* CTIdentityRepo.h in Headers */,
071EB4F3217F6427008F0FAB /* CTInAppNotification.h in Headers */,
F9356ED42487FE4600B4F507 /* CleverTapPushNotificationDelegate.h in Headers */,
4847D16D2CCB90E0008DC327 /* CTEventDatabase.h in Headers */,
07B9453B219EA34300D4C542 /* CTInboxSimpleMessageCell.h in Headers */,
6BF5A5982ACEE22100CDED20 /* CleverTapJSInterfacePrivate.h in Headers */,
07053B7221E653E70085B44A /* UIView+CTToast.h in Headers */,
Expand Down Expand Up @@ -2524,6 +2550,7 @@
files = (
6BA3B2E12B05411C004E834B /* InAppHelper.m in Sources */,
32394C2529FA272600956058 /* CTValidatorTest.m in Sources */,
4847D1722CDA17C2008DC327 /* CTEventDatabaseTests.m in Sources */,
6BB778CE2BEE48C300A41628 /* CTCustomTemplateInAppDataTest.m in Sources */,
6BA3B2E82B07E207004E834B /* CTTriggersMatcher+Tests.m in Sources */,
6BBF05CE2C58E3FB0047E3D9 /* NSURLSessionMock.m in Sources */,
Expand Down Expand Up @@ -2718,6 +2745,7 @@
07B94540219EA34300D4C542 /* CTInboxController.m in Sources */,
4E25E3C4278887A70008C888 /* CTLegacyIdentityRepo.m in Sources */,
078C63AA22420321001FDDB8 /* CleverTapJSInterface.m in Sources */,
4847D16F2CCB90F5008DC327 /* CTEventDatabase.m in Sources */,
4E49AE55275D24570074A774 /* CTValidationResultStack.m in Sources */,
D01A0895207EC2D400423D6F /* CleverTapInstanceConfig.m in Sources */,
071EB4C8217F6427008F0FAB /* CTDismissButton.m in Sources */,
Expand Down
5 changes: 5 additions & 0 deletions CleverTapSDK/CTConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,8 @@ extern NSString *CLTAP_PROFILE_IDENTITY_KEY;
#define CLTAP_ENCRYPTION_LEVEL @"CleverTapEncryptionLevel"
#define CLTAP_ENCRYPTION_IV @"__CL3>3Rt#P__1V_"
#define CLTAP_ENCRYPTION_PII_DATA (@[@"Identity", @"Email", @"Phone", @"Name"]);

#pragma mark Constants for Event Database
#define CLTAP_DATABASE_VERSION 1
#define CLTAP_EVENT_DB_MAX_ROW_LIMIT (2048 + 256) * 5;
#define CLTAP_EVENT_DB_ROWS_TO_CLEANUP 2048 + 256;
12 changes: 12 additions & 0 deletions CleverTapSDK/CTLocalDataStore.h
nishant-clevertap marked this conversation as resolved.
Show resolved Hide resolved
nishant-clevertap marked this conversation as resolved.
Show resolved Hide resolved
nishant-clevertap marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,16 @@

- (void)changeUser;

- (BOOL)isEventLoggedFirstTime:(NSString*)eventName;

- (int)readUserEventLogCount:(NSString *)eventName;

- (CleverTapEventDetail *)readUserEventLog:(NSString *)eventName;

- (NSTimeInterval)readUserEventLogFirstTs:(NSString *)eventName;

- (NSTimeInterval)readUserEventLogLastTs:(NSString *)eventName;

- (NSDictionary *)readUserEventLogs;

@end
83 changes: 65 additions & 18 deletions CleverTapSDK/CTLocalDataStore.m
akashvercetti marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#import "CTDispatchQueueManager.h"
#import "CTMultiDelegateManager.h"
#import "CTProfileBuilder.h"
#import "CTEventDatabase.h"

static const void *const kProfileBackgroundQueueKey = &kProfileBackgroundQueueKey;
static const double kProfilePersistenceIntervalSeconds = 30.f;
Expand All @@ -34,6 +35,8 @@ @interface CTLocalDataStore() {
@property (nonatomic, strong) CTDeviceInfo *deviceInfo;
@property (nonatomic, strong) NSArray *piiKeys;
@property (nonatomic, strong) CTDispatchQueueManager *dispatchQueueManager;
@property (nonatomic, strong) NSMutableSet *userEventLogs;
@property (nonatomic, strong) CTEventDatabase *dbHelper;

@end

Expand All @@ -44,6 +47,8 @@ - (instancetype)initWithConfig:(CleverTapInstanceConfig *)config profileValues:(
_config = config;
_deviceInfo = deviceInfo;
self.dispatchQueueManager = dispatchQueueManager;
self.userEventLogs = [NSMutableSet set];
self.dbHelper = [CTEventDatabase sharedInstanceWithConfig:self.config];
localProfileUpdateExpiryStore = [NSMutableDictionary new];
_backgroundQueue = dispatch_queue_create([[NSString stringWithFormat:@"com.clevertap.profileBackgroundQueue:%@", _config.accountId] UTF8String], DISPATCH_QUEUE_SERIAL);
dispatch_queue_set_specific(_backgroundQueue, kProfileBackgroundQueueKey, (__bridge void *)self, NULL);
Expand Down Expand Up @@ -102,6 +107,9 @@ - (void)changeUser {
self->localProfileForSession = [self _inflateLocalProfile];
}
}];
@synchronized (self.userEventLogs) {
[self.userEventLogs removeAllObjects];
}
[self clearStoredEvents];
}

Expand Down Expand Up @@ -184,24 +192,8 @@ - (void)persistEvent:(NSDictionary *)event {
if (!event || !event[CLTAP_EVENT_NAME]) return;
[self runOnBackgroundQueue:^{
NSString *eventName = event[CLTAP_EVENT_NAME];
NSDictionary *s = [self getStoredEvents];
if (!s) s = @{};
NSTimeInterval now = [[[NSDate alloc] init] timeIntervalSince1970];
NSArray *ed = s[eventName];
if (!ed || ed.count < 3) {
// This event has been recorded for the very first time
// Set the count to 0, first and last to now
// Count will be incremented soon after this block
ed = @[@0.0f, @(now), @(now)];
}
NSMutableArray *ped = [ed mutableCopy];
double currentCount = ((NSNumber *) ped[0]).doubleValue;
currentCount++;
ped[0] = @(currentCount);
ped[2] = @(now);
NSMutableDictionary *store = [s mutableCopy];
store[eventName] = ped;
[self setStoredEvents:store];
// TODO: add normalisation
akashvercetti marked this conversation as resolved.
Show resolved Hide resolved
[self.dbHelper upsertEvent:eventName normalizedEventName:[CTUtils getNormalizedName:eventName] deviceID:self.deviceInfo.deviceId];
}];
}

Expand Down Expand Up @@ -610,6 +602,54 @@ - (void)removeProfileFieldsWithKeys:(NSArray *)keys {
[self removeProfileFieldsWithKeys:keys fromUpstream:NO];
}

- (BOOL)isEventLoggedFirstTime:(NSString*)eventName {
@synchronized (self.userEventLogs) {
// TODO: add normalisation
if ([self.userEventLogs containsObject:eventName]) {
akashvercetti marked this conversation as resolved.
Show resolved Hide resolved
return NO;
}
}
// TODO: Add normalized name here
akashvercetti marked this conversation as resolved.
Show resolved Hide resolved
NSInteger count = [self.dbHelper getEventCount:[CTUtils getNormalizedName:eventName] deviceID:self.deviceInfo.deviceId];
if (count > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this check be count > 0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is updated as per TAN, as the event is stored in the LocalDataStore before the evaluation. This means a record for the event will always exist in the data store. If the event count is 1, it is a first time event. Refer: https://wizrocket.atlassian.net/wiki/spaces/EN/pages/4464115774/TAN+SDK+In-app+Multi-triggers#LocalDataStore

Also the same changes are in Android PR: https://github.com/CleverTap/clevertap-android-sdk/pull/683/files#diff-3e307aa90ae0394b024172f2b91b3c392c33c49380e4895becadaab6633f4e86R283

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is for the boolean check count == 1 but if it is recorded in the database, we can add it to the set.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes got it, Should I update it like:

NSInteger count = [self.dbHelper getEventCount:normalizedName deviceID:self.deviceInfo.deviceId];
if (count > 0) {
    @synchronized (self.userEventLogs) {
        [self.userEventLogs addObject:normalizedName];
    }
}
return count == 1;
    ```

@synchronized (self.userEventLogs) {
[self.userEventLogs addObject:eventName];
akashvercetti marked this conversation as resolved.
Show resolved Hide resolved
}
}
return count == 1;
}

#pragma mark - Public APIs for Event log

- (int)readUserEventLogCount:(NSString *)eventName {
NSString *normalizedEventName = [CTUtils getNormalizedName:eventName];
return (int) [self.dbHelper getEventCount:normalizedEventName deviceID:self.deviceInfo.deviceId];
}

- (CleverTapEventDetail *)readUserEventLog:(NSString *)eventName {
NSString *normalizedEventName = [CTUtils getNormalizedName:eventName];
return [self.dbHelper getEventDetail:normalizedEventName deviceID:self.deviceInfo.deviceId];
}

- (NSTimeInterval)readUserEventLogFirstTs:(NSString *)eventName {
NSString *normalizedEventName = [CTUtils getNormalizedName:eventName];
return (int) [self.dbHelper getFirstTimestamp:normalizedEventName deviceID:self.deviceInfo.deviceId];
}

- (NSTimeInterval)readUserEventLogLastTs:(NSString *)eventName {
NSString *normalizedEventName = [CTUtils getNormalizedName:eventName];
return (int) [self.dbHelper getLastTimestamp:normalizedEventName deviceID:self.deviceInfo.deviceId];
}

- (NSDictionary *)readUserEventLogs {
nzagorchev marked this conversation as resolved.
Show resolved Hide resolved
NSArray<CleverTapEventDetail *> *allEvents = [self.dbHelper getAllEventsForDeviceID:self.deviceInfo.deviceId];
NSMutableDictionary *history = [[NSMutableDictionary alloc] init];
for (CleverTapEventDetail *event in allEvents) {
history[event.eventName] = event;
}
return history;
}


#pragma mark - Private Local Profile Getters and Setters and disk persistence handling

Expand Down Expand Up @@ -643,6 +683,13 @@ - (void)_setProfileValue:(id)value forKey:(NSString *)key fromUpstream:(BOOL)fro
if (!fromUpstream) {
[self updateLocalProfileUpdateExpiryTimeForKey:key];
}

// PERSIST PROFILE KEY AS EVENT
NSArray *systemProfileKeys = @[CLTAP_SYS_CARRIER, CLTAP_SYS_CC, CLTAP_SYS_TZ];
nishant-clevertap marked this conversation as resolved.
Show resolved Hide resolved
if (![systemProfileKeys containsObject:key]) {
NSDictionary *profileEvent = @{CLTAP_EVENT_NAME: key};
[self persistEvent:profileEvent];
}
}
@catch (NSException *exception) {
CleverTapLogInternal(self.config.logLevel, @"%@: Exception setting profile field %@ in session cache for value %@", self, key, value);
Expand Down
99 changes: 92 additions & 7 deletions CleverTapSDK/CleverTap.h
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ extern NSString * _Nonnull const CleverTapGeofencesDidUpdateNotification;

@param event event name
*/
- (NSTimeInterval)eventGetFirstTime:(NSString *_Nonnull)event;
- (NSTimeInterval)eventGetFirstTime:(NSString *_Nonnull)event __attribute__((deprecated("Deprecated as of version 7.1.0, use getUserEventLogFirstTs instead")));

/*!
@method
Expand All @@ -813,7 +813,7 @@ extern NSString * _Nonnull const CleverTapGeofencesDidUpdateNotification;
@param event event name
*/

- (NSTimeInterval)eventGetLastTime:(NSString *_Nonnull)event;
- (NSTimeInterval)eventGetLastTime:(NSString *_Nonnull)event __attribute__((deprecated("Deprecated as of version 7.1.0, use getUserEventLogLastTs instead")));

/*!
@method
Expand All @@ -824,7 +824,7 @@ extern NSString * _Nonnull const CleverTapGeofencesDidUpdateNotification;

@param event event name
*/
- (int)eventGetOccurrences:(NSString *_Nonnull)event;
- (int)eventGetOccurrences:(NSString *_Nonnull)event __attribute__((deprecated("Deprecated as of version 7.1.0, use getUserEventLogCount instead")));

/*!
@method
Expand All @@ -838,7 +838,7 @@ extern NSString * _Nonnull const CleverTapGeofencesDidUpdateNotification;
Be sure to call enablePersonalization (typically once at app launch) prior to using this method.

*/
- (NSDictionary *_Nullable)userGetEventHistory;
- (NSDictionary *_Nullable)userGetEventHistory __attribute__((deprecated("Deprecated as of version 7.1.0, use getUserEventLogHistory instead")));

/*!
@method
Expand All @@ -853,7 +853,72 @@ extern NSString * _Nonnull const CleverTapGeofencesDidUpdateNotification;

@param event event name
*/
- (CleverTapEventDetail *_Nullable)eventGetDetail:(NSString *_Nullable)event;
- (CleverTapEventDetail *_Nullable)eventGetDetail:(NSString *_Nullable)event __attribute__((deprecated("Deprecated as of version 7.1.0, use getUserEventLog instead")));

/*!
@method

@abstract
Get the the count of logged events for a specific event name associated with the current user.
This operation involves a database query and should be called from a background thread.
Be sure to call enablePersonalization prior to invoking this method.

@param eventName event name
*/
- (int)getUserEventLogCount:(NSString *_Nonnull)eventName;

/*!
@method

@abstract
Get the details for the event.

@discussion
Returns a CleverTapEventDetail object (eventName, normalizedEventName, firstTime, lastTime, count, deviceID)
This operation involves a database query and should be called from a background thread.
Be sure to call enablePersonalization (typically once at app launch) prior to using this method.

@param eventName event name
*/
- (CleverTapEventDetail *_Nullable)getUserEventLog:(NSString *_Nullable)eventName;

/*!
@method

@abstract
Get the time of the first recording of the event.
This operation involves a database query and should be called from a background thread.
Be sure to call enablePersonalization prior to invoking this method.

@param eventName event name
*/
- (NSTimeInterval)getUserEventLogFirstTs:(NSString *_Nonnull)eventName;

/*!
@method

@abstract
Get the time of the last recording of the event.
This operation involves a database query and should be called from a background thread.
Be sure to call enablePersonalization prior to invoking this method.

@param eventName event name
*/
- (NSTimeInterval)getUserEventLogLastTs:(NSString *_Nonnull)eventName;

/*!
@method

@abstract
Get the user's event history.

@discussion
Returns a dictionary of CleverTapEventDetail objects (eventName, normalizedEventName, firstTime, lastTime, count, deviceID), keyed by eventName.
This operation involves a database query and should be called from a background thread.
Be sure to call enablePersonalization (typically once at app launch) prior to using this method.

*/
- (NSDictionary *_Nullable)getUserEventLogHistory;


#pragma mark Session API
Expand Down Expand Up @@ -889,7 +954,17 @@ extern NSString * _Nonnull const CleverTapGeofencesDidUpdateNotification;

Be sure to call enablePersonalization (typically once at app launch) prior to using this method.
*/
- (int)userGetTotalVisits;
- (int)userGetTotalVisits __attribute__((deprecated("Deprecated as of version 7.1.0, use getUserAppLaunchCount instead")));

/*!
@method

@abstract
Get the total number of visits by this user.
This operation involves a database query and should be called from a background thread.
Be sure to call enablePersonalization (typically once at app launch) prior to using this method.
*/
- (int)getUserAppLaunchCount;

/*!
@method
Expand All @@ -909,7 +984,17 @@ extern NSString * _Nonnull const CleverTapGeofencesDidUpdateNotification;
Be sure to call enablePersonalization (typically once at app launch) prior to using this method.

*/
- (NSTimeInterval)userGetPreviousVisitTime;
- (NSTimeInterval)userGetPreviousVisitTime __attribute__((deprecated("Deprecated as of version 7.1.0, use getUserLastVisitTs instead")));

/*!
@method

@abstract
Get the last prior visit time for this user.
Be sure to call enablePersonalization (typically once at app launch) prior to using this method.

*/
- (NSTimeInterval)getUserLastVisitTs;

/* ------------------------------------------------------------------------------------------------------
* Synchronization
Expand Down
Loading
Loading