Skip to content

Commit

Permalink
fix: Swift UserId and DeviceId setter (#299)
Browse files Browse the repository at this point in the history
* Add readwrite properties to m file
  • Loading branch information
jooohhn authored Oct 19, 2020
1 parent 7dbdad8 commit b7c0f90
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Sources/Amplitude/Amplitude.h
Original file line number Diff line number Diff line change
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: 2 additions & 0 deletions Sources/Amplitude/Amplitude.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ @interface Amplitude()
@property (nonatomic, assign) long long sessionId;
@property (nonatomic, assign) BOOL backoffUpload;
@property (nonatomic, assign) int backoffUploadBatchSize;
@property (nonatomic, copy, readwrite, nullable) NSString *userId;
@property (nonatomic, copy, readwrite) NSString *deviceId;
#if TARGET_OS_IOS || TARGET_OS_MACCATALYST
@property (nonatomic, strong) AMPEventExplorer *eventExplorer;
#endif
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

0 comments on commit b7c0f90

Please sign in to comment.