Skip to content

Commit

Permalink
Merge pull request #67 from rudderlabs/identifyTraitsFix
Browse files Browse the repository at this point in the history
Reset Traits on Successive Identify calls with Different UserId's
  • Loading branch information
desusai7 authored Jul 5, 2021
2 parents dcba7c7 + a49ea21 commit 16809a7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ RudderStack is available through [CocoaPods](https://cocoapods.org) and [Carthag
### CocoaPods
To install it, simply add the following line to your Podfile:
```xcode
pod 'Rudder', '1.0.19'
pod 'Rudder', '1.0.20'
```

### Carthage
And for Carthage support add the following line to your `Cartfile`
```xcode
github "rudderlabs/rudder-sdk-ios" "v1.0.19"
github "rudderlabs/rudder-sdk-ios" "v1.0.20"
```

Remember to include the following code in all `.m` and `.h` files where you want to refer to or use Rudder SDK classes
Expand Down
4 changes: 2 additions & 2 deletions Rudder.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Rudder'
s.version = "1.0.19"
s.version = "1.0.20"
s.summary = "Privacy and Security focused Segment-alternative. iOS SDK"
s.description = <<-DESC
Rudder is a platform for collecting, storing and routing customer event data to dozens of tools. Rudder is open-source, can run in your cloud environment (AWS, GCP, Azure or even your data-centre) and provides a powerful transformation framework to process your event data on the fly.
Expand All @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.license = { :type => "Apache", :file => "LICENSE" }
s.author = { "Rudderstack" => "[email protected]" }
s.platform = :ios, "9.0"
s.source = { :git => "https://github.com/rudderlabs/rudder-sdk-ios.git", :tag => "v1.0.19" }
s.source = { :git => "https://github.com/rudderlabs/rudder-sdk-ios.git", :tag => "v1.0.20" }

s.ios.deployment_target = '8.0'

Expand Down
2 changes: 1 addition & 1 deletion Rudder/RSConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ @implementation RSConstants
NSString *const RSControlPlaneUrl = @"https://api.rudderlabs.com";
bool const RSTrackLifeCycleEvents = YES;
bool const RSRecordScreenViews = NO;
NSString *const RS_VERSION = @"1.0.19";
NSString *const RS_VERSION = @"1.0.20";
@end
8 changes: 8 additions & 0 deletions Rudder/RSContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ - (void)updateTraits:(RSTraits *)traits {
[_traits removeAllObjects];
}

NSString* existingId = (NSString*)[_traits objectForKey:@"userId"];
NSString* userId = (NSString*) traits.userId;

if(existingId!=nil && userId!=nil && ![existingId isEqual:userId])
{
_traits = [[traits dict]mutableCopy];
return;
}
[_traits setValuesForKeysWithDictionary:[traits dict]];
}

Expand Down

0 comments on commit 16809a7

Please sign in to comment.