Respond to CR.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-02-08 14:25:31 -05:00
parent adfbcc3e27
commit 192264e45b
5 changed files with 24 additions and 18 deletions

View File

@ -1,5 +1,5 @@
//
// Prefix header for all source files of the 'RedPhone' target in the 'RedPhone' project
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import <Availability.h>
@ -16,8 +16,8 @@
#endif
#import <SignalServiceKit/Asserts.h>
#import <SignalServiceKit/OWSDispatch.h>
#import "iOSVersions.h"
#import "OWSDispatch.h"
#define SignalAlertView(title,msg) [[[UIAlertView alloc] initWithTitle:title message:msg delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", @"") otherButtonTitles:nil, nil] show]
#define SignalReportError [Pastelog reportErrorAndSubmitLogsWithAlertTitle:NSLocalizedString(@"ERROR_WAS_DETECTED_TITLE", @"") alertBody:NSLocalizedString(@"ERROR_WAS_DETECTED_SUBMIT", @"")];

View File

@ -1,3 +1,7 @@
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import <Contacts/Contacts.h>
#import <Foundation/Foundation.h>
#import <SignalServiceKit/ContactsManagerProtocol.h>
@ -8,7 +12,7 @@
NS_ASSUME_NONNULL_BEGIN
extern NSString *const OWSContactsManagerContactsDidChangeNotification;
extern NSString *const OWSContactsManagerSignalRecipientsDidChangeNotification;
@class UIFont;

View File

@ -1,3 +1,7 @@
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "OWSContactsManager.h"
#import "ContactsUpdater.h"
#import "Environment.h"
@ -7,7 +11,8 @@
typedef BOOL (^ContactSearchBlock)(id, NSUInteger, BOOL *);
NSString *const OWSContactsManagerContactsDidChangeNotification = @"OWSContactsManagerContactsDidChangeNotification";
NSString *const OWSContactsManagerSignalRecipientsDidChangeNotification =
@"OWSContactsManagerSignalRecipientsDidChangeNotification";
@interface OWSContactsManager ()
@ -103,7 +108,7 @@ void onAddressBookChanged(ABAddressBookRef notifyAddressBook, CFDictionaryRef in
[[ContactsUpdater sharedUpdater] updateSignalContactIntersectionWithABContacts:self.allContacts
success:^{
DDLogInfo(@"%@ Successfully intersected contacts.", self.tag);
[self fireContactsDidChange];
[self fireSignalRecipientsDidChange];
}
failure:^(NSError *error) {
DDLogWarn(@"%@ Failed to intersect contacts with error: %@. Rescheduling", self.tag, error);
@ -116,10 +121,11 @@ void onAddressBookChanged(ABAddressBookRef notifyAddressBook, CFDictionaryRef in
}];
}
- (void)fireContactsDidChange {
- (void)fireSignalRecipientsDidChange
{
AssertIsOnMainThread();
[[NSNotificationCenter defaultCenter] postNotificationName:OWSContactsManagerContactsDidChangeNotification
[[NSNotificationCenter defaultCenter] postNotificationName:OWSContactsManagerSignalRecipientsDidChangeNotification
object:nil];
}

View File

@ -99,8 +99,8 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
- (void)observeNotifications
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(contactsDidChange:)
name:OWSContactsManagerContactsDidChangeNotification
selector:@selector(signalRecipientsDidChange:)
name:OWSContactsManagerSignalRecipientsDidChangeNotification
object:nil];
}
@ -109,7 +109,7 @@ NSString *const MessageComposeTableViewControllerCellContact = @"ContactTableVie
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)contactsDidChange:(NSNotification *)notification {
- (void)signalRecipientsDidChange:(NSNotification *)notification {
[self updateContacts];
}

View File

@ -1,9 +1,5 @@
//
// NewGroupViewController.m
// Signal
//
// Created by Dylan Bourgeois on 13/11/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "NewGroupViewController.h"
@ -75,8 +71,8 @@ static NSString *const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
- (void)observeNotifications
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(contactsDidChange:)
name:OWSContactsManagerContactsDidChangeNotification
selector:@selector(signalRecipientsDidChange:)
name:OWSContactsManagerSignalRecipientsDidChangeNotification
object:nil];
}
@ -85,7 +81,7 @@ static NSString *const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)contactsDidChange:(NSNotification *)notification {
- (void)signalRecipientsDidChange:(NSNotification *)notification {
[self updateContacts];
}