-
Notifications
You must be signed in to change notification settings - Fork 24
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
this runs through the background and removes any experiments that are… #302
Conversation
… not in a fresh datafile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR looks good to me.
Can we add one unit test.
Load one datafile, set userprofile, then load another datafile which doesn't have the same experiment mapped in userprofile. and call cleanup service and check what result is returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as @msohailhussain , please add unit tests for these methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly ok, just need a few more tests
|
||
- (void)removeInvalidExperimentsForAllUsers:(NSArray<NSString *> *)validExperimentIds { | ||
|
||
NSMutableDictionary*userProflieService = [[self.dataStore getUserDataForType:OPTLYDataStoreDataTypeUserProfileService] mutableCopy]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo in userProflieService
. Also need a space before it
- (void)cleanUserProfileService:(NSArray<OPTLYExperiment> *)experiments { | ||
if (experiments == nil) return; | ||
|
||
if (_userProfileService != nil && [(NSObject *)_userProfileService respondsToSelector:@selector(removeInvalidExperimentsForAllUsers:)]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems dangerous, as in, should we wrap it in a try/catch
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
respondsToSelector is a test. I can't think of a possible reason an exception could be thrown here.
@@ -52,4 +52,8 @@ __attribute((deprecated("Use OPTLYManager initWithBuilder method instead."))); | |||
**/ | |||
- (void)removeAllUserExperimentRecords; | |||
|
|||
/** | |||
* Cleanup and remove experiments that are not in the valid experiment list passed in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Clean up...
@@ -67,6 +69,29 @@ @interface OPTLYManagerBase() | |||
|
|||
@implementation OPTLYManagerBase | |||
|
|||
- (void)cleanUserProfileService:(NSArray<OPTLYExperiment> *)experiments { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add some unit tests for this method, particularly around failure scenarios
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikeng13 done
…rofileService. fix typos
…izely/objective-c-sdk into cleanup/userprofileservice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just a few small nits
|
||
[manager cleanUserProfileService:client.optimizely.config.experiments]; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: exceess new lines?
@@ -53,7 +53,11 @@ __attribute((deprecated("Use OPTLYManager initWithBuilder method instead."))); | |||
- (void)removeAllUserExperimentRecords; | |||
|
|||
/** | |||
* Cleanup and remove experiments that are not in the valid experiment list passed in. | |||
* Clean up and remove experiments that are not in the valid experiment list passed in. | |||
* This is called when initialzied from a remote datafile to ensure that the UserProfileService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo --> initialized
* master: this runs through the background and removes any experiments that are… (#302) Updating libraries based on SourceClear recommendation (#304) add credits for third party libraries (#299) # Conflicts: # OptimizelySDKUniversal/generated-frameworks/Release-iOS-universal-SDK/OptimizelySDKiOS.framework.zip # OptimizelySDKUniversal/generated-frameworks/Release-iOS-universal-SDK/OptimizelySDKiOS.framework/OptimizelySDKiOS
… not in a fresh datafile