mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-26 11:30:50 +02:00
Empty screens: Implement people empty screen.
This commit is contained in:
@@ -461,4 +461,53 @@
|
||||
[super searchBarCancelButtonClicked:searchBar];
|
||||
}
|
||||
|
||||
#pragma mark - Empty view management
|
||||
|
||||
- (void)updateEmptyView
|
||||
{
|
||||
[self.emptyView fillWith:[UIImage imageNamed:@"people_empty_screen_artwork"]
|
||||
title:NSLocalizedStringFromTable(@"people_empty_view_title", @"Vector", nil)
|
||||
informationText:NSLocalizedStringFromTable(@"people_empty_view_information", @"Vector", nil)];
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowEmptyView
|
||||
{
|
||||
return [self totalItemCounts] == 0;
|
||||
}
|
||||
|
||||
// Total items to display on the screen
|
||||
- (NSUInteger)totalItemCounts
|
||||
{
|
||||
return recentsDataSource.invitesCellDataArray.count
|
||||
+ recentsDataSource.conversationCellDataArray.count
|
||||
+ recentsDataSource.peopleCellDataArray.count
|
||||
+ [self numberOfContactsInContactsDataSource];
|
||||
}
|
||||
|
||||
- (NSUInteger)numberOfContactsInContactsDataSource
|
||||
{
|
||||
BOOL areLocalContactsAccessAuthorized = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts] == CNAuthorizationStatusAuthorized;
|
||||
|
||||
NSInteger nbOfItemsInContactDataSource = 0;
|
||||
|
||||
for (NSInteger i = 0; i < contactsSectionNumber; i++)
|
||||
{
|
||||
nbOfItemsInContactDataSource += [contactsDataSource tableView:self.recentsTableView numberOfRowsInSection:i];
|
||||
}
|
||||
|
||||
NSInteger numberOfContactsInContactsDataSource;
|
||||
|
||||
// No local contacts to show and no search in directory
|
||||
if (!areLocalContactsAccessAuthorized && contactsSectionNumber == 1 && nbOfItemsInContactDataSource <= 1)
|
||||
{
|
||||
numberOfContactsInContactsDataSource = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
numberOfContactsInContactsDataSource = nbOfItemsInContactDataSource;
|
||||
}
|
||||
|
||||
return numberOfContactsInContactsDataSource;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user