diff --git a/Riot/Model/Contact/ContactsDataSource.m b/Riot/Model/Contact/ContactsDataSource.m index 07a6ea531..a7444a347 100644 --- a/Riot/Model/Contact/ContactsDataSource.m +++ b/Riot/Model/Contact/ContactsDataSource.m @@ -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]; diff --git a/Riot/ViewController/PeopleViewController.m b/Riot/ViewController/PeopleViewController.m index 4c54f9a89..9e34228cb 100644 --- a/Riot/ViewController/PeopleViewController.m +++ b/Riot/ViewController/PeopleViewController.m @@ -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;