mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-02 14:16:59 +02:00
ContactsTableViewController: refresh the matrix ids in the local contacts when view will appear.
This commit is contained in:
@@ -80,7 +80,7 @@
|
||||
self.rageShakeManager = [RageShakeManager sharedManager];
|
||||
|
||||
// Prepare search session
|
||||
searchProcessingQueue = dispatch_queue_create("StartChatViewController", DISPATCH_QUEUE_SERIAL);
|
||||
searchProcessingQueue = dispatch_queue_create("ContactsTableViewController", DISPATCH_QUEUE_SERIAL);
|
||||
searchProcessingCount = 0;
|
||||
searchProcessingText = nil;
|
||||
searchProcessingLocalContacts = nil;
|
||||
@@ -163,15 +163,6 @@
|
||||
[tracker send:[[GAIDictionaryBuilder createScreenView] build]];
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Observe kAppDelegateDidTapStatusBarNotification.
|
||||
kAppDelegateDidTapStatusBarNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kAppDelegateDidTapStatusBarNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
|
||||
|
||||
@@ -183,6 +174,23 @@
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onContactManagerDidUpdate:) name:kMXKContactManagerDidUpdateMatrixContactsNotification object:nil];
|
||||
[[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.
|
||||
[[MXKContactManager sharedManager] updateMatrixIDsForAllLocalContacts];
|
||||
}
|
||||
|
||||
// Scroll to the top the current table content if any
|
||||
[self.tableView setContentOffset:CGPointMake(-self.tableView.contentInset.left, -self.tableView.contentInset.top) animated:NO];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated
|
||||
@@ -303,6 +311,9 @@
|
||||
{
|
||||
[self stopActivityIndicator];
|
||||
|
||||
// Scroll the resulting list to the top only when the search pattern has been modified.
|
||||
BOOL shouldScrollToTop = (currentSearchText != searchProcessingText);
|
||||
|
||||
// Update the filtered contacts.
|
||||
currentSearchText = searchProcessingText;
|
||||
filteredLocalContacts = searchProcessingLocalContacts;
|
||||
@@ -346,8 +357,11 @@
|
||||
// Refresh display
|
||||
[self refreshTableView];
|
||||
|
||||
// Force scroll to top
|
||||
[self.tableView setContentOffset:CGPointMake(-self.tableView.contentInset.left, -self.tableView.contentInset.top) animated:NO];
|
||||
if (shouldScrollToTop)
|
||||
{
|
||||
// Scroll to the top
|
||||
[self.tableView setContentOffset:CGPointMake(-self.tableView.contentInset.left, -self.tableView.contentInset.top) animated:NO];
|
||||
}
|
||||
|
||||
if (complete)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user