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 2 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
7 changes: 5 additions & 2 deletions Sources/Amplitude/Amplitude.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,15 +541,18 @@ typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void);
*/

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

**Note: this is deprecated** - please use `setUserId:(NSString*) userId startNewSession:(BOOL)startNewSession`
Copy link
Contributor

Choose a reason for hiding this comment

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

no space in between for (NSString*) userId


@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.

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

This will allow user to call setter without changing readonly for userId and deviceId inside Amplitude.h?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed so readwrite occurs in header instead of implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will revert so that we can solve the method syntax bug

@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