element-ios/Vector/ViewController/HomePeopleSearchViewController.m
giomfo da0016c612 Prepare #904: Improve the people invite screens
- Make `HomePeopleSearchViewController` inherit of the new class `ContactsTableViewController` to handle room members.
2017-01-12 17:30:09 +01:00

76 lines
2.4 KiB
Objective-C

/*
Copyright 2016 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import "HomePeopleSearchViewController.h"
#import "AppDelegate.h"
@implementation HomePeopleSearchViewController
#pragma mark - Class methods
+ (UINib *)nib
{
return [UINib nibWithNibName:NSStringFromClass([HomePeopleSearchViewController class])
bundle:[NSBundle bundleForClass:[HomePeopleSearchViewController class]]];
}
+ (instancetype)homePeopleSearchViewController
{
return [[[self class] alloc] initWithNibName:NSStringFromClass([HomePeopleSearchViewController class])
bundle:[NSBundle bundleForClass:[HomePeopleSearchViewController class]]];
}
#pragma mark -
- (void)viewDidLoad
{
[super viewDidLoad];
// Check whether the view controller has been pushed via storyboard
if (!self.tableView)
{
// Instantiate view controller objects
[[[self class] nib] instantiateWithOwner:self options:nil];
}
// Hide line separators of empty cells
self.tableView.tableFooterView = [[UIView alloc] init];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// Screen tracking (via Google Analytics)
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
if (tracker)
{
[tracker set:kGAIScreenName value:@"PeopleGlobalSearch"];
[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;
}
}
@end