Commit 9dc9d4d9 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Dropbox: fix re-occurant issue that another file than the user indicated was being downloaded

parent c9eabc13
......@@ -27,6 +27,7 @@
UIProgressView *_progressView;
UIActivityIndicatorView *_activityIndicator;
DBMetadata *_selectedFile;
}
@end
......@@ -146,15 +147,16 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
DBMetadata *selectedFile = _dropboxController.currentListFiles[indexPath.row];
if (!selectedFile.isDirectory) {
_selectedFile = _dropboxController.currentListFiles[indexPath.row];
if (!_selectedFile.isDirectory) {
/* selected item is a proper file, ask the user if s/he wants to download it */
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DROPBOX_DOWNLOAD", @"") message:[NSString stringWithFormat:NSLocalizedString(@"DROPBOX_DL_LONG", @""), selectedFile.filename, [[UIDevice currentDevice] model]] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", @"") otherButtonTitles:NSLocalizedString(@"BUTTON_DOWNLOAD", @""), nil];
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DROPBOX_DOWNLOAD", @"") message:[NSString stringWithFormat:NSLocalizedString(@"DROPBOX_DL_LONG", @""), _selectedFile.filename, [[UIDevice currentDevice] model]] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", @"") otherButtonTitles:NSLocalizedString(@"BUTTON_DOWNLOAD", @""), nil];
[alert show];
} else {
/* dive into subdirectory */
_currentPath = [_currentPath stringByAppendingFormat:@"/%@", selectedFile.filename];
_currentPath = [_currentPath stringByAppendingFormat:@"/%@", _selectedFile.filename];
[self _requestInformationForCurrentPath];
_selectedFile = nil;
}
[self.tableView deselectRowAtIndexPath:indexPath animated:NO];
......@@ -162,10 +164,10 @@
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1) {
DBMetadata *selectedFile = _dropboxController.currentListFiles[self.tableView.indexPathForSelectedRow.row];
[_dropboxController downloadFileToDocumentFolder:selectedFile];
}
if (buttonIndex == 1)
[_dropboxController downloadFileToDocumentFolder:_selectedFile];
_selectedFile = nil;
}
#pragma mark - dropbox controller delegate
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment