From 192264e45bc6ab91c6d300572808231138ec127f Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 8 Feb 2017 14:25:31 -0500 Subject: [PATCH] Respond to CR. // FREEBIE --- Signal/Signal-Prefix.pch | 4 ++-- Signal/src/contact/OWSContactsManager.h | 6 +++++- Signal/src/contact/OWSContactsManager.m | 14 ++++++++++---- .../MessageComposeTableViewController.m | 6 +++--- .../src/view controllers/NewGroupViewController.m | 12 ++++-------- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Signal/Signal-Prefix.pch b/Signal/Signal-Prefix.pch index 215a8114a..800821156 100644 --- a/Signal/Signal-Prefix.pch +++ b/Signal/Signal-Prefix.pch @@ -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 @@ -16,8 +16,8 @@ #endif #import + #import #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", @"")]; diff --git a/Signal/src/contact/OWSContactsManager.h b/Signal/src/contact/OWSContactsManager.h index 4f9be825e..a2564dbbc 100644 --- a/Signal/src/contact/OWSContactsManager.h +++ b/Signal/src/contact/OWSContactsManager.h @@ -1,3 +1,7 @@ +// +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// + #import #import #import @@ -8,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN -extern NSString *const OWSContactsManagerContactsDidChangeNotification; +extern NSString *const OWSContactsManagerSignalRecipientsDidChangeNotification; @class UIFont; diff --git a/Signal/src/contact/OWSContactsManager.m b/Signal/src/contact/OWSContactsManager.m index 5261da0de..9a950168d 100644 --- a/Signal/src/contact/OWSContactsManager.m +++ b/Signal/src/contact/OWSContactsManager.m @@ -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]; } diff --git a/Signal/src/view controllers/MessageComposeTableViewController.m b/Signal/src/view controllers/MessageComposeTableViewController.m index df6e09ba9..aea995462 100644 --- a/Signal/src/view controllers/MessageComposeTableViewController.m +++ b/Signal/src/view controllers/MessageComposeTableViewController.m @@ -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]; } diff --git a/Signal/src/view controllers/NewGroupViewController.m b/Signal/src/view controllers/NewGroupViewController.m index 58f132880..4a8ac6fb8 100644 --- a/Signal/src/view controllers/NewGroupViewController.m +++ b/Signal/src/view controllers/NewGroupViewController.m @@ -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]; }