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> #import <Availability.h>
@ -16,8 +16,8 @@
#endif #endif
#import <SignalServiceKit/Asserts.h> #import <SignalServiceKit/Asserts.h>
#import <SignalServiceKit/OWSDispatch.h>
#import "iOSVersions.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 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", @"")]; #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 <Contacts/Contacts.h>
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <SignalServiceKit/ContactsManagerProtocol.h> #import <SignalServiceKit/ContactsManagerProtocol.h>
@ -8,7 +12,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
extern NSString *const OWSContactsManagerContactsDidChangeNotification; extern NSString *const OWSContactsManagerSignalRecipientsDidChangeNotification;
@class UIFont; @class UIFont;

View file

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

View file

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

View file

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