Merge lp:~urbanape/ubuntuone-ios-files/background-processing into lp:~threeve/ubuntuone-ios-files/background-processing

Proposed by Zachery Bir
Status: Merged
Approved by: Jason Foreman
Approved revision: 38
Merged at revision: 32
Proposed branch: lp:~urbanape/ubuntuone-ios-files/background-processing
Merge into: lp:~threeve/ubuntuone-ios-files/background-processing
Diff against target: 1077 lines (+484/-100)
20 files modified
Files.xcodeproj/project.pbxproj (+6/-0)
Files/Files-Info.plist (+3/-1)
Files/U1AssetRepresenationDataProvider.m (+19/-17)
Files/U1AutoUploadOperation.m (+8/-1)
Files/U1AutoUploadsManager.m (+93/-41)
Files/U1FileDetailsViewController.h (+1/-0)
Files/U1FileDetailsViewController.m (+11/-1)
Files/U1FileDetailsViewController.xib (+198/-8)
Files/U1FilesClient.m (+8/-0)
Files/U1FilesService.h (+0/-1)
Files/U1FilesService.m (+7/-0)
Files/U1FolderNode.h (+1/-1)
Files/U1FolderNode.m (+5/-0)
Files/U1FolderViewController.h (+0/-1)
Files/U1FolderViewController.m (+23/-1)
Files/U1FolderViewController.xib (+23/-25)
Files/U1LoginController.m (+2/-1)
Files/U1TopPinningLabel.h (+20/-0)
Files/U1TopPinningLabel.m (+30/-0)
Files/U1UploadOperation.m (+26/-1)
To merge this branch: bzr merge lp:~urbanape/ubuntuone-ios-files/background-processing
Reviewer Review Type Date Requested Status
Jason Foreman Approve
Review via email: mp+84960@code.launchpad.net

Description of the change

This branch adds checks to protect attempts to upload ALAssets that have been deleted in the interval. We don't re-queue them on start, but if it's in the queue already, we also check when the operation is underway.

To post a comment you must log in.
Revision history for this message
Jason Foreman (threeve) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Files.xcodeproj/project.pbxproj'
--- Files.xcodeproj/project.pbxproj 2011-12-07 22:53:01 +0000
+++ Files.xcodeproj/project.pbxproj 2011-12-08 14:24:32 +0000
@@ -19,6 +19,7 @@
19 916BF76C145A464E00D4FE06 /* settings@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 916BF76A145A464E00D4FE06 /* settings@2x.png */; };19 916BF76C145A464E00D4FE06 /* settings@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 916BF76A145A464E00D4FE06 /* settings@2x.png */; };
20 916BF77A145AF6B900D4FE06 /* Entitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 916BF779145AF6B900D4FE06 /* Entitlements.plist */; };20 916BF77A145AF6B900D4FE06 /* Entitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 916BF779145AF6B900D4FE06 /* Entitlements.plist */; };
21 916E0082143C9A3A0037F6D3 /* U1UploadsPoolViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 916E0081143C9A390037F6D3 /* U1UploadsPoolViewController.m */; };21 916E0082143C9A3A0037F6D3 /* U1UploadsPoolViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 916E0081143C9A390037F6D3 /* U1UploadsPoolViewController.m */; };
22 9172C870148FA4F600FC7737 /* U1TopPinningLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9172C86F148FA4F600FC7737 /* U1TopPinningLabel.m */; };
22 917692C7148DB50500316986 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 917692C6148DB50500316986 /* MobileCoreServices.framework */; };23 917692C7148DB50500316986 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 917692C6148DB50500316986 /* MobileCoreServices.framework */; };
23 917ADEC71458954E00980FD4 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 917ADEC51458954E00980FD4 /* Icon.png */; };24 917ADEC71458954E00980FD4 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 917ADEC51458954E00980FD4 /* Icon.png */; };
24 917ADEC81458954E00980FD4 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 917ADEC61458954E00980FD4 /* Icon@2x.png */; };25 917ADEC81458954E00980FD4 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 917ADEC61458954E00980FD4 /* Icon@2x.png */; };
@@ -170,6 +171,8 @@
170 916BF779145AF6B900D4FE06 /* Entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Entitlements.plist; sourceTree = "<group>"; };171 916BF779145AF6B900D4FE06 /* Entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Entitlements.plist; sourceTree = "<group>"; };
171 916E0080143C9A390037F6D3 /* U1UploadsPoolViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = U1UploadsPoolViewController.h; sourceTree = "<group>"; };172 916E0080143C9A390037F6D3 /* U1UploadsPoolViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = U1UploadsPoolViewController.h; sourceTree = "<group>"; };
172 916E0081143C9A390037F6D3 /* U1UploadsPoolViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = U1UploadsPoolViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };173 916E0081143C9A390037F6D3 /* U1UploadsPoolViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = U1UploadsPoolViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
174 9172C86E148FA4F600FC7737 /* U1TopPinningLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = U1TopPinningLabel.h; sourceTree = "<group>"; };
175 9172C86F148FA4F600FC7737 /* U1TopPinningLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = U1TopPinningLabel.m; sourceTree = "<group>"; };
173 917692C6148DB50500316986 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };176 917692C6148DB50500316986 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
174 917ADEC014585DC800980FD4 /* U1Files 1.0-9.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "U1Files 1.0-9.xcdatamodel"; sourceTree = "<group>"; };177 917ADEC014585DC800980FD4 /* U1Files 1.0-9.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "U1Files 1.0-9.xcdatamodel"; sourceTree = "<group>"; };
175 917ADEC51458954E00980FD4 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };178 917ADEC51458954E00980FD4 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
@@ -667,6 +670,8 @@
667 91EC184D145B8E3B00DF31F4 /* U1SettingsViewController.xib */,670 91EC184D145B8E3B00DF31F4 /* U1SettingsViewController.xib */,
668 9623AE6014868F7000ACDF1C /* U1ReportingInputStream.h */,671 9623AE6014868F7000ACDF1C /* U1ReportingInputStream.h */,
669 9623AE6114868F7000ACDF1C /* U1ReportingInputStream.m */,672 9623AE6114868F7000ACDF1C /* U1ReportingInputStream.m */,
673 9172C86E148FA4F600FC7737 /* U1TopPinningLabel.h */,
674 9172C86F148FA4F600FC7737 /* U1TopPinningLabel.m */,
670 );675 );
671 path = Files;676 path = Files;
672 sourceTree = "<group>";677 sourceTree = "<group>";
@@ -1054,6 +1059,7 @@
1054 910393E81475B118004DE69D /* U1AutoUploadOperation.m in Sources */,1059 910393E81475B118004DE69D /* U1AutoUploadOperation.m in Sources */,
1055 9623AE6214868F7000ACDF1C /* U1ReportingInputStream.m in Sources */,1060 9623AE6214868F7000ACDF1C /* U1ReportingInputStream.m in Sources */,
1056 96D1A8E0148DB9F800B210E7 /* U1TransparentToolbar.m in Sources */,1061 96D1A8E0148DB9F800B210E7 /* U1TransparentToolbar.m in Sources */,
1062 9172C870148FA4F600FC7737 /* U1TopPinningLabel.m in Sources */,
1057 );1063 );
1058 runOnlyForDeploymentPostprocessing = 0;1064 runOnlyForDeploymentPostprocessing = 0;
1059 };1065 };
10601066
=== modified file 'Files/Files-Info.plist'
--- Files/Files-Info.plist 2011-12-05 19:53:10 +0000
+++ Files/Files-Info.plist 2011-12-08 14:24:32 +0000
@@ -41,11 +41,13 @@
41 <key>CFBundleSignature</key>41 <key>CFBundleSignature</key>
42 <string>????</string>42 <string>????</string>
43 <key>CFBundleVersion</key>43 <key>CFBundleVersion</key>
44 <string>23</string>44 <string>24</string>
45 <key>LSRequiresIPhoneOS</key>45 <key>LSRequiresIPhoneOS</key>
46 <true/>46 <true/>
47 <key>NSMainNibFile</key>47 <key>NSMainNibFile</key>
48 <string>MainWindow_iPhone</string>48 <string>MainWindow_iPhone</string>
49 <key>UIPrerenderedIcon</key>
50 <true/>
49 <key>UISupportedInterfaceOrientations</key>51 <key>UISupportedInterfaceOrientations</key>
50 <array>52 <array>
51 <string>UIInterfaceOrientationPortrait</string>53 <string>UIInterfaceOrientationPortrait</string>
5254
=== modified file 'Files/U1AssetRepresenationDataProvider.m'
--- Files/U1AssetRepresenationDataProvider.m 2011-12-07 22:53:01 +0000
+++ Files/U1AssetRepresenationDataProvider.m 2011-12-08 14:24:32 +0000
@@ -46,14 +46,25 @@
46{46{
47 [library assetForURL:self.assetURL resultBlock:^(ALAsset *asset) {47 [library assetForURL:self.assetURL resultBlock:^(ALAsset *asset) {
48 48
49 ALAssetRepresentation *representation = [asset defaultRepresentation];49 if (asset == nil)
50 uint8_t *buffer = (uint8_t*)malloc(representation.size);50 {
51 NSUInteger length = [representation getBytes:buffer fromOffset:0 length:representation.size error:nil];51 if (block)
52 NSData *imageData = [NSData dataWithBytesNoCopy:buffer length:length freeWhenDone:YES];52 {
53 NSString *mimeType = (id)UTTypeCopyPreferredTagWithClass((CFStringRef)[representation UTI], kUTTagClassMIMEType);53 NSError *error = [NSError errorWithDomain:@"nonexistentAsset" code:1 userInfo:nil];
54 NSInputStream *dataStream = [NSInputStream inputStreamWithData:imageData];54 block(nil, nil, nil, error);
55 if (block)55 }
56 block(dataStream, mimeType, length, nil);56 }
57 else
58 {
59 ALAssetRepresentation *representation = [asset defaultRepresentation];
60 uint8_t *buffer = (uint8_t*)malloc(representation.size);
61 NSUInteger length = [representation getBytes:buffer fromOffset:0 length:representation.size error:nil];
62 NSData *imageData = [NSData dataWithBytesNoCopy:buffer length:length freeWhenDone:YES];
63 NSString *mimeType = (id)UTTypeCopyPreferredTagWithClass((CFStringRef)[representation UTI], kUTTagClassMIMEType);
64 NSInputStream *dataStream = [NSInputStream inputStreamWithData:imageData];
65 if (block)
66 block(dataStream, mimeType, length, nil);
67 }
57 68
58 } failureBlock:^(NSError *error) {69 } failureBlock:^(NSError *error) {
59 if (block)70 if (block)
@@ -61,13 +72,4 @@
61 }];72 }];
62}73}
6374
64- (NSData *)serializeData;
65{
66// Byte *buffer = (Byte*)malloc(self.representation.size);
67// NSUInteger length = [self.representation getBytes:buffer fromOffset:0 length:self.representation.size error:nil];
68// NSData *assetData = [NSData dataWithBytesNoCopy:buffer length:length freeWhenDone:YES];
69// return assetData;
70 return nil;
71}
72
73@end75@end
7476
=== modified file 'Files/U1AutoUploadOperation.m'
--- Files/U1AutoUploadOperation.m 2011-12-07 22:53:01 +0000
+++ Files/U1AutoUploadOperation.m 2011-12-08 14:24:32 +0000
@@ -55,7 +55,14 @@
55 self.executing = YES;55 self.executing = YES;
56 [self didChangeValueForKey:@"isExecuting"];56 [self didChangeValueForKey:@"isExecuting"];
57 57
58 [self beginUpload];58 if ([self isCancelled])
59 {
60 [self finishExecuting];
61 }
62 else
63 {
64 [self beginUpload];
65 }
59}66}
6067
61- (void)dealloc68- (void)dealloc
6269
=== modified file 'Files/U1AutoUploadsManager.m'
--- Files/U1AutoUploadsManager.m 2011-12-07 22:53:01 +0000
+++ Files/U1AutoUploadsManager.m 2011-12-08 14:24:32 +0000
@@ -18,6 +18,7 @@
1818
19#import "Reachability.h"19#import "Reachability.h"
2020
21#import "U1AccountManager.h"
21#import "U1Asset.h"22#import "U1Asset.h"
22#import "U1AssetRepresenationDataProvider.h"23#import "U1AssetRepresenationDataProvider.h"
23#import "U1AutoUploadOperation.h"24#import "U1AutoUploadOperation.h"
@@ -77,6 +78,7 @@
77 dataRepository = [U1DataRepository sharedDataRepository];78 dataRepository = [U1DataRepository sharedDataRepository];
78 [defaultCenter addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil];79 [defaultCenter addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil];
79 [defaultCenter addObserver:self selector:@selector(volumesFetched:) name:@"volumesFetched" object:nil];80 [defaultCenter addObserver:self selector:@selector(volumesFetched:) name:@"volumesFetched" object:nil];
81 [defaultCenter addObserver:self selector:@selector(didSignOut:) name:U1AccountManagerDidSignOut object:nil];
80 return self;82 return self;
81}83}
8284
@@ -157,8 +159,16 @@
157 }159 }
158 if (!found)160 if (!found)
159 {161 {
162 static BOOL creatingUploadVolume = NO;
163
164 if (creatingUploadVolume)
165 return;
166
167 creatingUploadVolume = YES;
168
160 [self.filesClient createVolumeAtPath:[self remoteUploadFolderPath]169 [self.filesClient createVolumeAtPath:[self remoteUploadFolderPath]
161 completionBlock:^(U1Volume *volume, NSError *error) {170 completionBlock:^(U1Volume *volume, NSError *error) {
171 creatingUploadVolume = NO;
162 if (error == nil)172 if (error == nil)
163 {173 {
164 self.remoteUploadFolder = volume.rootFolder;174 self.remoteUploadFolder = volume.rootFolder;
@@ -181,6 +191,11 @@
181 // We received a list of volumes. If our upload folder is not among them, prime it.191 // We received a list of volumes. If our upload folder is not among them, prime it.
182}192}
183193
194- (void)didSignOut:(NSNotification*)notification;
195{
196 [self.autoUploadPreparationQueue cancelAllOperations];
197}
198
184- (void)fetchRemoteUploadFolderContents;199- (void)fetchRemoteUploadFolderContents;
185{200{
186 // fetch the remote upload folder contents, and stash the children objects somewhere locally.201 // fetch the remote upload folder contents, and stash the children objects somewhere locally.
@@ -348,54 +363,91 @@
348- (void)queuePreviousUploads;363- (void)queuePreviousUploads;
349{364{
350 // We should poll our data repository for all U1Assets which have generation=nil. They *should* all have U1FileNodes associated with them. If the U1FileNode's parent equals our autoUploadsManager's remoteUploadFolder, then it's an auto-upload, and we let the LAM handle it. Otherwise, kick it off immediately to the FilesClient and get it back in the queue.365 // We should poll our data repository for all U1Assets which have generation=nil. They *should* all have U1FileNodes associated with them. If the U1FileNode's parent equals our autoUploadsManager's remoteUploadFolder, then it's an auto-upload, and we let the LAM handle it. Otherwise, kick it off immediately to the FilesClient and get it back in the queue.
351 NSPredicate *p = [NSPredicate predicateWithFormat:@"generation = %@", nil];366 NSPredicate *p = [NSPredicate predicateWithFormat:@"generation = %@", nil];
352 NSError *error = nil;367 NSError *error = nil;
353 NSSortDescriptor *sortBy = [NSSortDescriptor sortDescriptorWithKey:@"filename" ascending:YES];368 NSSortDescriptor *sortBy = [NSSortDescriptor sortDescriptorWithKey:@"filename" ascending:YES];
354 NSArray *previouslyQueuedU1Assets = [self.dataRepository resultsForEntityClass:[U1Asset class]369 NSArray *previouslyQueuedU1Assets = [self.dataRepository resultsForEntityClass:[U1Asset class]
355 matchingPredicate:p370 matchingPredicate:p
356 withSortDescriptors:[NSArray arrayWithObject:sortBy]371 withSortDescriptors:[NSArray arrayWithObject:sortBy]
357 error:&error];372 error:&error];
358 [previouslyQueuedU1Assets enumerateObjectsUsingBlock:^(U1Asset *u1asset, NSUInteger idx, BOOL *stop) {373 __block NSMutableArray *assetsDeletedFromLibrary = [NSMutableArray array];
359 if (u1asset.fileNode.parent == self.remoteUploadFolder)374
360 {375 [previouslyQueuedU1Assets enumerateObjectsUsingBlock:^(U1Asset *u1asset, NSUInteger idx, BOOL *stop) {
361 [self.assetsLibrary assetForURL:[NSURL URLWithString:u1asset.url]376 if (u1asset.fileNode.parent == self.remoteUploadFolder)
362 resultBlock:^(ALAsset *asset) {377 {
378 [self.assetsLibrary assetForURL:[NSURL URLWithString:u1asset.url]
379 resultBlock:^(ALAsset *asset) {
380 if (asset == nil)
381 {
382 NSLog(@"In the results block, but asset is nil!");
383 [assetsDeletedFromLibrary addObject:u1asset];
384 }
385 else
386 {
363 ALAssetRepresentation *rep = [asset defaultRepresentation];387 ALAssetRepresentation *rep = [asset defaultRepresentation];
364 // Belongs to LAM, could punt and let it get picked up by checkForNewAssets388 // Belongs to LAM, could punt and let it get picked up by checkForNewAssets
365 NSOperation *op = [self queueAutoUploadForAsset:u1asset andRepresentation:rep];389 NSOperation *op = [self queueAutoUploadForAsset:u1asset andRepresentation:rep];
366 if (op)390 if (op)
391 {
367 [self.autoUploadPreparationQueue addOperation:op];392 [self.autoUploadPreparationQueue addOperation:op];
368 } failureBlock:^(NSError *error) {393 }
369 NSLog(@"Error: %@", error);394 }
370 // TODO: delete asset395 } failureBlock:^(NSError *error) {
371 }];396 NSLog(@"Error: %@", error);
372 }397 [assetsDeletedFromLibrary addObject:u1asset];
373 else398 }];
399 }
400 else
401 {
402 NSURL *imageURL = [NSURL URLWithString:u1asset.url];
403
404 [self.assetsLibrary assetForURL:imageURL
405 resultBlock:^(ALAsset *asset) {
406 if (asset == nil)
407 {
408 NSLog(@"In the results block, but asset is nil!");
409 [assetsDeletedFromLibrary addObject:u1asset];
410 }
411 else
412 {
413 ALAssetRepresentation *representation = [asset defaultRepresentation];
414 NSString *mimetype = (id)UTTypeCopyPreferredTagWithClass((CFStringRef)[representation UTI], kUTTagClassMIMEType);
415
416 U1AssetRepresenationDataProvider *provider = [[U1AssetRepresenationDataProvider alloc] init];
417 provider.assetURL = imageURL;
418
419 [self.filesClient uploadContentDataProvider:provider
420 toFolder:u1asset.fileNode.parent
421 withResourceName:u1asset.filename
422 withContentType:mimetype
423 withPriority:NSOperationQueuePriorityVeryHigh
424 progressBlock:^(long long bytesUploaded, long long totalBytes) {}
425 completionBlock:^(U1FileNode *updatedNode, NSError *error) {
426 u1asset.generation = updatedNode.generation;
427 }];
428 }
429 } failureBlock:^(NSError *error) {
430 NSLog(@"Error: %@", error);
431 [assetsDeletedFromLibrary addObject:u1asset];
432 }];
433 }
434 }];
435
436 // Iterate over the assetsDeletedFromLibrary, and clean them up.
437 [self.dataRepository dispatchAsyncBlockWithManagedObjectContext:^(NSManagedObjectContext *context) {
438 for (int i = 0; i < [assetsDeletedFromLibrary count]; i++)
439 {
440 U1Asset *assetToBeDeleted = [assetsDeletedFromLibrary objectAtIndex:i];
441 U1FileNode *placeholderNode = assetToBeDeleted.fileNode;
442 [context deleteObject:assetToBeDeleted];
443 if (placeholderNode.generation == nil)
374 {444 {
375 NSURL *imageURL = [NSURL URLWithString:u1asset.url];445 [context deleteObject:placeholderNode];
376
377 [self.assetsLibrary assetForURL:imageURL
378 resultBlock:^(ALAsset *asset) {
379 ALAssetRepresentation *representation = [asset defaultRepresentation];
380 NSString *mimetype = (id)UTTypeCopyPreferredTagWithClass((CFStringRef)[representation UTI], kUTTagClassMIMEType);
381
382 U1AssetRepresenationDataProvider *provider = [[U1AssetRepresenationDataProvider alloc] init];
383 provider.assetURL = imageURL;
384
385 [self.filesClient uploadContentDataProvider:provider
386 toFolder:u1asset.fileNode.parent
387 withResourceName:u1asset.filename
388 withContentType:mimetype
389 withPriority:NSOperationQueuePriorityVeryHigh
390 progressBlock:^(long long bytesUploaded, long long totalBytes) {}
391 completionBlock:^(U1FileNode *updatedNode, NSError *error) {
392 u1asset.generation = updatedNode.generation;
393 }];
394 } failureBlock:^(NSError *error) {
395 NSLog(@"Error: %@", error);
396 }];
397 }446 }
398 }];447 [self.dataRepository save:NULL];
448 }
449 [assetsDeletedFromLibrary release];
450 }];
399}451}
400452
401- (NSString *)remoteUploadFolderPath;453- (NSString *)remoteUploadFolderPath;
402454
=== modified file 'Files/U1FileDetailsViewController.h'
--- Files/U1FileDetailsViewController.h 2011-11-28 21:01:34 +0000
+++ Files/U1FileDetailsViewController.h 2011-12-08 14:24:32 +0000
@@ -21,6 +21,7 @@
21@interface U1FileDetailsViewController : UIViewController <UITextFieldDelegate, UITableViewDataSource, UITableViewDelegate>21@interface U1FileDetailsViewController : UIViewController <UITextFieldDelegate, UITableViewDataSource, UITableViewDelegate>
2222
23@property (nonatomic, retain, readonly) IBOutlet UIView *loadingContainerView;23@property (nonatomic, retain, readonly) IBOutlet UIView *loadingContainerView;
24@property (nonatomic, retain, readonly) IBOutlet UIView *fileAncillaryDetailsView;
24@property (nonatomic, retain, readonly) IBOutlet UIImageView *iconImageView;25@property (nonatomic, retain, readonly) IBOutlet UIImageView *iconImageView;
25@property (nonatomic, retain, readonly) IBOutlet UILabel *nameLabel;26@property (nonatomic, retain, readonly) IBOutlet UILabel *nameLabel;
26@property (nonatomic, retain, readonly) IBOutlet UIActivityIndicatorView *loadingActivityView;27@property (nonatomic, retain, readonly) IBOutlet UIActivityIndicatorView *loadingActivityView;
2728
=== modified file 'Files/U1FileDetailsViewController.m'
--- Files/U1FileDetailsViewController.m 2011-11-28 22:44:42 +0000
+++ Files/U1FileDetailsViewController.m 2011-12-08 14:24:32 +0000
@@ -57,7 +57,7 @@
5757
58@implementation U1FileDetailsViewController58@implementation U1FileDetailsViewController
5959
60@synthesize loadingContainerView, iconImageView, nameLabel, loadingActivityView, sizeLabel, createdLabel, modifiedLabel, toolbar, publicURLLabel, renameTextField, sectionOneCells, sectionTwoCells, actionsTableView, publishSwitch, publishStatusLabel;60@synthesize loadingContainerView, fileAncillaryDetailsView, iconImageView, nameLabel, loadingActivityView, sizeLabel, createdLabel, modifiedLabel, toolbar, publicURLLabel, renameTextField, sectionOneCells, sectionTwoCells, actionsTableView, publishSwitch, publishStatusLabel;
61@synthesize node, docController, filesClient, contentURL, fileInfo;61@synthesize node, docController, filesClient, contentURL, fileInfo;
6262
63NSDateFormatter *modificationDateFormatter(void)63NSDateFormatter *modificationDateFormatter(void)
@@ -111,6 +111,7 @@
111- (void)dealloc;111- (void)dealloc;
112{112{
113 [loadingContainerView release];113 [loadingContainerView release];
114 [fileAncillaryDetailsView release];
114 [iconImageView release];115 [iconImageView release];
115 [nameLabel release];116 [nameLabel release];
116 [loadingActivityView release];117 [loadingActivityView release];
@@ -160,6 +161,15 @@
160 [self.publishStatusLabel setText:[self.node publicURLString]];161 [self.publishStatusLabel setText:[self.node publicURLString]];
161 self.fileInfo = [self.filesClient localInfoForNode:self.node];162 self.fileInfo = [self.filesClient localInfoForNode:self.node];
162 [self.iconImageView setImage:[self.docController.icons lastObject]];163 [self.iconImageView setImage:[self.docController.icons lastObject]];
164 // Set the fileAncillaryDetailsView's frame's origin.Y to be self.nameLabel's frame's height + 1
165 CGSize expectedLabelSize = [self.title sizeWithFont:self.nameLabel.font
166 constrainedToSize:self.nameLabel.frame.size
167 lineBreakMode:UILineBreakModeWordWrap];
168
169 [self.fileAncillaryDetailsView setFrame:CGRectMake(self.fileAncillaryDetailsView.frame.origin.x,
170 (self.nameLabel.frame.origin.y + expectedLabelSize.height + 1),
171 self.fileAncillaryDetailsView.frame.size.width,
172 self.fileAncillaryDetailsView.frame.size.height)];
163}173}
164174
165- (void)viewDidUnload;175- (void)viewDidUnload;
166176
=== modified file 'Files/U1FileDetailsViewController.xib'
--- Files/U1FileDetailsViewController.xib 2011-11-28 22:44:42 +0000
+++ Files/U1FileDetailsViewController.xib 2011-12-08 14:24:32 +0000
@@ -93,8 +93,8 @@
93 <int key="IBUIContentMode">7</int>93 <int key="IBUIContentMode">7</int>
94 <bool key="IBUIUserInteractionEnabled">NO</bool>94 <bool key="IBUIUserInteractionEnabled">NO</bool>
95 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>95 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
96 <string key="IBUIText"/>96 <string key="IBUIText">File.png</string>
97 <object class="NSColor" key="IBUITextColor">97 <object class="NSColor" key="IBUITextColor" id="425813574">
98 <int key="NSColorSpace">3</int>98 <int key="NSColorSpace">3</int>
99 <bytes key="NSWhite">MC4zMzMzMzMzMzMzAA</bytes>99 <bytes key="NSWhite">MC4zMzMzMzMzMzMzAA</bytes>
100 </object>100 </object>
@@ -120,7 +120,7 @@
120 <string key="NSFrame">{{105, 20}, {195, 48}}</string>120 <string key="NSFrame">{{105, 20}, {195, 48}}</string>
121 <reference key="NSSuperview" ref="346642923"/>121 <reference key="NSSuperview" ref="346642923"/>
122 <reference key="NSWindow"/>122 <reference key="NSWindow"/>
123 <reference key="NSNextKeyView" ref="591885325"/>123 <reference key="NSNextKeyView" ref="12890828"/>
124 <bool key="IBUIOpaque">NO</bool>124 <bool key="IBUIOpaque">NO</bool>
125 <bool key="IBUIClipsSubviews">YES</bool>125 <bool key="IBUIClipsSubviews">YES</bool>
126 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>126 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -147,15 +147,128 @@
147 <int key="NSfFlags">16</int>147 <int key="NSfFlags">16</int>
148 </object>148 </object>
149 </object>149 </object>
150 <object class="IBUIView" id="12890828">
151 <reference key="NSNextResponder" ref="346642923"/>
152 <int key="NSvFlags">292</int>
153 <array class="NSMutableArray" key="NSSubviews">
154 <object class="IBUILabel" id="723802363">
155 <reference key="NSNextResponder" ref="12890828"/>
156 <int key="NSvFlags">292</int>
157 <string key="NSFrame">{{40, 0}, {155, 20}}</string>
158 <reference key="NSSuperview" ref="12890828"/>
159 <reference key="NSWindow"/>
160 <reference key="NSNextKeyView" ref="759648964"/>
161 <bool key="IBUIOpaque">NO</bool>
162 <bool key="IBUIClipsSubviews">YES</bool>
163 <int key="IBUIContentMode">7</int>
164 <bool key="IBUIUserInteractionEnabled">NO</bool>
165 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
166 <string key="IBUIText">192KB</string>
167 <reference key="IBUITextColor" ref="425813574"/>
168 <nil key="IBUIHighlightedColor"/>
169 <int key="IBUIBaselineAdjustment">1</int>
170 <bool key="IBUIAdjustsFontSizeToFit">NO</bool>
171 <float key="IBUIMinimumFontSize">10</float>
172 <object class="IBUIFontDescription" key="IBUIFontDescription" id="769395091">
173 <string key="name">HelveticaNeue-Medium</string>
174 <string key="family">Helvetica Neue</string>
175 <int key="traits">0</int>
176 <double key="pointSize">14</double>
177 </object>
178 <object class="NSFont" key="IBUIFont" id="395422269">
179 <string key="NSName">HelveticaNeue-Medium</string>
180 <double key="NSSize">14</double>
181 <int key="NSfFlags">16</int>
182 </object>
183 </object>
184 <object class="IBUILabel" id="568016573">
185 <reference key="NSNextResponder" ref="12890828"/>
186 <int key="NSvFlags">292</int>
187 <string key="NSFrame">{{0, 1}, {32, 18}}</string>
188 <reference key="NSSuperview" ref="12890828"/>
189 <reference key="NSWindow"/>
190 <reference key="NSNextKeyView" ref="215006113"/>
191 <bool key="IBUIOpaque">NO</bool>
192 <bool key="IBUIClipsSubviews">YES</bool>
193 <int key="IBUIContentMode">7</int>
194 <bool key="IBUIUserInteractionEnabled">NO</bool>
195 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
196 <string key="IBUIText">Size:</string>
197 <reference key="IBUITextColor" ref="425813574"/>
198 <nil key="IBUIHighlightedColor"/>
199 <int key="IBUIBaselineAdjustment">1</int>
200 <float key="IBUIMinimumFontSize">10</float>
201 <object class="IBUIFontDescription" key="IBUIFontDescription" id="420297569">
202 <string key="name">HelveticaNeue-Bold</string>
203 <string key="family">Helvetica Neue</string>
204 <int key="traits">2</int>
205 <double key="pointSize">14</double>
206 </object>
207 <object class="NSFont" key="IBUIFont" id="362501816">
208 <string key="NSName">HelveticaNeue-Bold</string>
209 <double key="NSSize">14</double>
210 <int key="NSfFlags">16</int>
211 </object>
212 </object>
213 <object class="IBUILabel" id="215006113">
214 <reference key="NSNextResponder" ref="12890828"/>
215 <int key="NSvFlags">292</int>
216 <string key="NSFrame">{{0, 21}, {63, 18}}</string>
217 <reference key="NSSuperview" ref="12890828"/>
218 <reference key="NSWindow"/>
219 <reference key="NSNextKeyView" ref="723802363"/>
220 <bool key="IBUIOpaque">NO</bool>
221 <bool key="IBUIClipsSubviews">YES</bool>
222 <int key="IBUIContentMode">7</int>
223 <bool key="IBUIUserInteractionEnabled">NO</bool>
224 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
225 <string key="IBUIText">Modified:</string>
226 <reference key="IBUITextColor" ref="425813574"/>
227 <nil key="IBUIHighlightedColor"/>
228 <int key="IBUIBaselineAdjustment">1</int>
229 <float key="IBUIMinimumFontSize">10</float>
230 <reference key="IBUIFontDescription" ref="420297569"/>
231 <reference key="IBUIFont" ref="362501816"/>
232 </object>
233 <object class="IBUILabel" id="759648964">
234 <reference key="NSNextResponder" ref="12890828"/>
235 <int key="NSvFlags">292</int>
236 <string key="NSFrame">{{71, 21}, {124, 19}}</string>
237 <reference key="NSSuperview" ref="12890828"/>
238 <reference key="NSWindow"/>
239 <reference key="NSNextKeyView" ref="591885325"/>
240 <bool key="IBUIOpaque">NO</bool>
241 <bool key="IBUIClipsSubviews">YES</bool>
242 <int key="IBUIContentMode">7</int>
243 <bool key="IBUIUserInteractionEnabled">NO</bool>
244 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
245 <string key="IBUIText">about 5 minutes ago</string>
246 <reference key="IBUITextColor" ref="425813574"/>
247 <nil key="IBUIHighlightedColor"/>
248 <int key="IBUIBaselineAdjustment">1</int>
249 <bool key="IBUIAdjustsFontSizeToFit">NO</bool>
250 <float key="IBUIMinimumFontSize">10</float>
251 <reference key="IBUIFontDescription" ref="769395091"/>
252 <reference key="IBUIFont" ref="395422269"/>
253 </object>
254 </array>
255 <string key="NSFrame">{{105, 76}, {195, 59}}</string>
256 <reference key="NSSuperview" ref="346642923"/>
257 <reference key="NSWindow"/>
258 <reference key="NSNextKeyView" ref="568016573"/>
259 <object class="NSColor" key="IBUIBackgroundColor" id="436719790">
260 <int key="NSColorSpace">3</int>
261 <bytes key="NSWhite">MCAwAA</bytes>
262 </object>
263 <bool key="IBUIOpaque">NO</bool>
264 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
265 </object>
150 </array>266 </array>
151 <string key="NSFrameSize">{320, 104}</string>267 <string key="NSFrameSize">{320, 104}</string>
152 <reference key="NSSuperview" ref="149170707"/>268 <reference key="NSSuperview" ref="149170707"/>
153 <reference key="NSWindow"/>269 <reference key="NSWindow"/>
154 <reference key="NSNextKeyView" ref="749932571"/>270 <reference key="NSNextKeyView" ref="749932571"/>
155 <object class="NSColor" key="IBUIBackgroundColor" id="436719790">271 <reference key="IBUIBackgroundColor" ref="436719790"/>
156 <int key="NSColorSpace">3</int>
157 <bytes key="NSWhite">MCAwAA</bytes>
158 </object>
159 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>272 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
160 </object>273 </object>
161 </array>274 </array>
@@ -640,6 +753,30 @@
640 </object>753 </object>
641 <object class="IBConnectionRecord">754 <object class="IBConnectionRecord">
642 <object class="IBCocoaTouchOutletConnection" key="connection">755 <object class="IBCocoaTouchOutletConnection" key="connection">
756 <string key="label">fileAncillaryDetailsView</string>
757 <reference key="source" ref="372490531"/>
758 <reference key="destination" ref="12890828"/>
759 </object>
760 <int key="connectionID">102</int>
761 </object>
762 <object class="IBConnectionRecord">
763 <object class="IBCocoaTouchOutletConnection" key="connection">
764 <string key="label">sizeLabel</string>
765 <reference key="source" ref="372490531"/>
766 <reference key="destination" ref="723802363"/>
767 </object>
768 <int key="connectionID">104</int>
769 </object>
770 <object class="IBConnectionRecord">
771 <object class="IBCocoaTouchOutletConnection" key="connection">
772 <string key="label">modifiedLabel</string>
773 <reference key="source" ref="372490531"/>
774 <reference key="destination" ref="759648964"/>
775 </object>
776 <int key="connectionID">106</int>
777 </object>
778 <object class="IBConnectionRecord">
779 <object class="IBCocoaTouchOutletConnection" key="connection">
643 <string key="label">delegate</string>780 <string key="label">delegate</string>
644 <reference key="source" ref="1038751454"/>781 <reference key="source" ref="1038751454"/>
645 <reference key="destination" ref="372490531"/>782 <reference key="destination" ref="372490531"/>
@@ -761,6 +898,7 @@
761 <reference ref="675538218"/>898 <reference ref="675538218"/>
762 <reference ref="749932571"/>899 <reference ref="749932571"/>
763 <reference ref="1038751454"/>900 <reference ref="1038751454"/>
901 <reference ref="12890828"/>
764 </array>902 </array>
765 <reference key="parent" ref="149170707"/>903 <reference key="parent" ref="149170707"/>
766 </object>904 </object>
@@ -863,6 +1001,39 @@
863 <reference key="object" ref="827181736"/>1001 <reference key="object" ref="827181736"/>
864 <reference key="parent" ref="502759082"/>1002 <reference key="parent" ref="502759082"/>
865 </object>1003 </object>
1004 <object class="IBObjectRecord">
1005 <int key="objectID">97</int>
1006 <reference key="object" ref="12890828"/>
1007 <array class="NSMutableArray" key="children">
1008 <reference ref="723802363"/>
1009 <reference ref="759648964"/>
1010 <reference ref="215006113"/>
1011 <reference ref="568016573"/>
1012 </array>
1013 <reference key="parent" ref="346642923"/>
1014 </object>
1015 <object class="IBObjectRecord">
1016 <int key="objectID">91</int>
1017 <reference key="object" ref="723802363"/>
1018 <reference key="parent" ref="12890828"/>
1019 <string key="objectName">Size Label</string>
1020 </object>
1021 <object class="IBObjectRecord">
1022 <int key="objectID">93</int>
1023 <reference key="object" ref="759648964"/>
1024 <reference key="parent" ref="12890828"/>
1025 <string key="objectName">Last Modified Label</string>
1026 </object>
1027 <object class="IBObjectRecord">
1028 <int key="objectID">101</int>
1029 <reference key="object" ref="215006113"/>
1030 <reference key="parent" ref="12890828"/>
1031 </object>
1032 <object class="IBObjectRecord">
1033 <int key="objectID">98</int>
1034 <reference key="object" ref="568016573"/>
1035 <reference key="parent" ref="12890828"/>
1036 </object>
866 </array>1037 </array>
867 </object>1038 </object>
868 <dictionary class="NSMutableDictionary" key="flattenedProperties">1039 <dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -871,6 +1042,8 @@
871 <string key="-2.CustomClassName">UIResponder</string>1042 <string key="-2.CustomClassName">UIResponder</string>
872 <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>1043 <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
873 <string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>1044 <string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
1045 <string key="101.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
1046 <string key="17.CustomClassName">U1TopPinningLabel</string>
874 <string key="17.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>1047 <string key="17.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
875 <string key="32.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>1048 <string key="32.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
876 <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>1049 <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -893,12 +1066,16 @@
893 <string key="75.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>1066 <string key="75.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
894 <string key="86.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>1067 <string key="86.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
895 <string key="87.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>1068 <string key="87.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
1069 <string key="91.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
1070 <string key="93.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
1071 <string key="97.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
1072 <string key="98.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
896 </dictionary>1073 </dictionary>
897 <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>1074 <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
898 <nil key="activeLocalization"/>1075 <nil key="activeLocalization"/>
899 <dictionary class="NSMutableDictionary" key="localizations"/>1076 <dictionary class="NSMutableDictionary" key="localizations"/>
900 <nil key="sourceID"/>1077 <nil key="sourceID"/>
901 <int key="maxID">90</int>1078 <int key="maxID">106</int>
902 </object>1079 </object>
903 <object class="IBClassDescriber" key="IBDocument.Classes">1080 <object class="IBClassDescriber" key="IBDocument.Classes">
904 <array class="NSMutableArray" key="referencedPartialClassDescriptions">1081 <array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -908,6 +1085,7 @@
908 <dictionary class="NSMutableDictionary" key="outlets">1085 <dictionary class="NSMutableDictionary" key="outlets">
909 <string key="actionsTableView">UITableView</string>1086 <string key="actionsTableView">UITableView</string>
910 <string key="createdLabel">UILabel</string>1087 <string key="createdLabel">UILabel</string>
1088 <string key="fileAncillaryDetailsView">UIView</string>
911 <string key="iconImageView">UIImageView</string>1089 <string key="iconImageView">UIImageView</string>
912 <string key="loadingActivityView">UIActivityIndicatorView</string>1090 <string key="loadingActivityView">UIActivityIndicatorView</string>
913 <string key="loadingContainerView">UIView</string>1091 <string key="loadingContainerView">UIView</string>
@@ -929,6 +1107,10 @@
929 <string key="name">createdLabel</string>1107 <string key="name">createdLabel</string>
930 <string key="candidateClassName">UILabel</string>1108 <string key="candidateClassName">UILabel</string>
931 </object>1109 </object>
1110 <object class="IBToOneOutletInfo" key="fileAncillaryDetailsView">
1111 <string key="name">fileAncillaryDetailsView</string>
1112 <string key="candidateClassName">UIView</string>
1113 </object>
932 <object class="IBToOneOutletInfo" key="iconImageView">1114 <object class="IBToOneOutletInfo" key="iconImageView">
933 <string key="name">iconImageView</string>1115 <string key="name">iconImageView</string>
934 <string key="candidateClassName">UIImageView</string>1116 <string key="candidateClassName">UIImageView</string>
@@ -991,6 +1173,14 @@
991 <string key="minorKey">./Classes/U1FileDetailsViewController.h</string>1173 <string key="minorKey">./Classes/U1FileDetailsViewController.h</string>
992 </object>1174 </object>
993 </object>1175 </object>
1176 <object class="IBPartialClassDescription">
1177 <string key="className">U1TopPinningLabel</string>
1178 <string key="superclassName">UILabel</string>
1179 <object class="IBClassDescriptionSource" key="sourceIdentifier">
1180 <string key="majorKey">IBProjectSource</string>
1181 <string key="minorKey">./Classes/U1TopPinningLabel.h</string>
1182 </object>
1183 </object>
994 </array>1184 </array>
995 </object>1185 </object>
996 <int key="IBDocument.localizationMode">0</int>1186 <int key="IBDocument.localizationMode">0</int>
9971187
=== modified file 'Files/U1FilesClient.m'
--- Files/U1FilesClient.m 2011-12-07 22:53:01 +0000
+++ Files/U1FilesClient.m 2011-12-08 14:24:32 +0000
@@ -19,6 +19,7 @@
1919
20#import "Reachability.h"20#import "Reachability.h"
2121
22#import "U1AccountManager.h"
22#import "U1DataRepository.h"23#import "U1DataRepository.h"
23#import "U1FilesService.h"24#import "U1FilesService.h"
24#import "U1FileNode.h"25#import "U1FileNode.h"
@@ -65,12 +66,14 @@
65 [self.uploadsQueue setMaxConcurrentOperationCount:1];66 [self.uploadsQueue setMaxConcurrentOperationCount:1];
66 NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];67 NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
67 [defaultCenter addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil];68 [defaultCenter addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil];
69 [defaultCenter addObserver:self selector:@selector(didSignOut:) name:U1AccountManagerDidSignOut object:nil];
68 return self;70 return self;
69}71}
7072
71- (void)dealloc;73- (void)dealloc;
72{74{
73 [[NSNotificationCenter defaultCenter] removeObserver:self];75 [[NSNotificationCenter defaultCenter] removeObserver:self];
76 [uploadsQueue cancelAllOperations];
74 [uploadsQueue release];77 [uploadsQueue release];
75 [super dealloc];78 [super dealloc];
76}79}
@@ -95,6 +98,11 @@
95 }98 }
96}99}
97100
101- (void)didSignOut:(NSNotification*)notification;
102{
103 [self.uploadsQueue cancelAllOperations];
104}
105
98- (id)accountInfoWithCompletionBlock:(void(^)(NSDictionary *accountInfo, NSError *error))completionBlock;106- (id)accountInfoWithCompletionBlock:(void(^)(NSDictionary *accountInfo, NSError *error))completionBlock;
99{107{
100 return [self.filesService accountInfoWithCompletionBlock:completionBlock];108 return [self.filesService accountInfoWithCompletionBlock:completionBlock];
101109
=== modified file 'Files/U1FilesService.h'
--- Files/U1FilesService.h 2011-12-07 22:53:01 +0000
+++ Files/U1FilesService.h 2011-12-08 14:24:32 +0000
@@ -20,7 +20,6 @@
2020
21@protocol U1UploadDataProvider <NSObject>21@protocol U1UploadDataProvider <NSObject>
22- (void)prepareDataStreamWithBlock:(void(^)(NSInputStream *dataStream, NSString *mimeType, NSUInteger length, NSError *error))block;22- (void)prepareDataStreamWithBlock:(void(^)(NSInputStream *dataStream, NSString *mimeType, NSUInteger length, NSError *error))block;
23- (NSData *)serializeData;
24@end23@end
2524
2625
2726
=== modified file 'Files/U1FilesService.m'
--- Files/U1FilesService.m 2011-12-07 22:53:01 +0000
+++ Files/U1FilesService.m 2011-12-08 14:24:32 +0000
@@ -363,6 +363,13 @@
363 id result = nil;363 id result = nil;
364 NSHTTPURLResponse *response = httpOperation.response;364 NSHTTPURLResponse *response = httpOperation.response;
365 NSError *error = httpOperation.error;365 NSError *error = httpOperation.error;
366
367 if ([response statusCode] == 401)
368 {
369 [[U1AccountManager sharedAccountManager] removeCredentials];
370 return;
371 }
372
366 if (!error &&373 if (!error &&
367 ![[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)] containsIndex:[response statusCode]])374 ![[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)] containsIndex:[response statusCode]])
368 {375 {
369376
=== modified file 'Files/U1FolderNode.h'
--- Files/U1FolderNode.h 2011-09-08 16:59:34 +0000
+++ Files/U1FolderNode.h 2011-12-08 14:24:32 +0000
@@ -19,5 +19,5 @@
1919
2020
21@interface U1FolderNode : _U1FolderNode21@interface U1FolderNode : _U1FolderNode
2222@property (nonatomic, readonly) NSNumber *size;
23@end23@end
2424
=== modified file 'Files/U1FolderNode.m'
--- Files/U1FolderNode.m 2011-10-26 03:39:52 +0000
+++ Files/U1FolderNode.m 2011-12-08 14:24:32 +0000
@@ -29,4 +29,9 @@
29 return YES;29 return YES;
30}30}
3131
32- (NSNumber*)size;
33{
34 return 0;
35}
36
32@end37@end
3338
=== modified file 'Files/U1FolderViewController.h'
--- Files/U1FolderViewController.h 2011-09-08 16:59:34 +0000
+++ Files/U1FolderViewController.h 2011-12-08 14:24:32 +0000
@@ -25,7 +25,6 @@
25@interface U1FolderViewController : PullRefreshTableViewController25@interface U1FolderViewController : PullRefreshTableViewController
2626
27@property (nonatomic, retain, readonly) IBOutlet UITableViewCell *loadingCell;27@property (nonatomic, retain, readonly) IBOutlet UITableViewCell *loadingCell;
28
29@property (assign) id<U1FolderViewControllerDelegate> delegate;28@property (assign) id<U1FolderViewControllerDelegate> delegate;
30@property (retain) U1FilesClient *filesClient;29@property (retain) U1FilesClient *filesClient;
3130
3231
=== modified file 'Files/U1FolderViewController.m'
--- Files/U1FolderViewController.m 2011-12-07 22:53:01 +0000
+++ Files/U1FolderViewController.m 2011-12-08 14:24:32 +0000
@@ -384,6 +384,28 @@
384 [self loadInfoForNode];384 [self loadInfoForNode];
385}385}
386386
387- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section;
388{
389 UILabel *footerLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 22)] autorelease];
390 footerLabel.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.85f];
391 [footerLabel setFont:[UIFont systemFontOfSize:14.f]];
392 [footerLabel setShadowColor:[UIColor whiteColor]];
393 [footerLabel setShadowOffset:CGSizeMake(0, 1)];
394 [footerLabel setTextAlignment:UITextAlignmentCenter];
395
396 int numItems = [[[self.resultsController sections] objectAtIndex:0] numberOfObjects];
397 NSNumber *folderRawSize = [[self.resultsController fetchedObjects] valueForKeyPath:@"@sum.size"];
398 NSString *folderSize = [self.byteSizeTransformer transformedValue:folderRawSize];
399
400 [footerLabel setText:[NSString stringWithFormat:@"%d items, %@", numItems, folderSize]];
401
402 return footerLabel;
403}
404
405- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;
406{
407 return 22.0f;
408}
387409
388#pragma mark Private Methods410#pragma mark Private Methods
389411
@@ -400,7 +422,7 @@
400 [self.resultsController setDelegate:self];422 [self.resultsController setDelegate:self];
401 [self.tableView reloadData];423 [self.tableView reloadData];
402 }424 }
403 425
404 if (resultsDataSourceType == U1DataSourceRemote)426 if (resultsDataSourceType == U1DataSourceRemote)
405 [self stopLoading];427 [self stopLoading];
406 428
407429
=== modified file 'Files/U1FolderViewController.xib'
--- Files/U1FolderViewController.xib 2011-08-31 14:56:30 +0000
+++ Files/U1FolderViewController.xib 2011-12-08 14:24:32 +0000
@@ -1,14 +1,14 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">2<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
3 <data>3 <data>
4 <int key="IBDocument.SystemTarget">1056</int>4 <int key="IBDocument.SystemTarget">1280</int>
5 <string key="IBDocument.SystemVersion">10K549</string>5 <string key="IBDocument.SystemVersion">10K549</string>
6 <string key="IBDocument.InterfaceBuilderVersion">1306</string>6 <string key="IBDocument.InterfaceBuilderVersion">1938</string>
7 <string key="IBDocument.AppKitVersion">1038.36</string>7 <string key="IBDocument.AppKitVersion">1038.36</string>
8 <string key="IBDocument.HIToolboxVersion">461.00</string>8 <string key="IBDocument.HIToolboxVersion">461.00</string>
9 <object class="NSMutableDictionary" key="IBDocument.PluginVersions">9 <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
10 <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>10 <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
11 <string key="NS.object.0">301</string>11 <string key="NS.object.0">933</string>
12 </object>12 </object>
13 <object class="NSArray" key="IBDocument.IntegratedClassDependencies">13 <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
14 <bool key="EncodedWithXMLCoder">YES</bool>14 <bool key="EncodedWithXMLCoder">YES</bool>
@@ -23,11 +23,8 @@
23 <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>23 <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
24 </object>24 </object>
25 <object class="NSMutableDictionary" key="IBDocument.Metadata">25 <object class="NSMutableDictionary" key="IBDocument.Metadata">
26 <bool key="EncodedWithXMLCoder">YES</bool>26 <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
27 <object class="NSArray" key="dict.sortedKeys" id="0">27 <integer value="1" key="NS.object.0"/>
28 <bool key="EncodedWithXMLCoder">YES</bool>
29 </object>
30 <reference key="dict.values" ref="0"/>
31 </object>28 </object>
32 <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">29 <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
33 <bool key="EncodedWithXMLCoder">YES</bool>30 <bool key="EncodedWithXMLCoder">YES</bool>
@@ -45,7 +42,6 @@
45 <string key="NSFrameSize">{320, 460}</string>42 <string key="NSFrameSize">{320, 460}</string>
46 <reference key="NSSuperview"/>43 <reference key="NSSuperview"/>
47 <reference key="NSWindow"/>44 <reference key="NSWindow"/>
48 <reference key="NSNextKeyView"/>
49 <object class="NSColor" key="IBUIBackgroundColor">45 <object class="NSColor" key="IBUIBackgroundColor">
50 <int key="NSColorSpace">3</int>46 <int key="NSColorSpace">3</int>
51 <bytes key="NSWhite">MQA</bytes>47 <bytes key="NSWhite">MQA</bytes>
@@ -61,7 +57,7 @@
61 <float key="IBUISectionFooterHeight">22</float>57 <float key="IBUISectionFooterHeight">22</float>
62 </object>58 </object>
63 <object class="IBUITableViewCell" id="864788526">59 <object class="IBUITableViewCell" id="864788526">
64 <reference key="NSNextResponder"/>60 <nil key="NSNextResponder"/>
65 <int key="NSvFlags">292</int>61 <int key="NSvFlags">292</int>
66 <object class="NSMutableArray" key="NSSubviews">62 <object class="NSMutableArray" key="NSSubviews">
67 <bool key="EncodedWithXMLCoder">YES</bool>63 <bool key="EncodedWithXMLCoder">YES</bool>
@@ -75,18 +71,12 @@
75 <int key="NSvFlags">292</int>71 <int key="NSvFlags">292</int>
76 <string key="NSFrame">{{136, 17}, {75, 21}}</string>72 <string key="NSFrame">{{136, 17}, {75, 21}}</string>
77 <reference key="NSSuperview" ref="834389907"/>73 <reference key="NSSuperview" ref="834389907"/>
78 <reference key="NSWindow"/>
79 <bool key="IBUIOpaque">NO</bool>74 <bool key="IBUIOpaque">NO</bool>
80 <bool key="IBUIClipsSubviews">YES</bool>75 <bool key="IBUIClipsSubviews">YES</bool>
81 <int key="IBUIContentMode">7</int>76 <int key="IBUIContentMode">7</int>
82 <bool key="IBUIUserInteractionEnabled">NO</bool>77 <bool key="IBUIUserInteractionEnabled">NO</bool>
83 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>78 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
84 <string key="IBUIText">Loading...</string>79 <string key="IBUIText">Loading...</string>
85 <object class="NSFont" key="IBUIFont">
86 <string key="NSName">Helvetica</string>
87 <double key="NSSize">17</double>
88 <int key="NSfFlags">16</int>
89 </object>
90 <object class="NSColor" key="IBUITextColor">80 <object class="NSColor" key="IBUITextColor">
91 <int key="NSColorSpace">1</int>81 <int key="NSColorSpace">1</int>
92 <bytes key="NSRGB">MCAwIDAAA</bytes>82 <bytes key="NSRGB">MCAwIDAAA</bytes>
@@ -94,13 +84,23 @@
94 <nil key="IBUIHighlightedColor"/>84 <nil key="IBUIHighlightedColor"/>
95 <int key="IBUIBaselineAdjustment">1</int>85 <int key="IBUIBaselineAdjustment">1</int>
96 <float key="IBUIMinimumFontSize">10</float>86 <float key="IBUIMinimumFontSize">10</float>
87 <object class="IBUIFontDescription" key="IBUIFontDescription">
88 <string key="name">Helvetica</string>
89 <string key="family">Helvetica</string>
90 <int key="traits">0</int>
91 <double key="pointSize">17</double>
92 </object>
93 <object class="NSFont" key="IBUIFont">
94 <string key="NSName">Helvetica</string>
95 <double key="NSSize">17</double>
96 <int key="NSfFlags">16</int>
97 </object>
97 </object>98 </object>
98 <object class="IBUIActivityIndicatorView" id="42067442">99 <object class="IBUIActivityIndicatorView" id="42067442">
99 <reference key="NSNextResponder" ref="834389907"/>100 <reference key="NSNextResponder" ref="834389907"/>
100 <int key="NSvFlags">292</int>101 <int key="NSvFlags">292</int>
101 <string key="NSFrame">{{108, 18}, {20, 20}}</string>102 <string key="NSFrame">{{108, 18}, {20, 20}}</string>
102 <reference key="NSSuperview" ref="834389907"/>103 <reference key="NSSuperview" ref="834389907"/>
103 <reference key="NSWindow"/>
104 <reference key="NSNextKeyView" ref="317026358"/>104 <reference key="NSNextKeyView" ref="317026358"/>
105 <bool key="IBUIOpaque">NO</bool>105 <bool key="IBUIOpaque">NO</bool>
106 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>106 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -109,9 +109,8 @@
109 <int key="IBUIStyle">2</int>109 <int key="IBUIStyle">2</int>
110 </object>110 </object>
111 </object>111 </object>
112 <string key="NSFrameSize">{320, 54}</string>112 <string key="NSFrameSize">{320, 53}</string>
113 <reference key="NSSuperview" ref="864788526"/>113 <reference key="NSSuperview" ref="864788526"/>
114 <reference key="NSWindow"/>
115 <reference key="NSNextKeyView" ref="42067442"/>114 <reference key="NSNextKeyView" ref="42067442"/>
116 <object class="NSColor" key="IBUIBackgroundColor">115 <object class="NSColor" key="IBUIBackgroundColor">
117 <int key="NSColorSpace">3</int>116 <int key="NSColorSpace">3</int>
@@ -125,15 +124,12 @@
125 </object>124 </object>
126 </object>125 </object>
127 <string key="NSFrameSize">{320, 54}</string>126 <string key="NSFrameSize">{320, 54}</string>
128 <reference key="NSSuperview"/>
129 <reference key="NSWindow"/>
130 <reference key="NSNextKeyView" ref="834389907"/>127 <reference key="NSNextKeyView" ref="834389907"/>
131 <object class="NSColor" key="IBUIBackgroundColor">128 <object class="NSColor" key="IBUIBackgroundColor">
132 <int key="NSColorSpace">1</int>129 <int key="NSColorSpace">1</int>
133 <bytes key="NSRGB">MSAxIDEAA</bytes>130 <bytes key="NSRGB">MSAxIDEAA</bytes>
134 </object>131 </object>
135 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>132 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
136 <int key="IBUISeparatorStyle">1</int>
137 <reference key="IBUIContentView" ref="834389907"/>133 <reference key="IBUIContentView" ref="834389907"/>
138 </object>134 </object>
139 </object>135 </object>
@@ -162,7 +158,9 @@
162 <bool key="EncodedWithXMLCoder">YES</bool>158 <bool key="EncodedWithXMLCoder">YES</bool>
163 <object class="IBObjectRecord">159 <object class="IBObjectRecord">
164 <int key="objectID">0</int>160 <int key="objectID">0</int>
165 <reference key="object" ref="0"/>161 <object class="NSArray" key="object" id="0">
162 <bool key="EncodedWithXMLCoder">YES</bool>
163 </object>
166 <reference key="children" ref="1000"/>164 <reference key="children" ref="1000"/>
167 <nil key="parent"/>165 <nil key="parent"/>
168 </object>166 </object>
@@ -242,7 +240,7 @@
242 <reference key="dict.values" ref="0"/>240 <reference key="dict.values" ref="0"/>
243 </object>241 </object>
244 <nil key="sourceID"/>242 <nil key="sourceID"/>
245 <int key="maxID">13</int>243 <int key="maxID">17</int>
246 </object>244 </object>
247 <object class="IBClassDescriber" key="IBDocument.Classes">245 <object class="IBClassDescriber" key="IBDocument.Classes">
248 <object class="NSMutableArray" key="referencedPartialClassDescriptions">246 <object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -284,6 +282,6 @@
284 </object>282 </object>
285 <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>283 <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
286 <int key="IBDocument.defaultPropertyAccessControl">3</int>284 <int key="IBDocument.defaultPropertyAccessControl">3</int>
287 <string key="IBCocoaTouchPluginVersion">301</string>285 <string key="IBCocoaTouchPluginVersion">933</string>
288 </data>286 </data>
289</archive>287</archive>
290288
=== modified file 'Files/U1LoginController.m'
--- Files/U1LoginController.m 2011-08-31 14:56:30 +0000
+++ Files/U1LoginController.m 2011-12-08 14:24:32 +0000
@@ -80,9 +80,10 @@
80 [self.loginViewController.view setUserInteractionEnabled:NO];80 [self.loginViewController.view setUserInteractionEnabled:NO];
81 81
82 // 1. get/create U1 oauth token82 // 1. get/create U1 oauth token
83 NSString *tokenName = [NSString stringWithFormat:@"Ubuntu One @ %@", [[UIDevice currentDevice] name]];
83 NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:84 NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
84 @"authenticate", @"ws.op",85 @"authenticate", @"ws.op",
85 @"Ubuntu One @ iOS", @"token_name",86 tokenName, @"token_name",
86 nil];87 nil];
87 NSString * paramsString = UOSSOEncodedStringFromParametersDictionary(params);88 NSString * paramsString = UOSSOEncodedStringFromParametersDictionary(params);
88 89
8990
=== added file 'Files/U1TopPinningLabel.h'
--- Files/U1TopPinningLabel.h 1970-01-01 00:00:00 +0000
+++ Files/U1TopPinningLabel.h 2011-12-08 14:24:32 +0000
@@ -0,0 +1,20 @@
1//
2// Copyright 2011 Canonical Ltd.
3//
4// This program is free software: you can redistribute it and/or modify it
5// under the terms of the GNU Affero General Public License version 3,
6// as published by the Free Software Foundation.
7//
8// This program is distributed in the hope that it will be useful, but
9// WITHOUT ANY WARRANTY; without even the implied warranties of
10// MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11// PURPOSE. See the GNU Affero General Public License for more details.
12//
13// You should have received a copy of the GNU Affero General Public License
14// along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16#import <UIKit/UIKit.h>
17
18@interface U1TopPinningLabel : UILabel
19
20@end
021
=== added file 'Files/U1TopPinningLabel.m'
--- Files/U1TopPinningLabel.m 1970-01-01 00:00:00 +0000
+++ Files/U1TopPinningLabel.m 2011-12-08 14:24:32 +0000
@@ -0,0 +1,30 @@
1//
2// Copyright 2011 Canonical Ltd.
3//
4// This program is free software: you can redistribute it and/or modify it
5// under the terms of the GNU Affero General Public License version 3,
6// as published by the Free Software Foundation.
7//
8// This program is distributed in the hope that it will be useful, but
9// WITHOUT ANY WARRANTY; without even the implied warranties of
10// MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11// PURPOSE. See the GNU Affero General Public License for more details.
12//
13// You should have received a copy of the GNU Affero General Public License
14// along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16#import "U1TopPinningLabel.h"
17
18@implementation U1TopPinningLabel
19
20- (CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines {
21 CGRect textRect = [super textRectForBounds:bounds limitedToNumberOfLines:numberOfLines];
22 textRect.origin.y = bounds.origin.y;
23 return textRect;
24}
25
26-(void)drawTextInRect:(CGRect)requestedRect {
27 CGRect actualRect = [self textRectForBounds:requestedRect limitedToNumberOfLines:self.numberOfLines];
28 [super drawTextInRect:actualRect];
29}
30@end
031
=== modified file 'Files/U1UploadOperation.m'
--- Files/U1UploadOperation.m 2011-12-07 22:53:01 +0000
+++ Files/U1UploadOperation.m 2011-12-08 14:24:32 +0000
@@ -71,6 +71,12 @@
7171
72- (void)beginUpload;72- (void)beginUpload;
73{73{
74 if ([self isCancelled])
75 {
76 [self finishExecuting];
77 return;
78 }
79
74 dispatch_async(dispatch_get_main_queue(), ^(void) {80 dispatch_async(dispatch_get_main_queue(), ^(void) {
7581
76 [self.fileInfo setUploadPercentage:0.0];82 [self.fileInfo setUploadPercentage:0.0];
@@ -99,7 +105,26 @@
99 if (filesServiceError != nil)105 if (filesServiceError != nil)
100 {106 {
101 self.error = filesServiceError;107 self.error = filesServiceError;
102 [self beginUpload];108 if ([filesServiceError.domain isEqualToString:@"nonexistentAsset"])
109 {
110 // Asset is gone, delete U1Asset and potentially the Node, and stop running
111 U1DataRepository *dataRepository = [U1DataRepository sharedDataRepository];
112 [dataRepository dispatchAsyncBlockWithManagedObjectContext:^(NSManagedObjectContext *context) {
113 U1Asset *assetToBeDeleted = self.fileNode.asset;
114 [context deleteObject:assetToBeDeleted];
115 if (self.fileNode.generation == nil)
116 {
117 [context deleteObject:self.fileNode];
118 }
119 [dataRepository save:NULL];
120 }];
121 [self finishExecuting];
122 }
123 else
124 {
125 // File upload timed out or something else, so reschedule
126 [self beginUpload];
127 }
103 }128 }
104 else129 else
105 {130 {

Subscribers

People subscribed via source and target branches

to all changes: