Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #957 from owncloud/improve_error_messages_view
Browse files Browse the repository at this point in the history
Improved error messages in file list view, show warnings on the top
  • Loading branch information
nasli authored Nov 17, 2017
2 parents c622ab5 + 2eaf0fd commit d452d7c
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 12 deletions.
4 changes: 3 additions & 1 deletion Owncloud iOs Client/Tabs/FileTab/FilesViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
#import "SelectFolderNavigation.h"
#import "ManageFavorites.h"
#import "DetectUserData.h"
#import "TSMessage.h"
#import "TSMessageView.h"

#ifdef CONTAINER_APP
#import "Owncloud_iOs_Client-Swift.h"
Expand All @@ -64,7 +66,7 @@

@interface FilesViewController : UIViewController
<UITableViewDelegate, UITableViewDataSource, UIActionSheetDelegate,
ELCImagePickerControllerDelegate, UISearchBarDelegate, UIAlertViewDelegate, MBProgressHUDDelegate, UITextFieldDelegate, DeleteFileDelegate, OpenWithDelegate, DownloadViewControllerDelegate, CheckAccessToServerDelegate, RenameDelegate, MoveFileDelegate, SWTableViewCellDelegate, ManageNetworkErrorsDelegate, ManageFavoritesDelegate>
ELCImagePickerControllerDelegate, UISearchBarDelegate, UIAlertViewDelegate, MBProgressHUDDelegate, UITextFieldDelegate, DeleteFileDelegate, OpenWithDelegate, DownloadViewControllerDelegate, CheckAccessToServerDelegate, RenameDelegate, MoveFileDelegate, SWTableViewCellDelegate, ManageNetworkErrorsDelegate, ManageFavoritesDelegate, TSMessageViewProtocol>

//Table view
@property(nonatomic, strong) IBOutlet UITableView *tableView;
Expand Down
49 changes: 42 additions & 7 deletions Owncloud iOs Client/Tabs/FileTab/FilesViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,41 @@ - (void) showAlertView:(NSString*)string {
[_alert show];
}


#pragma mark - TSMessages

- (void)showWarningMessageWithText: (NSString *) message {

//Run UI Updates
[TSMessage setDelegate:self];

if (self.navigationController.navigationBarHidden){
[self.navigationController setNavigationBarHidden:NO];
}

[TSMessage showNotificationInViewController:self.navigationController
title:message
subtitle:nil
image:nil
type:TSMessageNotificationTypeWarning
duration:TSMessageNotificationDurationAutomatic
callback:nil
buttonTitle:nil
buttonCallback:nil
atPosition:TSMessageNotificationPositionNavBarOverlay
canBeDismissedByUser:YES];
}

#pragma mark - TSMessage Delegate

- (void)customizeMessageView:(TSMessageView *)messageView
{
messageView.alpha = messageAlpha;
messageView.duration = messageDuration;
}



#pragma mark - UITextFieldDelegate methods

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
Expand Down Expand Up @@ -1683,7 +1718,7 @@ - (void) goToFolder:(FileDto *) selectedFile {
[self goToFolderWithoutCheck];
} else {

[self performSelectorOnMainThread:@selector(showAlertView:)
[self performSelectorOnMainThread:@selector(showWarningMessageWithText:)
withObject:NSLocalizedString(@"not_possible_connect_to_server", nil)
waitUntilDone:YES];
[self endLoading];
Expand Down Expand Up @@ -2298,7 +2333,7 @@ - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSIn
case 3:

if (self.isCurrentFolderSonOfFavoriteFolder) {
[self performSelectorOnMainThread:@selector(showAlertView:)
[self performSelectorOnMainThread:@selector(showWarningMessageWithText:)
withObject:NSLocalizedString(@"parent_folder_is_available_offline_folder_child", nil)
waitUntilDone:YES];
} else {
Expand All @@ -2320,7 +2355,7 @@ - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSIn
if (_selectedFileDto.isDownload || [[CheckAccessToServer sharedManager] isNetworkIsReachable]){
[self didSelectOpenWithOptionAndFile:_selectedFileDto];
} else {
[self performSelectorOnMainThread:@selector(showAlertView:)
[self performSelectorOnMainThread:@selector(showWarningMessageWithText:)
withObject:NSLocalizedString(@"not_possible_connect_to_server", nil)
waitUntilDone:YES];
}
Expand All @@ -2333,7 +2368,7 @@ - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSIn
break;
case 3:
if (self.isCurrentFolderSonOfFavoriteFolder) {
[self performSelectorOnMainThread:@selector(showAlertView:)
[self performSelectorOnMainThread:@selector(showWarningMessageWithText:)
withObject:NSLocalizedString(@"parent_folder_is_available_offline_file_child", nil)
waitUntilDone:YES];
} else {
Expand Down Expand Up @@ -3285,7 +3320,7 @@ - (void)manageServerErrors: (NSInteger)errorCodeFromServer and:(NSError *)error
*/
- (void)showError:(NSString *) message {

[self performSelectorOnMainThread:@selector(showAlertView:)
[self performSelectorOnMainThread:@selector(showWarningMessageWithText:)
withObject:message
waitUntilDone:YES];

Expand Down Expand Up @@ -3340,8 +3375,8 @@ -(void)connectionToTheServerWasChecked:(BOOL)isConnected withHttpStatusCode:(NSI
DLog(@"Ok, we have connection to the server");
} else {
//Error msg
//Call showAlertView in main thread
[self performSelectorOnMainThread:@selector(showAlertView:)
//Call show error in main thread
[self performSelectorOnMainThread:@selector(showWarningMessageWithText:)
withObject:NSLocalizedString(@"not_possible_connect_to_server", nil)
waitUntilDone:YES];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
#define loadingVisibleSearchDelay 2.0
#define loadingVisibleSortDelay 0.1
#define searchResultsPerPage 30
#define messageAlpha 0.96
#define messageDuration 3.5
#define shareSearchUserLaunchRequestDelay 1.0

@interface ShareSearchUserViewController ()
Expand Down
5 changes: 3 additions & 2 deletions Owncloud iOs Client/Utils/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,6 @@
#define k_max_number_options_sort_menu 2
#define k_max_number_options_account_menu 3



//Customize top warning Messages view (TSMessage)
#define messageAlpha 0.96
#define messageDuration 3.5

0 comments on commit d452d7c

Please sign in to comment.