Skip to content

Commit ba7e7e4

Browse files
committed
Merge branch 'master' into vnext_minor
2 parents d278d9a + 6d3158e commit ba7e7e4

File tree

15 files changed

+175
-53
lines changed

15 files changed

+175
-53
lines changed

.travis.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ xcode_scheme:
99
- KeenClientFramework
1010
xcode_sdk: iphonesimulator10.3
1111
env:
12-
- XCODEBUILD_PLATFORM='iOS Simulator' XCODEBUILD_SIM_OS=10.3 XCODEBUILD_DEVICE='iPhone 6' XCODEBUILD_ACTION=build
12+
- XCODEBUILD_PLATFORM='iOS Simulator' XCODEBUILD_SIM_OS=10.3.1 XCODEBUILD_DEVICE='iPhone 6' XCODEBUILD_ACTION=build
1313

1414
matrix:
1515
include:
1616
- xcode_scheme: KeenClient
1717
xcode_sdk: iphonesimulator10.3
1818
env:
19-
- XCODEBUILD_PLATFORM='iOS Simulator' XCODEBUILD_SIM_OS=10.3 XCODEBUILD_DEVICE='iPhone 6' XCODEBUILD_ACTION=test
19+
- XCODEBUILD_PLATFORM='iOS Simulator' XCODEBUILD_SIM_OS=10.3.1 XCODEBUILD_DEVICE='iPhone 6' XCODEBUILD_ACTION=test
2020
- xcode_scheme: KeenClient
2121
xcode_sdk: iphonesimulator10.3
2222
env:
@@ -31,20 +31,20 @@ matrix:
3131
- XCODEBUILD_PLATFORM='OS X' XCODEBUILD_ACTION=build
3232
- xcode_scheme: KeenClientExampleObjCCocoaPods
3333
xcode_sdk: iphonesimulator10.3
34-
env: POD_INSTALL=true XCODEBUILD_WORKSPACE=Examples/objc/cocoapods/KeenClientExampleObjCCocoaPods.xcworkspace XCODEBUILD_PLATFORM='iOS Simulator' XCODEBUILD_SIM_OS=10.3 XCODEBUILD_DEVICE='iPhone 6' XCODEBUILD_ACTION=build
34+
env: POD_INSTALL=true XCODEBUILD_WORKSPACE=Examples/objc/cocoapods/KeenClientExampleObjCCocoaPods.xcworkspace XCODEBUILD_PLATFORM='iOS Simulator' XCODEBUILD_SIM_OS=10.3.1 XCODEBUILD_DEVICE='iPhone 6' XCODEBUILD_ACTION=build
3535
- xcode_scheme: KeenClientExampleObjCCarthage
3636
xcode_sdk: iphonesimulator10.3
37-
env: CARTHAGE_INSTALL=true XCODEBUILD_PROJECT=Examples/objc/carthage/KeenClientExampleObjCCarthage.xcodeproj XCODEBUILD_PROJECT_TARGET=KeenClientExampleObjCCarthage XCODEBUILD_PLATFORM='iOS Simulator' XCODEBUILD_SIM_OS=10.3 XCODEBUILD_DEVICE='iPhone 6' XCODEBUILD_ACTION=build
37+
env: CARTHAGE_INSTALL=true XCODEBUILD_PROJECT=Examples/objc/carthage/KeenClientExampleObjCCarthage.xcodeproj XCODEBUILD_PROJECT_TARGET=KeenClientExampleObjCCarthage XCODEBUILD_PLATFORM='iOS Simulator' XCODEBUILD_SIM_OS=10.3.1 XCODEBUILD_DEVICE='iPhone 6' XCODEBUILD_ACTION=build
3838
- xcode_scheme: KeenClientExampleSwiftCocoaPods
3939
xcode_sdk: iphonesimulator10.3
40-
env: POD_INSTALL=true XCODEBUILD_WORKSPACE=Examples/swift/cocoapods/KeenClientExampleSwiftCocoaPods.xcworkspace XCODEBUILD_PLATFORM='iOS Simulator' XCODEBUILD_SIM_OS=10.3 XCODEBUILD_DEVICE='iPhone 6' XCODEBUILD_ACTION=build
40+
env: POD_INSTALL=true XCODEBUILD_WORKSPACE=Examples/swift/cocoapods/KeenClientExampleSwiftCocoaPods.xcworkspace XCODEBUILD_PLATFORM='iOS Simulator' XCODEBUILD_SIM_OS=10.3.1 XCODEBUILD_DEVICE='iPhone 6' XCODEBUILD_ACTION=build
4141
- xcode_scheme: KeenClientExampleSwiftCarthage
4242
xcode_sdk: iphonesimulator10.3
43-
env: CARTHAGE_INSTALL=true XCODEBUILD_PROJECT=Examples/swift/carthage/KeenClientExampleSwiftCarthage.xcodeproj XCODEBUILD_PROJECT_TARGET=KeenClientExampleSwiftCarthage XCODEBUILD_PLATFORM='iOS Simulator' XCODEBUILD_SIM_OS=10.3 XCODEBUILD_DEVICE='iPhone 6' XCODEBUILD_ACTION=build
43+
env: CARTHAGE_INSTALL=true XCODEBUILD_PROJECT=Examples/swift/carthage/KeenClientExampleSwiftCarthage.xcodeproj XCODEBUILD_PROJECT_TARGET=KeenClientExampleSwiftCarthage XCODEBUILD_PLATFORM='iOS Simulator' XCODEBUILD_SIM_OS=10.3.1 XCODEBUILD_DEVICE='iPhone 6' XCODEBUILD_ACTION=build
4444

4545
before_install:
4646
- gem install bundler
47-
- rvm use 2.3.0
47+
- rvm use 2.4.1
4848

4949
script: ./bin/test.sh
5050

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

55

6+
## [3.6.2] - 2017-06-08
7+
### Fixed
8+
- Fixed issue where calling `uploadWithFinishedBlock:` quickly in succession could cause duplicate event uploads.
9+
610
## [3.6.1] - 2017-05-12
711
### Fixed
812
- Fixed missing headers from framework build

Examples/objc/carthage/Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
git "keenlabs/KeenClient-iOS"
1+
github "keenlabs/KeenClient-iOS"

Examples/swift/carthage/Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
git "keenlabs/KeenClient-iOS"
1+
github "keenlabs/KeenClient-iOS"

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
source 'https://rubygems.org'
2-
ruby '2.3.0'
2+
ruby '2.4.1'
33

44
gem 'slather'
55
gem 'xcpretty'

KeenClient.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'KeenClient'
3-
spec.version = '3.6.1'
3+
spec.version = '3.6.2'
44
spec.license = { :type => 'MIT' }
55
spec.ios.deployment_target = '6.0'
66
spec.osx.deployment_target = '10.9'

KeenClient.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
480FEB751E846F7500641112 /* KIOUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 480FEB701E846F7500641112 /* KIOUtil.m */; };
7676
480FEB761E846F7500641112 /* KIOUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 480FEB701E846F7500641112 /* KIOUtil.m */; };
7777
481496EC1EC3832C00A9DEED /* SavedQueryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 481496EB1EC3832C00A9DEED /* SavedQueryTests.m */; };
78+
481794741EE8F66500586007 /* MockNSURLSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 481794731EE8F66500586007 /* MockNSURLSession.m */; };
7879
481A9B7C1E5690950094B985 /* KeenLogSinkNSLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 481A9B7A1E5690950094B985 /* KeenLogSinkNSLog.h */; };
7980
481A9B7D1E5690950094B985 /* KeenLogSinkNSLog.m in Sources */ = {isa = PBXBuildFile; fileRef = 481A9B7B1E5690950094B985 /* KeenLogSinkNSLog.m */; };
8081
481A9B7E1E5691270094B985 /* KeenLogSink.h in Headers */ = {isa = PBXBuildFile; fileRef = 481A9B711E5687EA0094B985 /* KeenLogSink.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -206,6 +207,8 @@
206207
480FEB701E846F7500641112 /* KIOUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KIOUtil.m; sourceTree = "<group>"; };
207208
481496EA1EC3832C00A9DEED /* SavedQueryTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SavedQueryTests.h; sourceTree = "<group>"; };
208209
481496EB1EC3832C00A9DEED /* SavedQueryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SavedQueryTests.m; sourceTree = "<group>"; };
210+
481794721EE8F66500586007 /* MockNSURLSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockNSURLSession.h; sourceTree = "<group>"; };
211+
481794731EE8F66500586007 /* MockNSURLSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MockNSURLSession.m; sourceTree = "<group>"; };
209212
481A9B711E5687EA0094B985 /* KeenLogSink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeenLogSink.h; sourceTree = "<group>"; };
210213
481A9B7A1E5690950094B985 /* KeenLogSinkNSLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeenLogSinkNSLog.h; sourceTree = "<group>"; };
211214
481A9B7B1E5690950094B985 /* KeenLogSinkNSLog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KeenLogSinkNSLog.m; sourceTree = "<group>"; };
@@ -468,6 +471,8 @@
468471
486B59711EB29C5200D5251D /* KIOUploaderTestable.h */,
469472
4888924B1EC13C21008C6024 /* TestDatabaseRequirement.h */,
470473
4888924C1EC13C21008C6024 /* TestDatabaseRequirement.m */,
474+
481794721EE8F66500586007 /* MockNSURLSession.h */,
475+
481794731EE8F66500586007 /* MockNSURLSession.m */,
471476
);
472477
name = Shared;
473478
sourceTree = "<group>";
@@ -783,6 +788,7 @@
783788
isa = PBXSourcesBuildPhase;
784789
buildActionMask = 2147483647;
785790
files = (
791+
481794741EE8F66500586007 /* MockNSURLSession.m in Sources */,
786792
CA6410E218E39F3A00E53E3C /* KIODBStoreTests.m in Sources */,
787793
486B596E1EB29B0A00D5251D /* KeenTestCaseBase.m in Sources */,
788794
48CAA1781ED60792003C2008 /* DatasetTests.m in Sources */,

KeenClient/KIOUploader.m

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ - (void)handleEventAPIResponse:(NSURLResponse *)response
4040

4141
@property (nonatomic) KIONetwork *network;
4242

43+
@property BOOL isUploading;
44+
45+
@property NSCondition *isUploadingCondition;
46+
4347
@end
4448

4549
@implementation KIOUploader
@@ -71,6 +75,9 @@ - (instancetype)initWithNetwork:(KIONetwork *)network andStore:(KIODBStore *)sto
7175

7276
self.maxEventUploadAttempts = 3;
7377

78+
self.isUploadingCondition = [NSCondition new];
79+
self.isUploading = NO;
80+
7481
self.network = network;
7582

7683
self.store = store;
@@ -170,6 +177,10 @@ - (void)uploadEventsForConfig:(KeenClientConfig *)config completionHandler:(void
170177
}
171178
}
172179

180+
[self.isUploadingCondition lock];
181+
self.isUploading = YES;
182+
[self.isUploadingCondition unlock];
183+
173184
// then make an http request to the keen server.
174185
[self.network sendEvents:data
175186
config:config
@@ -178,7 +189,20 @@ - (void)uploadEventsForConfig:(KeenClientConfig *)config completionHandler:(void
178189
[self handleEventAPIResponse:response andData:data forEvents:eventIDs];
179190

180191
[self runUploadFinishedBlock:completionHandler];
192+
193+
[self.isUploadingCondition lock];
194+
self.isUploading = NO;
195+
[self.isUploadingCondition signal];
196+
[self.isUploadingCondition unlock];
181197
}];
198+
199+
// Block the queue until uploading has finished.
200+
// Otherwise we'll pick up events that are in flight and try to upload them again
201+
[self.isUploadingCondition lock];
202+
while (self.isUploading) {
203+
[self.isUploadingCondition waitUntilDate:[NSDate dateWithTimeIntervalSinceNow:60]];
204+
}
205+
[self.isUploadingCondition unlock];
182206
}
183207
});
184208
}

KeenClient/KeenConstants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#import <Foundation/Foundation.h>
1010

11-
#define kKeenSdkVersion @"3.6.1"
11+
#define kKeenSdkVersion @"3.6.2"
1212

1313
extern NSString * const kKeenServerAddress;
1414
extern NSString * const kKeenApiVersion;

KeenClientFramework/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>3.6.1</string>
18+
<string>3.6.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>3.6.1</string>
22+
<string>3.6.2</string>
2323
<key>NSPrincipalClass</key>
2424
<string></string>
2525
</dict>

0 commit comments

Comments
 (0)