Ver código fonte

DropboxController: tell the user if we encounter an error

Felix Paul Kühne 11 anos atrás
pai
commit
cc032a803e
1 arquivos alterados com 10 adições e 0 exclusões
  1. 10 0
      AspenProject/VLCDropboxController.m

+ 10 - 0
AspenProject/VLCDropboxController.m

@@ -134,6 +134,7 @@
 - (void)restClient:(DBRestClient *)client loadMetadataFailedWithError:(NSError *)error
 {
     APLog(@"DBMetadata download failed with error %i", error.code);
+    [self _handleError:error];
 }
 
 - (void)restClient:(DBRestClient*)client loadedFile:(NSString*)localPath
@@ -152,6 +153,7 @@
 - (void)restClient:(DBRestClient*)client loadFileFailedWithError:(NSError*)error
 {
     APLog(@"DBFile download failed with error %i", error.code);
+    [self _handleError:error];
     if ([self.delegate respondsToSelector:@selector(operationWithProgressInformationStopped)])
         [self.delegate operationWithProgressInformationStopped];
     _downloadInProgress = NO;
@@ -175,6 +177,7 @@
 - (void)restClient:(DBRestClient*)restClient loadStreamableURLFailedWithError:(NSError*)error
 {
     APLog(@"loadStreamableURL failed with error %i", error.code);
+    [self _handleError:error];
 }
 
 #pragma mark - DBSession delegate
@@ -218,4 +221,11 @@
     return 0;
 }
 
+#pragma mark - user feedback
+- (void)_handleError:(NSError *)error
+{
+    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@"ERROR_NUMBER", @""), error.code] message:error.localizedDescription delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", @"") otherButtonTitles:nil];
+    [alert show];
+}
+
 @end