Clean up ahead of PR.

// FREEBIE
pull/1/head
Matthew Chen 9 years ago
parent 325134c6e8
commit 1b99671e0e

@ -5,6 +5,7 @@
#import "BlockListViewController.h"
#import "AddToBlockListViewController.h"
#import "BlockListUIUtils.h"
#import "ContactTableViewCell.h"
#import "ContactsViewHelper.h"
#import "Environment.h"
#import "OWSContactsManager.h"
@ -92,15 +93,17 @@ NS_ASSUME_NONNULL_BEGIN
[helper.blockedPhoneNumbers sortedArrayUsingSelector:@selector(compare:)];
for (NSString *phoneNumber in blockedPhoneNumbers) {
[blocklistSection addItem:[OWSTableItem itemWithCustomCellBlock:^{
// TODO: Use ContactTableViewCell.
UITableViewCell *cell = [UITableViewCell new];
NSString *displayName = [helper.contactsManager displayNameForPhoneIdentifier:phoneNumber];
cell.textLabel.text = displayName;
cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f];
cell.accessoryType = UITableViewCellAccessoryCheckmark;
cell.textLabel.textColor = [UIColor blackColor];
ContactTableViewCell *cell = [ContactTableViewCell new];
SignalAccount *signalAccount = [helper signalAccountForRecipientId:phoneNumber];
if (signalAccount) {
[cell configureWithSignalAccount:signalAccount contactsManager:helper.contactsManager];
} else {
[cell configureWithRecipientId:phoneNumber contactsManager:helper.contactsManager];
}
return cell;
}
customRowHeight:[ContactTableViewCell rowHeight]
actionBlock:^{
[BlockListUIUtils showUnblockPhoneNumberActionSheet:phoneNumber
fromViewController:weakSelf

@ -35,15 +35,6 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable SignalAccount *)signalAccountForRecipientId:(NSString *)recipientId;
// This method is faster than OWSBlockingManager but
// is only safe to be called on the main thread.
//
// Returns true if _any_ number associated with this contact
// is blocked.
//
// TODO: Is this obsolete?
- (BOOL)isContactBlocked:(Contact *)contact;
// This method is faster than OWSBlockingManager but
// is only safe to be called on the main thread.
- (BOOL)isRecipientIdBlocked:(NSString *)recipientId;

@ -122,24 +122,6 @@ NS_ASSUME_NONNULL_BEGIN
return [TSAccountManager localNumber];
}
- (BOOL)isContactBlocked:(Contact *)contact
{
OWSAssert([NSThread isMainThread]);
if (contact.parsedPhoneNumbers.count < 1) {
// Do not consider contacts without any valid phone numbers to be blocked.
return NO;
}
for (PhoneNumber *phoneNumber in contact.parsedPhoneNumbers) {
if ([_blockedPhoneNumbers containsObject:phoneNumber.toE164]) {
return YES;
}
}
return NO;
}
- (BOOL)isRecipientIdBlocked:(NSString *)recipientId
{
AssertIsOnMainThread();

@ -48,11 +48,9 @@ extern NSString *const OWSContactsManagerSignalAccountsDidChangeNotification;
#pragma mark - Util
- (NSString *)displayNameForPhoneIdentifier:(nullable NSString *)identifier;
- (NSString *)displayNameForContact:(Contact *)contact;
- (NSString *)displayNameForSignalAccount:(SignalAccount *)signalAccount;
- (nullable UIImage *)imageForPhoneIdentifier:(nullable NSString *)identifier;
- (NSAttributedString *)formattedDisplayNameForSignalAccount:(SignalAccount *)signalAccount font:(UIFont *_Nonnull)font;
- (NSAttributedString *)formattedFullNameForContact:(Contact *)contact font:(UIFont *)font;
- (NSAttributedString *)formattedFullNameForRecipientId:(NSString *)recipientId font:(UIFont *)font;
+ (NSComparator _Nonnull)contactComparator;

@ -27,9 +27,6 @@ extern NSString *const kContactsTable_CellReuseIdentifier;
+ (CGFloat)rowHeight;
// TODO: Remove this method once "new 1:1 conversation" view is converted to use SignalAccounts.
- (void)configureWithContact:(Contact *)contact contactsManager:(OWSContactsManager *)contactsManager;
- (void)configureWithSignalAccount:(SignalAccount *)signalAccount contactsManager:(OWSContactsManager *)contactsManager;
- (void)configureWithRecipientId:(NSString *)recipientId contactsManager:(OWSContactsManager *)contactsManager;

@ -82,14 +82,6 @@ NSString *const kContactsTable_CellReuseIdentifier = @"kContactsTable_CellReuseI
[self layoutSubviews];
}
- (void)configureWithContact:(Contact *)contact contactsManager:(OWSContactsManager *)contactsManager
{
[self configureWithRecipientId:contact.textSecureIdentifiers.firstObject
avatarName:contact.fullName
displayName:[contactsManager formattedFullNameForContact:contact font:self.nameLabel.font]
contactsManager:contactsManager];
}
- (void)configureWithSignalAccount:(SignalAccount *)signalAccount contactsManager:(OWSContactsManager *)contactsManager
{
[self configureWithRecipientId:signalAccount.recipientId

Loading…
Cancel
Save