From 6d2acb70fc95a4ed152747545f7883d58ade50a5 Mon Sep 17 00:00:00 2001 From: Christine Corbett Date: Mon, 26 Jan 2015 12:22:00 -1000 Subject: [PATCH] in message view compose, ability to call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • RedPhone contacts which aren't TextSecure contacts are disabled from starting conversation via compose. --- Signal.xcodeproj/project.pbxproj | 4 - Signal/src/Storyboard/Storyboard.storyboard | 152 +++++++++++++++++- .../view controllers/ContactTableViewCell.xib | 52 ------ .../MessageComposeTableViewController.m | 7 +- Signal/src/views/ContactTableViewCell.h | 3 +- Signal/src/views/ContactTableViewCell.m | 46 +----- 6 files changed, 161 insertions(+), 103 deletions(-) delete mode 100644 Signal/src/view controllers/ContactTableViewCell.xib diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index abed8117e..41d3a0678 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -274,7 +274,6 @@ A1A018531805C60D00A052A6 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D221A091169C9E5E00537ABF /* CoreGraphics.framework */; }; A1C32D5017A06538000A904E /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1C32D4F17A06537000A904E /* AddressBookUI.framework */; }; A1C32D5117A06544000A904E /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1C32D4D17A0652C000A904E /* AddressBook.framework */; }; - A507A3B01A6C60E300BEED0D /* ContactTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A507A3AE1A6C60E300BEED0D /* ContactTableViewCell.xib */; }; A507A3B11A6C60E300BEED0D /* InboxTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A507A3AF1A6C60E300BEED0D /* InboxTableViewCell.xib */; }; A547DD741A70A87800103EC7 /* DJWActionSheet+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = A547DD721A70A87800103EC7 /* DJWActionSheet+OWS.m */; }; A5509ECA1A69AB8B00ABA4BC /* Storyboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A5509EC91A69AB8B00ABA4BC /* Storyboard.storyboard */; }; @@ -876,7 +875,6 @@ A1C32D4D17A0652C000A904E /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; A1C32D4F17A06537000A904E /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; }; A1FDCBEE16DAA6C300868894 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; - A507A3AE1A6C60E300BEED0D /* ContactTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ContactTableViewCell.xib; path = "Signal/src/view controllers/ContactTableViewCell.xib"; sourceTree = SOURCE_ROOT; }; A507A3AF1A6C60E300BEED0D /* InboxTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = InboxTableViewCell.xib; path = "Signal/src/view controllers/InboxTableViewCell.xib"; sourceTree = SOURCE_ROOT; }; A547DD721A70A87800103EC7 /* DJWActionSheet+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "DJWActionSheet+OWS.m"; path = "util/DJWActionSheet+OWS.m"; sourceTree = ""; }; A547DD731A70A87800103EC7 /* DJWActionSheet+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "DJWActionSheet+OWS.h"; path = "util/DJWActionSheet+OWS.h"; sourceTree = ""; }; @@ -1942,7 +1940,6 @@ 76EB053818170B33006006FC /* xibs */ = { isa = PBXGroup; children = ( - A507A3AE1A6C60E300BEED0D /* ContactTableViewCell.xib */, A507A3AF1A6C60E300BEED0D /* InboxTableViewCell.xib */, ); path = xibs; @@ -2995,7 +2992,6 @@ FC3BD97C1A2CD385005B96BB /* signal_dotted@2x.png in Resources */, B10C9B621A7049EC00ECA2BF /* play_icon@2x.png in Resources */, B633C5CD1A1D190B0059AC12 /* photo@2x.png in Resources */, - A507A3B01A6C60E300BEED0D /* ContactTableViewCell.xib in Resources */, B633C5861A1D190B0059AC12 /* call@2x.png in Resources */, B67EBF5D19194AC60084CCFD /* Settings.bundle in Resources */, E1370BE418A0686C00826894 /* outring.mp3 in Resources */, diff --git a/Signal/src/Storyboard/Storyboard.storyboard b/Signal/src/Storyboard/Storyboard.storyboard index 63ffd702b..7f6d4653c 100755 --- a/Signal/src/Storyboard/Storyboard.storyboard +++ b/Signal/src/Storyboard/Storyboard.storyboard @@ -5203,6 +5203,151 @@ A0 09 9A FF A8 8A 09 99 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5237,7 +5382,7 @@ A0 09 9A FF A8 8A 09 99 - + @@ -5469,6 +5614,7 @@ A0 09 9A FF A8 8A 09 99 + @@ -5492,8 +5638,8 @@ A0 09 9A FF A8 8A 09 99 - - + + diff --git a/Signal/src/view controllers/ContactTableViewCell.xib b/Signal/src/view controllers/ContactTableViewCell.xib deleted file mode 100644 index e19cd3b3d..000000000 --- a/Signal/src/view controllers/ContactTableViewCell.xib +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Signal/src/view controllers/MessageComposeTableViewController.m b/Signal/src/view controllers/MessageComposeTableViewController.m index 094ad047a..37be9c831 100644 --- a/Signal/src/view controllers/MessageComposeTableViewController.m +++ b/Signal/src/view controllers/MessageComposeTableViewController.m @@ -263,10 +263,15 @@ -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return 44.0f; + return 52.0f; } #pragma mark - Table View delegate +- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath { + Contact *person = [self contactForIndexPath:indexPath]; + return person.isTextSecureContact ? indexPath : nil; +} + -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { diff --git a/Signal/src/views/ContactTableViewCell.h b/Signal/src/views/ContactTableViewCell.h index c981b1000..80c82e278 100644 --- a/Signal/src/views/ContactTableViewCell.h +++ b/Signal/src/views/ContactTableViewCell.h @@ -11,10 +11,9 @@ @property (nonatomic, strong) IBOutlet UILabel *nameLabel; @property (nonatomic, strong) IBOutlet UIButton *callButton ; -@property (nonatomic, strong) IBOutlet UIButton *messageButton; @property BOOL shouldShowContactButtons; - (void)configureWithContact:(Contact *)contact; - +-(IBAction)callContact:(id)sender; @end diff --git a/Signal/src/views/ContactTableViewCell.m b/Signal/src/views/ContactTableViewCell.m index c3fcb5312..d0f406f4a 100644 --- a/Signal/src/views/ContactTableViewCell.m +++ b/Signal/src/views/ContactTableViewCell.m @@ -16,10 +16,7 @@ @implementation ContactTableViewCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { - self = [NSBundle.mainBundle loadNibNamed:NSStringFromClass(self.class) owner:self options:nil][0]; - self.selectionStyle = UITableViewCellSelectionStyleGray; - _shouldShowContactButtons = YES; - + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; return self; } @@ -27,38 +24,15 @@ return NSStringFromClass(self.class); } --(void)showContactButtons:(BOOL)enabled -{ - _callButton.hidden = !enabled; - _callButton.enabled = enabled; - _messageButton.hidden = !enabled; - _callButton.enabled = enabled; -} - (void)configureWithContact:(Contact *)contact { - [self showContactButtons:_shouldShowContactButtons]; - + _callButton.hidden = !contact.isRedPhoneContact; + if(!contact.isTextSecureContact) { + self.selectionStyle = UITableViewCellSelectionStyleNone; + } _associatedContact = contact; _nameLabel.attributedText = [self attributedStringForContact:contact]; - - if (contact.isRedPhoneContact && _shouldShowContactButtons) - { - UIImage * callImage = [[UIImage imageNamed:@"call_dark"]imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; - [_callButton setImage:callImage forState:UIControlStateNormal]; - _callButton.tintColor = [UIColor ows_materialBlueColor]; - } else { - [_callButton setImage:[UIImage imageNamed:@"call_dotted"] forState:UIControlStateNormal]; - } - - if (contact.isTextSecureContact && _shouldShowContactButtons) - { - UIImage * messageImage = [[UIImage imageNamed:@"signal"]imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; - [_messageButton setImage:messageImage forState:UIControlStateNormal]; - _messageButton.tintColor = [UIColor ows_materialBlueColor]; - } else { - [_messageButton setImage:[UIImage imageNamed:@"signal_dotted"] forState:UIControlStateNormal]; - } } - (NSAttributedString *)attributedStringForContact:(Contact *)contact { @@ -98,15 +72,5 @@ } } --(IBAction)messageContact:(id)sender -{ - if (_associatedContact.isTextSecureContact) { - NSArray *textSecureIdentifiers = [_associatedContact textSecureIdentifiers]; - [Environment messageIdentifier:[textSecureIdentifiers firstObject]]; - } else{ - DDLogWarn(@"Tried to intiate a call but contact has no RedPhone identifier"); - } - -} @end