Revision 54fd5c36 Classes/StorageObjectViewController.m
b/Classes/StorageObjectViewController.m | ||
---|---|---|
93 | 93 |
|
94 | 94 |
- (void)viewDidLoad { |
95 | 95 |
[super viewDidLoad]; |
96 |
|
|
96 | 97 |
objectIsPublicSwitch = [[UISwitch alloc] init]; |
97 | 98 |
[objectIsPublicSwitch addTarget:self action:@selector(objectIsPublicSwitchChanged:) forControlEvents:UIControlEventValueChanged]; |
98 | 99 |
|
... | ... | |
120 | 121 |
objectIsPublicSwitch.enabled = NO; |
121 | 122 |
} |
122 | 123 |
|
123 |
|
|
124 | 124 |
downloadProgressView = [[AnimatedProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault]; |
125 | 125 |
fileDownloading = ([self.account.manager.objectDownloadRequests objectForKey:object.fullPath] != nil) ? YES : NO; |
126 | 126 |
if (fileDownloading) { |
... | ... | |
197 | 197 |
[self.tableView reloadData]; |
198 | 198 |
} |
199 | 199 |
|
200 |
- (void)viewDidAppear:(BOOL)animated { |
|
201 |
if (object.metadata == nil) { |
|
202 |
[self reloadMetadataSection]; |
|
203 |
} |
|
204 |
} |
|
205 |
|
|
200 | 206 |
#pragma mark - |
201 | 207 |
#pragma mark Table view data source |
202 | 208 |
|
203 | 209 |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { |
210 |
|
|
204 | 211 |
int numberOfSections = 8; |
205 | 212 |
if (!self.container.cdnEnabled) |
206 | 213 |
numberOfSections--; |
... | ... | |
814 | 821 |
[super dealloc]; |
815 | 822 |
} |
816 | 823 |
|
824 |
#pragma mark - |
|
825 |
#pragma mark Helper functions |
|
826 |
|
|
827 |
- (void)reloadMetadataSection { |
|
828 |
NSString *activityMessage = @"Loading metadata..."; |
|
829 |
activityIndicatorView = [[ActivityIndicatorView alloc] initWithFrame:[ActivityIndicatorView frameForText:activityMessage] text:activityMessage]; |
|
830 |
[activityIndicatorView addToView:self.view]; |
|
831 |
[[self.account.manager getObjectInfo:container object:object version:versionID] |
|
832 |
success:^(OpenStackRequest *request) { |
|
833 |
[activityIndicatorView removeFromSuperviewAndRelease]; |
|
834 |
object.metadata = [NSMutableDictionary dictionary]; |
|
835 |
for (NSString *header in request.responseHeaders) { |
|
836 |
NSString *metadataKey; |
|
837 |
NSString *metadataValue; |
|
838 |
if ([header rangeOfString:@"X-Object-Meta-"].location != NSNotFound) { |
|
839 |
metadataKey = [header substringFromIndex:14]; |
|
840 |
metadataValue = [request.responseHeaders objectForKey:header]; |
|
841 |
[object.metadata setObject:metadataValue forKey:metadataKey]; |
|
842 |
} |
|
843 |
} |
|
844 |
NSIndexSet *metadataSections = [NSIndexSet indexSetWithIndex:kMetadata]; |
|
845 |
[self.tableView reloadSections:metadataSections withRowAnimation:UITableViewRowAnimationFade]; |
|
846 |
} |
|
847 |
failure:^(OpenStackRequest *request) { |
|
848 |
[activityIndicatorView removeFromSuperviewAndRelease]; |
|
849 |
[self alert:@"There was a problem retrieving the object's metadata." request:request]; |
|
850 |
}]; |
|
851 |
} |
|
852 |
|
|
817 | 853 |
|
818 | 854 |
@end |
819 | 855 |
|
Also available in: Unified diff