Skip to content

Commit

Permalink
The AWS Mobile SDK for iOS v2 Developer Preview 4.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yosuke Matsuda committed Jul 29, 2014
1 parent b92ec00 commit 091acaf
Show file tree
Hide file tree
Showing 45 changed files with 689 additions and 323 deletions.
2 changes: 1 addition & 1 deletion AWSCore/Authentication/AWSSignature.m
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ - (NSString *)signRequestV4:(NSURLRequest *)request{

NSString *dateStamp = [xAmzDate az_stringValue:AZDateShortDateFormat1];

NSString *path = [request.URL.path az_stringWithURLEncodingExceptSlash];
NSString *path = [request.URL.path az_stringWithURLEncodingPath];
if (path.length == 0) {
path = [NSString stringWithFormat:@"/"];
}
Expand Down
46 changes: 0 additions & 46 deletions AWSCore/MobileAnalytics/ThirdParty/gzip/AIDataGZIP.h

This file was deleted.

126 changes: 0 additions & 126 deletions AWSCore/MobileAnalytics/ThirdParty/gzip/AIDataGZIP.m

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#import "AZCategory.h"
#import "AWSMobileAnalyticsInstanceIdInterceptor.h"
#import "AWSMobileAnalyticsClientContextInterceptor.h"
#import "AIDataGZIP.h"
#import "GZIP.h"
#import "AWSMobileAnalyticsDefaultSessionClient.h"
#import "AZLogging.h"

Expand Down Expand Up @@ -102,7 +102,7 @@ -(void) addInterceptor: (id<AWSMobileAnalyticsInterceptor>) theInterceptor

//adapt the body
if ([theRequest postBody]) {
NSData *unzippedBody = [AIDataGZIP gunzippedData:[theRequest postBody]];
NSData *unzippedBody = [[theRequest postBody] gunzippedData];
NSArray *sourceEventsArray = [NSJSONSerialization JSONObjectWithData:unzippedBody options:kNilOptions error:NULL];
NSAssert([sourceEventsArray isKindOfClass:[NSArray class]] , @"invalid postBody: postBody should be an array");

Expand Down
2 changes: 1 addition & 1 deletion AWSCore/MobileAnalytics/core/io/AWSMobileAnalyticsWriter.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#import <objc/runtime.h>
#import <CommonCrypto/CommonCryptor.h>
#import <CommonCrypto/CommonDigest.h>
#import "AIDataGZIP.h"
#import "GZIP.h"
#import "AWSMobileAnalyticsBase64Utils.h"

@interface AWSMobileAnalyticsWriter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

#import "AWSMobileAnalyticsIOSPreferences.h"
#import "AIDataGZIP.h"
#import "GZIP.h"
#import "AZLogging.h"

NSString * const AIPreferencesFilename = @"preferences";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#import "AWSMobileAnalyticsERSRequestBuilder.h"
#import "AWSMobileAnalyticsConstants.h"
#import "AWSMobileAnalyticsConfigurationKeys.h"
#import "AIDataGZIP.h"
#import "GZIP.h"
#import "AWSMobileAnalyticsSerializable.h"
#import "AWSMobileAnalyticsSerializerFactory.h"

Expand Down Expand Up @@ -76,7 +76,7 @@ - (id)initWithConfiguration:(id<AWSMobileAnalyticsConfiguration>)configuration
NSData* jsonData = [self createBodyFromObjects:theObjects];

// compress the string and set the compressed header
NSData* compressedBody = [AIDataGZIP gzippedData:jsonData];
NSData* compressedBody = [jsonData gzippedData];
[request setPostBody:compressedBody];
[request addHeader:@"gzip" forName:CONTENT_ENCODING_KEY];

Expand Down
2 changes: 1 addition & 1 deletion AWSCore/Networking/AWSNetworking.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ - (NSString *)userAgent {
NSString *systemName = [[[UIDevice currentDevice] systemName] stringByReplacingOccurrencesOfString:@" " withString:@"-"];
NSString *systemVersion = [[UIDevice currentDevice] systemVersion];
NSString *localeIdentifier = [[NSLocale currentLocale] localeIdentifier];
_userAgent = [NSString stringWithFormat:@"aws-sdk-iOS/%@ %@/%@ %@", @"2.0.4", systemName, systemVersion, localeIdentifier];
_userAgent = [NSString stringWithFormat:@"aws-sdk-iOS/%@ %@/%@ %@", @"2.0.5", systemName, systemVersion, localeIdentifier];
});

return _userAgent;
Expand Down
9 changes: 5 additions & 4 deletions AWSCore/STS/AWSSTS.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#import "AWSURLResponseSerialization.h"
#import "AWSURLRequestRetryHandler.h"

NSString *const AWSSTSDefinitionFileName = @"sts-2011-06-15";

@interface AWSSTSResponseSerializer : AWSXMLResponseSerializer

@property (nonatomic, assign) Class outputClass;
Expand Down Expand Up @@ -200,13 +202,12 @@ - (BFTask *)invokeRequest:(AWSRequest *)request
}
networkingRequest.HTTPMethod = HTTPMethod;

AWSQueryStringRequestSerializer *requestSerializer = [AWSQueryStringRequestSerializer new];
requestSerializer.additionalParameters = @{@"Action" : operationName,
@"Version" : @"2011-06-15"};
AWSQueryStringRequestSerializer *requestSerializer = [AWSQueryStringRequestSerializer serializerWithResource:AWSSTSDefinitionFileName
actionName:operationName];
networkingRequest.requestSerializer = requestSerializer;

networkingRequest.responseSerializer = [AWSSTSResponseSerializer serializerWithOutputClass:outputClass
resource:@"sts-2011-06-15"
resource:AWSSTSDefinitionFileName
actionName:operationName];

return [self.networking sendRequest:networkingRequest];
Expand Down
24 changes: 23 additions & 1 deletion AWSCore/Serialization/AWSSerialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ typedef NS_ENUM(NSInteger, AWSXMLParserErrorType) {
AWSXMLParserInvalidXMLValue,
};

//defined domain for errors from AWSRuntime.
FOUNDATION_EXPORT NSString *const AWSQueryParamBuilderErrorDomain;

/* NSError codes in AWSErrorDomain. */
typedef NS_ENUM(NSInteger, AWSQueryParamBuilderErrorType) {
AWSQueryParamBuilderUnknownError,
AWSQueryParamBuilderDefinitionFileIsEmpty,
AWSQueryParamBuilderUndefinedActionRule,
AWSQueryParamBuilderInternalError,
};

@interface AWSJSONDictionary : NSDictionary

- (instancetype)initWithDictionary:(NSDictionary *)otherDictionary
Expand All @@ -72,9 +83,20 @@ typedef NS_ENUM(NSInteger, AWSXMLParserErrorType) {

@interface AWSXMLParser : NSObject

+ (NSMutableDictionary *)dictionaryForXMLData:(NSData *)data
+ (AWSXMLParser *)sharedInstance;

- (NSMutableDictionary *)dictionaryForXMLData:(NSData *)data
actionName:(NSString *)actionName
serviceDefinitionRule:(NSDictionary *)serviceDefinitionRule
error:(NSError *__autoreleasing *)error;

@end

@interface AWSQueryParamBuilder : NSObject

+ (NSDictionary *)buildFormattedParams:(NSDictionary *)params
actionName:(NSString *)actionName
serviceDefinitionRule:(NSDictionary *)serviceDefinitionRule
error:(NSError *__autoreleasing *)error;

@end
Loading

0 comments on commit 091acaf

Please sign in to comment.