Skip to content

Commit

Permalink
AWS SDK for iOS 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
amazonwebservices committed Nov 22, 2011
1 parent 657a7c0 commit 71060a6
Show file tree
Hide file tree
Showing 820 changed files with 13,341 additions and 1,230 deletions.
4 changes: 2 additions & 2 deletions samples/AWSiOSDemo/AWSiOSDemo/AWSiOSDemoAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(N
{
[window addSubview:viewController.view];
[window makeKeyAndVisible];

// Uncomment the line below to see more logging.
[AmazonLogger verboseLogging];

return YES;
}

Expand Down
24 changes: 12 additions & 12 deletions samples/AWSiOSDemo/AWSiOSDemo/AWSiOSDemoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,83 +26,83 @@ @implementation AWSiOSDemoViewController

-(IBAction)listBuckets:(id)sender
{
if ( ![AmazonClientManager hasCredentials] ) {
if (![AmazonClientManager hasCredentials]) {
[[Constants credentialsAlert] show];
}
else {
BucketList *bucketList = [[BucketList alloc] init];
bucketList.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

[self presentModalViewController:bucketList animated:YES];
[bucketList release];
}
}

-(IBAction)listDomains:(id)sender
{
if ( ![AmazonClientManager hasCredentials] ) {
if (![AmazonClientManager hasCredentials]) {
[[Constants credentialsAlert] show];
}
else {
DomainList *domainList = [[DomainList alloc] init];
domainList.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

[self presentModalViewController:domainList animated:YES];
[domainList release];
}
}

-(IBAction)listQueues:(id)sender
{
if ( ![AmazonClientManager hasCredentials] ) {
if (![AmazonClientManager hasCredentials]) {
[[Constants credentialsAlert] show];
}
else {
QueueList *queueList = [[QueueList alloc] init];
queueList.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

[self presentModalViewController:queueList animated:YES];
[queueList release];
}
}

-(IBAction)listTopics:(id)sender
{
if ( ![AmazonClientManager hasCredentials] ) {
if (![AmazonClientManager hasCredentials]) {
[[Constants credentialsAlert] show];
}
else {
TopicList *topicList = [[TopicList alloc] init];
topicList.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

[self presentModalViewController:topicList animated:YES];
[topicList release];
}
}

-(IBAction)s3AsyncDemo:(id)sender
{
if ( ![AmazonClientManager hasCredentials] ) {
if (![AmazonClientManager hasCredentials]) {
[[Constants credentialsAlert] show];
}
else {
S3AsyncViewController *s3Async = [[S3AsyncViewController alloc] init];
s3Async.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

[self presentModalViewController:s3Async animated:YES];
[s3Async release];
}
}

-(IBAction)sdbAsyncDemo:(id)sender
{
if ( ![AmazonClientManager hasCredentials] ) {
if (![AmazonClientManager hasCredentials]) {
[[Constants credentialsAlert] show];
}
else {
SdbAsyncViewController *sdbAsync = [[SdbAsyncViewController alloc] init];
sdbAsync.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

[self presentModalViewController:sdbAsync animated:YES];
[sdbAsync release];
}
Expand Down
3 changes: 1 addition & 2 deletions samples/AWSiOSDemo/AWSiOSDemo/Classes/AmazonClientManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#import <AWSiOSSDK/SNS/AmazonSNSClient.h>
#import "Constants.h"

@interface AmazonClientManager : NSObject {

@interface AmazonClientManager:NSObject {
}

+(AmazonS3Client *)s3;
Expand Down
16 changes: 8 additions & 8 deletions samples/AWSiOSDemo/AWSiOSDemo/Classes/AmazonClientManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ +(AmazonSNSClient *)sns

+(bool)hasCredentials
{
return ( ![ACCESS_KEY_ID isEqualToString:@"CHANGE ME"] && ![SECRET_KEY isEqualToString:@"CHANGE ME"]);
return (![ACCESS_KEY_ID isEqualToString:@"CHANGE ME"] && ![SECRET_KEY isEqualToString:@"CHANGE ME"]);
}

+(void)validateCredentials
+(void)validateCredentials
{
if ( ( sdb == nil ) || ( s3 == nil ) || ( sqs == nil ) || ( sns == nil ) ) {
if ((sdb == nil) || (s3 == nil) || (sqs == nil) || (sns == nil)) {
[AmazonClientManager clearCredentials];
s3 = [[AmazonS3Client alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY];

s3 = [[AmazonS3Client alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY];
sdb = [[AmazonSimpleDBClient alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY];
sqs = [[AmazonSQSClient alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY];
sns = [[AmazonSNSClient alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY];
}
}
}

+(void)clearCredentials
Expand All @@ -72,8 +72,8 @@ +(void)clearCredentials
[sdb release];
[sns release];
[sqs release];
s3 = nil;

s3 = nil;
sdb = nil;
sqs = nil;
sns = nil;
Expand Down
5 changes: 3 additions & 2 deletions samples/AWSiOSDemo/AWSiOSDemo/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);

[pool release];
return retVal;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
AWSiOSDemoTVMViewController *viewController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet AWSiOSDemoTVMViewController *viewController;

@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(N
{
[window addSubview:viewController.view];
[window makeKeyAndVisible];

// Comment the line below to stop some of the logging.
[AmazonLogger verboseLogging];

Expand Down
26 changes: 13 additions & 13 deletions samples/AWSiOSDemoTVM/AWSiOSDemoTVM/AWSiOSDemoTVMViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ @implementation AWSiOSDemoTVMViewController

-(IBAction)listBuckets:(id)sender
{
if ( ![AmazonClientManager hasCredentials] ) {
if (![AmazonClientManager hasCredentials]) {
[[Constants credentialsAlert] show];
}
else {
Response *response = [AmazonClientManager validateCredentials];
if ( ![response wasSuccessful] ) {
if (![response wasSuccessful]) {
[[Constants errorAlert:response.message] show];
}
else {
Expand All @@ -48,18 +48,18 @@ -(IBAction)listBuckets:(id)sender

-(IBAction)listDomains:(id)sender
{
if ( ![AmazonClientManager hasCredentials] ) {
if (![AmazonClientManager hasCredentials]) {
[[Constants credentialsAlert] show];
}
else {
Response *response = [AmazonClientManager validateCredentials];
if ( ![response wasSuccessful] ) {
if (![response wasSuccessful]) {
[[Constants errorAlert:response.message] show];
}
else {
DomainList *domainList = [[DomainList alloc] init];
domainList.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

[self presentModalViewController:domainList animated:YES];
[domainList release];
}
Expand All @@ -68,12 +68,12 @@ -(IBAction)listDomains:(id)sender

-(IBAction)listQueues:(id)sender
{
if ( ![AmazonClientManager hasCredentials] ) {
if (![AmazonClientManager hasCredentials]) {
[[Constants credentialsAlert] show];
}
else {
Response *response = [AmazonClientManager validateCredentials];
if ( ![response wasSuccessful] ) {
if (![response wasSuccessful]) {
[[Constants errorAlert:response.message] show];
}
else {
Expand All @@ -88,12 +88,12 @@ -(IBAction)listQueues:(id)sender

-(IBAction)listTopics:(id)sender
{
if ( ![AmazonClientManager hasCredentials] ) {
if (![AmazonClientManager hasCredentials]) {
[[Constants credentialsAlert] show];
}
else {
Response *response = [AmazonClientManager validateCredentials];
if ( ![response wasSuccessful] ) {
if (![response wasSuccessful]) {
[[Constants errorAlert:response.message] show];
}
else {
Expand All @@ -108,12 +108,12 @@ -(IBAction)listTopics:(id)sender

-(IBAction)s3AsyncDemo:(id)sender
{
if ( ![AmazonClientManager hasCredentials] ) {
if (![AmazonClientManager hasCredentials]) {
[[Constants credentialsAlert] show];
}
else {
Response *response = [AmazonClientManager validateCredentials];
if ( ![response wasSuccessful] ) {
if (![response wasSuccessful]) {
[[Constants errorAlert:response.message] show];
}
else {
Expand All @@ -128,12 +128,12 @@ -(IBAction)s3AsyncDemo:(id)sender

-(IBAction)sdbAsyncDemo:(id)sender
{
if ( ![AmazonClientManager hasCredentials] ) {
if (![AmazonClientManager hasCredentials]) {
[[Constants credentialsAlert] show];
}
else {
Response *response = [AmazonClientManager validateCredentials];
if ( ![response wasSuccessful] ) {
if (![response wasSuccessful]) {
[[Constants errorAlert:response.message] show];
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
#import "Constants.h"
#import "Response.h"

@interface AmazonClientManager : NSObject {

@interface AmazonClientManager:NSObject {
}

+(AmazonS3Client *)s3;
Expand All @@ -32,7 +31,7 @@
+(AmazonSNSClient *)sns;

+(bool)hasCredentials;
+(Response*)validateCredentials;
+(Response *)validateCredentials;
+(void)clearCredentials;
+(void)wipeAllCredentials;

Expand Down
34 changes: 17 additions & 17 deletions samples/AWSiOSDemoTVM/AWSiOSDemoTVM/Classes/AmazonClientManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ +(AmazonSNSClient *)sns
return sns;
}

+(AmazonTVMClient *)tvm
+(AmazonTVMClient *)tvm
{
if ( tvm == nil ) {
if (tvm == nil) {
tvm = [[AmazonTVMClient alloc] initWithEndpoint:TOKEN_VENDING_MACHINE_URL useSSL:USE_SSL];
}

return tvm;
}

Expand All @@ -64,29 +64,29 @@ +(bool)hasCredentials
return ![TOKEN_VENDING_MACHINE_URL isEqualToString:@"CHANGE ME"];
}

+(Response*)validateCredentials
+(Response *)validateCredentials
{
Response* ableToGetToken = [[[Response alloc] initWithCode:200 andMessage:@"OK"] autorelease];
if ( [AmazonKeyChainWrapper areCredentialsExpired] ) {
Response *ableToGetToken = [[[Response alloc] initWithCode:200 andMessage:@"OK"] autorelease];

if ( [AmazonKeyChainWrapper areCredentialsExpired]) {
[AmazonClientManager clearCredentials];

ableToGetToken = [[AmazonClientManager tvm] anonymousRegister];
if ( [ableToGetToken wasSuccessful] ) {
ableToGetToken = [[AmazonClientManager tvm] getToken];
if ( [ableToGetToken wasSuccessful]) {
ableToGetToken = [[AmazonClientManager tvm] getToken];
}
}
if ( [ableToGetToken wasSuccessful] && ( ( sdb == nil ) || ( s3 == nil ) || ( sqs == nil ) || ( sns == nil ) ) ) {

if ( [ableToGetToken wasSuccessful] && ((sdb == nil) || (s3 == nil) || (sqs == nil) || (sns == nil))) {
[AmazonClientManager clearCredentials];

AmazonCredentials *credentials = [[AmazonKeyChainWrapper getCredentialsFromKeyChain] autorelease];
s3 = [[AmazonS3Client alloc] initWithCredentials:credentials];
AmazonCredentials *credentials = [[AmazonKeyChainWrapper getCredentialsFromKeyChain] autorelease];
s3 = [[AmazonS3Client alloc] initWithCredentials:credentials];
sdb = [[AmazonSimpleDBClient alloc] initWithCredentials:credentials];
sqs = [[AmazonSQSClient alloc] initWithCredentials:credentials];
sns = [[AmazonSNSClient alloc] initWithCredentials:credentials];
}
}

return ableToGetToken;
}

Expand All @@ -96,8 +96,8 @@ +(void)clearCredentials
[sdb release];
[sns release];
[sqs release];
s3 = nil;

s3 = nil;
sdb = nil;
sqs = nil;
sns = nil;
Expand Down
4 changes: 2 additions & 2 deletions samples/AWSiOSDemoTVM/AWSiOSDemoTVM/Classes/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/**
* This indiciates whether or not the TVM is supports SSL connections.
*/
#define USE_SSL NO
#define USE_SSL NO


#define CREDENTIALS_ALERT_MESSAGE @"Please update the Constants.h file with your credentials or Token Vending Machine URL."
Expand All @@ -38,7 +38,7 @@
}

+(UIAlertView *)credentialsAlert;
+(UIAlertView *)errorAlert:(NSString*)message;
+(UIAlertView *)errorAlert:(NSString *)message;
+(UIAlertView *)expiredCredentialsAlert;

@end
Loading

0 comments on commit 71060a6

Please sign in to comment.