From 91c23e932fce5c835c5076cd462fca1b33c6ef74 Mon Sep 17 00:00:00 2001 From: zhang zhenfang Date: Tue, 16 Apr 2013 23:42:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iPad/AppDelegate_iPad.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/iPad/AppDelegate_iPad.m b/iPad/AppDelegate_iPad.m index 0e15cce..1a92e90 100644 --- a/iPad/AppDelegate_iPad.m +++ b/iPad/AppDelegate_iPad.m @@ -8,7 +8,7 @@ #import "AppDelegate_iPad.h" #import "ACSugarSync.h" - +#import "ACWebDAVClient.h" @implementation AppDelegate_iPad @synthesize window; @@ -20,11 +20,13 @@ @implementation AppDelegate_iPad - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. - ACSugarSyncClient* client = [ACSugarSyncClient clientWithUsername:@"jkichline@gmail.com" password:@"spoon!08" accessKey:@"MTY0OTE1ODEzMTM1MzU1NTYxNjg" privateAccessKey:@"MmFhYzljN2RlOGQ0NDA5YWE1NDNlYTA0Yzk2MDk5N2Q"]; - [client authorize:self selector:@selector(authorized:)]; +// ACSugarSyncClient* client = [ACSugarSyncClient clientWithUsername:@"jkichline@gmail.com" password:@"spoon!08" accessKey:@"MTY0OTE1ODEzMTM1MzU1NTYxNjg" privateAccessKey:@"MmFhYzljN2RlOGQ0NDA5YWE1NDNlYTA0Yzk2MDk5N2Q"]; +// [client authorize:self selector:@selector(authorized:)]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAuthorization:) name:ACSugarSyncAuthorizationCompleteNotification object:client]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleRetrieveUser:) name:ACSugarSyncRetrievedUserNotification object:client]; + ACWebDAVClient *client1 = [ACWebDAVClient clientWithHost:@"http://192.168.137.17:8888/owncloud/remote.php/webdav" username:@"fangzhzh" password:@"fangzhzh"]; + [client1 loadMetadata:@"/"]; +// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAuthorization:) name:ACSugarSyncAuthorizationCompleteNotification object:client]; +// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleRetrieveUser:) name:ACSugarSyncRetrievedUserNotification object:client]; [self.window makeKeyAndVisible]; return YES; From c2de900296bffa8ac1f4d2d9744f8d2195c2db02 Mon Sep 17 00:00:00 2001 From: zhang zhenfang Date: Tue, 30 Apr 2013 03:02:59 +0800 Subject: [PATCH 2/3] bugfix. --- src/ACWebDAV/Requests/ACWebDAVMoveRequest.m | 7 +++---- src/ACWebDAV/Requests/ACWebDAVPropertyRequest.m | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ACWebDAV/Requests/ACWebDAVMoveRequest.m b/src/ACWebDAV/Requests/ACWebDAVMoveRequest.m index 5bddb59..211705e 100644 --- a/src/ACWebDAV/Requests/ACWebDAVMoveRequest.m +++ b/src/ACWebDAV/Requests/ACWebDAVMoveRequest.m @@ -62,19 +62,18 @@ -(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChalleng - (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSHTTPURLResponse*)response { if([response statusCode] == 201) { - if(self.delegate != nil && [(NSObject*)self.delegate respondsToSelector:@selector(ACWebDAVMoveRequest:didMoveItem:)]) { + if(self.delegate != nil && [(NSObject*)self.delegate respondsToSelector:@selector(request:didMoveItem:)]) { ACWebDAVLocation* newLocation = [ACWebDAVLocation locationWithURL:[response URL] username:self.location.username password:self.location.password]; ACWebDAVItem* item = [[ACWebDAVItem alloc] initWithLocation:newLocation]; [self.delegate request:self didMoveItem:item]; [item release]; } } else { - if(self.delegate != nil && [(NSObject*)self.delegate respondsToSelector:@selector(ACWebDAVMoveRequest:didFailWithErrorCode:)]) { + if(self.delegate != nil && [(NSObject*)self.delegate respondsToSelector:@selector(request:didFailWithErrorCode:)]) { [self.delegate request:self didFailWithErrorCode:[response statusCode]]; } } } - -(void)connectionDidFinishLoading:(NSURLConnection *)connection { [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; [connection release]; @@ -82,7 +81,7 @@ -(void)connectionDidFinishLoading:(NSURLConnection *)connection { -(void)connection:(NSURLConnection*)connection didFailWithError:(NSError*)error { [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; - if(self.delegate != nil && [(NSObject*)self.delegate respondsToSelector:@selector(ACWebDAVMoveRequest:didFailWithError:)]) { + if(self.delegate != nil && [(NSObject*)self.delegate respondsToSelector:@selector(request:didFailWithError:)]) { [self.delegate request:self didFailWithError:error]; } [connection release]; diff --git a/src/ACWebDAV/Requests/ACWebDAVPropertyRequest.m b/src/ACWebDAV/Requests/ACWebDAVPropertyRequest.m index ed7999d..0467958 100644 --- a/src/ACWebDAV/Requests/ACWebDAVPropertyRequest.m +++ b/src/ACWebDAV/Requests/ACWebDAVPropertyRequest.m @@ -244,6 +244,10 @@ -(void)connectionDidFinishLoading:(NSURLConnection *)connection { -(void)connection:(NSURLConnection*)connection didFailWithError:(NSError*)error { [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; + if(self.delegate != nil && [(NSObject*)self.delegate respondsToSelector:@selector(request:didFailWithError:)]) { + [self.delegate request:self didFailWithError:error]; + } + [connection release]; } From 1ebee85d27b889e9eb4a559e4a1e96cea0d5abd3 Mon Sep 17 00:00:00 2001 From: zhang zhenfang Date: Tue, 30 Apr 2013 03:04:16 +0800 Subject: [PATCH 3/3] restore appdelegate --- iPad/AppDelegate_iPad.m | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/iPad/AppDelegate_iPad.m b/iPad/AppDelegate_iPad.m index 1a92e90..3bb7b8c 100644 --- a/iPad/AppDelegate_iPad.m +++ b/iPad/AppDelegate_iPad.m @@ -8,7 +8,7 @@ #import "AppDelegate_iPad.h" #import "ACSugarSync.h" -#import "ACWebDAVClient.h" + @implementation AppDelegate_iPad @synthesize window; @@ -17,16 +17,14 @@ @implementation AppDelegate_iPad #pragma mark - #pragma mark Application lifecycle -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. -// ACSugarSyncClient* client = [ACSugarSyncClient clientWithUsername:@"jkichline@gmail.com" password:@"spoon!08" accessKey:@"MTY0OTE1ODEzMTM1MzU1NTYxNjg" privateAccessKey:@"MmFhYzljN2RlOGQ0NDA5YWE1NDNlYTA0Yzk2MDk5N2Q"]; -// [client authorize:self selector:@selector(authorized:)]; + ACSugarSyncClient* client = [ACSugarSyncClient clientWithUsername:@"jkichline@gmail.com" password:@"spoon!08" accessKey:@"MTY0OTE1ODEzMTM1MzU1NTYxNjg" privateAccessKey:@"MmFhYzljN2RlOGQ0NDA5YWE1NDNlYTA0Yzk2MDk5N2Q"]; + [client authorize:self selector:@selector(authorized:)]; - ACWebDAVClient *client1 = [ACWebDAVClient clientWithHost:@"http://192.168.137.17:8888/owncloud/remote.php/webdav" username:@"fangzhzh" password:@"fangzhzh"]; - [client1 loadMetadata:@"/"]; -// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAuthorization:) name:ACSugarSyncAuthorizationCompleteNotification object:client]; -// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleRetrieveUser:) name:ACSugarSyncRetrievedUserNotification object:client]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAuthorization:) name:ACSugarSyncAuthorizationCompleteNotification object:client]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleRetrieveUser:) name:ACSugarSyncRetrievedUserNotification object:client]; [self.window makeKeyAndVisible]; return YES; @@ -54,8 +52,8 @@ -(void)test:(id)value { ACSugarSyncFile* file = (ACSugarSyncFile*)item; NSLog(@"File: %@ - %d bytes", file, file.size); if(file.size > 0) { -// [file downloadFile]; -// break; + // [file downloadFile]; + // break; } } }