Contact access permission: make it work again.

Ask the permission when the user displays the people tab.
This commit is contained in:
manuroe 2017-06-07 14:28:52 +02:00
parent 9d10dbfc10
commit 71d5131837
2 changed files with 12 additions and 10 deletions

View file

@ -81,15 +81,8 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onContactManagerDidUpdate:) name:kMXKContactManagerDidUpdateLocalContactsNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onContactManagerDidUpdate:) name:kMXKContactManagerDidUpdateLocalContactMatrixIDsNotification object:nil];
// Check whether the access to the local contacts has not been already asked.
if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined)
{
// Allow by default the local contacts sync in order to discover matrix users.
// This setting change will trigger the loading of the local contacts, which will automatically
// ask user permission to access their local contacts.
[MXKAppSettings standardAppSettings].syncLocalContacts = YES;
}
else
// Refresh the matrix identifiers for all the local contacts.
if (ABAddressBookGetAuthorizationStatus() != kABAuthorizationStatusNotDetermined)
{
// Refresh the matrix identifiers for all the local contacts.
[[MXKContactManager sharedManager] updateMatrixIDsForAllLocalContacts];

View file

@ -100,7 +100,16 @@
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// Check whether the access to the local contacts has not been already asked.
if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined)
{
// Allow by default the local contacts sync in order to discover matrix users.
// This setting change will trigger the loading of the local contacts, which will automatically
// ask user permission to access their local contacts.
[MXKAppSettings standardAppSettings].syncLocalContacts = YES;
}
[AppDelegate theDelegate].masterTabBarController.navigationItem.title = NSLocalizedStringFromTable(@"title_people", @"Vector", nil);
[AppDelegate theDelegate].masterTabBarController.navigationController.navigationBar.tintColor = kRiotColorOrange;
[AppDelegate theDelegate].masterTabBarController.tabBar.tintColor = kRiotColorOrange;