From a514575459a3dba04f9a26b20013439233ca8db9 Mon Sep 17 00:00:00 2001 From: John Tran Date: Fri, 16 Oct 2020 01:59:10 -0700 Subject: [PATCH 1/7] Move ID setters to m file --- Sources/Amplitude/Amplitude.m | 2 ++ Sources/Amplitude/AmplitudePrivate.h | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Amplitude/Amplitude.m b/Sources/Amplitude/Amplitude.m index c56d65be..ac95656b 100644 --- a/Sources/Amplitude/Amplitude.m +++ b/Sources/Amplitude/Amplitude.m @@ -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 diff --git a/Sources/Amplitude/AmplitudePrivate.h b/Sources/Amplitude/AmplitudePrivate.h index b48e0925..3d3f5744 100644 --- a/Sources/Amplitude/AmplitudePrivate.h +++ b/Sources/Amplitude/AmplitudePrivate.h @@ -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 From 4dc32755ea687d5f099b16ef3031ddbaf482361d Mon Sep 17 00:00:00 2001 From: John Tran Date: Fri, 16 Oct 2020 02:04:54 -0700 Subject: [PATCH 2/7] deprecate setUserId with startNewSession --- Sources/Amplitude/Amplitude.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/Amplitude/Amplitude.h b/Sources/Amplitude/Amplitude.h index 2a3aba10..eeb71bad 100644 --- a/Sources/Amplitude/Amplitude.h +++ b/Sources/Amplitude/Amplitude.h @@ -541,7 +541,10 @@ 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` + @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) */ @@ -549,7 +552,7 @@ typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void); - (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. From 09227803b65650ab4c1cbbdf7e7b0e3f0ec48221 Mon Sep 17 00:00:00 2001 From: John Tran Date: Fri, 16 Oct 2020 15:00:21 -0700 Subject: [PATCH 3/7] format nit --- Sources/Amplitude/Amplitude.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Amplitude/Amplitude.h b/Sources/Amplitude/Amplitude.h index eeb71bad..964eb305 100644 --- a/Sources/Amplitude/Amplitude.h +++ b/Sources/Amplitude/Amplitude.h @@ -543,7 +543,7 @@ typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void); /** Sets the userId and starts a new session. - **Note: this is deprecated** - please use `setUserId:(NSString*) userId startNewSession:(BOOL)startNewSession` + **Note: this is deprecated** - please use `setUserId:(NSString*)userId startNewSession:(BOOL)startNewSession` @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) From 748a27733dace2182c956c96e8aca6a9620ec2f4 Mon Sep 17 00:00:00 2001 From: John Tran Date: Fri, 16 Oct 2020 16:28:08 -0700 Subject: [PATCH 4/7] Remove deprecation --- Sources/Amplitude/Amplitude.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Sources/Amplitude/Amplitude.h b/Sources/Amplitude/Amplitude.h index 964eb305..3ec351ef 100644 --- a/Sources/Amplitude/Amplitude.h +++ b/Sources/Amplitude/Amplitude.h @@ -543,8 +543,6 @@ typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void); /** Sets the userId and starts a new session. - **Note: this is deprecated** - please use `setUserId:(NSString*)userId startNewSession:(BOOL)startNewSession` - @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) */ From 0942f777011a5cf93bf553cd33bcc4d47d0a647b Mon Sep 17 00:00:00 2001 From: John Tran Date: Fri, 16 Oct 2020 16:29:30 -0700 Subject: [PATCH 5/7] Add param docs --- Sources/Amplitude/Amplitude.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/Amplitude/Amplitude.h b/Sources/Amplitude/Amplitude.h index 3ec351ef..7616991d 100644 --- a/Sources/Amplitude/Amplitude.h +++ b/Sources/Amplitude/Amplitude.h @@ -554,6 +554,8 @@ typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void); @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; From 30c6f029409934154837791e304143e268d3110c Mon Sep 17 00:00:00 2001 From: John Tran Date: Fri, 16 Oct 2020 16:30:45 -0700 Subject: [PATCH 6/7] move readwrite to header --- Sources/Amplitude/Amplitude.h | 4 ++-- Sources/Amplitude/Amplitude.m | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Sources/Amplitude/Amplitude.h b/Sources/Amplitude/Amplitude.h index 7616991d..ac5eded7 100644 --- a/Sources/Amplitude/Amplitude.h +++ b/Sources/Amplitude/Amplitude.h @@ -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) diff --git a/Sources/Amplitude/Amplitude.m b/Sources/Amplitude/Amplitude.m index ac95656b..c56d65be 100644 --- a/Sources/Amplitude/Amplitude.m +++ b/Sources/Amplitude/Amplitude.m @@ -87,8 +87,6 @@ @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 From 2498d2b015e88898655149299daf4e6e3e00c980 Mon Sep 17 00:00:00 2001 From: John Tran Date: Mon, 19 Oct 2020 11:26:47 -0700 Subject: [PATCH 7/7] Revert "move readwrite to header" This reverts commit 30c6f029409934154837791e304143e268d3110c. --- Sources/Amplitude/Amplitude.h | 4 ++-- Sources/Amplitude/Amplitude.m | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/Amplitude/Amplitude.h b/Sources/Amplitude/Amplitude.h index ac5eded7..7616991d 100644 --- a/Sources/Amplitude/Amplitude.h +++ b/Sources/Amplitude/Amplitude.h @@ -65,12 +65,12 @@ typedef NSDictionary *_Nullable (^AMPLocationInfoBlock)(void); /** Identifier for the current user. */ -@property (nonatomic, copy, nullable) NSString *userId; +@property (nonatomic, copy, readonly, nullable) NSString *userId; /** Identifier for the current device. */ -@property (nonatomic, copy) NSString *deviceId; +@property (nonatomic, copy, readonly) NSString *deviceId; /** Name of the SDK instance (ex: no name for default instance, or custom name for a named instance) diff --git a/Sources/Amplitude/Amplitude.m b/Sources/Amplitude/Amplitude.m index c56d65be..ac95656b 100644 --- a/Sources/Amplitude/Amplitude.m +++ b/Sources/Amplitude/Amplitude.m @@ -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