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

fix: Swift UserId and DeviceId setter #299

Merged
merged 7 commits into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
11 changes: 7 additions & 4 deletions Sources/Amplitude/Amplitude.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void);
/**
Identifier for the current user.
*/
@property (nonatomic, copy, readonly, nullable) NSString *userId;
@property (nonatomic, copy, nullable) NSString *userId;

/**
Identifier for the current device.
*/
@property (nonatomic, copy, readonly) NSString *deviceId;
@property (nonatomic, copy) NSString *deviceId;

/**
Name of the SDK instance (ex: no name for default instance, or custom name for a named instance)
Expand Down Expand Up @@ -541,18 +541,21 @@ typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void);
*/

/**
Sets the userId.
Sets the userId and starts a new session.

@param userId If your app has its own login system that you want to track users with, you can set the userId.
@see [Setting Custom UserIds](https://github.com/amplitude/Amplitude-iOS#setting-custom-user-ids)
*/

- (void)setUserId:(nullable NSString *)userId;

/**
Sets the userId and starts a new session. The previous session for the previous user will be terminated and a new session will begin for the new user id.
Sets the userId. If startNewSession is true, the previous session for the previous user will be terminated and a new session will begin for the new userId.

@param userId If your app has its own login system that you want to track users with, you can set the userId.

@param startNewSession Terminates previous user session and creates a new one for the new user

@see [Setting Custom UserIds](https://github.com/amplitude/Amplitude-iOS#setting-custom-user-ids)
*/
- (void)setUserId:(nullable NSString *)userId startNewSession:(BOOL)startNewSession;
Expand Down
2 changes: 0 additions & 2 deletions Sources/Amplitude/AmplitudePrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
@interface Amplitude ()

@property (nonatomic, copy, readwrite) NSString *apiKey;
@property (nonatomic, copy, readwrite) NSString *userId;
@property (nonatomic, copy, readwrite) NSString *deviceId;
@property (nonatomic, copy, readwrite) NSString *instanceName;

@end