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

Version 2.13.0 #135

Merged
merged 135 commits into from
Jun 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
164ed50
adds inlineUserInEvents to LDConfig
markpokornycos Apr 11, 2018
51c8c40
adds inlineUser capability to LDEventModel
markpokornycos Apr 11, 2018
1399e84
adds inlineUser to LDDataManager and test
markpokornycos Apr 16, 2018
590d292
adds identify event to LDDataManager
markpokornycos Apr 16, 2018
673197a
adds creating identify event on setting ldUser
markpokornycos Apr 16, 2018
d278788
advances version to 2.13.0
markpokornycos Apr 16, 2018
dc1346e
fixes defect that caused inlineUser to be sent to the server
markpokornycos Apr 16, 2018
322dcb2
fixes update user defect
markpokornycos Apr 17, 2018
87e6226
advances version
markpokornycos Apr 17, 2018
e18c84c
installs shorter min flag polling interval for DEBUG
markpokornycos Apr 17, 2018
60212cc
changes syntax for dictionaryValue & initWithDictionary
markpokornycos Apr 18, 2018
63679c2
fixes client build issues
markpokornycos Apr 24, 2018
23f2160
fixes test build warnings
markpokornycos Apr 24, 2018
022eda5
removes LDFlagConfigValue from public access
markpokornycos Apr 24, 2018
8faa91c
removes LDFlagConfigModel from public access
markpokornycos Apr 24, 2018
63e7e32
removes incorrect import
markpokornycos Apr 24, 2018
4ea0a62
adds a new LDFlagConfig group and moves some files there
markpokornycos Apr 18, 2018
cd8b167
adds LDFlagValueCounter init/counterWithValue
markpokornycos Apr 18, 2018
08558af
adds remaining capability to LDFlagValueCounter
markpokornycos Apr 18, 2018
c7311a4
stubs LDFlagCounter
markpokornycos Apr 18, 2018
1b0441d
adds LDFlagCounter test stub
markpokornycos Apr 18, 2018
f176fc8
adds LDFlagCounter constructors
markpokornycos Apr 18, 2018
3fa85e8
adds LDFlagConfigValue category method for testing
markpokornycos Apr 18, 2018
496064f
add version specifier to several test fixtures
markpokornycos Apr 18, 2018
463825d
adds LDFlagCounter logRequest tests
markpokornycos Apr 19, 2018
5329523
removes LDFlagValueCounter unknown value constructors
markpokornycos Apr 19, 2018
77a0d3b
adds unknown flag value logRequest test on LDFlagCounter
markpokornycos Apr 19, 2018
90b4528
fixes defect with LDFlagValueCounter dictionary for unknown values
markpokornycos Apr 19, 2018
cf2cb0a
adds LDFlagCounter dictionaryValue
markpokornycos Apr 19, 2018
e06ae89
adds LDFlagConfigTracker
markpokornycos Apr 19, 2018
9e288a3
changes _Nonnull to nonnull in selected code
markpokornycos Apr 19, 2018
20f09f8
changes _Nullable to nullable in selected code
markpokornycos Apr 19, 2018
fef2042
adds LDEventModel support for featureSummary events
markpokornycos Apr 20, 2018
aa8d6eb
adds debug event support
markpokornycos Apr 20, 2018
fa10ffe
installs LDFlagConfigTracker into LDFlagConfigModel
markpokornycos Apr 25, 2018
94f709b
adds createSummaryEvent to LDDataManager
markpokornycos Apr 25, 2018
1e0c4ed
fixes missing files issue in client app
markpokornycos Apr 25, 2018
17711e5
wires LDClientManager to reset the config tracker
markpokornycos Apr 25, 2018
39ad4fb
fixes broken LDClientManagerTests
markpokornycos Apr 25, 2018
460622d
moves LDUserModel+Stub into LDUserModel+Testable
markpokornycos Apr 25, 2018
dda3e97
moves LDUserModel+Equatable into LDUserModel+Testable
markpokornycos Apr 25, 2018
47da3cc
moves LDUserModel+JsonDecodeable into LDUserModel+Testable
markpokornycos Apr 25, 2018
a1b9b66
renames LDUser.config to LDUser.flagConfig
markpokornycos Apr 25, 2018
0d6e68d
stubs variation into LDFlagConfigValue
markpokornycos Apr 26, 2018
8a8d336
removes flag evaluation methods from LDUserModel
markpokornycos Apr 26, 2018
e52231a
renames flagConfigValue accessors in LDFlagConfigModel
markpokornycos Apr 26, 2018
1e808a2
replaces LDFlagConfigTracker logRequest method to take a LDFlagConfig…
markpokornycos Apr 26, 2018
abb6bd4
adds NSDate isWithinTimeInterval
markpokornycos Apr 27, 2018
85807a2
fixes defect in NSDictionary keysWithDifferentValues
markpokornycos Apr 27, 2018
ed1b02b
creates flagConfigModel on init
markpokornycos Apr 27, 2018
26719ce
adds flagConfigValueForFlagKey to LDFlagConfigModel
markpokornycos Apr 27, 2018
f217baa
adds LDFlagConfigValue description
markpokornycos Apr 27, 2018
13ed17e
adds the tracker to all LDFlagConfigModel init methods
markpokornycos Apr 27, 2018
ae39c37
adds a tracker to the LDUserModel stub method
markpokornycos Apr 27, 2018
1c1c9dc
refactors LDClient variation methods
markpokornycos Apr 27, 2018
b4344a9
fixes sometimes failing LDEventModel test
markpokornycos Apr 27, 2018
fd2d050
prevent LDDataManager from creating empty summary events
markpokornycos Apr 27, 2018
0eb7238
add descriptions
markpokornycos Apr 30, 2018
ee920e0
moves LDFlagConfigTracker into LDUserModel
markpokornycos Apr 30, 2018
dae8e1e
specifies isKnownValue in request logs
markpokornycos Apr 30, 2018
9adfea4
matches flag values by value and isKnownValue
markpokornycos Apr 30, 2018
b3ebde9
adds debug events to flag requests
markpokornycos May 1, 2018
d7a022a
adds variation to summary event reports
markpokornycos May 1, 2018
d090e96
renames flag events to summary
markpokornycos May 1, 2018
dec09e6
changes LDFlagConfigValue
markpokornycos May 2, 2018
e66873a
refactors LDFlagConfigModel hasFeaturesEqualToDictionary
markpokornycos May 2, 2018
7587b4f
adds LDFlagConfigValue to LDEventModel
markpokornycos May 2, 2018
368967a
adds LDDataManager createFeature/DebugEvent using flagConfigValue
markpokornycos May 2, 2018
881668a
advances version
markpokornycos May 2, 2018
cd9d101
creates feature & debug events using flagConfigValue
markpokornycos May 2, 2018
55ca885
removes unneeded flagValue based event creation methods
markpokornycos May 2, 2018
f2397d5
moves LDFlagConfigValue dictionary items into feature/debug event dic…
markpokornycos May 2, 2018
1adbf13
adds schema version Event Header to event requests
markpokornycos May 2, 2018
630ba43
omits version & variation from LDFlagConfigValue dictionary when not set
markpokornycos May 2, 2018
317a910
fixes defect with feature and debug reports for unknown flags
markpokornycos May 2, 2018
7b6e2c0
adds flagConfigValue to LDFlagValueCounter
markpokornycos May 2, 2018
89c42db
modifies LDFlagConfigValue hasPropertiesMatchingDictionary to reject …
markpokornycos May 2, 2018
ae33d11
adds request logging using flagConfigValue to LDFlagCounter
markpokornycos May 2, 2018
939091a
logs flag requests using flagConfigValue in LDFlagConfigTracker
markpokornycos May 2, 2018
0c2abc9
removes value, version, and variation from LDFlagValueCounter
markpokornycos May 3, 2018
3e83ec2
updates patch to use LDFlagConfigValue
markpokornycos May 3, 2018
751c1e9
adds LDDataManager createFlagEvaluationEvents method
markpokornycos May 8, 2018
164b992
makes mutually exclusive tests else if
markpokornycos May 8, 2018
ef961e2
cleans up misplaced comma
markpokornycos May 8, 2018
fc10ee5
stubs in LDEventTrackingContext
markpokornycos May 4, 2018
feca64b
implements LDEventTrackingContext categories
markpokornycos May 4, 2018
a3e8a7c
adds NSDate dateFromMillisSince1970
markpokornycos May 4, 2018
f96bc9c
implements LDEventTrackingContext init methods
markpokornycos May 4, 2018
340b99b
adds NSCoding protocol methods
markpokornycos May 4, 2018
1a20aee
adds variation to test fixtures
markpokornycos May 7, 2018
a419bb7
adds test support methods to LDFlagConfigValue
markpokornycos May 7, 2018
9094860
refactors LDFlagConfigValue init and constructor tests
markpokornycos May 7, 2018
4883e5f
refactor LDFlagConfigValue isEqual
markpokornycos May 7, 2018
6900d39
adds event tracking context implementation to flagConfigValue
markpokornycos May 7, 2018
a4d1983
installs test for trackEvents before publishing feature event
markpokornycos May 8, 2018
f56a975
installs gate for debugEventsUntilDate
markpokornycos May 8, 2018
098fbd0
stubs in responseDate for RequestManagerDelegate protocol
markpokornycos May 8, 2018
4694d43
removes unused test fixture
markpokornycos May 8, 2018
0bf49fd
adds json header date formatter
markpokornycos May 8, 2018
a8a085c
extracts date from event response header in LDRequestManager
markpokornycos May 9, 2018
b941783
removes @synthesize from LDClientManagerTest
markpokornycos May 9, 2018
03213df
wires LDClientManager to pass lastEventResponseDate to LDDataManager
markpokornycos May 9, 2018
3a7f376
advance version
markpokornycos May 9, 2018
5a3e2aa
clear TODOs from Summary Events work
markpokornycos May 9, 2018
e76ff9f
updates event tracking context if no flags change
markpokornycos May 9, 2018
729e1c5
updates event tracking context on put when no flags change
markpokornycos May 9, 2018
5fb615d
fixes defect with put handling not saving the user
markpokornycos May 9, 2018
24f9d19
add flagVersion to with version fixtures
markpokornycos May 21, 2018
dd18bf6
rename does not exist constant to common kLDFlagConfigValueItemDoesNo…
markpokornycos May 21, 2018
8840dde
rename version to flagConfigModelVersion
markpokornycos May 21, 2018
6afac2f
add flagConfigValueVersion to LDFlagConfigValue
markpokornycos May 21, 2018
3700dee
changes flag request endpoints for GET & REPORT
markpokornycos May 21, 2018
1515212
removes support for original json format LDFlagConfigValues
markpokornycos May 22, 2018
08604c0
removes ability to stub LDFlagConfigValue withoutVersions
markpokornycos May 22, 2018
f631c6f
remove withoutVersions fixtures
markpokornycos May 22, 2018
f0b3d5e
refactor modelVersion test to pass when missing
markpokornycos May 22, 2018
b534058
installs flagVersion into LDFlagConfigValue
markpokornycos May 22, 2018
cae0642
installs switch to use flagVersion for version in dictionaryValue
markpokornycos May 22, 2018
b66e5eb
add tooltip comments about ignoring optional items for equality checks
markpokornycos May 22, 2018
c6d35ca
applies LDFlagConfigValue dictionaryValue to LDFlagValueCounter
markpokornycos May 22, 2018
de40c93
refactors LDEventModel dictionaryValue to use flagVersion when available
markpokornycos May 23, 2018
5d28454
advance version
markpokornycos May 23, 2018
62b3cce
correct flag request urls
markpokornycos May 23, 2018
df40a34
correct REPORT flag request url
markpokornycos May 23, 2018
7d84792
remove value from equality tests on LDFlagConfigValue
markpokornycos May 23, 2018
44783e4
address PR comments
markpokornycos May 24, 2018
2a21322
advance version
markpokornycos May 24, 2018
eff79ca
Merge pull request #78 from launchdarkly/summaryEvents
arun251 May 29, 2018
ba95ad2
precludes crash on selected null json values
markpokornycos May 29, 2018
08ee28b
fix date overflow when converting to millisSince1970
markpokornycos May 29, 2018
703fc53
fixes defect reporting null value in events
markpokornycos May 31, 2018
c1a0aba
adds reported value into feature and debug reports
markpokornycos May 31, 2018
3e402a9
adds reported value into summary reports
markpokornycos May 31, 2018
97b6430
prep for release
markpokornycos Jun 1, 2018
765041d
advance eventsource to 3.2.4
markpokornycos Jun 1, 2018
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to the LaunchDarkly iOS SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).

## [2.13.0] - 2018-06-01
### Added
- New property `inlineUserInEvents` in `LDConfig`. When `YES` includes the full user (excluding private attributes) in analytics `feature` and `custom` events. When `NO` includes only the `userKey`. Default: `NO`.
- Calling `start` or `updateUser` (when started) on `LDClient` logs an analytics `identify` event. `identify` events contain the full user (excluding private attributes) regardless of `inlineUserInEvents`.
- Adds analytics `summary` event used to track feature flag requests to the SDK.
- Adds analytics `debug` event available to assist with debugging when requested from the website Debugger.

### Changed
- Changes analytics `feature` events so that they are only sent when requested via the website Dashboard.
- Fixed a defect preventing the SDK from updating correctly on a `put` streaming event when there are no flag changes.
- Fixed a defect on `watchOS` causing the SDK to report analytics dates incorrectly.

## [2.12.1] - 2018-04-23
### Changed
- Clears selected warnings in CocoaPods project
Expand Down
528 changes: 340 additions & 188 deletions Darkly.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion Darkly/DarklyConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#import "DarklyConstants.h"

NSString * const kClientVersion = @"2.12.1";
NSString * const kClientVersion = @"2.13.0";
NSString * const kBaseUrl = @"https://app.launchdarkly.com";
NSString * const kEventsUrl = @"https://mobile.launchdarkly.com";
NSString * const kStreamUrl = @"https://clientstream.launchdarkly.com";
Expand Down Expand Up @@ -35,7 +35,11 @@
int const kDefaultFlushInterval = 30;
int const kMinimumFlushIntervalMillis = 0;
int const kDefaultPollingInterval = 300;
#if DEBUG
int const kMinimumPollingInterval = 30;
#else
int const kMinimumPollingInterval = 300;
#endif
int const kDefaultBackgroundFetchInterval = 3600;
int const kMinimumBackgroundFetchInterval = 900;
int const kMillisInSecs = 1000;
Expand Down
187 changes: 102 additions & 85 deletions Darkly/LDClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#import "DarklyConstants.h"
#import "NSThread+MainExecutable.h"
#import "LDThrottler.h"
#import "LDFlagConfigModel.h"
#import "LDFlagConfigValue.h"
#import "LDFlagConfigTracker.h"

@interface LDClient()
@property (nonatomic, assign) BOOL isOnline;
Expand Down Expand Up @@ -49,6 +52,11 @@ +(LDClient *)sharedInstance
return sharedLDClient;
}

-(void)setLdUser:(LDUserModel*)user {
_ldUser = user;
[[LDDataManager sharedManager] createIdentifyEventWithUser:_ldUser config:self.ldConfig];
}

-(BOOL)start:(LDConfigBuilder *)inputConfigBuilder userBuilder:(LDUserBuilder *)inputUserBuilder {
return [self start:[inputConfigBuilder build] withUserBuilder:inputUserBuilder];
}
Expand Down Expand Up @@ -103,140 +111,149 @@ - (LDUserBuilder *)currentUserBuilder {
}
}

- (BOOL)boolVariation:(NSString *)featureKey fallback:(BOOL)fallback{
DEBUG_LOG(@"LDClient boolVariation method called for feature=%@ and fallback=%d", featureKey, fallback);
if (![featureKey isKindOfClass:[NSString class]]) {
NSLog(@"featureKey should be an NSString. Returning fallback value");
- (BOOL)boolVariation:(NSString *)flagKey fallback:(BOOL)fallback{
DEBUG_LOG(@"LDClient boolVariation method called for flagKey=%@ and fallback=%d", flagKey, fallback);
if (![flagKey isKindOfClass:[NSString class]]) {
NSLog(@"flagKey should be an NSString. Returning fallback value");
return fallback;
}
if (self.clientStarted) {
BOOL flagExists = [self.ldUser doesFlagExist: featureKey];
NSObject *flagValue = [self.ldUser flagValue: featureKey];
BOOL returnValue = fallback;
if ([flagValue isKindOfClass:[NSNumber class]] && flagExists) {
returnValue = [(NSNumber *)flagValue boolValue];
}

[[LDDataManager sharedManager] createFeatureEvent: featureKey keyValue:[NSNumber numberWithBool:returnValue] defaultKeyValue:[NSNumber numberWithBool:fallback] user:self.ldUser config:self.ldConfig];
return returnValue;
} else {
if (!self.clientStarted) {
DEBUG_LOGX(@"LDClient not started yet!");
return fallback;
}
return fallback;

LDFlagConfigValue *flagConfigValue = [self.ldUser.flagConfig flagConfigValueForFlagKey:flagKey];
BOOL returnValue = flagConfigValue.value && [flagConfigValue.value isKindOfClass:[NSNumber class]] ? [flagConfigValue.value boolValue] : fallback;

[[LDDataManager sharedManager] createFlagEvaluationEventsWithFlagKey:flagKey
reportedFlagValue:@(returnValue)
flagConfigValue:flagConfigValue
defaultFlagValue:@(fallback)
user:self.ldUser
config:self.ldConfig];
return returnValue;
}

- (NSNumber*)numberVariation:(NSString *)featureKey fallback:(NSNumber*)fallback{
DEBUG_LOG(@"LDClient numberVariation method called for feature=%@ and fallback=%@", featureKey, fallback);
if (![featureKey isKindOfClass:[NSString class]]) {
NSLog(@"featureKey should be an NSString. Returning fallback value");
- (NSNumber*)numberVariation:(NSString *)flagKey fallback:(NSNumber*)fallback{
DEBUG_LOG(@"LDClient numberVariation method called for flagKey=%@ and fallback=%@", flagKey, fallback);
if (![flagKey isKindOfClass:[NSString class]]) {
NSLog(@"flagKey should be an NSString. Returning fallback value");
return fallback;
}
if (self.clientStarted) {
BOOL flagExists = [self.ldUser doesFlagExist: featureKey];
NSObject *flagValue = [self.ldUser flagValue: featureKey];
NSNumber *returnValue = fallback;
if ([flagValue isKindOfClass:[NSNumber class]] && flagExists) {
returnValue = (NSNumber *)flagValue;
}

[[LDDataManager sharedManager] createFeatureEvent: featureKey keyValue:returnValue defaultKeyValue:fallback user:self.ldUser config:self.ldConfig];
return returnValue;
} else {
if (!self.clientStarted) {
DEBUG_LOGX(@"LDClient not started yet!");
return fallback;
}
return fallback;

LDFlagConfigValue *flagConfigValue = [self.ldUser.flagConfig flagConfigValueForFlagKey:flagKey];
NSNumber *returnValue = flagConfigValue.value && [flagConfigValue.value isKindOfClass:[NSNumber class]] ? flagConfigValue.value : fallback;

[[LDDataManager sharedManager] createFlagEvaluationEventsWithFlagKey:flagKey
reportedFlagValue:returnValue
flagConfigValue:flagConfigValue
defaultFlagValue:fallback
user:self.ldUser
config:self.ldConfig];
return returnValue;
}

- (double)doubleVariation:(NSString *)featureKey fallback:(double)fallback {
DEBUG_LOG(@"LDClient doubleVariation method called for feature=%@ and fallback=%f", featureKey, fallback);
if (![featureKey isKindOfClass:[NSString class]]) {
NSLog(@"featureKey should be an NSString. Returning fallback value");
- (double)doubleVariation:(NSString *)flagKey fallback:(double)fallback {
DEBUG_LOG(@"LDClient doubleVariation method called for flagKey=%@ and fallback=%f", flagKey, fallback);
if (![flagKey isKindOfClass:[NSString class]]) {
NSLog(@"flagKey should be an NSString. Returning fallback value");
return fallback;
}
if (!self.clientStarted) {
DEBUG_LOGX(@"LDClient not started yet!");
return fallback;
}
BOOL flagExists = [self.ldUser doesFlagExist: featureKey];
id flagValue = [self.ldUser flagValue: featureKey];
double returnValue = fallback;
if (flagExists && [flagValue isKindOfClass:[NSNumber class]]) {
returnValue = [((NSNumber *)flagValue) doubleValue];
}

[[LDDataManager sharedManager] createFeatureEvent:featureKey keyValue:[NSNumber numberWithDouble:returnValue] defaultKeyValue:[NSNumber numberWithDouble:fallback] user:self.ldUser config:self.ldConfig];

LDFlagConfigValue *flagConfigValue = [self.ldUser.flagConfig flagConfigValueForFlagKey:flagKey];
double returnValue = flagConfigValue.value && [flagConfigValue.value isKindOfClass:[NSNumber class]] ? [flagConfigValue.value doubleValue] : fallback;

[[LDDataManager sharedManager] createFlagEvaluationEventsWithFlagKey:flagKey
reportedFlagValue:@(returnValue)
flagConfigValue:flagConfigValue
defaultFlagValue:@(fallback)
user:self.ldUser
config:self.ldConfig];
return returnValue;
}

- (NSString*)stringVariation:(NSString *)featureKey fallback:(NSString*)fallback{
DEBUG_LOG(@"LDClient stringVariation method called for feature=%@ and fallback=%@", featureKey, fallback);
if (![featureKey isKindOfClass:[NSString class]]) {
NSLog(@"featureKey should be an NSString. Returning fallback value");
- (NSString*)stringVariation:(NSString *)flagKey fallback:(NSString*)fallback{
DEBUG_LOG(@"LDClient stringVariation method called for flagKey=%@ and fallback=%@", flagKey, fallback);
if (![flagKey isKindOfClass:[NSString class]]) {
NSLog(@"flagKey should be an NSString. Returning fallback value");
return fallback;
}
if (self.clientStarted) {
BOOL flagExists = [self.ldUser doesFlagExist: featureKey];
NSObject *flagValue = [self.ldUser flagValue: featureKey];
NSString *returnValue = fallback;
if ([flagValue isKindOfClass:[NSString class]] && flagExists) {
returnValue = (NSString *)flagValue;
}

[[LDDataManager sharedManager] createFeatureEvent: featureKey keyValue:returnValue defaultKeyValue:fallback user:self.ldUser config:self.ldConfig];
return returnValue;
} else {
if (!self.clientStarted) {
DEBUG_LOGX(@"LDClient not started yet!");
return fallback;
}
return fallback;

LDFlagConfigValue *flagConfigValue = [self.ldUser.flagConfig flagConfigValueForFlagKey:flagKey];
NSString *returnValue = flagConfigValue.value && [flagConfigValue.value isKindOfClass:[NSString class]] ? flagConfigValue.value : fallback;

[[LDDataManager sharedManager] createFlagEvaluationEventsWithFlagKey:flagKey
reportedFlagValue:returnValue
flagConfigValue:flagConfigValue
defaultFlagValue:fallback
user:self.ldUser
config:self.ldConfig];
return returnValue;
}

- (NSArray*)arrayVariation:(NSString *)featureKey fallback:(NSArray*)fallback{
DEBUG_LOG(@"LDClient arrayVariation method called for feature=%@ and fallback=%@", featureKey, fallback);
if (![featureKey isKindOfClass:[NSString class]]) {
NSLog(@"featureKey should be an NSString. Returning fallback value");
- (NSArray*)arrayVariation:(NSString *)flagKey fallback:(NSArray*)fallback{
DEBUG_LOG(@"LDClient arrayVariation method called for flagKey=%@ and fallback=%@", flagKey, fallback);
if (![flagKey isKindOfClass:[NSString class]]) {
NSLog(@"flagKey should be an NSString. Returning fallback value");
return fallback;
}
if (!self.clientStarted) {
DEBUG_LOGX(@"LDClient not started yet!");
return fallback;
}
BOOL flagExists = [self.ldUser doesFlagExist: featureKey];
id flagValue = [self.ldUser flagValue: featureKey];
NSArray *returnValue = fallback;
if (flagExists && [flagValue isKindOfClass:[NSArray class]]) {
returnValue = (NSArray *)flagValue;
}

[[LDDataManager sharedManager] createFeatureEvent: featureKey keyValue:returnValue defaultKeyValue:fallback user:self.ldUser config:self.ldConfig];

LDFlagConfigValue *flagConfigValue = [self.ldUser.flagConfig flagConfigValueForFlagKey:flagKey];
NSArray *returnValue = flagConfigValue.value && [flagConfigValue.value isKindOfClass:[NSArray class]] ? flagConfigValue.value : fallback;

[[LDDataManager sharedManager] createFlagEvaluationEventsWithFlagKey:flagKey
reportedFlagValue:returnValue
flagConfigValue:flagConfigValue
defaultFlagValue:fallback
user:self.ldUser
config:self.ldConfig];
return returnValue;
}

- (NSDictionary*)dictionaryVariation:(NSString *)featureKey fallback:(NSDictionary*)fallback{
DEBUG_LOG(@"LDClient dictionaryVariation method called for feature=%@ and fallback=%@", featureKey, fallback);
if (![featureKey isKindOfClass:[NSString class]]) {
NSLog(@"featureKey should be an NSString. Returning fallback value");
- (NSDictionary*)dictionaryVariation:(NSString *)flagKey fallback:(NSDictionary*)fallback{
DEBUG_LOG(@"LDClient dictionaryVariation method called for flagKey=%@ and fallback=%@", flagKey, fallback);
if (![flagKey isKindOfClass:[NSString class]]) {
NSLog(@"flagKey should be an NSString. Returning fallback value");
return fallback;
}
if (!self.clientStarted) {
DEBUG_LOGX(@"LDClient not started yet!");
return fallback;
}
BOOL flagExists = [self.ldUser doesFlagExist: featureKey];
id flagValue = [self.ldUser flagValue: featureKey];
NSDictionary *returnValue = fallback;
if (flagExists && [flagValue isKindOfClass:[NSDictionary class]]) {
returnValue = (NSDictionary *)flagValue;
}

[[LDDataManager sharedManager] createFeatureEvent: featureKey keyValue:returnValue defaultKeyValue:fallback user:self.ldUser config:self.ldConfig];

LDFlagConfigValue *flagConfigValue = [self.ldUser.flagConfig flagConfigValueForFlagKey:flagKey];
NSDictionary *returnValue = flagConfigValue.value && [flagConfigValue.value isKindOfClass:[NSDictionary class]] ? flagConfigValue.value : fallback;

[[LDDataManager sharedManager] createFlagEvaluationEventsWithFlagKey:flagKey
reportedFlagValue:returnValue
flagConfigValue:flagConfigValue
defaultFlagValue:fallback
user:self.ldUser
config:self.ldConfig];
return returnValue;
}

- (BOOL)track:(NSString *)eventName data:(NSDictionary *)dataDictionary
{
DEBUG_LOG(@"LDClient track method called for event=%@ and data=%@", eventName, dataDictionary);
if (self.clientStarted) {
[[LDDataManager sharedManager] createCustomEvent:eventName withCustomValuesDictionary: dataDictionary user:self.ldUser config:self.ldConfig];
[[LDDataManager sharedManager] createCustomEventWithKey:eventName customData: dataDictionary user:self.ldUser config:self.ldConfig];
return YES;
} else {
DEBUG_LOGX(@"LDClient not started yet!");
Expand Down
2 changes: 1 addition & 1 deletion Darkly/LDClientManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

- (void)syncWithServerForEvents;
- (void)syncWithServerForConfig;
- (void)processedEvents:(BOOL)success jsonEventArray:(NSArray *)jsonEventArray;
- (void)processedEvents:(BOOL)success jsonEventArray:(NSArray*)jsonEventArray responseDate:(NSDate*)responseDate;
- (void)processedConfig:(BOOL)success jsonConfigDictionary:(NSDictionary *)jsonConfigDictionary;
- (void)startPolling;
- (void)stopPolling;
Expand Down
Loading