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