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

SDK-4010 - onUserLogin for iOS appends user string prefix to both Email and Name system user properties #367

Conversation

kushCT
Copy link
Contributor

@kushCT kushCT commented Aug 20, 2024

  • Added hotfix for User prefix getting appended to system variables

@kushCT kushCT changed the base branch from master to develop August 20, 2024 15:19

// Iterate through the original dictionary's keys
for (NSString *key in [dictionary allKeys]) {
if ([knownProfileFields containsObject:key] && [key hasPrefix:@"user"]) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the first condition should be enough maybe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done the changes

@akashvercetti akashvercetti changed the title [Hotfix]: onUserLogin for iOS appends user string prefix to both Email and Name system user properties SDK - 4010 - onUserLogin for iOS appends user string prefix to both Email and Name system user properties Aug 21, 2024
@akashvercetti akashvercetti changed the title SDK - 4010 - onUserLogin for iOS appends user string prefix to both Email and Name system user properties SDK-4010 - onUserLogin for iOS appends user string prefix to both Email and Name system user properties Aug 21, 2024
Copy link
Contributor

@nzagorchev nzagorchev left a comment

Choose a reason for hiding this comment

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

Please, check the comments left.

I believe the code which maps the keys becomes redundant now (CTProfileBuilder):

           KnownField kf = [CTKnownProfileFields getKnownFieldIfPossibleForKey:key];
            if (kf != UNKNOWN) {
// This will return the same key
                systemFields[[CTKnownProfileFields getStorageValueForField:kf]] = value;

Please, also address the following:

  • Fix CTUserInfoMigratorTest tests
  • Add a CTUserInfoMigratorTest test for the new migration logic
  • Add a CTProfileBuilder:build:completionHandler for profile test if possible
  • Add a CTLocalDataStore:generateBaseProfile test if possible


@implementation CTUserInfoMigrator

+ (void)migrateUserInfoFileForAccountID:(NSString *)acc_id deviceID:(NSString *)device_id {
+ (void)migrateUserInfoFileForAccountID:(NSString *)acc_id deviceID:(NSString *)device_id config:(CleverTapInstanceConfig *) config {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you pass the whole CleverTapInstanceConfig instance, you can read the accountId from the config, instead of passing it as another parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done the changes


@interface CTUserInfoMigrator : NSObject

+ (void)migrateUserInfoFileForAccountID:(NSString *)acc_id deviceID:(NSString *)device_id;
+ (void)migrateUserInfoFileForAccountID:(NSString *)acc_id deviceID:(NSString *)device_id config:(CleverTapInstanceConfig *) config;
Copy link
Contributor

Choose a reason for hiding this comment

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

This change breaks the CTUserInfoMigratorTest tests, please see the other comment about this method parameters and address the tests, as well.

Copy link
Contributor

@nzagorchev nzagorchev left a comment

Choose a reason for hiding this comment

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

Approving with the note that we need to add more unit tests later on

Copy link
Collaborator

@akashvercetti akashvercetti left a comment

Choose a reason for hiding this comment

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

@kushCT add version and changelog changes here or in another branch

@kushCT kushCT merged commit 26c5601 into develop Aug 22, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants