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

Propagate the SDK version to ios-eventsource as User-Agent #100

Merged
merged 37 commits into from
Jun 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
bf8bcde
Merge pull request #6 from launchdarkly/arun/clientstream
arun251 Apr 17, 2017
b1ad507
Carthage + watchOS + tvOS + macOS Support
danialzahid94 Apr 19, 2017
ac6f361
Update Version (#9)
danialzahid94 Apr 25, 2017
fdabf28
Remove Race Conditions (#10)
danialzahid94 Apr 25, 2017
026d4b1
Merge branch 'master'
arun251 Apr 25, 2017
9ae14fe
Fix wait time of semaphore to block for as long as needed
danialzahid94 May 5, 2017
d2122bb
Merge pull request #13 from launchdarkly/dz/fixSemaphore
danialzahid94 May 12, 2017
4d99408
Optimize user storage
danialzahid94 May 15, 2017
6c5e78b
Remove polling data race
danialzahid94 May 15, 2017
9ee254a
Fix for test cases
danialzahid94 May 15, 2017
95ce76c
Fix device and os storage
danialzahid94 May 16, 2017
6ed8ab7
Remove warning genrating methods
danialzahid94 May 16, 2017
b6d6fe5
Add backwards compatibility for earlier users
danialzahid94 May 16, 2017
af5c9f2
[CH3478] Use the configured connection timeout
arun251 May 18, 2017
618fe9f
Optimize purgeUsers and add tests
danialzahid94 May 18, 2017
001daef
Merge pull request #16 from launchdarkly/arun/ch3478/use-connection-t…
arun251 May 18, 2017
b5325f9
Merge branch 'master'
arun251 May 18, 2017
d82b4b9
Merge branch 'master'
arun251 May 19, 2017
a91273b
Merge pull request #14 from launchdarkly/dz/optimizePersistence
arun251 May 19, 2017
d79c93b
Merge branch 'master'
arun251 May 19, 2017
92eaaa1
Remove nil values from dictionary before saving
danialzahid94 May 25, 2017
2b26dfb
Add test cases for dictionary validation
danialzahid94 May 25, 2017
88a5e61
Merge pull request #19 from launchdarkly/dz/fixFlagStorage
arun251 May 25, 2017
19f26ef
Merge branch 'master'
arun251 May 26, 2017
f106241
Add configurable background fetch interval
danialzahid94 Jun 1, 2017
35abb9f
Fix eventsArray crash due to multi thread manipulation
danialzahid94 Jun 9, 2017
7b4a73c
Fix test cases
danialzahid94 Jun 9, 2017
52c3671
Merge pull request #20 from launchdarkly/dz/backgroundFetchLimit
arun251 Jun 9, 2017
9bbf17f
Merge pull request #21 from launchdarkly/dz/eventMultiThreading
arun251 Jun 9, 2017
8e6c23a
Merge branch 'master'
arun251 Jun 14, 2017
6b70a27
Pass user agent to event source headers
danialzahid94 Jun 16, 2017
918dcd7
Point EventSource to open PR for testing
danialzahid94 Jun 16, 2017
29946b6
Update version to 2.4.2
danialzahid94 Jun 20, 2017
e5a686d
Merge pull request #25 from launchdarkly/dz/eventSourceHeaders
arun251 Jun 20, 2017
3915d85
Update to DarklyEventSource 2.0.0
arun251 Jun 20, 2017
5888d18
Merge branch 'master'
arun251 Jun 20, 2017
c12119d
rm Pods/Local Podspecs/
arun251 Jun 20, 2017
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
10 changes: 5 additions & 5 deletions Darkly.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
3C6B373432EFD282378462BE /* [CP] Copy Pods Resources */ = {
Expand Down Expand Up @@ -760,7 +760,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
5C4803774368D95181AF24C4 /* [CP] Check Pods Manifest.lock */ = {
Expand All @@ -775,7 +775,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
5D2C539BFFB0DE3649453E89 /* [CP] Copy Pods Resources */ = {
Expand Down Expand Up @@ -835,7 +835,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
BF156E0BAB52CCB17B6F9FDC /* [CP] Check Pods Manifest.lock */ = {
Expand All @@ -850,7 +850,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down
2 changes: 1 addition & 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.4.1";
NSString * const kClientVersion = @"2.4.2";
NSString * const kBaseUrl = @"https://app.launchdarkly.com";
NSString * const kEventsUrl = @"https://mobile.launchdarkly.com";
NSString * const kStreamUrl = @"https://clientstream.launchdarkly.com/mping";
Expand Down
15 changes: 13 additions & 2 deletions Darkly/LDClientManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ - (void)startPolling {
[pollingMgr startEventPolling];

if ([config streaming]) {
eventSource = [EventSource eventSourceWithURL:[NSURL URLWithString:kStreamUrl] mobileKey:config.mobileKey timeoutInterval:[config.connectionTimeout doubleValue]];

eventSource = [EventSource eventSourceWithURL:[NSURL URLWithString:kStreamUrl] httpHeaders:[self httpHeadersForEventSource] timeoutInterval:[config.connectionTimeout doubleValue]];

[eventSource onMessage:^(Event *e) {
[self syncWithServerForConfig];
Expand Down Expand Up @@ -106,7 +107,7 @@ - (void)willEnterForeground {
LDClient *client = [LDClient sharedInstance];

if ([[client ldConfig] streaming]) {
eventSource = [EventSource eventSourceWithURL:[NSURL URLWithString:kStreamUrl] mobileKey:client.ldConfig.mobileKey];
eventSource = [EventSource eventSourceWithURL:[NSURL URLWithString:kStreamUrl] httpHeaders:[self httpHeadersForEventSource]];

[eventSource onMessage:^(Event *e) {
[self syncWithServerForConfig];
Expand Down Expand Up @@ -200,5 +201,15 @@ - (void)processedConfig:(BOOL)success jsonConfigDictionary:(NSDictionary *)jsonC
DEBUG_LOGX(@"ClientManager processedConfig method called after receiving failure response from server");
}
}

- (NSDictionary *)httpHeadersForEventSource {
NSMutableDictionary *headers = [[NSMutableDictionary alloc] init];

NSString *authKey = [kHeaderMobileKey stringByAppendingString:[[[LDClient sharedInstance] ldConfig] mobileKey]];

[headers setObject:authKey forKey:@"Authorization"];
[headers setObject:[@"iOS/" stringByAppendingString:kClientVersion] forKey:@"User-Agent"];
return headers;
}

@end
1 change: 1 addition & 0 deletions Darkly/LDRequestManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

}

extern NSString * const kHeaderMobileKey;
@property (nonatomic) NSString* mobileKey;
@property (nonatomic) NSString* baseUrl;
@property (nonatomic) NSString* eventsUrl;
Expand Down
2 changes: 1 addition & 1 deletion Darkly/LDRequestManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

static NSString * const kFeatureFlagUrl = @"/msdk/eval/users/";
static NSString * const kEventUrl = @"/mobile/events/bulk";
static NSString * const kHeaderMobileKey = @"api_key ";
NSString * const kHeaderMobileKey = @"api_key ";
static NSString * const kConfigRequestCompletedNotification = @"config_request_completed_notification";
static NSString * const kEventRequestCompletedNotification = @"event_request_completed_notification";

Expand Down
6 changes: 3 additions & 3 deletions LaunchDarkly.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "LaunchDarkly"
s.version = "2.4.1"
s.version = "2.4.2"
s.summary = "iOS SDK for LaunchDarkly"

s.description = <<-DESC
Expand All @@ -23,13 +23,13 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = "9.0"
s.osx.deployment_target = '10.10'

s.source = { :git => "https://github.com/launchdarkly/ios-client.git", :tag => "2.4.1" }
s.source = { :git => "https://github.com/launchdarkly/ios-client.git", :tag => "2.4.2" }

s.source_files = "Darkly/*.{h,m}"

s.requires_arc = true

s.subspec 'Core' do |ss|
ss.dependency 'DarklyEventSource', '~> 1.3.2'
ss.dependency 'DarklyEventSource', '~> 2.0.0'
end
end
8 changes: 4 additions & 4 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
target 'Darkly_iOS' do
platform :ios, '8.0'
pod 'DarklyEventSource', '~> 1.3.2'
pod 'DarklyEventSource', '~> 2.0.0'
end

target 'Darkly_tvOS' do
platform :tvos, '9.0'
pod 'DarklyEventSource', '~> 1.3.2'
pod 'DarklyEventSource', '~> 2.0.0'
end

target 'Darkly_watchOS' do
platform :watchos, '2.0'
pod 'DarklyEventSource', '~> 1.3.2'
pod 'DarklyEventSource', '~> 2.0.0'
end

target 'Darkly_osx' do
platform :osx, '10.10'
pod 'DarklyEventSource', '~> 1.3.2'
pod 'DarklyEventSource', '~> 2.0.0'
end

target 'DarklyTests' do
Expand Down
8 changes: 4 additions & 4 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- DarklyEventSource (1.3.2)
- DarklyEventSource (2.0.0)
- OCMock (3.4)
- OHHTTPStubs (4.8.0):
- OHHTTPStubs/Default (= 4.8.0)
Expand All @@ -16,15 +16,15 @@ PODS:
- OHHTTPStubs/OHPathHelpers (4.8.0)

DEPENDENCIES:
- DarklyEventSource (~> 1.3.2)
- DarklyEventSource (~> 2.0.0)
- OCMock (~> 3.1)
- OHHTTPStubs (~> 4.2)

SPEC CHECKSUMS:
DarklyEventSource: 3e7d841a21c024be53ce4ea6b2c38883ff5abacd
DarklyEventSource: 710930f8f17e75abaf4d6c38a31a71718cc151e5
OCMock: 35ae71d6a8fcc1b59434d561d1520b9dd4f15765
OHHTTPStubs: b393565822317305b87a1440d4c7aff131679f66

PODFILE CHECKSUM: 78938681ef11778def1ee4bdd045f33cae8cae9e
PODFILE CHECKSUM: d836ea6c9bef753ac2087843fcd31ef94b56e250

COCOAPODS: 1.2.1
16 changes: 8 additions & 8 deletions Pods/DarklyEventSource/EventSource/EventSource.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 14 additions & 10 deletions Pods/DarklyEventSource/EventSource/EventSource.m

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Pods/DarklyEventSource/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 0 additions & 38 deletions Pods/Local Podspecs/DarklyEventSource.podspec.json

This file was deleted.

8 changes: 4 additions & 4 deletions Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading