diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index 6cc3d88a4..3bf631afc 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -160,6 +160,8 @@ "contacts_address_book_section" = "LOCAL CONTACTS"; "contacts_address_book_matrix_users_toggle" = "Matrix users only"; "contacts_address_book_no_contact" = "No local contacts"; +"contacts_address_book_permission_required" = "Permission required to access local contacts"; +"contacts_address_book_permission_denied" = "You didn't allow Riot to access your local contacts"; "contacts_matrix_users_section" = "KNOWN CONTACTS"; // Chat participants diff --git a/Riot/Model/Contact/ContactsDataSource.m b/Riot/Model/Contact/ContactsDataSource.m index a7444a347..57740e990 100644 --- a/Riot/Model/Contact/ContactsDataSource.m +++ b/Riot/Model/Contact/ContactsDataSource.m @@ -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; }