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
1=== modified file 'Files.xcodeproj/project.pbxproj'
2--- Files.xcodeproj/project.pbxproj 2011-12-07 22:53:01 +0000
3+++ Files.xcodeproj/project.pbxproj 2011-12-08 14:24:32 +0000
4@@ -19,6 +19,7 @@
5 916BF76C145A464E00D4FE06 /* settings@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 916BF76A145A464E00D4FE06 /* settings@2x.png */; };
6 916BF77A145AF6B900D4FE06 /* Entitlements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 916BF779145AF6B900D4FE06 /* Entitlements.plist */; };
7 916E0082143C9A3A0037F6D3 /* U1UploadsPoolViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 916E0081143C9A390037F6D3 /* U1UploadsPoolViewController.m */; };
8+ 9172C870148FA4F600FC7737 /* U1TopPinningLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9172C86F148FA4F600FC7737 /* U1TopPinningLabel.m */; };
9 917692C7148DB50500316986 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 917692C6148DB50500316986 /* MobileCoreServices.framework */; };
10 917ADEC71458954E00980FD4 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 917ADEC51458954E00980FD4 /* Icon.png */; };
11 917ADEC81458954E00980FD4 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 917ADEC61458954E00980FD4 /* Icon@2x.png */; };
12@@ -170,6 +171,8 @@
13 916BF779145AF6B900D4FE06 /* Entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Entitlements.plist; sourceTree = "<group>"; };
14 916E0080143C9A390037F6D3 /* U1UploadsPoolViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = U1UploadsPoolViewController.h; sourceTree = "<group>"; };
15 916E0081143C9A390037F6D3 /* U1UploadsPoolViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = U1UploadsPoolViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
16+ 9172C86E148FA4F600FC7737 /* U1TopPinningLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = U1TopPinningLabel.h; sourceTree = "<group>"; };
17+ 9172C86F148FA4F600FC7737 /* U1TopPinningLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = U1TopPinningLabel.m; sourceTree = "<group>"; };
18 917692C6148DB50500316986 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
19 917ADEC014585DC800980FD4 /* U1Files 1.0-9.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "U1Files 1.0-9.xcdatamodel"; sourceTree = "<group>"; };
20 917ADEC51458954E00980FD4 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
21@@ -667,6 +670,8 @@
22 91EC184D145B8E3B00DF31F4 /* U1SettingsViewController.xib */,
23 9623AE6014868F7000ACDF1C /* U1ReportingInputStream.h */,
24 9623AE6114868F7000ACDF1C /* U1ReportingInputStream.m */,
25+ 9172C86E148FA4F600FC7737 /* U1TopPinningLabel.h */,
26+ 9172C86F148FA4F600FC7737 /* U1TopPinningLabel.m */,
27 );
28 path = Files;
29 sourceTree = "<group>";
30@@ -1054,6 +1059,7 @@
31 910393E81475B118004DE69D /* U1AutoUploadOperation.m in Sources */,
32 9623AE6214868F7000ACDF1C /* U1ReportingInputStream.m in Sources */,
33 96D1A8E0148DB9F800B210E7 /* U1TransparentToolbar.m in Sources */,
34+ 9172C870148FA4F600FC7737 /* U1TopPinningLabel.m in Sources */,
35 );
36 runOnlyForDeploymentPostprocessing = 0;
37 };
38
39=== modified file 'Files/Files-Info.plist'
40--- Files/Files-Info.plist 2011-12-05 19:53:10 +0000
41+++ Files/Files-Info.plist 2011-12-08 14:24:32 +0000
42@@ -41,11 +41,13 @@
43 <key>CFBundleSignature</key>
44 <string>????</string>
45 <key>CFBundleVersion</key>
46- <string>23</string>
47+ <string>24</string>
48 <key>LSRequiresIPhoneOS</key>
49 <true/>
50 <key>NSMainNibFile</key>
51 <string>MainWindow_iPhone</string>
52+ <key>UIPrerenderedIcon</key>
53+ <true/>
54 <key>UISupportedInterfaceOrientations</key>
55 <array>
56 <string>UIInterfaceOrientationPortrait</string>
57
58=== modified file 'Files/U1AssetRepresenationDataProvider.m'
59--- Files/U1AssetRepresenationDataProvider.m 2011-12-07 22:53:01 +0000
60+++ Files/U1AssetRepresenationDataProvider.m 2011-12-08 14:24:32 +0000
61@@ -46,14 +46,25 @@
62 {
63 [library assetForURL:self.assetURL resultBlock:^(ALAsset *asset) {
64
65- ALAssetRepresentation *representation = [asset defaultRepresentation];
66- uint8_t *buffer = (uint8_t*)malloc(representation.size);
67- NSUInteger length = [representation getBytes:buffer fromOffset:0 length:representation.size error:nil];
68- NSData *imageData = [NSData dataWithBytesNoCopy:buffer length:length freeWhenDone:YES];
69- NSString *mimeType = (id)UTTypeCopyPreferredTagWithClass((CFStringRef)[representation UTI], kUTTagClassMIMEType);
70- NSInputStream *dataStream = [NSInputStream inputStreamWithData:imageData];
71- if (block)
72- block(dataStream, mimeType, length, nil);
73+ if (asset == nil)
74+ {
75+ if (block)
76+ {
77+ NSError *error = [NSError errorWithDomain:@"nonexistentAsset" code:1 userInfo:nil];
78+ block(nil, nil, nil, error);
79+ }
80+ }
81+ else
82+ {
83+ ALAssetRepresentation *representation = [asset defaultRepresentation];
84+ uint8_t *buffer = (uint8_t*)malloc(representation.size);
85+ NSUInteger length = [representation getBytes:buffer fromOffset:0 length:representation.size error:nil];
86+ NSData *imageData = [NSData dataWithBytesNoCopy:buffer length:length freeWhenDone:YES];
87+ NSString *mimeType = (id)UTTypeCopyPreferredTagWithClass((CFStringRef)[representation UTI], kUTTagClassMIMEType);
88+ NSInputStream *dataStream = [NSInputStream inputStreamWithData:imageData];
89+ if (block)
90+ block(dataStream, mimeType, length, nil);
91+ }
92
93 } failureBlock:^(NSError *error) {
94 if (block)
95@@ -61,13 +72,4 @@
96 }];
97 }
98
99-- (NSData *)serializeData;
100-{
101-// Byte *buffer = (Byte*)malloc(self.representation.size);
102-// NSUInteger length = [self.representation getBytes:buffer fromOffset:0 length:self.representation.size error:nil];
103-// NSData *assetData = [NSData dataWithBytesNoCopy:buffer length:length freeWhenDone:YES];
104-// return assetData;
105- return nil;
106-}
107-
108 @end
109
110=== modified file 'Files/U1AutoUploadOperation.m'
111--- Files/U1AutoUploadOperation.m 2011-12-07 22:53:01 +0000
112+++ Files/U1AutoUploadOperation.m 2011-12-08 14:24:32 +0000
113@@ -55,7 +55,14 @@
114 self.executing = YES;
115 [self didChangeValueForKey:@"isExecuting"];
116
117- [self beginUpload];
118+ if ([self isCancelled])
119+ {
120+ [self finishExecuting];
121+ }
122+ else
123+ {
124+ [self beginUpload];
125+ }
126 }
127
128 - (void)dealloc
129
130=== modified file 'Files/U1AutoUploadsManager.m'
131--- Files/U1AutoUploadsManager.m 2011-12-07 22:53:01 +0000
132+++ Files/U1AutoUploadsManager.m 2011-12-08 14:24:32 +0000
133@@ -18,6 +18,7 @@
134
135 #import "Reachability.h"
136
137+#import "U1AccountManager.h"
138 #import "U1Asset.h"
139 #import "U1AssetRepresenationDataProvider.h"
140 #import "U1AutoUploadOperation.h"
141@@ -77,6 +78,7 @@
142 dataRepository = [U1DataRepository sharedDataRepository];
143 [defaultCenter addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil];
144 [defaultCenter addObserver:self selector:@selector(volumesFetched:) name:@"volumesFetched" object:nil];
145+ [defaultCenter addObserver:self selector:@selector(didSignOut:) name:U1AccountManagerDidSignOut object:nil];
146 return self;
147 }
148
149@@ -157,8 +159,16 @@
150 }
151 if (!found)
152 {
153+ static BOOL creatingUploadVolume = NO;
154+
155+ if (creatingUploadVolume)
156+ return;
157+
158+ creatingUploadVolume = YES;
159+
160 [self.filesClient createVolumeAtPath:[self remoteUploadFolderPath]
161 completionBlock:^(U1Volume *volume, NSError *error) {
162+ creatingUploadVolume = NO;
163 if (error == nil)
164 {
165 self.remoteUploadFolder = volume.rootFolder;
166@@ -181,6 +191,11 @@
167 // We received a list of volumes. If our upload folder is not among them, prime it.
168 }
169
170+- (void)didSignOut:(NSNotification*)notification;
171+{
172+ [self.autoUploadPreparationQueue cancelAllOperations];
173+}
174+
175 - (void)fetchRemoteUploadFolderContents;
176 {
177 // fetch the remote upload folder contents, and stash the children objects somewhere locally.
178@@ -348,54 +363,91 @@
179 - (void)queuePreviousUploads;
180 {
181 // 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.
182- NSPredicate *p = [NSPredicate predicateWithFormat:@"generation = %@", nil];
183- NSError *error = nil;
184- NSSortDescriptor *sortBy = [NSSortDescriptor sortDescriptorWithKey:@"filename" ascending:YES];
185- NSArray *previouslyQueuedU1Assets = [self.dataRepository resultsForEntityClass:[U1Asset class]
186- matchingPredicate:p
187- withSortDescriptors:[NSArray arrayWithObject:sortBy]
188- error:&error];
189- [previouslyQueuedU1Assets enumerateObjectsUsingBlock:^(U1Asset *u1asset, NSUInteger idx, BOOL *stop) {
190- if (u1asset.fileNode.parent == self.remoteUploadFolder)
191- {
192- [self.assetsLibrary assetForURL:[NSURL URLWithString:u1asset.url]
193- resultBlock:^(ALAsset *asset) {
194+ NSPredicate *p = [NSPredicate predicateWithFormat:@"generation = %@", nil];
195+ NSError *error = nil;
196+ NSSortDescriptor *sortBy = [NSSortDescriptor sortDescriptorWithKey:@"filename" ascending:YES];
197+ NSArray *previouslyQueuedU1Assets = [self.dataRepository resultsForEntityClass:[U1Asset class]
198+ matchingPredicate:p
199+ withSortDescriptors:[NSArray arrayWithObject:sortBy]
200+ error:&error];
201+ __block NSMutableArray *assetsDeletedFromLibrary = [NSMutableArray array];
202+
203+ [previouslyQueuedU1Assets enumerateObjectsUsingBlock:^(U1Asset *u1asset, NSUInteger idx, BOOL *stop) {
204+ if (u1asset.fileNode.parent == self.remoteUploadFolder)
205+ {
206+ [self.assetsLibrary assetForURL:[NSURL URLWithString:u1asset.url]
207+ resultBlock:^(ALAsset *asset) {
208+ if (asset == nil)
209+ {
210+ NSLog(@"In the results block, but asset is nil!");
211+ [assetsDeletedFromLibrary addObject:u1asset];
212+ }
213+ else
214+ {
215 ALAssetRepresentation *rep = [asset defaultRepresentation];
216 // Belongs to LAM, could punt and let it get picked up by checkForNewAssets
217 NSOperation *op = [self queueAutoUploadForAsset:u1asset andRepresentation:rep];
218 if (op)
219+ {
220 [self.autoUploadPreparationQueue addOperation:op];
221- } failureBlock:^(NSError *error) {
222- NSLog(@"Error: %@", error);
223- // TODO: delete asset
224- }];
225- }
226- else
227+ }
228+ }
229+ } failureBlock:^(NSError *error) {
230+ NSLog(@"Error: %@", error);
231+ [assetsDeletedFromLibrary addObject:u1asset];
232+ }];
233+ }
234+ else
235+ {
236+ NSURL *imageURL = [NSURL URLWithString:u1asset.url];
237+
238+ [self.assetsLibrary assetForURL:imageURL
239+ resultBlock:^(ALAsset *asset) {
240+ if (asset == nil)
241+ {
242+ NSLog(@"In the results block, but asset is nil!");
243+ [assetsDeletedFromLibrary addObject:u1asset];
244+ }
245+ else
246+ {
247+ ALAssetRepresentation *representation = [asset defaultRepresentation];
248+ NSString *mimetype = (id)UTTypeCopyPreferredTagWithClass((CFStringRef)[representation UTI], kUTTagClassMIMEType);
249+
250+ U1AssetRepresenationDataProvider *provider = [[U1AssetRepresenationDataProvider alloc] init];
251+ provider.assetURL = imageURL;
252+
253+ [self.filesClient uploadContentDataProvider:provider
254+ toFolder:u1asset.fileNode.parent
255+ withResourceName:u1asset.filename
256+ withContentType:mimetype
257+ withPriority:NSOperationQueuePriorityVeryHigh
258+ progressBlock:^(long long bytesUploaded, long long totalBytes) {}
259+ completionBlock:^(U1FileNode *updatedNode, NSError *error) {
260+ u1asset.generation = updatedNode.generation;
261+ }];
262+ }
263+ } failureBlock:^(NSError *error) {
264+ NSLog(@"Error: %@", error);
265+ [assetsDeletedFromLibrary addObject:u1asset];
266+ }];
267+ }
268+ }];
269+
270+ // Iterate over the assetsDeletedFromLibrary, and clean them up.
271+ [self.dataRepository dispatchAsyncBlockWithManagedObjectContext:^(NSManagedObjectContext *context) {
272+ for (int i = 0; i < [assetsDeletedFromLibrary count]; i++)
273+ {
274+ U1Asset *assetToBeDeleted = [assetsDeletedFromLibrary objectAtIndex:i];
275+ U1FileNode *placeholderNode = assetToBeDeleted.fileNode;
276+ [context deleteObject:assetToBeDeleted];
277+ if (placeholderNode.generation == nil)
278 {
279- NSURL *imageURL = [NSURL URLWithString:u1asset.url];
280-
281- [self.assetsLibrary assetForURL:imageURL
282- resultBlock:^(ALAsset *asset) {
283- ALAssetRepresentation *representation = [asset defaultRepresentation];
284- NSString *mimetype = (id)UTTypeCopyPreferredTagWithClass((CFStringRef)[representation UTI], kUTTagClassMIMEType);
285-
286- U1AssetRepresenationDataProvider *provider = [[U1AssetRepresenationDataProvider alloc] init];
287- provider.assetURL = imageURL;
288-
289- [self.filesClient uploadContentDataProvider:provider
290- toFolder:u1asset.fileNode.parent
291- withResourceName:u1asset.filename
292- withContentType:mimetype
293- withPriority:NSOperationQueuePriorityVeryHigh
294- progressBlock:^(long long bytesUploaded, long long totalBytes) {}
295- completionBlock:^(U1FileNode *updatedNode, NSError *error) {
296- u1asset.generation = updatedNode.generation;
297- }];
298- } failureBlock:^(NSError *error) {
299- NSLog(@"Error: %@", error);
300- }];
301+ [context deleteObject:placeholderNode];
302 }
303- }];
304+ [self.dataRepository save:NULL];
305+ }
306+ [assetsDeletedFromLibrary release];
307+ }];
308 }
309
310 - (NSString *)remoteUploadFolderPath;
311
312=== modified file 'Files/U1FileDetailsViewController.h'
313--- Files/U1FileDetailsViewController.h 2011-11-28 21:01:34 +0000
314+++ Files/U1FileDetailsViewController.h 2011-12-08 14:24:32 +0000
315@@ -21,6 +21,7 @@
316 @interface U1FileDetailsViewController : UIViewController <UITextFieldDelegate, UITableViewDataSource, UITableViewDelegate>
317
318 @property (nonatomic, retain, readonly) IBOutlet UIView *loadingContainerView;
319+@property (nonatomic, retain, readonly) IBOutlet UIView *fileAncillaryDetailsView;
320 @property (nonatomic, retain, readonly) IBOutlet UIImageView *iconImageView;
321 @property (nonatomic, retain, readonly) IBOutlet UILabel *nameLabel;
322 @property (nonatomic, retain, readonly) IBOutlet UIActivityIndicatorView *loadingActivityView;
323
324=== modified file 'Files/U1FileDetailsViewController.m'
325--- Files/U1FileDetailsViewController.m 2011-11-28 22:44:42 +0000
326+++ Files/U1FileDetailsViewController.m 2011-12-08 14:24:32 +0000
327@@ -57,7 +57,7 @@
328
329 @implementation U1FileDetailsViewController
330
331-@synthesize loadingContainerView, iconImageView, nameLabel, loadingActivityView, sizeLabel, createdLabel, modifiedLabel, toolbar, publicURLLabel, renameTextField, sectionOneCells, sectionTwoCells, actionsTableView, publishSwitch, publishStatusLabel;
332+@synthesize loadingContainerView, fileAncillaryDetailsView, iconImageView, nameLabel, loadingActivityView, sizeLabel, createdLabel, modifiedLabel, toolbar, publicURLLabel, renameTextField, sectionOneCells, sectionTwoCells, actionsTableView, publishSwitch, publishStatusLabel;
333 @synthesize node, docController, filesClient, contentURL, fileInfo;
334
335 NSDateFormatter *modificationDateFormatter(void)
336@@ -111,6 +111,7 @@
337 - (void)dealloc;
338 {
339 [loadingContainerView release];
340+ [fileAncillaryDetailsView release];
341 [iconImageView release];
342 [nameLabel release];
343 [loadingActivityView release];
344@@ -160,6 +161,15 @@
345 [self.publishStatusLabel setText:[self.node publicURLString]];
346 self.fileInfo = [self.filesClient localInfoForNode:self.node];
347 [self.iconImageView setImage:[self.docController.icons lastObject]];
348+ // Set the fileAncillaryDetailsView's frame's origin.Y to be self.nameLabel's frame's height + 1
349+ CGSize expectedLabelSize = [self.title sizeWithFont:self.nameLabel.font
350+ constrainedToSize:self.nameLabel.frame.size
351+ lineBreakMode:UILineBreakModeWordWrap];
352+
353+ [self.fileAncillaryDetailsView setFrame:CGRectMake(self.fileAncillaryDetailsView.frame.origin.x,
354+ (self.nameLabel.frame.origin.y + expectedLabelSize.height + 1),
355+ self.fileAncillaryDetailsView.frame.size.width,
356+ self.fileAncillaryDetailsView.frame.size.height)];
357 }
358
359 - (void)viewDidUnload;
360
361=== modified file 'Files/U1FileDetailsViewController.xib'
362--- Files/U1FileDetailsViewController.xib 2011-11-28 22:44:42 +0000
363+++ Files/U1FileDetailsViewController.xib 2011-12-08 14:24:32 +0000
364@@ -93,8 +93,8 @@
365 <int key="IBUIContentMode">7</int>
366 <bool key="IBUIUserInteractionEnabled">NO</bool>
367 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
368- <string key="IBUIText"/>
369- <object class="NSColor" key="IBUITextColor">
370+ <string key="IBUIText">File.png</string>
371+ <object class="NSColor" key="IBUITextColor" id="425813574">
372 <int key="NSColorSpace">3</int>
373 <bytes key="NSWhite">MC4zMzMzMzMzMzMzAA</bytes>
374 </object>
375@@ -120,7 +120,7 @@
376 <string key="NSFrame">{{105, 20}, {195, 48}}</string>
377 <reference key="NSSuperview" ref="346642923"/>
378 <reference key="NSWindow"/>
379- <reference key="NSNextKeyView" ref="591885325"/>
380+ <reference key="NSNextKeyView" ref="12890828"/>
381 <bool key="IBUIOpaque">NO</bool>
382 <bool key="IBUIClipsSubviews">YES</bool>
383 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
384@@ -147,15 +147,128 @@
385 <int key="NSfFlags">16</int>
386 </object>
387 </object>
388+ <object class="IBUIView" id="12890828">
389+ <reference key="NSNextResponder" ref="346642923"/>
390+ <int key="NSvFlags">292</int>
391+ <array class="NSMutableArray" key="NSSubviews">
392+ <object class="IBUILabel" id="723802363">
393+ <reference key="NSNextResponder" ref="12890828"/>
394+ <int key="NSvFlags">292</int>
395+ <string key="NSFrame">{{40, 0}, {155, 20}}</string>
396+ <reference key="NSSuperview" ref="12890828"/>
397+ <reference key="NSWindow"/>
398+ <reference key="NSNextKeyView" ref="759648964"/>
399+ <bool key="IBUIOpaque">NO</bool>
400+ <bool key="IBUIClipsSubviews">YES</bool>
401+ <int key="IBUIContentMode">7</int>
402+ <bool key="IBUIUserInteractionEnabled">NO</bool>
403+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
404+ <string key="IBUIText">192KB</string>
405+ <reference key="IBUITextColor" ref="425813574"/>
406+ <nil key="IBUIHighlightedColor"/>
407+ <int key="IBUIBaselineAdjustment">1</int>
408+ <bool key="IBUIAdjustsFontSizeToFit">NO</bool>
409+ <float key="IBUIMinimumFontSize">10</float>
410+ <object class="IBUIFontDescription" key="IBUIFontDescription" id="769395091">
411+ <string key="name">HelveticaNeue-Medium</string>
412+ <string key="family">Helvetica Neue</string>
413+ <int key="traits">0</int>
414+ <double key="pointSize">14</double>
415+ </object>
416+ <object class="NSFont" key="IBUIFont" id="395422269">
417+ <string key="NSName">HelveticaNeue-Medium</string>
418+ <double key="NSSize">14</double>
419+ <int key="NSfFlags">16</int>
420+ </object>
421+ </object>
422+ <object class="IBUILabel" id="568016573">
423+ <reference key="NSNextResponder" ref="12890828"/>
424+ <int key="NSvFlags">292</int>
425+ <string key="NSFrame">{{0, 1}, {32, 18}}</string>
426+ <reference key="NSSuperview" ref="12890828"/>
427+ <reference key="NSWindow"/>
428+ <reference key="NSNextKeyView" ref="215006113"/>
429+ <bool key="IBUIOpaque">NO</bool>
430+ <bool key="IBUIClipsSubviews">YES</bool>
431+ <int key="IBUIContentMode">7</int>
432+ <bool key="IBUIUserInteractionEnabled">NO</bool>
433+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
434+ <string key="IBUIText">Size:</string>
435+ <reference key="IBUITextColor" ref="425813574"/>
436+ <nil key="IBUIHighlightedColor"/>
437+ <int key="IBUIBaselineAdjustment">1</int>
438+ <float key="IBUIMinimumFontSize">10</float>
439+ <object class="IBUIFontDescription" key="IBUIFontDescription" id="420297569">
440+ <string key="name">HelveticaNeue-Bold</string>
441+ <string key="family">Helvetica Neue</string>
442+ <int key="traits">2</int>
443+ <double key="pointSize">14</double>
444+ </object>
445+ <object class="NSFont" key="IBUIFont" id="362501816">
446+ <string key="NSName">HelveticaNeue-Bold</string>
447+ <double key="NSSize">14</double>
448+ <int key="NSfFlags">16</int>
449+ </object>
450+ </object>
451+ <object class="IBUILabel" id="215006113">
452+ <reference key="NSNextResponder" ref="12890828"/>
453+ <int key="NSvFlags">292</int>
454+ <string key="NSFrame">{{0, 21}, {63, 18}}</string>
455+ <reference key="NSSuperview" ref="12890828"/>
456+ <reference key="NSWindow"/>
457+ <reference key="NSNextKeyView" ref="723802363"/>
458+ <bool key="IBUIOpaque">NO</bool>
459+ <bool key="IBUIClipsSubviews">YES</bool>
460+ <int key="IBUIContentMode">7</int>
461+ <bool key="IBUIUserInteractionEnabled">NO</bool>
462+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
463+ <string key="IBUIText">Modified:</string>
464+ <reference key="IBUITextColor" ref="425813574"/>
465+ <nil key="IBUIHighlightedColor"/>
466+ <int key="IBUIBaselineAdjustment">1</int>
467+ <float key="IBUIMinimumFontSize">10</float>
468+ <reference key="IBUIFontDescription" ref="420297569"/>
469+ <reference key="IBUIFont" ref="362501816"/>
470+ </object>
471+ <object class="IBUILabel" id="759648964">
472+ <reference key="NSNextResponder" ref="12890828"/>
473+ <int key="NSvFlags">292</int>
474+ <string key="NSFrame">{{71, 21}, {124, 19}}</string>
475+ <reference key="NSSuperview" ref="12890828"/>
476+ <reference key="NSWindow"/>
477+ <reference key="NSNextKeyView" ref="591885325"/>
478+ <bool key="IBUIOpaque">NO</bool>
479+ <bool key="IBUIClipsSubviews">YES</bool>
480+ <int key="IBUIContentMode">7</int>
481+ <bool key="IBUIUserInteractionEnabled">NO</bool>
482+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
483+ <string key="IBUIText">about 5 minutes ago</string>
484+ <reference key="IBUITextColor" ref="425813574"/>
485+ <nil key="IBUIHighlightedColor"/>
486+ <int key="IBUIBaselineAdjustment">1</int>
487+ <bool key="IBUIAdjustsFontSizeToFit">NO</bool>
488+ <float key="IBUIMinimumFontSize">10</float>
489+ <reference key="IBUIFontDescription" ref="769395091"/>
490+ <reference key="IBUIFont" ref="395422269"/>
491+ </object>
492+ </array>
493+ <string key="NSFrame">{{105, 76}, {195, 59}}</string>
494+ <reference key="NSSuperview" ref="346642923"/>
495+ <reference key="NSWindow"/>
496+ <reference key="NSNextKeyView" ref="568016573"/>
497+ <object class="NSColor" key="IBUIBackgroundColor" id="436719790">
498+ <int key="NSColorSpace">3</int>
499+ <bytes key="NSWhite">MCAwAA</bytes>
500+ </object>
501+ <bool key="IBUIOpaque">NO</bool>
502+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
503+ </object>
504 </array>
505 <string key="NSFrameSize">{320, 104}</string>
506 <reference key="NSSuperview" ref="149170707"/>
507 <reference key="NSWindow"/>
508 <reference key="NSNextKeyView" ref="749932571"/>
509- <object class="NSColor" key="IBUIBackgroundColor" id="436719790">
510- <int key="NSColorSpace">3</int>
511- <bytes key="NSWhite">MCAwAA</bytes>
512- </object>
513+ <reference key="IBUIBackgroundColor" ref="436719790"/>
514 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
515 </object>
516 </array>
517@@ -640,6 +753,30 @@
518 </object>
519 <object class="IBConnectionRecord">
520 <object class="IBCocoaTouchOutletConnection" key="connection">
521+ <string key="label">fileAncillaryDetailsView</string>
522+ <reference key="source" ref="372490531"/>
523+ <reference key="destination" ref="12890828"/>
524+ </object>
525+ <int key="connectionID">102</int>
526+ </object>
527+ <object class="IBConnectionRecord">
528+ <object class="IBCocoaTouchOutletConnection" key="connection">
529+ <string key="label">sizeLabel</string>
530+ <reference key="source" ref="372490531"/>
531+ <reference key="destination" ref="723802363"/>
532+ </object>
533+ <int key="connectionID">104</int>
534+ </object>
535+ <object class="IBConnectionRecord">
536+ <object class="IBCocoaTouchOutletConnection" key="connection">
537+ <string key="label">modifiedLabel</string>
538+ <reference key="source" ref="372490531"/>
539+ <reference key="destination" ref="759648964"/>
540+ </object>
541+ <int key="connectionID">106</int>
542+ </object>
543+ <object class="IBConnectionRecord">
544+ <object class="IBCocoaTouchOutletConnection" key="connection">
545 <string key="label">delegate</string>
546 <reference key="source" ref="1038751454"/>
547 <reference key="destination" ref="372490531"/>
548@@ -761,6 +898,7 @@
549 <reference ref="675538218"/>
550 <reference ref="749932571"/>
551 <reference ref="1038751454"/>
552+ <reference ref="12890828"/>
553 </array>
554 <reference key="parent" ref="149170707"/>
555 </object>
556@@ -863,6 +1001,39 @@
557 <reference key="object" ref="827181736"/>
558 <reference key="parent" ref="502759082"/>
559 </object>
560+ <object class="IBObjectRecord">
561+ <int key="objectID">97</int>
562+ <reference key="object" ref="12890828"/>
563+ <array class="NSMutableArray" key="children">
564+ <reference ref="723802363"/>
565+ <reference ref="759648964"/>
566+ <reference ref="215006113"/>
567+ <reference ref="568016573"/>
568+ </array>
569+ <reference key="parent" ref="346642923"/>
570+ </object>
571+ <object class="IBObjectRecord">
572+ <int key="objectID">91</int>
573+ <reference key="object" ref="723802363"/>
574+ <reference key="parent" ref="12890828"/>
575+ <string key="objectName">Size Label</string>
576+ </object>
577+ <object class="IBObjectRecord">
578+ <int key="objectID">93</int>
579+ <reference key="object" ref="759648964"/>
580+ <reference key="parent" ref="12890828"/>
581+ <string key="objectName">Last Modified Label</string>
582+ </object>
583+ <object class="IBObjectRecord">
584+ <int key="objectID">101</int>
585+ <reference key="object" ref="215006113"/>
586+ <reference key="parent" ref="12890828"/>
587+ </object>
588+ <object class="IBObjectRecord">
589+ <int key="objectID">98</int>
590+ <reference key="object" ref="568016573"/>
591+ <reference key="parent" ref="12890828"/>
592+ </object>
593 </array>
594 </object>
595 <dictionary class="NSMutableDictionary" key="flattenedProperties">
596@@ -871,6 +1042,8 @@
597 <string key="-2.CustomClassName">UIResponder</string>
598 <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
599 <string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
600+ <string key="101.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
601+ <string key="17.CustomClassName">U1TopPinningLabel</string>
602 <string key="17.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
603 <string key="32.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
604 <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
605@@ -893,12 +1066,16 @@
606 <string key="75.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
607 <string key="86.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
608 <string key="87.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
609+ <string key="91.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
610+ <string key="93.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
611+ <string key="97.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
612+ <string key="98.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
613 </dictionary>
614 <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
615 <nil key="activeLocalization"/>
616 <dictionary class="NSMutableDictionary" key="localizations"/>
617 <nil key="sourceID"/>
618- <int key="maxID">90</int>
619+ <int key="maxID">106</int>
620 </object>
621 <object class="IBClassDescriber" key="IBDocument.Classes">
622 <array class="NSMutableArray" key="referencedPartialClassDescriptions">
623@@ -908,6 +1085,7 @@
624 <dictionary class="NSMutableDictionary" key="outlets">
625 <string key="actionsTableView">UITableView</string>
626 <string key="createdLabel">UILabel</string>
627+ <string key="fileAncillaryDetailsView">UIView</string>
628 <string key="iconImageView">UIImageView</string>
629 <string key="loadingActivityView">UIActivityIndicatorView</string>
630 <string key="loadingContainerView">UIView</string>
631@@ -929,6 +1107,10 @@
632 <string key="name">createdLabel</string>
633 <string key="candidateClassName">UILabel</string>
634 </object>
635+ <object class="IBToOneOutletInfo" key="fileAncillaryDetailsView">
636+ <string key="name">fileAncillaryDetailsView</string>
637+ <string key="candidateClassName">UIView</string>
638+ </object>
639 <object class="IBToOneOutletInfo" key="iconImageView">
640 <string key="name">iconImageView</string>
641 <string key="candidateClassName">UIImageView</string>
642@@ -991,6 +1173,14 @@
643 <string key="minorKey">./Classes/U1FileDetailsViewController.h</string>
644 </object>
645 </object>
646+ <object class="IBPartialClassDescription">
647+ <string key="className">U1TopPinningLabel</string>
648+ <string key="superclassName">UILabel</string>
649+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
650+ <string key="majorKey">IBProjectSource</string>
651+ <string key="minorKey">./Classes/U1TopPinningLabel.h</string>
652+ </object>
653+ </object>
654 </array>
655 </object>
656 <int key="IBDocument.localizationMode">0</int>
657
658=== modified file 'Files/U1FilesClient.m'
659--- Files/U1FilesClient.m 2011-12-07 22:53:01 +0000
660+++ Files/U1FilesClient.m 2011-12-08 14:24:32 +0000
661@@ -19,6 +19,7 @@
662
663 #import "Reachability.h"
664
665+#import "U1AccountManager.h"
666 #import "U1DataRepository.h"
667 #import "U1FilesService.h"
668 #import "U1FileNode.h"
669@@ -65,12 +66,14 @@
670 [self.uploadsQueue setMaxConcurrentOperationCount:1];
671 NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
672 [defaultCenter addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil];
673+ [defaultCenter addObserver:self selector:@selector(didSignOut:) name:U1AccountManagerDidSignOut object:nil];
674 return self;
675 }
676
677 - (void)dealloc;
678 {
679 [[NSNotificationCenter defaultCenter] removeObserver:self];
680+ [uploadsQueue cancelAllOperations];
681 [uploadsQueue release];
682 [super dealloc];
683 }
684@@ -95,6 +98,11 @@
685 }
686 }
687
688+- (void)didSignOut:(NSNotification*)notification;
689+{
690+ [self.uploadsQueue cancelAllOperations];
691+}
692+
693 - (id)accountInfoWithCompletionBlock:(void(^)(NSDictionary *accountInfo, NSError *error))completionBlock;
694 {
695 return [self.filesService accountInfoWithCompletionBlock:completionBlock];
696
697=== modified file 'Files/U1FilesService.h'
698--- Files/U1FilesService.h 2011-12-07 22:53:01 +0000
699+++ Files/U1FilesService.h 2011-12-08 14:24:32 +0000
700@@ -20,7 +20,6 @@
701
702 @protocol U1UploadDataProvider <NSObject>
703 - (void)prepareDataStreamWithBlock:(void(^)(NSInputStream *dataStream, NSString *mimeType, NSUInteger length, NSError *error))block;
704-- (NSData *)serializeData;
705 @end
706
707
708
709=== modified file 'Files/U1FilesService.m'
710--- Files/U1FilesService.m 2011-12-07 22:53:01 +0000
711+++ Files/U1FilesService.m 2011-12-08 14:24:32 +0000
712@@ -363,6 +363,13 @@
713 id result = nil;
714 NSHTTPURLResponse *response = httpOperation.response;
715 NSError *error = httpOperation.error;
716+
717+ if ([response statusCode] == 401)
718+ {
719+ [[U1AccountManager sharedAccountManager] removeCredentials];
720+ return;
721+ }
722+
723 if (!error &&
724 ![[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)] containsIndex:[response statusCode]])
725 {
726
727=== modified file 'Files/U1FolderNode.h'
728--- Files/U1FolderNode.h 2011-09-08 16:59:34 +0000
729+++ Files/U1FolderNode.h 2011-12-08 14:24:32 +0000
730@@ -19,5 +19,5 @@
731
732
733 @interface U1FolderNode : _U1FolderNode
734-
735+@property (nonatomic, readonly) NSNumber *size;
736 @end
737
738=== modified file 'Files/U1FolderNode.m'
739--- Files/U1FolderNode.m 2011-10-26 03:39:52 +0000
740+++ Files/U1FolderNode.m 2011-12-08 14:24:32 +0000
741@@ -29,4 +29,9 @@
742 return YES;
743 }
744
745+- (NSNumber*)size;
746+{
747+ return 0;
748+}
749+
750 @end
751
752=== modified file 'Files/U1FolderViewController.h'
753--- Files/U1FolderViewController.h 2011-09-08 16:59:34 +0000
754+++ Files/U1FolderViewController.h 2011-12-08 14:24:32 +0000
755@@ -25,7 +25,6 @@
756 @interface U1FolderViewController : PullRefreshTableViewController
757
758 @property (nonatomic, retain, readonly) IBOutlet UITableViewCell *loadingCell;
759-
760 @property (assign) id<U1FolderViewControllerDelegate> delegate;
761 @property (retain) U1FilesClient *filesClient;
762
763
764=== modified file 'Files/U1FolderViewController.m'
765--- Files/U1FolderViewController.m 2011-12-07 22:53:01 +0000
766+++ Files/U1FolderViewController.m 2011-12-08 14:24:32 +0000
767@@ -384,6 +384,28 @@
768 [self loadInfoForNode];
769 }
770
771+- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section;
772+{
773+ UILabel *footerLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 22)] autorelease];
774+ footerLabel.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.85f];
775+ [footerLabel setFont:[UIFont systemFontOfSize:14.f]];
776+ [footerLabel setShadowColor:[UIColor whiteColor]];
777+ [footerLabel setShadowOffset:CGSizeMake(0, 1)];
778+ [footerLabel setTextAlignment:UITextAlignmentCenter];
779+
780+ int numItems = [[[self.resultsController sections] objectAtIndex:0] numberOfObjects];
781+ NSNumber *folderRawSize = [[self.resultsController fetchedObjects] valueForKeyPath:@"@sum.size"];
782+ NSString *folderSize = [self.byteSizeTransformer transformedValue:folderRawSize];
783+
784+ [footerLabel setText:[NSString stringWithFormat:@"%d items, %@", numItems, folderSize]];
785+
786+ return footerLabel;
787+}
788+
789+- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;
790+{
791+ return 22.0f;
792+}
793
794 #pragma mark Private Methods
795
796@@ -400,7 +422,7 @@
797 [self.resultsController setDelegate:self];
798 [self.tableView reloadData];
799 }
800-
801+
802 if (resultsDataSourceType == U1DataSourceRemote)
803 [self stopLoading];
804
805
806=== modified file 'Files/U1FolderViewController.xib'
807--- Files/U1FolderViewController.xib 2011-08-31 14:56:30 +0000
808+++ Files/U1FolderViewController.xib 2011-12-08 14:24:32 +0000
809@@ -1,14 +1,14 @@
810 <?xml version="1.0" encoding="UTF-8"?>
811 <archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
812 <data>
813- <int key="IBDocument.SystemTarget">1056</int>
814+ <int key="IBDocument.SystemTarget">1280</int>
815 <string key="IBDocument.SystemVersion">10K549</string>
816- <string key="IBDocument.InterfaceBuilderVersion">1306</string>
817+ <string key="IBDocument.InterfaceBuilderVersion">1938</string>
818 <string key="IBDocument.AppKitVersion">1038.36</string>
819 <string key="IBDocument.HIToolboxVersion">461.00</string>
820 <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
821 <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
822- <string key="NS.object.0">301</string>
823+ <string key="NS.object.0">933</string>
824 </object>
825 <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
826 <bool key="EncodedWithXMLCoder">YES</bool>
827@@ -23,11 +23,8 @@
828 <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
829 </object>
830 <object class="NSMutableDictionary" key="IBDocument.Metadata">
831- <bool key="EncodedWithXMLCoder">YES</bool>
832- <object class="NSArray" key="dict.sortedKeys" id="0">
833- <bool key="EncodedWithXMLCoder">YES</bool>
834- </object>
835- <reference key="dict.values" ref="0"/>
836+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
837+ <integer value="1" key="NS.object.0"/>
838 </object>
839 <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
840 <bool key="EncodedWithXMLCoder">YES</bool>
841@@ -45,7 +42,6 @@
842 <string key="NSFrameSize">{320, 460}</string>
843 <reference key="NSSuperview"/>
844 <reference key="NSWindow"/>
845- <reference key="NSNextKeyView"/>
846 <object class="NSColor" key="IBUIBackgroundColor">
847 <int key="NSColorSpace">3</int>
848 <bytes key="NSWhite">MQA</bytes>
849@@ -61,7 +57,7 @@
850 <float key="IBUISectionFooterHeight">22</float>
851 </object>
852 <object class="IBUITableViewCell" id="864788526">
853- <reference key="NSNextResponder"/>
854+ <nil key="NSNextResponder"/>
855 <int key="NSvFlags">292</int>
856 <object class="NSMutableArray" key="NSSubviews">
857 <bool key="EncodedWithXMLCoder">YES</bool>
858@@ -75,18 +71,12 @@
859 <int key="NSvFlags">292</int>
860 <string key="NSFrame">{{136, 17}, {75, 21}}</string>
861 <reference key="NSSuperview" ref="834389907"/>
862- <reference key="NSWindow"/>
863 <bool key="IBUIOpaque">NO</bool>
864 <bool key="IBUIClipsSubviews">YES</bool>
865 <int key="IBUIContentMode">7</int>
866 <bool key="IBUIUserInteractionEnabled">NO</bool>
867 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
868 <string key="IBUIText">Loading...</string>
869- <object class="NSFont" key="IBUIFont">
870- <string key="NSName">Helvetica</string>
871- <double key="NSSize">17</double>
872- <int key="NSfFlags">16</int>
873- </object>
874 <object class="NSColor" key="IBUITextColor">
875 <int key="NSColorSpace">1</int>
876 <bytes key="NSRGB">MCAwIDAAA</bytes>
877@@ -94,13 +84,23 @@
878 <nil key="IBUIHighlightedColor"/>
879 <int key="IBUIBaselineAdjustment">1</int>
880 <float key="IBUIMinimumFontSize">10</float>
881+ <object class="IBUIFontDescription" key="IBUIFontDescription">
882+ <string key="name">Helvetica</string>
883+ <string key="family">Helvetica</string>
884+ <int key="traits">0</int>
885+ <double key="pointSize">17</double>
886+ </object>
887+ <object class="NSFont" key="IBUIFont">
888+ <string key="NSName">Helvetica</string>
889+ <double key="NSSize">17</double>
890+ <int key="NSfFlags">16</int>
891+ </object>
892 </object>
893 <object class="IBUIActivityIndicatorView" id="42067442">
894 <reference key="NSNextResponder" ref="834389907"/>
895 <int key="NSvFlags">292</int>
896 <string key="NSFrame">{{108, 18}, {20, 20}}</string>
897 <reference key="NSSuperview" ref="834389907"/>
898- <reference key="NSWindow"/>
899 <reference key="NSNextKeyView" ref="317026358"/>
900 <bool key="IBUIOpaque">NO</bool>
901 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
902@@ -109,9 +109,8 @@
903 <int key="IBUIStyle">2</int>
904 </object>
905 </object>
906- <string key="NSFrameSize">{320, 54}</string>
907+ <string key="NSFrameSize">{320, 53}</string>
908 <reference key="NSSuperview" ref="864788526"/>
909- <reference key="NSWindow"/>
910 <reference key="NSNextKeyView" ref="42067442"/>
911 <object class="NSColor" key="IBUIBackgroundColor">
912 <int key="NSColorSpace">3</int>
913@@ -125,15 +124,12 @@
914 </object>
915 </object>
916 <string key="NSFrameSize">{320, 54}</string>
917- <reference key="NSSuperview"/>
918- <reference key="NSWindow"/>
919 <reference key="NSNextKeyView" ref="834389907"/>
920 <object class="NSColor" key="IBUIBackgroundColor">
921 <int key="NSColorSpace">1</int>
922 <bytes key="NSRGB">MSAxIDEAA</bytes>
923 </object>
924 <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
925- <int key="IBUISeparatorStyle">1</int>
926 <reference key="IBUIContentView" ref="834389907"/>
927 </object>
928 </object>
929@@ -162,7 +158,9 @@
930 <bool key="EncodedWithXMLCoder">YES</bool>
931 <object class="IBObjectRecord">
932 <int key="objectID">0</int>
933- <reference key="object" ref="0"/>
934+ <object class="NSArray" key="object" id="0">
935+ <bool key="EncodedWithXMLCoder">YES</bool>
936+ </object>
937 <reference key="children" ref="1000"/>
938 <nil key="parent"/>
939 </object>
940@@ -242,7 +240,7 @@
941 <reference key="dict.values" ref="0"/>
942 </object>
943 <nil key="sourceID"/>
944- <int key="maxID">13</int>
945+ <int key="maxID">17</int>
946 </object>
947 <object class="IBClassDescriber" key="IBDocument.Classes">
948 <object class="NSMutableArray" key="referencedPartialClassDescriptions">
949@@ -284,6 +282,6 @@
950 </object>
951 <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
952 <int key="IBDocument.defaultPropertyAccessControl">3</int>
953- <string key="IBCocoaTouchPluginVersion">301</string>
954+ <string key="IBCocoaTouchPluginVersion">933</string>
955 </data>
956 </archive>
957
958=== modified file 'Files/U1LoginController.m'
959--- Files/U1LoginController.m 2011-08-31 14:56:30 +0000
960+++ Files/U1LoginController.m 2011-12-08 14:24:32 +0000
961@@ -80,9 +80,10 @@
962 [self.loginViewController.view setUserInteractionEnabled:NO];
963
964 // 1. get/create U1 oauth token
965+ NSString *tokenName = [NSString stringWithFormat:@"Ubuntu One @ %@", [[UIDevice currentDevice] name]];
966 NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
967 @"authenticate", @"ws.op",
968- @"Ubuntu One @ iOS", @"token_name",
969+ tokenName, @"token_name",
970 nil];
971 NSString * paramsString = UOSSOEncodedStringFromParametersDictionary(params);
972
973
974=== added file 'Files/U1TopPinningLabel.h'
975--- Files/U1TopPinningLabel.h 1970-01-01 00:00:00 +0000
976+++ Files/U1TopPinningLabel.h 2011-12-08 14:24:32 +0000
977@@ -0,0 +1,20 @@
978+//
979+// Copyright 2011 Canonical Ltd.
980+//
981+// This program is free software: you can redistribute it and/or modify it
982+// under the terms of the GNU Affero General Public License version 3,
983+// as published by the Free Software Foundation.
984+//
985+// This program is distributed in the hope that it will be useful, but
986+// WITHOUT ANY WARRANTY; without even the implied warranties of
987+// MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
988+// PURPOSE. See the GNU Affero General Public License for more details.
989+//
990+// You should have received a copy of the GNU Affero General Public License
991+// along with this program. If not, see <http://www.gnu.org/licenses/>.
992+
993+#import <UIKit/UIKit.h>
994+
995+@interface U1TopPinningLabel : UILabel
996+
997+@end
998
999=== added file 'Files/U1TopPinningLabel.m'
1000--- Files/U1TopPinningLabel.m 1970-01-01 00:00:00 +0000
1001+++ Files/U1TopPinningLabel.m 2011-12-08 14:24:32 +0000
1002@@ -0,0 +1,30 @@
1003+//
1004+// Copyright 2011 Canonical Ltd.
1005+//
1006+// This program is free software: you can redistribute it and/or modify it
1007+// under the terms of the GNU Affero General Public License version 3,
1008+// as published by the Free Software Foundation.
1009+//
1010+// This program is distributed in the hope that it will be useful, but
1011+// WITHOUT ANY WARRANTY; without even the implied warranties of
1012+// MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1013+// PURPOSE. See the GNU Affero General Public License for more details.
1014+//
1015+// You should have received a copy of the GNU Affero General Public License
1016+// along with this program. If not, see <http://www.gnu.org/licenses/>.
1017+
1018+#import "U1TopPinningLabel.h"
1019+
1020+@implementation U1TopPinningLabel
1021+
1022+- (CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines {
1023+ CGRect textRect = [super textRectForBounds:bounds limitedToNumberOfLines:numberOfLines];
1024+ textRect.origin.y = bounds.origin.y;
1025+ return textRect;
1026+}
1027+
1028+-(void)drawTextInRect:(CGRect)requestedRect {
1029+ CGRect actualRect = [self textRectForBounds:requestedRect limitedToNumberOfLines:self.numberOfLines];
1030+ [super drawTextInRect:actualRect];
1031+}
1032+@end
1033
1034=== modified file 'Files/U1UploadOperation.m'
1035--- Files/U1UploadOperation.m 2011-12-07 22:53:01 +0000
1036+++ Files/U1UploadOperation.m 2011-12-08 14:24:32 +0000
1037@@ -71,6 +71,12 @@
1038
1039 - (void)beginUpload;
1040 {
1041+ if ([self isCancelled])
1042+ {
1043+ [self finishExecuting];
1044+ return;
1045+ }
1046+
1047 dispatch_async(dispatch_get_main_queue(), ^(void) {
1048
1049 [self.fileInfo setUploadPercentage:0.0];
1050@@ -99,7 +105,26 @@
1051 if (filesServiceError != nil)
1052 {
1053 self.error = filesServiceError;
1054- [self beginUpload];
1055+ if ([filesServiceError.domain isEqualToString:@"nonexistentAsset"])
1056+ {
1057+ // Asset is gone, delete U1Asset and potentially the Node, and stop running
1058+ U1DataRepository *dataRepository = [U1DataRepository sharedDataRepository];
1059+ [dataRepository dispatchAsyncBlockWithManagedObjectContext:^(NSManagedObjectContext *context) {
1060+ U1Asset *assetToBeDeleted = self.fileNode.asset;
1061+ [context deleteObject:assetToBeDeleted];
1062+ if (self.fileNode.generation == nil)
1063+ {
1064+ [context deleteObject:self.fileNode];
1065+ }
1066+ [dataRepository save:NULL];
1067+ }];
1068+ [self finishExecuting];
1069+ }
1070+ else
1071+ {
1072+ // File upload timed out or something else, so reschedule
1073+ [self beginUpload];
1074+ }
1075 }
1076 else
1077 {

Subscribers

People subscribed via source and target branches

to all changes: