in message view compose, ability to call

• RedPhone contacts which aren't TextSecure contacts are disabled from starting conversation via compose.
This commit is contained in:
Christine Corbett 2015-01-26 12:22:00 -10:00
parent 2d6b15333a
commit 6d2acb70fc
6 changed files with 161 additions and 103 deletions

View file

@ -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 = "<group>"; };
A547DD731A70A87800103EC7 /* DJWActionSheet+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "DJWActionSheet+OWS.h"; path = "util/DJWActionSheet+OWS.h"; sourceTree = "<group>"; };
@ -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 */,

View file

@ -5203,6 +5203,151 @@ A0 09 9A FF A8 8A 09 99</string>
<rect key="frame" x="0.0" y="0.0" width="600" height="536"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="ContactTableViewCell" rowHeight="48" id="Ld5-sX-pB8" customClass="ContactTableViewCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Ld5-sX-pB8" id="EqP-87-4hZ">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="urb-Me-knG">
<rect key="frame" x="0.0" y="-21" width="42" height="21"/>
<constraints>
<constraint firstAttribute="width" constant="200" id="x58-IA-RdP">
<variation key="heightClass=regular-widthClass=compact" constant="300"/>
</constraint>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
<variation key="default">
<mask key="constraints">
<exclude reference="x58-IA-RdP"/>
</mask>
</variation>
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
<rect key="frame" x="19" y="4" width="300" height="35.5"/>
<mask key="constraints">
<include reference="x58-IA-RdP"/>
</mask>
</variation>
</label>
<button opaque="NO" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fLe-oL-dMO">
<rect key="frame" x="-23" y="-15" width="46" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="22" id="AOr-xI-am4">
<variation key="heightClass=regular-widthClass=compact" constant="52"/>
</constraint>
<constraint firstAttribute="height" constant="22" id="dQN-ek-OOr">
<variation key="heightClass=regular-widthClass=compact" constant="52"/>
</constraint>
</constraints>
<inset key="contentEdgeInsets" minX="12" minY="12" maxX="12" maxY="12"/>
<state key="normal" image="btnPhone--blue"/>
<variation key="default">
<mask key="constraints">
<exclude reference="AOr-xI-am4"/>
<exclude reference="dQN-ek-OOr"/>
</mask>
</variation>
<variation key="heightClass=regular-widthClass=compact">
<mask key="constraints">
<include reference="AOr-xI-am4"/>
<include reference="dQN-ek-OOr"/>
</mask>
</variation>
<connections>
<action selector="callContact:" destination="Ld5-sX-pB8" eventType="touchUpInside" id="5t9-mr-Zna"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="fLe-oL-dMO" firstAttribute="leading" secondItem="urb-Me-knG" secondAttribute="trailing" constant="28" id="2Vf-k2-W49">
<variation key="heightClass=regular-widthClass=compact" constant="20"/>
</constraint>
<constraint firstAttribute="bottomMargin" secondItem="urb-Me-knG" secondAttribute="bottom" constant="4" id="3fF-H3-Spz">
<variation key="heightClass=regular-widthClass=compact" constant="-4"/>
</constraint>
<constraint firstItem="fLe-oL-dMO" firstAttribute="leading" secondItem="EqP-87-4hZ" secondAttribute="leadingMargin" constant="331" id="5IO-fW-aD7"/>
<constraint firstItem="fLe-oL-dMO" firstAttribute="leading" secondItem="urb-Me-knG" secondAttribute="leading" constant="319" id="LjB-Ps-0DS"/>
<constraint firstAttribute="trailingMargin" secondItem="urb-Me-knG" secondAttribute="trailing" constant="61" id="R9g-GE-nWU">
<variation key="heightClass=regular-widthClass=compact" constant="70"/>
</constraint>
<constraint firstItem="urb-Me-knG" firstAttribute="leading" secondItem="EqP-87-4hZ" secondAttribute="leadingMargin" constant="13" id="Zjd-vI-V9V">
<variation key="heightClass=regular-widthClass=compact" constant="12"/>
</constraint>
<constraint firstAttribute="bottomMargin" secondItem="fLe-oL-dMO" secondAttribute="bottom" constant="-4" id="flj-fb-47g"/>
<constraint firstItem="fLe-oL-dMO" firstAttribute="width" secondItem="urb-Me-knG" secondAttribute="width" id="hKy-af-fMx"/>
<constraint firstItem="urb-Me-knG" firstAttribute="top" secondItem="EqP-87-4hZ" secondAttribute="topMargin" constant="3" id="iex-zH-iTD">
<variation key="heightClass=regular-widthClass=compact" constant="-4"/>
</constraint>
<constraint firstItem="fLe-oL-dMO" firstAttribute="centerY" secondItem="urb-Me-knG" secondAttribute="centerY" constant="-0.75" id="j8L-QL-A7r">
<variation key="heightClass=regular-widthClass=compact" constant="0.0"/>
</constraint>
<constraint firstAttribute="trailingMargin" secondItem="fLe-oL-dMO" secondAttribute="trailing" constant="20" id="kBR-I4-HV3">
<variation key="heightClass=regular-widthClass=compact" constant="4"/>
</constraint>
<constraint firstItem="fLe-oL-dMO" firstAttribute="top" secondItem="EqP-87-4hZ" secondAttribute="topMargin" constant="-4" id="rmh-CA-Wxe"/>
<constraint firstAttribute="centerX" secondItem="fLe-oL-dMO" secondAttribute="centerX" constant="-150" id="xJ6-WQ-D6w"/>
<constraint firstItem="fLe-oL-dMO" firstAttribute="trailing" secondItem="urb-Me-knG" secondAttribute="trailing" constant="44" id="yI1-XH-CUW"/>
<constraint firstAttribute="trailingMargin" secondItem="fLe-oL-dMO" secondAttribute="trailing" constant="31" id="yJX-cn-Oue"/>
<constraint firstItem="urb-Me-knG" firstAttribute="top" secondItem="fLe-oL-dMO" secondAttribute="bottom" constant="-28" id="yiJ-F5-vDc"/>
</constraints>
<variation key="default">
<mask key="subviews">
<exclude reference="urb-Me-knG"/>
<exclude reference="fLe-oL-dMO"/>
</mask>
<mask key="constraints">
<exclude reference="3fF-H3-Spz"/>
<exclude reference="R9g-GE-nWU"/>
<exclude reference="Zjd-vI-V9V"/>
<exclude reference="iex-zH-iTD"/>
<exclude reference="yiJ-F5-vDc"/>
<exclude reference="2Vf-k2-W49"/>
<exclude reference="5IO-fW-aD7"/>
<exclude reference="LjB-Ps-0DS"/>
<exclude reference="flj-fb-47g"/>
<exclude reference="hKy-af-fMx"/>
<exclude reference="j8L-QL-A7r"/>
<exclude reference="kBR-I4-HV3"/>
<exclude reference="rmh-CA-Wxe"/>
<exclude reference="xJ6-WQ-D6w"/>
<exclude reference="yI1-XH-CUW"/>
<exclude reference="yJX-cn-Oue"/>
</mask>
</variation>
<variation key="heightClass=regular-widthClass=compact">
<mask key="subviews">
<include reference="urb-Me-knG"/>
<include reference="fLe-oL-dMO"/>
</mask>
<mask key="constraints">
<include reference="3fF-H3-Spz"/>
<include reference="R9g-GE-nWU"/>
<include reference="Zjd-vI-V9V"/>
<include reference="iex-zH-iTD"/>
<exclude reference="yiJ-F5-vDc"/>
<include reference="2Vf-k2-W49"/>
<exclude reference="5IO-fW-aD7"/>
<exclude reference="LjB-Ps-0DS"/>
<exclude reference="flj-fb-47g"/>
<exclude reference="hKy-af-fMx"/>
<include reference="j8L-QL-A7r"/>
<exclude reference="kBR-I4-HV3"/>
<exclude reference="rmh-CA-Wxe"/>
<exclude reference="xJ6-WQ-D6w"/>
<exclude reference="yI1-XH-CUW"/>
<exclude reference="yJX-cn-Oue"/>
</mask>
</variation>
</tableViewCellContentView>
<connections>
<outlet property="callButton" destination="fLe-oL-dMO" id="vXp-mN-WSg"/>
<outlet property="nameLabel" destination="urb-Me-knG" id="2h5-l1-QDQ"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="Qga-41-bw2" id="dUq-5d-dub"/>
<outlet property="delegate" destination="Qga-41-bw2" id="vfF-Gh-noL"/>
@ -5237,7 +5382,7 @@ A0 09 9A FF A8 8A 09 99</string>
<viewControllerLayoutGuide type="bottom" id="kH6-9L-pzh"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="P0X-AM-Yjw">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="536"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ukg-om-VX3">
@ -5469,6 +5614,7 @@ A0 09 9A FF A8 8A 09 99</string>
<image name="archive-inactive@1x" width="40" height="51"/>
<image name="btnCancel--white" width="20" height="20"/>
<image name="btnGroup--white" width="29" height="26"/>
<image name="btnPhone--blue" width="45" height="44"/>
<image name="btnSignalLogo--white" width="32" height="32"/>
<image name="call.png" width="100" height="100"/>
<image name="call_dark.png" width="50" height="50"/>
@ -5492,8 +5638,8 @@ A0 09 9A FF A8 8A 09 99</string>
<image name="speaker-inactive" width="80" height="80"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="DR8-fx-0PD"/>
<segue reference="gZ1-lh-srF"/>
<segue reference="ZcV-Ck-baL"/>
<segue reference="xo7-5J-BJb"/>
<segue reference="D0d-4f-lcI"/>
</inferredMetricsTieBreakers>
</document>

View file

@ -1,52 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" indentationWidth="10" reuseIdentifier="ContactTableViewCell" id="11" customClass="ContactTableViewCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="11" id="Ibd-RS-koG">
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Tyler Reinhard" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3">
<rect key="frame" x="20" y="4" width="222" height="36"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pUn-E0-OEJ">
<rect key="frame" x="283" y="9" width="25" height="25.5"/>
<state key="normal" title="Button" image="btnPhone--blue">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
</subviews>
<constraints>
<constraint firstItem="3" firstAttribute="top" secondItem="Ibd-RS-koG" secondAttribute="topMargin" constant="-4" id="H8v-R2-KWU"/>
<constraint firstAttribute="trailingMargin" secondItem="3" secondAttribute="trailing" constant="70" id="KCJ-gu-mnE"/>
<constraint firstItem="3" firstAttribute="leading" secondItem="Ibd-RS-koG" secondAttribute="leadingMargin" constant="37" id="hEW-rs-zJ0"/>
<constraint firstItem="3" firstAttribute="leading" secondItem="Ibd-RS-koG" secondAttribute="leadingMargin" constant="12" id="jFH-FI-5hp"/>
<constraint firstAttribute="bottomMargin" secondItem="3" secondAttribute="bottom" constant="-4.5" id="vDP-VK-QhQ"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="hEW-rs-zJ0"/>
</mask>
</variation>
</tableViewCellContentView>
<connections>
<outlet property="nameLabel" destination="3" id="13"/>
</connections>
<point key="canvasLocation" x="191" y="440"/>
</tableViewCell>
</objects>
<resources>
<image name="btnPhone--blue" width="45" height="44"/>
</resources>
</document>

View file

@ -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
{

View file

@ -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

View file

@ -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