-
Notifications
You must be signed in to change notification settings - Fork 55
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
Conversation
… Profile Decrement API
…pps by passing them the array as argument
…ute_names' into Adding_unit_test_cases * SDK_3824_Refactor_adapter_to_start_using_profile_attribute_names: Moved the getUserAttribute and updating profile fields to LocalDataStoreFile Refractored some files for code cleaning Added support for Profile type Events to be included for server side inapps Code Cleaning and refactoring
…tart_using_profile_attribute_names SDK-3824 Refactor adapter to start using profile attribute names
SDK-3831 - Adding unit test cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extend CTBatchSentDelegate
- (void)onBatchSent:(NSArray *)batchWithHeader withSuccess:(BOOL)success;
to also provide the queue type. Based on the queue type, remove the successfully sent headers from the respective collections. If the queue type is Event, use the current code, if it is Profile, remove from the profile collections.
@@ -298,7 +330,7 @@ - (void)updateTTL:(NSMutableDictionary *)inApp { | |||
- (BatchHeaderKeyPathValues)onBatchHeaderCreationForQueue:(CTQueueType)queueType { | |||
// Evaluation is done for events only at the moment, | |||
// send the evaluated and suppressed ids in that queue header | |||
if (queueType != CTQueueTypeEvents) { | |||
if (queueType != CTQueueTypeEvents && queueType != CTQueueTypeProfile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create separate collections for the profile server-side in-app ids and the profile suppressed client-side in-apps.
Add to the header the ones based on the queue type.
… batch sent header for incorporating user profile changes
if (newValue == oldValue) { | ||
continue; | ||
} | ||
[eligibleInApps addObjectsFromArray:[self evaluate:event withInApps:self.inAppStore.clientSideInApps]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The evaluation needs to be outside the if event.profileAttrName so non-profile events are also evaluated
NSMutableArray<NSDictionary *> *eligibleInApps = [NSMutableArray array]; | ||
for (CTEventAdapter *event in events) { | ||
[eligibleInApps addObjectsFromArray:[self evaluate:event withInApps:self.inAppStore.serverSideInApps]]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format code
[self removeSentEvaluatedServerSideInAppIds:header]; | ||
[self removeSentSuppressedClientSideInApps:header]; | ||
} | ||
else if (queueType == CTQueueTypeEvents) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check should be else if (queueType == CTQueueTypeProfile) {
@@ -215,6 +279,25 @@ - (void)removeSentSuppressedClientSideInApps:(NSDictionary *)header { | |||
} | |||
} | |||
|
|||
- (void)removeSentEvaluatedServerSideInAppIdsForProfile:(NSDictionary *)header { | |||
NSArray *inapps_eval = header[CLTAP_INAPP_SS_EVAL_STORAGE_KEY_PROFILE]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The header key is the same for profile and event queues, it should be CLTAP_INAPP_SS_EVAL_META_KEY
.
} | ||
|
||
- (void)removeSentSuppressedClientSideInAppsForProfile:(NSDictionary *)header { | ||
NSArray *suppresed_inapps = header[CLTAP_INAPP_SUPPRESSED_STORAGE_KEY_PROFILE]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The header key is the same for profile and event queues, it should be CLTAP_INAPP_SUPPRESSED_META_KEY
.
if (queueType == CTQueueTypeProfile) { | ||
|
||
if ([self.evaluatedServerSideInAppIdsForProfile count] > 0) { | ||
header[CLTAP_INAPP_SS_EVAL_STORAGE_KEY_PROFILE] = self.evaluatedServerSideInAppIdsForProfile; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The header meta key should be CLTAP_INAPP_SS_EVAL_META_KEY
.
header[CLTAP_INAPP_SS_EVAL_STORAGE_KEY_PROFILE] = self.evaluatedServerSideInAppIdsForProfile; | ||
} | ||
if ([self.suppressedClientSideInAppsForProfile count] > 0) { | ||
header[CLTAP_INAPP_SUPPRESSED_STORAGE_KEY_PROFILE] = self.suppressedClientSideInAppsForProfile; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The header meta key should be CLTAP_INAPP_SUPPRESSED_META_KEY
.
[super setUp]; | ||
CleverTapInstanceConfig *config = [[CleverTapInstanceConfig alloc] initWithAccountId:@"testAccount" accountToken:@"testToken" accountRegion:@"testRegion"]; | ||
CTDeviceInfo *deviceInfo = [[CTDeviceInfo alloc] initWithConfig:config andCleverTapID:@"testDeviceInfo"]; | ||
CTDispatchQueueManager *queueManager =[[CTDispatchQueueManager alloc]initWithConfig:config]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test does not compile.
Method calls to [self.evaluationManager onBatchSent:batchWithHeaderAll withSuccess:YES];
need to be changed to [self.evaluationManager onBatchSent:batchWithHeaderAll withSuccess:YES withQueueType:queueType];
based on the queue type.
|
||
|
||
[self.evaluationManager evaluateOnUserAttributeChange:profile]; | ||
XCTAssertEqualObjects((@[@1]), self.evaluationManager.evaluatedServerSideInAppIds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should check against evaluatedServerSideInAppIdsForProfile
.
Added Unit Test cases for