Contact access permission: Display "You didn't allow Riot to access your local contacts" instead of "No local contacts" when the user has denied the phonebook permission

This commit is contained in:
manuroe
2017-06-07 15:34:11 +02:00
parent b78378e7bc
commit f38e36f013
2 changed files with 25 additions and 1 deletions
+23 -1
View File
@@ -529,7 +529,29 @@
}
else if (indexPath.section == filteredLocalContactsSection)
{
tableViewCell.textLabel.text = NSLocalizedStringFromTable(@"contacts_address_book_no_contact", @"Vector", nil);
tableViewCell.textLabel.numberOfLines = 0;
// Indicate to the user why there is no contacts
switch (ABAddressBookGetAuthorizationStatus())
{
case kABAuthorizationStatusAuthorized:
// Because there is no contacts on the device
tableViewCell.textLabel.text = NSLocalizedStringFromTable(@"contacts_address_book_no_contact", @"Vector", nil);
break;
case kABAuthorizationStatusNotDetermined:
// Because the user have not granted the permission yet
// (The permission request popup is displayed at the same time)
tableViewCell.textLabel.text = NSLocalizedStringFromTable(@"contacts_address_book_permission_required", @"Vector", nil);
break;
default:
{
// Because the user didn't allow the app to access local contacts
tableViewCell.textLabel.text = NSLocalizedStringFromTable(@"contacts_address_book_permission_denied", @"Vector", nil);
break;
}
}
}
return tableViewCell;
}