Skip to content

Commit

Permalink
Update xcodeproj to recommended settings and fix warnings from XCode …
Browse files Browse the repository at this point in the history
…10 build system (#71)

* Update xcodeproj to recommended settings and fix warnings from XCode 10 build system

* Update xcodeproj to recommended settings and fix warnings from XCode 10 build system

* Refactor setting network service type in AWSSRWebSocket

* Check if iOS 10/12 is available for the new request network service types

* Remove responsive data request network service type handler

* Add changelog for 2.6.22
  • Loading branch information
Karthikeyan authored and rohandubal committed Sep 21, 2018
1 parent a7b73c1 commit f7abd42
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 37 deletions.
12 changes: 7 additions & 5 deletions AWSAppSyncClient.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
17D2C2071F6F44A3006C6818 /* AWSOfflineMutationStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17D2C2061F6F44A3006C6818 /* AWSOfflineMutationStore.swift */; };
17E009BB1FCAB234005031DB /* GraphQLDependencyTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E009991FCAB230005031DB /* GraphQLDependencyTracker.swift */; };
17E009BC1FCAB234005031DB /* AWSGraphQLSubscriptionResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E0099A1FCAB230005031DB /* AWSGraphQLSubscriptionResponse.swift */; };
17E009BD1FCAB234005031DB /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 17E0099B1FCAB230005031DB /* Info.plist */; };
17E009BE1FCAB234005031DB /* JSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E0099C1FCAB230005031DB /* JSON.swift */; };
17E009BF1FCAB234005031DB /* DataLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E0099D1FCAB230005031DB /* DataLoader.swift */; };
17E009C01FCAB234005031DB /* InMemoryNormalizedCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E0099E1FCAB230005031DB /* InMemoryNormalizedCache.swift */; };
Expand Down Expand Up @@ -515,7 +514,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 0920;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Dubal, Rohan";
TargetAttributes = {
174F80AB2109229C00775D0D = {
Expand Down Expand Up @@ -577,7 +576,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
17E009BD1FCAB234005031DB /* Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -590,7 +588,7 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-AWSAppSync-AWSAppSyncTests/Pods-AWSAppSync-AWSAppSyncTests-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-AWSAppSync-AWSAppSyncTests/Pods-AWSAppSync-AWSAppSyncTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/AWSCore/AWSCore.framework",
"${BUILT_PRODUCTS_DIR}/ReachabilitySwift/Reachability.framework",
"${BUILT_PRODUCTS_DIR}/SQLite.swift/SQLite.framework",
Expand All @@ -603,7 +601,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AWSAppSync-AWSAppSyncTests/Pods-AWSAppSync-AWSAppSyncTests-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AWSAppSync-AWSAppSyncTests/Pods-AWSAppSync-AWSAppSyncTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
37A9334DB9AF4C4235F5D117 /* [CP] Check Pods Manifest.lock */ = {
Expand Down Expand Up @@ -854,13 +852,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -913,13 +913,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion AWSAppSyncClient/MQTTSDK/AWSIoTMQTTClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ - (void)initiateReconnectTimer: (id) sender
//Set the timeout to 1800 seconds, which is 1.5x of the max keep-alive 1200 seconds.
//The unit of measure for the dispatch_time function is nano seconds.

dispatch_semaphore_wait(_timerSemaphore, dispatch_time(DISPATCH_TIME_NOW, 1800 *1000*1000*1000));
dispatch_semaphore_wait(_timerSemaphore, dispatch_time(DISPATCH_TIME_NOW, 1800 * NSEC_PER_SEC));
if (! self.reconnectTimer && self.mqttStatus != AWSIoTMQTTStatusConnected ) {
self.reconnectTimer =[NSTimer timerWithTimeInterval:self.currentReconnectTime target:self selector: @selector(reconnectToSession) userInfo:nil repeats:NO];
[[NSRunLoop currentRunLoop] addTimer:self.reconnectTimer forMode:NSRunLoopCommonModes];
Expand Down
54 changes: 27 additions & 27 deletions AWSAppSyncClient/MQTTSDK/SocketRocket/AWSSRWebSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,10 @@ - (void)_readHTTPHeader;
}

[self _readUntilHeaderCompleteWithCallback:^(AWSSRWebSocket *self, NSData *data) {
CFHTTPMessageAppendBytes(_receivedHTTPHeaders, (const UInt8 *)data.bytes, data.length);
CFHTTPMessageAppendBytes(self->_receivedHTTPHeaders, (const UInt8 *)data.bytes, data.length);

if (CFHTTPMessageIsHeaderComplete(_receivedHTTPHeaders)) {
SRFastLog(@"Finished reading headers %@", CFBridgingRelease(CFHTTPMessageCopyAllHeaderFields(_receivedHTTPHeaders)));
if (CFHTTPMessageIsHeaderComplete(self->_receivedHTTPHeaders)) {
SRFastLog(@"Finished reading headers %@", CFBridgingRelease(CFHTTPMessageCopyAllHeaderFields(self->_receivedHTTPHeaders)));
[self _HTTPHeadersDidFinish];
} else {
[self _readHTTPHeader];
Expand Down Expand Up @@ -757,7 +757,7 @@ - (void)_closeWithProtocolError:(NSString *)message;
// Need to shunt this on the _callbackQueue first to see if they received any messages
[self _performDelegateBlock:^{
[self closeWithCode:AWSSRStatusCodeProtocolError reason:message];
dispatch_async(_workQueue, ^{
dispatch_async(self->_workQueue, ^{
[self closeConnection];
});
}];
Expand All @@ -767,15 +767,15 @@ - (void)_failWithError:(NSError *)error;
{
dispatch_async(_workQueue, ^{
if (self.readyState != AWSSR_CLOSED) {
_failed = YES;
self->_failed = YES;
[self _performDelegateBlock:^{
if ([self.delegate respondsToSelector:@selector(webSocket:didFailWithError:)]) {
[self.delegate webSocket:self didFailWithError:error];
}
}];

self.readyState = AWSSR_CLOSED;
_selfRetain = nil;
self->_selfRetain = nil;

SRFastLog(@"Failing with error %@", error.localizedDescription);

Expand Down Expand Up @@ -827,7 +827,7 @@ - (void)handlePing:(NSData *)pingData;
{
// Need to pingpong this off _callbackQueue first to make sure messages happen in order
[self _performDelegateBlock:^{
dispatch_async(_workQueue, ^{
dispatch_async(self->_workQueue, ^{
[self _sendFrameWithOpcode:SROpCodePong data:pingData];
});
}];
Expand Down Expand Up @@ -1106,7 +1106,7 @@ - (void)_readFrameContinue;
[self _closeWithProtocolError:@"Client must receive unmasked data"];
}

size_t extra_bytes_needed = header.masked ? sizeof(_currentReadMaskKey) : 0;
size_t extra_bytes_needed = header.masked ? sizeof(self->_currentReadMaskKey) : 0;

if (header.payload_length == 126) {
extra_bytes_needed += sizeof(uint16_t);
Expand Down Expand Up @@ -1137,7 +1137,7 @@ - (void)_readFrameContinue;
}

if (header.masked) {
assert(mapped_size >= sizeof(_currentReadMaskOffset) + offset);
assert(mapped_size >= sizeof(self->_currentReadMaskOffset) + offset);
memcpy(self->_currentReadMaskKey, ((uint8_t *)mapped_buffer) + offset, sizeof(self->_currentReadMaskKey));
}

Expand All @@ -1150,12 +1150,12 @@ - (void)_readFrameContinue;
- (void)_readFrameNew;
{
dispatch_async(_workQueue, ^{
[_currentFrameData setLength:0];
[self->_currentFrameData setLength:0];

_currentFrameOpcode = 0;
_currentFrameCount = 0;
_readOpCount = 0;
_currentStringScanPosition = 0;
self->_currentFrameOpcode = 0;
self->_currentFrameCount = 0;
self->_readOpCount = 0;
self->_currentStringScanPosition = 0;

[self _readFrameContinue];
});
Expand Down Expand Up @@ -1199,7 +1199,7 @@ - (void)_pumpWriting;
if (!_failed) {
[self _performDelegateBlock:^{
if ([self.delegate respondsToSelector:@selector(webSocket:didCloseWithCode:reason:wasClean:)]) {
[self.delegate webSocket:self didCloseWithCode:_closeCode reason:_closeReason wasClean:YES];
[self.delegate webSocket:self didCloseWithCode:self->_closeCode reason:self->_closeReason wasClean:YES];
}
}];
}
Expand Down Expand Up @@ -1520,14 +1520,14 @@ - (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode;
if (self.readyState >= AWSSR_CLOSING) {
return;
}
assert(_readBuffer);
assert(self->_readBuffer);
//
// It looks as though the original implementation requires certificate pinning when connecting
// securely; this has been disabled here but the original test is left commented out for
// reference.
//
// if (!_secure && self.readyState == AWSSR_CONNECTING && aStream == _inputStream) {
if (self.readyState == AWSSR_CONNECTING && aStream == _inputStream) {
if (self.readyState == AWSSR_CONNECTING && aStream == self->_inputStream) {

[self didConnect];
}
Expand All @@ -1540,8 +1540,8 @@ - (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode;
SRFastLog(@"NSStreamEventErrorOccurred %@ %@", aStream, [[aStream streamError] copy]);
/// TODO specify error better!
[self _failWithError:aStream.streamError];
_readBufferOffset = 0;
[_readBuffer setLength:0];
self->_readBufferOffset = 0;
[self->_readBuffer setLength:0];
break;

}
Expand All @@ -1552,14 +1552,14 @@ - (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode;
if (aStream.streamError) {
[self _failWithError:aStream.streamError];
} else {
dispatch_async(_workQueue, ^{
dispatch_async(self->_workQueue, ^{
if (self.readyState != AWSSR_CLOSED) {
self.readyState = AWSSR_CLOSED;
_selfRetain = nil;
self->_selfRetain = nil;
}

if (!_sentClose && !_failed) {
_sentClose = YES;
if (!self->_sentClose && !self->_failed) {
self->_sentClose = YES;
// If we get closed in this state it's probably not clean because we should be sending this when we send messages
[self _performDelegateBlock:^{
if ([self.delegate respondsToSelector:@selector(webSocket:didCloseWithCode:reason:wasClean:)]) {
Expand All @@ -1578,13 +1578,13 @@ - (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode;
const int bufferSize = 2048;
uint8_t buffer[bufferSize];

while (_inputStream.hasBytesAvailable) {
NSInteger bytes_read = [_inputStream read:buffer maxLength:bufferSize];
while (self->_inputStream.hasBytesAvailable) {
NSInteger bytes_read = [self->_inputStream read:buffer maxLength:bufferSize];

if (bytes_read > 0) {
[_readBuffer appendBytes:buffer length:bytes_read];
[self->_readBuffer appendBytes:buffer length:bytes_read];
} else if (bytes_read < 0) {
[self _failWithError:_inputStream.streamError];
[self _failWithError:self->_inputStream.streamError];
}

if (bytes_read != bufferSize) {
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The AWS AppSync SDK for iOS enables you to access your AWS AppSync backend and perform operations like `Queries`, `Mutations` and `Subscriptions`. The SDK also includes support for offline operations.

## 2.6.22

### Enhancements

* Fix warnings imposed by iOS 12. [See PR#71](https://github.com/awslabs/aws-mobile-appsync-sdk-ios/pull/71)

## 2.6.21

### Enhancements
Expand Down

0 comments on commit f7abd42

Please sign in to comment.