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

Feature/user attributes #347

Merged
merged 28 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fd66c46
Added Support for persistence of user profiles with device Id
kushCT May 29, 2024
19d992d
Fill the local session cache with the old userProfile values when swi…
kushCT May 29, 2024
eb39220
fixed a build issue
May 30, 2024
d0fb2df
Refactor Event adapter and Trigger Adapter to start using profile att…
kushCT Jun 3, 2024
a21f7d4
Added support for User Attribute triggering for Profile Increment and…
kushCT Jun 5, 2024
584ad00
Refractored the CTEventAdapter constructor to incorporate profileAttr…
Jun 10, 2024
684948f
Code cleaning
kushCT Jun 11, 2024
631b176
Refractored the logic for evaluating client side and server side in a…
kushCT Jun 11, 2024
a16f1c3
Updated the logic for Profile Increment, Decrement and remove key
kushCT Jun 13, 2024
186a79c
Optimized code to persist profile only when the change in new profile…
kushCT Jun 18, 2024
40eafd5
Code cleaning and updated the persistence time to 30 seconds
kushCT Jun 21, 2024
deb9943
Adding Unit test cases for CTUserInfoMigrator file
kushCT Jun 21, 2024
5646ee6
Code Cleaning and refactoring
kushCT Jun 26, 2024
eae277d
Added support for Profile type Events to be included for server side …
kushCT Jun 27, 2024
45f5842
Refractored some files for code cleaning
kushCT Jul 2, 2024
6628d2f
Moved the getUserAttribute and updating profile fields to LocalDataSt…
kushCT Jul 2, 2024
c86673d
Merge branch 'SDK_3824_Refactor_adapter_to_start_using_profile_attrib…
kushCT Jul 3, 2024
6462881
Added unit testing for evaluate on User attributes method
kushCT Jul 4, 2024
ab7af0f
Added Unit tests for getUserAttributeChangeProperties
kushCT Jul 4, 2024
d6a9e17
Merge pull request #335 from CleverTap/SDK_3824_Refactor_adapter_to_s…
kushCT Jul 8, 2024
d4436b2
Removed NSLogs
kushCT Jul 8, 2024
2802ee9
Merge pull request #346 from CleverTap/Adding_unit_test_cases
kushCT Jul 8, 2024
d2a8972
Attached "inapps_eval_profile" and "inapps_suppressed_profile" to the…
kushCT Jul 10, 2024
f46b791
Fix client-side evaluation for events
nzagorchev Jul 12, 2024
e45f193
Fix batch header and sent
nzagorchev Jul 12, 2024
61223ce
Linting
nzagorchev Jul 12, 2024
5d3ed99
Fix in-app evaluation tests
nzagorchev Jul 12, 2024
cd72994
Merge branch 'develop' of github.com:CleverTap/clevertap-ios-sdk into…
nzagorchev Jul 12, 2024
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
20 changes: 20 additions & 0 deletions CleverTapSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
07D8C08B21DDEC54006F5A1B /* CTCarouselImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 07D8C08A21DDEC54006F5A1B /* CTCarouselImageView.h */; settings = {ATTRIBUTES = (Private, ); }; };
07FD65A2223BC26300A845B7 /* CTCoverViewController~iphoneland.xib in Resources */ = {isa = PBXBuildFile; fileRef = 07FD65A1223BC26300A845B7 /* CTCoverViewController~iphoneland.xib */; };
07FD65A4223BCB8200A845B7 /* CTCoverViewController~ipadland.xib in Resources */ = {isa = PBXBuildFile; fileRef = 07FD65A3223BCB8200A845B7 /* CTCoverViewController~ipadland.xib */; };
0B5564562C25946C00B87284 /* CTUserInfoMigratorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B5564552C25946C00B87284 /* CTUserInfoMigratorTest.m */; };
0B995A4A2C36AEDC00AF6006 /* CTLocalDataStoreTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B995A492C36AEDC00AF6006 /* CTLocalDataStoreTests.m */; };
1F1C18806B7F29B3374F2448 /* libPods-shared-CleverTapSDKTestsApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E303560B5EE1D154C1E3D9EF /* libPods-shared-CleverTapSDKTestsApp.a */; };
32394C1F29FA251E00956058 /* CTEventBuilderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 32394C1E29FA251E00956058 /* CTEventBuilderTest.m */; };
32394C2129FA264B00956058 /* CTPreferencesTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 32394C2029FA264B00956058 /* CTPreferencesTest.m */; };
Expand Down Expand Up @@ -273,6 +275,10 @@
4EA64A2E296C1190001D9B22 /* CTRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EA64A2B296C1190001D9B22 /* CTRequest.m */; };
4EA64A2F296C1190001D9B22 /* CTRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EA64A2B296C1190001D9B22 /* CTRequest.m */; };
4EAF05022A495DD5009D9D61 /* CleverTapInstanceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E1F154E27691CA0009387AE /* CleverTapInstanceTests.m */; };
4EB3638B2C087A8200C00AE2 /* CTUserInfoMigrator.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EB363892C087A8200C00AE2 /* CTUserInfoMigrator.m */; };
4EB3638C2C087A8200C00AE2 /* CTUserInfoMigrator.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EB363892C087A8200C00AE2 /* CTUserInfoMigrator.m */; };
4EB3638D2C087A8200C00AE2 /* CTUserInfoMigrator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EB3638A2C087A8200C00AE2 /* CTUserInfoMigrator.h */; settings = {ATTRIBUTES = (Private, ); }; };
4EB3638E2C087A8200C00AE2 /* CTUserInfoMigrator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EB3638A2C087A8200C00AE2 /* CTUserInfoMigrator.h */; settings = {ATTRIBUTES = (Private, ); }; };
4EB4C8BE2AAD91AC00B7F045 /* CTTriggerEvaluator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EB4C8BC2AAD91AC00B7F045 /* CTTriggerEvaluator.h */; };
4EB4C8BF2AAD91AC00B7F045 /* CTTriggerEvaluator.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EB4C8BD2AAD91AC00B7F045 /* CTTriggerEvaluator.m */; };
4ECD88312ADC8A05003885CE /* CTSessionManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ECD88302ADC8A05003885CE /* CTSessionManagerTests.m */; };
Expand Down Expand Up @@ -702,6 +708,8 @@
07D8C08A21DDEC54006F5A1B /* CTCarouselImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTCarouselImageView.h; sourceTree = "<group>"; };
07FD65A1223BC26300A845B7 /* CTCoverViewController~iphoneland.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "CTCoverViewController~iphoneland.xib"; sourceTree = "<group>"; };
07FD65A3223BCB8200A845B7 /* CTCoverViewController~ipadland.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "CTCoverViewController~ipadland.xib"; sourceTree = "<group>"; };
0B5564552C25946C00B87284 /* CTUserInfoMigratorTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTUserInfoMigratorTest.m; sourceTree = "<group>"; };
0B995A492C36AEDC00AF6006 /* CTLocalDataStoreTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTLocalDataStoreTests.m; sourceTree = "<group>"; };
0CA46771B6F202E37DAC9F70 /* Pods-shared-CleverTapSDKTestsApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-shared-CleverTapSDKTestsApp.debug.xcconfig"; path = "Target Support Files/Pods-shared-CleverTapSDKTestsApp/Pods-shared-CleverTapSDKTestsApp.debug.xcconfig"; sourceTree = "<group>"; };
129AEC403AFA828F591B756E /* Pods-shared-CleverTapSDKTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-shared-CleverTapSDKTests.release.xcconfig"; path = "Target Support Files/Pods-shared-CleverTapSDKTests/Pods-shared-CleverTapSDKTests.release.xcconfig"; sourceTree = "<group>"; };
32394C1E29FA251E00956058 /* CTEventBuilderTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTEventBuilderTest.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -779,6 +787,8 @@
4EA64A25296C115E001D9B22 /* CTRequestFactory.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTRequestFactory.m; sourceTree = "<group>"; };
4EA64A2A296C1190001D9B22 /* CTRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CTRequest.h; sourceTree = "<group>"; };
4EA64A2B296C1190001D9B22 /* CTRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTRequest.m; sourceTree = "<group>"; };
4EB363892C087A8200C00AE2 /* CTUserInfoMigrator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTUserInfoMigrator.m; sourceTree = "<group>"; };
4EB3638A2C087A8200C00AE2 /* CTUserInfoMigrator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CTUserInfoMigrator.h; sourceTree = "<group>"; };
4EB4C8BC2AAD91AC00B7F045 /* CTTriggerEvaluator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CTTriggerEvaluator.h; sourceTree = "<group>"; };
4EB4C8BD2AAD91AC00B7F045 /* CTTriggerEvaluator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTTriggerEvaluator.m; sourceTree = "<group>"; };
4EC2D084278AAD8000F4DE54 /* IdentityManagementTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IdentityManagementTests.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1444,6 +1454,8 @@
6A59D20E2A3351A800531F9D /* LeanplumCTTest.m */,
4ECD88302ADC8A05003885CE /* CTSessionManagerTests.m */,
6BD851C82B45CD1800FA5298 /* CTMultiDelegateManager+Tests.h */,
0B5564552C25946C00B87284 /* CTUserInfoMigratorTest.m */,
0B995A492C36AEDC00AF6006 /* CTLocalDataStoreTests.m */,
);
path = CleverTapSDKTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -1627,6 +1639,8 @@
D0CACF8D20B8A44C00A02327 /* CTCertificatePinning.m */,
D0CACF9420B8A4F800A02327 /* CTPinnedNSURLSessionDelegate.h */,
D0CACF9520B8A4F800A02327 /* CTPinnedNSURLSessionDelegate.m */,
4EB3638A2C087A8200C00AE2 /* CTUserInfoMigrator.h */,
4EB363892C087A8200C00AE2 /* CTUserInfoMigrator.m */,
071EB4AE217F6427008F0FAB /* CTInAppUtils.h */,
071EB47D217F6427008F0FAB /* CTInAppUtils.m */,
071EB486217F6427008F0FAB /* CTInAppFCManager.h */,
Expand Down Expand Up @@ -1743,6 +1757,7 @@
4E49AE54275D24570074A774 /* CTValidationResultStack.h in Headers */,
07BF465D217F7C88002E166D /* CTInAppDisplayViewControllerPrivate.h in Headers */,
6BD334F42AF7FC660099E33E /* CTTriggerRadius.h in Headers */,
4EB3638E2C087A8200C00AE2 /* CTUserInfoMigrator.h in Headers */,
4E838C41299F419900ED0875 /* ContentMerger.h in Headers */,
D0BD75A82417694F0006EE55 /* CTFeatureFlagsController.h in Headers */,
4E25E3CD278887A80008C888 /* CTLegacyIdentityRepo.h in Headers */,
Expand Down Expand Up @@ -1825,6 +1840,7 @@
4E8B816B2AD2B2FD00714BB4 /* CleverTapInternal.h in Headers */,
07B94541219EA34300D4C542 /* CleverTapInboxViewControllerPrivate.h in Headers */,
071EB4EE217F6427008F0FAB /* CTAlertViewController.h in Headers */,
4EB3638D2C087A8200C00AE2 /* CTUserInfoMigrator.h in Headers */,
4E838C4629A0C94B00ED0875 /* CleverTap+CTVar.h in Headers */,
D0CACF9620B8A4F800A02327 /* CTPinnedNSURLSessionDelegate.h in Headers */,
4E41FD92294F46510001FBED /* CTVar-Internal.h in Headers */,
Expand Down Expand Up @@ -2286,6 +2302,7 @@
6AA1357C2A2E467800EFF2C1 /* NSDictionary+Extensions.m in Sources */,
D014B8EF20E2FAAD001E0780 /* CleverTapUTMDetail.m in Sources */,
4E41FD9D294F46510001FBED /* CTVarCache.m in Sources */,
4EB3638C2C087A8200C00AE2 /* CTUserInfoMigrator.m in Sources */,
4E4E17852B50007D009E2F1E /* CTAES.m in Sources */,
D014B91D20E2FBD6001E0780 /* CTCertificatePinning.m in Sources */,
D014B90920E2FB71001E0780 /* CTLocalDataStore.m in Sources */,
Expand Down Expand Up @@ -2340,7 +2357,9 @@
6BEEC2D12AF1A3A900BD4EC5 /* CTClockMock.m in Sources */,
32790959299F4B29001FE140 /* CTDeviceInfoTest.m in Sources */,
4ECD88312ADC8A05003885CE /* CTSessionManagerTests.m in Sources */,
0B995A4A2C36AEDC00AF6006 /* CTLocalDataStoreTests.m in Sources */,
6A4427C52AA6515A0098866F /* CTTriggersMatcherTest.m in Sources */,
0B5564562C25946C00B87284 /* CTUserInfoMigratorTest.m in Sources */,
4E2CF1442AC56D8F00441E8B /* CTEncryptionTests.m in Sources */,
32394C2729FA278C00956058 /* CTUriHelperTest.m in Sources */,
487854072BF4BC4E00565685 /* CTFileDownloaderTests.m in Sources */,
Expand Down Expand Up @@ -2482,6 +2501,7 @@
D01A0895207EC2D400423D6F /* CleverTapInstanceConfig.m in Sources */,
071EB4C8217F6427008F0FAB /* CTDismissButton.m in Sources */,
4EF0D5472AD84BCA0044C48F /* CTSessionManager.m in Sources */,
4EB3638B2C087A8200C00AE2 /* CTUserInfoMigrator.m in Sources */,
4EB4C8BF2AAD91AC00B7F045 /* CTTriggerEvaluator.m in Sources */,
0701E9652372DE9C0034AAC2 /* CleverTapDisplayUnit.m in Sources */,
072F9E3E21B1368000BC6313 /* CTInboxIconMessageCell.m in Sources */,
Expand Down
3 changes: 2 additions & 1 deletion CleverTapSDK/CTBatchSentDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
//

#import <Foundation/Foundation.h>
#import "CTQueueType.h"

@protocol CTBatchSentDelegate <NSObject>

@optional
- (void)onBatchSent:(NSArray *)batchWithHeader withSuccess:(BOOL)success;
- (void)onBatchSent:(NSArray *)batchWithHeader withSuccess:(BOOL)success withQueueType:(CTQueueType)queueType;

@optional
- (void)onAppLaunchedWithSuccess:(BOOL)success;
Expand Down
19 changes: 19 additions & 0 deletions CleverTapSDK/CTConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ extern NSString *const kSessionId;
#define CLTAP_SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define CLTAP_APP_LAUNCHED_EVENT @"App Launched"
#define CLTAP_CHARGED_EVENT @"Charged"
#define CLTAP_PROFILE @"profile"
#define CLTAP_USER_ATTRIBUTE_CHANGE @"_change"
#define CLTAP_KEY_NEW_VALUE @"newValue"
#define CLTAP_KEY_OLD_VALUE @"oldValue"
#define CLTAP_KEY_PROFILE_ATTR_NAME @"profileAttrName"
#define CLTAP_EVENT_NAME @"evtName"
#define CLTAP_EVENT_DATA @"evtData"
#define CLTAP_CHARGED_EVENT_ITEMS @"Items"
Expand All @@ -75,6 +80,17 @@ extern NSString *const kSessionId;
#define CLTAP_NOTIFICATION_CLICKED_TAG @"wzrk_cts"
#define CLTAP_NOTIFICATION_TAG @"W$"
#define CLTAP_DATE_FORMAT @"yyyyMMdd"
#define CLTAP_DATE_PREFIX @"$D_"

// profile commands
static NSString *const kCLTAP_COMMAND_SET = @"$set";
static NSString *const kCLTAP_COMMAND_ADD = @"$add";
static NSString *const kCLTAP_COMMAND_REMOVE = @"$remove";
static NSString *const kCLTAP_COMMAND_INCREMENT = @"$incr";
static NSString *const kCLTAP_COMMAND_DECREMENT = @"$decr";
static NSString *const kCLTAP_COMMAND_DELETE = @"$delete";

#define CLTAP_MULTIVAL_COMMANDS @[kCLTAP_COMMAND_SET, kCLTAP_COMMAND_ADD, kCLTAP_COMMAND_REMOVE]

#pragma mark Constants for File Assets
#define CLTAP_FILE_URLS_EXPIRY_DICT @"file_urls_expiry_dict"
Expand Down Expand Up @@ -132,6 +148,8 @@ extern NSString *CLTAP_PROFILE_IDENTITY_KEY;
#define CLTAP_INAPP_SUPPRESSED_META_KEY @"inapps_suppressed"
#define CLTAP_INAPP_SS_EVAL_STORAGE_KEY @"inapps_eval"
#define CLTAP_INAPP_SUPPRESSED_STORAGE_KEY @"inapps_suppressed"
#define CLTAP_INAPP_SS_EVAL_STORAGE_KEY_PROFILE @"inapps_eval_profile"
#define CLTAP_INAPP_SUPPRESSED_STORAGE_KEY_PROFILE @"inapps_suppressed_profile"

#define CLTAP_PREFS_INAPP_SESSION_MAX_KEY @"imc_max"
#define CLTAP_PREFS_INAPP_LAST_DATE_KEY @"ict_date"
Expand Down Expand Up @@ -249,6 +267,7 @@ extern NSString *CLTAP_PROFILE_IDENTITY_KEY;
#pragma mark Constants for Profile identifier keys
#define CLTAP_PROFILE_IDENTIFIER_KEYS @[@"Identity", @"Email"] // LEGACY KEYS
#define CLTAP_ALL_PROFILE_IDENTIFIER_KEYS @[@"Identity", @"Email", @"Phone"]
#define CLTAP_SKIP_KEYS_USER_ATTRIBUTE_EVALUATION @[@"cc", @"tz", @"Carrier"]

#pragma mark Constants for Encryption
#define CLTAP_ENCRYPTION_LEVEL @"CleverTapEncryptionLevel"
Expand Down
6 changes: 5 additions & 1 deletion CleverTapSDK/CTLocalDataStore.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#import <Foundation/Foundation.h>
#import "CTDeviceInfo.h"
#import "CTDispatchQueueManager.h"

@class CleverTapInstanceConfig;
@class CleverTapEventDetail;

@interface CTLocalDataStore : NSObject

- (instancetype)initWithConfig:(CleverTapInstanceConfig *)config profileValues:(NSDictionary*)profileValues andDeviceInfo:(CTDeviceInfo*)deviceInfo;

- (instancetype)initWithConfig:(CleverTapInstanceConfig *)config profileValues:(NSDictionary*)profileValues andDeviceInfo:(CTDeviceInfo*)deviceInfo dispatchQueueManager:(CTDispatchQueueManager*)dispatchQueueManager;

- (void)persistEvent:(NSDictionary *)event;

Expand Down Expand Up @@ -34,6 +36,8 @@

- (id)getProfileFieldForKey:(NSString *)key;

- (NSDictionary<NSString *, NSDictionary<NSString *, id> *> *)getUserAttributeChangeProperties:(NSDictionary *)event;

- (void)persistLocalProfileIfRequired;

- (NSDictionary*)generateBaseProfile;
Expand Down
Loading
Loading