Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display initial consign if searchBar is empty #902

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions Riot/Modules/Contacts/ContactsTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ @interface ContactsTableViewController () <FindYourContactsFooterViewDelegate, S

@property (nonatomic, strong) ServiceTermsModalCoordinatorBridgePresenter *serviceTermsModalCoordinatorBridgePresenter;

@property (nonatomic, strong) UILabel *consignView; // Tchap: view to display consign when searchBar is empty.

@end

@implementation ContactsTableViewController
Expand Down Expand Up @@ -137,6 +139,8 @@ - (void)userInterfaceThemeDidChange
self.view.backgroundColor = self.contactsTableView.backgroundColor;
self.contactsTableView.separatorColor = ThemeService.shared.theme.lineBreakColor;

self.consignView.textColor = ThemeService.shared.theme.textSecondaryColor; // Tchap

if (self.contactsTableView.dataSource)
{
[self refreshContactsTable];
Expand Down Expand Up @@ -188,6 +192,7 @@ - (void)viewWillAppear:(BOOL)animated

// Show the contacts access footer if necessary.
[self updateFooterViewVisibility];
[self updateConsignViewVisibility]; // Tchap
[self.screenTracker trackScreen];
}

Expand Down Expand Up @@ -231,6 +236,62 @@ - (FindYourContactsFooterView*)makeFooterView
return footerView;
}

// Tchap: init consign view
- (UILabel *)_getConsignView
{
UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectZero];
lbl.numberOfLines = 0;
lbl.textAlignment = NSTextAlignmentCenter;
lbl.text = TchapL10n.roomInviteSearchConsign;
lbl.font = ThemeService.shared.theme.fonts.title3;
lbl.textColor = ThemeService.shared.theme.textSecondaryColor;

return lbl;
}

// Tchap: access consign view
- (UILabel *)consignView
{
if (self->_consignView == nil )
{
self->_consignView = [self _getConsignView];
}

return self->_consignView;
}

// Tchap: layout consign view in superview
- (void)layoutConsignView
{
if (self.consignView.superview == nil)
{
return;
}

UIView *sv = self.consignView.superview;

self.consignView.bounds = CGRectMake(0.0, 0.0, sv.bounds.size.width * 0.75, 0.0);
[self.consignView sizeToFit];

// Center consignView horizontally. Make it a bit above of centerY because the keyboard is displayed below.
self.consignView.center = CGPointMake(CGRectGetMidX(sv.bounds), CGRectGetMidY(sv.bounds)*0.5);
}

// Tchap: update consign view visibility if searchBar depending on active filtering
- (void)updateConsignViewVisibility
{
// Tchap: install consign view if necessary
if (self.contactsAreFilteredWithSearch)
{
[self.consignView removeFromSuperview];
}
else
{
[self.contactsTableView addSubview:self.consignView];
[self layoutConsignView];
}
}

/**
Checks whether local contacts sync is ready to use or if there are any search results
in the table, hiding the find your contacts footer if so. Otherwise the footer is shown
Expand Down Expand Up @@ -392,6 +453,7 @@ - (void)setContactsAreFilteredWithSearch:(BOOL)contactsAreFilteredWithSearch
{
_contactsAreFilteredWithSearch = contactsAreFilteredWithSearch;
[self updateFooterViewVisibility];
[self updateConsignViewVisibility]; // Tchap
}
}

Expand Down
1 change: 1 addition & 0 deletions Tchap/Assets/Localizations/fr.lproj/Tchap.strings
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,4 @@
////////////////////////////////////////////////////////////////////////////////
// MARK: Room Invite
"room_invite_error_action_forbidden" = "Cet utilisateur n'est pas autorisé à rejoindre ce salon.";
"room_invite_search_consign" = "Veuillez saisir le nom d'un correspondant pour le rechercher dans l'annuaire";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ca serait bien d'avoir la version anglaise ?

Copy link
Contributor Author

@NicolasBuquet NicolasBuquet Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il n'y a pas de traduction EN des textes propres à Tchap ;-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autant pour moi alors

1 change: 1 addition & 0 deletions changelog.d/868.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Affichage d'une consigne de recherche plus explicite sur l'écran d'ajout de membre à un salon.