Revision 60731366 Classes/ContainerDetailViewController.m
b/Classes/ContainerDetailViewController.m | ||
---|---|---|
17 | 17 |
#import "EditMetadataViewController.h" |
18 | 18 |
#import "EditPolicyViewController.h" |
19 | 19 |
#import "Folder.h" |
20 |
#import "StorageObject.h" |
|
20 | 21 |
#import "FolderViewController.h" |
21 | 22 |
#import "OpenStackRequest.h" |
22 | 23 |
#import "APICallback.h" |
... | ... | |
315 | 316 |
|
316 | 317 |
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { |
317 | 318 |
if (buttonIndex == 0) { |
318 |
|
|
319 |
NSString *activityMessage = @"Deleting container..."; |
|
320 |
[activityIndicatorView release]; |
|
321 |
activityIndicatorView = [[ActivityIndicatorView alloc] initWithText:activityMessage]; |
|
322 |
[activityIndicatorView addToView:self.view scrollOffset:self.tableView.contentOffset.y]; |
|
323 |
|
|
324 |
[[self.account.manager deleteContainer:self.container] success:^(OpenStackRequest *request) { |
|
325 |
|
|
326 |
[activityIndicatorView removeFromSuperview]; |
|
327 |
[self.account.containers removeObjectForKey:self.container.name]; |
|
328 |
[self.account persist]; |
|
329 |
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) |
|
319 |
__block ActivityIndicatorView *activityIndicatorView = [ActivityIndicatorView activityIndicatorViewWithText:@"Deleting container..." |
|
320 |
andAddToView:self.view |
|
321 |
scrollOffset:self.tableView.contentOffset.y]; |
|
322 |
[[self.account.manager deleteContainer:self.container] |
|
323 |
success:^(OpenStackRequest *request) { |
|
324 |
[activityIndicatorView removeFromSuperview]; |
|
325 |
[self.account.containers removeObjectForKey:self.container.name]; |
|
326 |
[self.account persist]; |
|
327 |
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { |
|
330 | 328 |
[self.containersViewController.navigationController popViewControllerAnimated:YES]; |
331 |
else
|
|
329 |
} else {
|
|
332 | 330 |
[self.navigationController popViewControllerAnimated:YES]; |
333 |
|
|
334 |
[self deleteContainerRow]; |
|
335 |
|
|
336 |
|
|
337 |
} failure:^(OpenStackRequest *request) { |
|
338 |
|
|
331 |
} |
|
332 |
[self deleteContainerRow]; |
|
333 |
} |
|
334 |
failure:^(OpenStackRequest *request) { |
|
335 |
[activityIndicatorView removeFromSuperview]; |
|
339 | 336 |
// 404 Not Found means it's not there, so we can show the user that it's deleted |
340 | 337 |
if ([request responseStatusCode] == 404) { |
341 | 338 |
[self.account.containers removeObjectForKey:container.name]; |
342 | 339 |
[self.account persist]; |
343 |
|
|
344 | 340 |
} else { |
345 |
[activityIndicatorView removeFromSuperview]; |
|
346 | 341 |
[self alert:@"There was a problem deleting this container." request:request]; |
347 | 342 |
} |
348 |
}]; |
|
349 |
|
|
343 |
}]; |
|
350 | 344 |
} |
351 | 345 |
[self.tableView deselectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:deleteSection] animated:YES]; |
352 | 346 |
} |
... | ... | |
361 | 355 |
[containersViewController release]; |
362 | 356 |
[selectedContainerIndexPath release]; |
363 | 357 |
[rootFolderViewController release]; |
364 |
[activityIndicatorView release]; |
|
365 | 358 |
[super dealloc]; |
366 | 359 |
} |
367 | 360 |
|
... | ... | |
369 | 362 |
#pragma mark Helper functions |
370 | 363 |
|
371 | 364 |
- (void)reloadMetadataSection { |
372 |
NSString *activityMessage = @"Loading metadata..."; |
|
373 |
[activityIndicatorView release]; |
|
374 |
activityIndicatorView = [[ActivityIndicatorView alloc] initWithText:activityMessage]; |
|
375 |
[activityIndicatorView addToView:self.view scrollOffset:self.tableView.contentOffset.y]; |
|
376 |
[[self.account.manager getContainerInfo:container] |
|
365 |
__block ActivityIndicatorView *activityIndicatorView = [ActivityIndicatorView activityIndicatorViewWithText:@"Loading metadata..." |
|
366 |
andAddToView:self.view |
|
367 |
scrollOffset:self.tableView.contentOffset.y]; |
|
368 |
[[self.account.manager getContainerInfo:container] |
|
377 | 369 |
success:^(OpenStackRequest *request) { |
378 | 370 |
[activityIndicatorView removeFromSuperview]; |
379 | 371 |
container.metadata = [NSMutableDictionary dictionary]; |
Also available in: Unified diff