Empty screens: Implement people empty screen.

This commit is contained in:
SBiOSoftWhare
2020-11-26 11:22:55 +01:00
parent fc861788e1
commit 15e3776b3e
@@ -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