From 64e49102db4eba7a4c5f8a59ff4b360150d1f4b5 Mon Sep 17 00:00:00 2001 From: nasli Date: Tue, 31 Oct 2017 11:21:06 +0100 Subject: [PATCH 1/2] Improved error messages in file list view, show warnings on the top --- .../Tabs/FileTab/FilesViewController.h | 4 ++- .../Tabs/FileTab/FilesViewController.m | 35 +++++++++++++++---- .../Share/ShareSearchUserViewController.m | 2 -- Owncloud iOs Client/Utils/constants.h | 5 +-- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/Owncloud iOs Client/Tabs/FileTab/FilesViewController.h b/Owncloud iOs Client/Tabs/FileTab/FilesViewController.h index c64f81e4bd..99ddddd092 100644 --- a/Owncloud iOs Client/Tabs/FileTab/FilesViewController.h +++ b/Owncloud iOs Client/Tabs/FileTab/FilesViewController.h @@ -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" @@ -64,7 +66,7 @@ @interface FilesViewController : UIViewController +ELCImagePickerControllerDelegate, UISearchBarDelegate, UIAlertViewDelegate, MBProgressHUDDelegate, UITextFieldDelegate, DeleteFileDelegate, OpenWithDelegate, DownloadViewControllerDelegate, CheckAccessToServerDelegate, RenameDelegate, MoveFileDelegate, SWTableViewCellDelegate, ManageNetworkErrorsDelegate, ManageFavoritesDelegate, TSMessageViewProtocol> //Table view @property(nonatomic, strong) IBOutlet UITableView *tableView; diff --git a/Owncloud iOs Client/Tabs/FileTab/FilesViewController.m b/Owncloud iOs Client/Tabs/FileTab/FilesViewController.m index c7f3fb8965..2e317601e3 100644 --- a/Owncloud iOs Client/Tabs/FileTab/FilesViewController.m +++ b/Owncloud iOs Client/Tabs/FileTab/FilesViewController.m @@ -1027,6 +1027,27 @@ - (void) showAlertView:(NSString*)string { [_alert show]; } + +#pragma mark - TSMessages + +- (void)showWarningMessageWithText: (NSString *) message { + + //Run UI Updates + [TSMessage setDelegate:self]; + [TSMessage showNotificationInViewController:self title:message subtitle:nil type:TSMessageNotificationTypeWarning]; + +} + +#pragma mark - TSMessage Delegate + +- (void)customizeMessageView:(TSMessageView *)messageView +{ + messageView.alpha = messageAlpha; + messageView.duration = messageDuration; +} + + + #pragma mark - UITextFieldDelegate methods - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{ @@ -1683,7 +1704,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]; @@ -2298,7 +2319,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 { @@ -2320,7 +2341,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]; } @@ -2333,7 +2354,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 { @@ -3285,7 +3306,7 @@ - (void)manageServerErrors: (NSInteger)errorCodeFromServer and:(NSError *)error */ - (void)showError:(NSString *) message { - [self performSelectorOnMainThread:@selector(showAlertView:) + [self performSelectorOnMainThread:@selector(showWarningMessageWithText:) withObject:message waitUntilDone:YES]; @@ -3340,8 +3361,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]; } diff --git a/Owncloud iOs Client/Tabs/FileTab/Share/ShareSearchUserViewController.m b/Owncloud iOs Client/Tabs/FileTab/Share/ShareSearchUserViewController.m index 67122cab53..a85057df36 100644 --- a/Owncloud iOs Client/Tabs/FileTab/Share/ShareSearchUserViewController.m +++ b/Owncloud iOs Client/Tabs/FileTab/Share/ShareSearchUserViewController.m @@ -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 () diff --git a/Owncloud iOs Client/Utils/constants.h b/Owncloud iOs Client/Utils/constants.h index 1e76f22730..0406076b77 100644 --- a/Owncloud iOs Client/Utils/constants.h +++ b/Owncloud iOs Client/Utils/constants.h @@ -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 From 2eaf0fdf03a15b72f0befe3616b92c83db013c71 Mon Sep 17 00:00:00 2001 From: nasli Date: Thu, 16 Nov 2017 11:38:00 +0100 Subject: [PATCH 2/2] Show error messages over navigation bar --- .../Tabs/FileTab/FilesViewController.m | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Owncloud iOs Client/Tabs/FileTab/FilesViewController.m b/Owncloud iOs Client/Tabs/FileTab/FilesViewController.m index 2e317601e3..37b8feb80c 100644 --- a/Owncloud iOs Client/Tabs/FileTab/FilesViewController.m +++ b/Owncloud iOs Client/Tabs/FileTab/FilesViewController.m @@ -1034,8 +1034,22 @@ - (void)showWarningMessageWithText: (NSString *) message { //Run UI Updates [TSMessage setDelegate:self]; - [TSMessage showNotificationInViewController:self title:message subtitle:nil type:TSMessageNotificationTypeWarning]; + 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