messaging view and group creation fixes:
• Create button should be btnCompose--white • Add people to be a tableview header (ask @helveticade for creatives) • Send button = btnSend--blue • Attachments button = btnAttachments--blue • message footer changes from call to message as input • Remove more button • Empty State update with asset and new copy • Default group name should be 'New Group' (UI only) • loading view • Update tab bar items with revised PDFs • Blue outline around avatar-less contacts • Replace swipe left actions with btnDelete--white asset • Replace swipe right buttons with cellBtnMoveToArchive--blue and cellBtnMoveToInbox--blue respectively • Done icon replaced with btnSignal in settings • Settings: Swap blue and grey for Registered Number and Change (change doesn't look like a button) • Settings: UI Switch on should be Signal Blue. • Disable search ui + group button while downloading contacts • new group: Create button should be btnCompose--white • new group: Add people to be a tableview header
This commit is contained in:
parent
d84ac5a493
commit
638dfae668
|
@ -97,7 +97,7 @@ CHECKOUT OPTIONS:
|
|||
:commit: cf63307d5e3833b16caa9a07f3b5ea06359913f9
|
||||
:git: https://github.com/corbett/APDropDownNavToolbar.git
|
||||
JSQMessagesViewController:
|
||||
:commit: 184f53b07b6a80709b9801d605f666fd61e297fb
|
||||
:commit: c8262eee36cf84eded334062dc80e1f2a1c495ab
|
||||
:git: https://github.com/WhisperSystems/JSQMessagesViewController
|
||||
SocketRocket:
|
||||
:commit: 954750c018
|
||||
|
|
2
Pods
2
Pods
|
@ -1 +1 @@
|
|||
Subproject commit 19ec30e1b24355b4115a21b6895a49f378ad40c4
|
||||
Subproject commit 8bf6fdd6c8a4c4e48c41814734e8709ba2396e6f
|
|
@ -315,6 +315,8 @@ static NSString* const kCallSegue = @"2.0_6.0_Call_Segue";
|
|||
[UIColor clearColor], UITextAttributeTextShadowColor,
|
||||
[NSValue valueWithUIOffset:UIOffsetMake(-1, 0)], UITextAttributeTextShadowOffset, nil];
|
||||
|
||||
[[UISwitch appearance] setOnTintColor:[UIColor ows_materialBlueColor]];
|
||||
|
||||
[[UINavigationBar appearance] setTitleTextAttributes:navbarTitleTextAttributes];
|
||||
|
||||
}
|
||||
|
|
|
@ -201,6 +201,13 @@
|
|||
</mask>
|
||||
</variation>
|
||||
</view>
|
||||
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="uiEmptyArchive" translatesAutoresizingMaskIntoConstraints="NO" id="TL0-JW-QbT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="240" height="128"/>
|
||||
<color key="backgroundColor" red="0.99989169836044312" green="1" blue="0.99988096952438354" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
|
||||
<rect key="frame" x="0.0" y="64" width="410" height="671"/>
|
||||
</variation>
|
||||
</imageView>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="PaA-ol-uQT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
|
||||
|
@ -216,6 +223,9 @@
|
|||
</tableViewCell>
|
||||
</prototypes>
|
||||
<sections/>
|
||||
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
|
||||
<rect key="frame" x="0.0" y="64" width="410" height="671"/>
|
||||
</variation>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="MY2-bB-USa" id="kop-Y6-6DR"/>
|
||||
<outlet property="delegate" destination="MY2-bB-USa" id="vmj-PA-2Od"/>
|
||||
|
@ -225,6 +235,9 @@
|
|||
<constraints>
|
||||
<constraint firstAttribute="centerX" secondItem="uoq-UX-3fJ" secondAttribute="centerX" constant="-5" id="6gc-oZ-IMJ"/>
|
||||
<constraint firstItem="7uh-gm-z8v" firstAttribute="top" secondItem="uoq-UX-3fJ" secondAttribute="bottom" id="7iL-hd-xP7"/>
|
||||
<constraint firstItem="TL0-JW-QbT" firstAttribute="width" secondItem="EFA-Fu-XJm" secondAttribute="width" id="9eN-l2-dkv">
|
||||
<variation key="heightClass=regular-widthClass=compact" constant="10"/>
|
||||
</constraint>
|
||||
<constraint firstAttribute="width" secondItem="uoq-UX-3fJ" secondAttribute="width" id="AP2-DE-zts"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="PaA-ol-uQT" secondAttribute="trailing" constant="-16" id="EdI-ia-IjN">
|
||||
<variation key="heightClass=regular-widthClass=compact" constant="-26"/>
|
||||
|
@ -232,7 +245,11 @@
|
|||
<constraint firstAttribute="trailingMargin" secondItem="uoq-UX-3fJ" secondAttribute="trailing" constant="-16" id="Fc5-tN-hro"/>
|
||||
<constraint firstItem="7uh-gm-z8v" firstAttribute="top" secondItem="uoq-UX-3fJ" secondAttribute="bottom" id="GCa-EH-8Vh"/>
|
||||
<constraint firstItem="uoq-UX-3fJ" firstAttribute="leading" secondItem="EFA-Fu-XJm" secondAttribute="leadingMargin" constant="-16" id="La3-rh-BpY"/>
|
||||
<constraint firstItem="7uh-gm-z8v" firstAttribute="top" secondItem="TL0-JW-QbT" secondAttribute="bottom" constant="65" id="LzX-41-FwR">
|
||||
<variation key="heightClass=regular-widthClass=compact" constant="66"/>
|
||||
</constraint>
|
||||
<constraint firstItem="PaA-ol-uQT" firstAttribute="leading" secondItem="EFA-Fu-XJm" secondAttribute="leadingMargin" constant="-16" id="OD6-Pc-Zug"/>
|
||||
<constraint firstItem="TL0-JW-QbT" firstAttribute="top" secondItem="lZK-q4-iwt" secondAttribute="bottom" id="jlZ-yQ-LLc"/>
|
||||
<constraint firstItem="PaA-ol-uQT" firstAttribute="top" secondItem="lZK-q4-iwt" secondAttribute="bottom" id="ouV-vM-Vyv">
|
||||
<variation key="heightClass=regular-widthClass=compact" constant="0.0"/>
|
||||
</constraint>
|
||||
|
@ -241,45 +258,56 @@
|
|||
<variation key="heightClass=regular-widthClass=compact" constant="10"/>
|
||||
</constraint>
|
||||
<constraint firstItem="uoq-UX-3fJ" firstAttribute="top" secondItem="lZK-q4-iwt" secondAttribute="bottom" constant="-1" id="xlM-od-Zuu"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="TL0-JW-QbT" secondAttribute="trailing" constant="-26" id="yfL-K8-woe"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="subviews">
|
||||
<exclude reference="uoq-UX-3fJ"/>
|
||||
<exclude reference="TL0-JW-QbT"/>
|
||||
<exclude reference="PaA-ol-uQT"/>
|
||||
</mask>
|
||||
<mask key="constraints">
|
||||
<exclude reference="7iL-hd-xP7"/>
|
||||
<exclude reference="GCa-EH-8Vh"/>
|
||||
<exclude reference="s5v-Hl-a3k"/>
|
||||
<exclude reference="EdI-ia-IjN"/>
|
||||
<exclude reference="OD6-Pc-Zug"/>
|
||||
<exclude reference="ouV-vM-Vyv"/>
|
||||
<exclude reference="wn4-O9-ILm"/>
|
||||
<exclude reference="9eN-l2-dkv"/>
|
||||
<exclude reference="jlZ-yQ-LLc"/>
|
||||
<exclude reference="yfL-K8-woe"/>
|
||||
<exclude reference="6gc-oZ-IMJ"/>
|
||||
<exclude reference="AP2-DE-zts"/>
|
||||
<exclude reference="Fc5-tN-hro"/>
|
||||
<exclude reference="La3-rh-BpY"/>
|
||||
<exclude reference="xlM-od-Zuu"/>
|
||||
<exclude reference="7iL-hd-xP7"/>
|
||||
<exclude reference="GCa-EH-8Vh"/>
|
||||
<exclude reference="LzX-41-FwR"/>
|
||||
<exclude reference="s5v-Hl-a3k"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<variation key="heightClass=regular-widthClass=compact">
|
||||
<mask key="subviews">
|
||||
<include reference="uoq-UX-3fJ"/>
|
||||
<include reference="TL0-JW-QbT"/>
|
||||
<include reference="PaA-ol-uQT"/>
|
||||
</mask>
|
||||
<mask key="constraints">
|
||||
<include reference="7iL-hd-xP7"/>
|
||||
<exclude reference="GCa-EH-8Vh"/>
|
||||
<include reference="s5v-Hl-a3k"/>
|
||||
<include reference="EdI-ia-IjN"/>
|
||||
<exclude reference="OD6-Pc-Zug"/>
|
||||
<include reference="ouV-vM-Vyv"/>
|
||||
<include reference="wn4-O9-ILm"/>
|
||||
<include reference="9eN-l2-dkv"/>
|
||||
<include reference="jlZ-yQ-LLc"/>
|
||||
<include reference="yfL-K8-woe"/>
|
||||
<exclude reference="6gc-oZ-IMJ"/>
|
||||
<include reference="AP2-DE-zts"/>
|
||||
<include reference="Fc5-tN-hro"/>
|
||||
<include reference="La3-rh-BpY"/>
|
||||
<exclude reference="xlM-od-Zuu"/>
|
||||
<include reference="7iL-hd-xP7"/>
|
||||
<exclude reference="GCa-EH-8Vh"/>
|
||||
<include reference="LzX-41-FwR"/>
|
||||
<include reference="s5v-Hl-a3k"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</view>
|
||||
|
@ -307,6 +335,7 @@
|
|||
</navigationItem>
|
||||
<connections>
|
||||
<outlet property="archiveButton" destination="WVY-Zl-dpP" id="IdE-Kz-1r0"/>
|
||||
<outlet property="emptyBoxImage" destination="TL0-JW-QbT" id="PTJ-VQ-CBF"/>
|
||||
<outlet property="inboxButton" destination="DfA-eN-PyK" id="p0D-Qj-YzC"/>
|
||||
<outlet property="inboxCountLabel" destination="GV1-fp-iPR" id="MHq-Gs-bgt"/>
|
||||
<outlet property="tableView" destination="PaA-ol-uQT" id="nQU-tR-wbL"/>
|
||||
|
@ -4569,7 +4598,7 @@ A0 09 9A FF A8 8A 09 99</string>
|
|||
<constraint firstAttribute="height" constant="21" id="hnY-fM-R9C"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="15"/>
|
||||
<color key="textColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="textColor" red="0.72933125495910645" green="0.72945815324783325" blue="0.72932326793670654" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
|
@ -4613,7 +4642,7 @@ A0 09 9A FF A8 8A 09 99</string>
|
|||
</constraints>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
|
||||
<state key="normal" title="Change">
|
||||
<color key="titleColor" red="0.73013532161712646" green="0.73026233911514282" blue="0.73012733459472656" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="titleColor" red="0.0" green="0.55733579397201538" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<variation key="default">
|
||||
|
@ -5159,9 +5188,10 @@ A0 09 9A FF A8 8A 09 99</string>
|
|||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Settings" id="Yrv-vP-ZVP" userLabel="_7.0a - Navigation Bar">
|
||||
<barButtonItem key="rightBarButtonItem" systemItem="done" id="TN5-Oj-Mpn">
|
||||
<barButtonItem key="rightBarButtonItem" image="btnSignalLogo--white" style="plain" id="fL4-BJ-gHP">
|
||||
<color key="tintColor" red="0.99989169840000003" green="1" blue="0.99988096950000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<connections>
|
||||
<segue destination="0Ge-H7-b9J" kind="unwind" unwindAction="unwindSettingsDone:" id="f4w-Qb-xi9"/>
|
||||
<segue destination="0Ge-H7-b9J" kind="unwind" unwindAction="unwindSettingsDone:" id="na1-9P-hTS"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
|
@ -5481,24 +5511,52 @@ A0 09 9A FF A8 8A 09 99</string>
|
|||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsMultipleSelection="YES" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="cFo-AT-Srf">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<prototypes>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="HeaderCell" textLabel="mNF-jo-r7O" style="IBUITableViewCellStyleDefault" id="axa-iP-3In">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="axa-iP-3In" id="C0O-2z-zUu">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Add People:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="mNF-jo-r7O">
|
||||
<view key="tableHeaderView" contentMode="scaleToFill" id="ekO-kw-iHV">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Add people:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="daD-wf-IGn">
|
||||
<rect key="frame" x="0.0" y="-21" width="42" height="21"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||
<color key="textColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<variation key="heightClass=regular-widthClass=compact">
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
|
||||
<rect key="frame" x="10" y="274" width="94" height="20.5"/>
|
||||
</variation>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="daD-wf-IGn" firstAttribute="leading" secondItem="ekO-kw-iHV" secondAttribute="leading" constant="26" id="00e-AP-Ygd">
|
||||
<variation key="heightClass=regular-widthClass=compact" constant="10"/>
|
||||
</constraint>
|
||||
<constraint firstAttribute="centerY" secondItem="daD-wf-IGn" secondAttribute="centerY" constant="0.5" id="biL-jB-cMW">
|
||||
<variation key="heightClass=regular-widthClass=compact" constant="0.0"/>
|
||||
</constraint>
|
||||
<constraint firstAttribute="trailing" secondItem="daD-wf-IGn" secondAttribute="trailing" constant="216" id="erz-Mz-zPt"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="subviews">
|
||||
<exclude reference="daD-wf-IGn"/>
|
||||
</mask>
|
||||
<mask key="constraints">
|
||||
<exclude reference="00e-AP-Ygd"/>
|
||||
<exclude reference="biL-jB-cMW"/>
|
||||
<exclude reference="erz-Mz-zPt"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<variation key="heightClass=regular-widthClass=compact">
|
||||
<mask key="subviews">
|
||||
<include reference="daD-wf-IGn"/>
|
||||
</mask>
|
||||
<mask key="constraints">
|
||||
<include reference="00e-AP-Ygd"/>
|
||||
<include reference="biL-jB-cMW"/>
|
||||
<include reference="erz-Mz-zPt"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</view>
|
||||
<prototypes>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="gray" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="GroupSearchCell" textLabel="a4j-OQ-ala" rowHeight="60" style="IBUITableViewCellStyleDefault" id="yfF-Jl-bZ1">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="yfF-Jl-bZ1" id="f0v-od-N9K">
|
||||
|
@ -5636,6 +5694,7 @@ A0 09 9A FF A8 8A 09 99</string>
|
|||
<image name="signals_tab.png" width="24" height="24"/>
|
||||
<image name="speaker-active" width="80" height="80"/>
|
||||
<image name="speaker-inactive" width="80" height="80"/>
|
||||
<image name="uiEmptyArchive" width="227" height="227"/>
|
||||
</resources>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="ZcV-Ck-baL"/>
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
_scrollView.contentSize = CGSizeMake(CGRectGetWidth(_contentContainerView.bounds),
|
||||
CGRectGetHeight(_scrollView.frame));
|
||||
|
||||
[UIUtil applyRoundedBorderToImageView:&_contactPictureView];
|
||||
|
||||
_scrollView.contentOffset = CGPointMake(CGRectGetWidth(_archiveView.frame), 0);
|
||||
_deleteImageView.image = [_deleteImageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
_archiveImageView.image = [_archiveImageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
|
@ -50,6 +48,9 @@
|
|||
_timeLabel.attributedText = [self dateAttributedString:thread.lastMessageDate];
|
||||
if([thread isKindOfClass:[TSGroupThread class]]) {
|
||||
_contactPictureView.image = ((TSGroupThread*)thread).groupModel.groupImage!=nil ? ((TSGroupThread*)thread).groupModel.groupImage : [UIImage imageNamed:@"empty-group-avatar"];
|
||||
if([_nameLabel.text length]==0) {
|
||||
_nameLabel.text = @"New Group";
|
||||
}
|
||||
}
|
||||
else {
|
||||
NSMutableString *initials = [NSMutableString string];
|
||||
|
@ -64,6 +65,14 @@
|
|||
}
|
||||
UIImage* image = [[JSQMessagesAvatarImageFactory avatarImageWithUserInitials:initials backgroundColor:[UIColor whiteColor] textColor:[UIColor ows_materialBlueColor] font:[UIFont ows_regularFontWithSize:36.0] diameter:100] avatarImage];
|
||||
_contactPictureView.image = thread.image!=nil ? thread.image : image;
|
||||
if(thread.image==nil) {
|
||||
UIImage *overlayImage = [UIImage imageNamed:@"circContact--empty"];
|
||||
UIImageView *overlayImageView = [[UIImageView alloc] initWithImage:overlayImage];
|
||||
[_contactPictureView addSubview:overlayImageView];
|
||||
}
|
||||
else {
|
||||
[UIUtil applyRoundedBorderToImageView:&_contactPictureView];
|
||||
}
|
||||
}
|
||||
|
||||
self.separatorInset = UIEdgeInsetsMake(0,_contactPictureView.frame.size.width*1.5f, 0, 0);
|
||||
|
@ -75,7 +84,7 @@
|
|||
{
|
||||
switch (state) {
|
||||
case kArchiveState:
|
||||
_archiveImageView.image = [[UIImage imageNamed:@"reply"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
_archiveImageView.image = [[UIImage imageNamed:@"cellBtnMoveToInbox--blue"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
break;
|
||||
case kInboxState:
|
||||
break;
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3rD-4i-EKG" userLabel="Delete View">
|
||||
<rect key="frame" x="299" y="0.0" width="102" height="72"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="delete.png" translatesAutoresizingMaskIntoConstraints="NO" id="TBw-ud-Ysk">
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="btnDelete--white" translatesAutoresizingMaskIntoConstraints="NO" id="TBw-ud-Ysk">
|
||||
<rect key="frame" x="50" y="23" width="19" height="25"/>
|
||||
<color key="backgroundColor" red="0.97896391153335571" green="0.3013535737991333" blue="0.023711061105132103" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.94901960780000005" green="0.21186716179592704" blue="0.099555311452974679" alpha="1" colorSpace="calibratedRGB"/>
|
||||
|
@ -29,7 +30,7 @@
|
|||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yBY-TS-2tI" userLabel="Archive View">
|
||||
<rect key="frame" x="-32" y="1" width="200" height="71"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="archive.png" translatesAutoresizingMaskIntoConstraints="NO" id="WyX-Hb-Mpn">
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="cellBtnMoveToArchive--blue" translatesAutoresizingMaskIntoConstraints="NO" id="WyX-Hb-Mpn">
|
||||
<rect key="frame" x="60" y="25" width="22" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="22" id="POu-Gs-JsW"/>
|
||||
|
@ -200,8 +201,8 @@
|
|||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="archive.png" width="100" height="100"/>
|
||||
<image name="btnDelete--white" width="19" height="24"/>
|
||||
<image name="cellBtnMoveToArchive--blue" width="30" height="30"/>
|
||||
<image name="contact_default_feed.png" width="242" height="242"/>
|
||||
<image name="delete.png" width="100" height="100"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
}
|
||||
|
||||
@property (nonatomic, strong) UISearchController *searchController;
|
||||
|
||||
@property (nonatomic, strong) UIActivityIndicatorView *activityIndicator;
|
||||
@property (nonatomic, strong) UIBarButtonItem *addGroup;
|
||||
@end
|
||||
|
||||
@implementation MessageComposeTableViewController
|
||||
|
@ -39,10 +40,25 @@
|
|||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self.navigationController.navigationBar setTranslucent:NO];
|
||||
[self initializeSearch];
|
||||
|
||||
contacts = [[Environment getCurrent] contactsManager].textSecureContacts;
|
||||
searchResults = contacts;
|
||||
[self initializeSearch];
|
||||
|
||||
self.searchController.searchBar.hidden = NO;
|
||||
|
||||
|
||||
|
||||
UIView* loadingView = [[UIView alloc] initWithFrame:self.tableView.frame];
|
||||
UIImageView *loadingImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"uiEmpty"]];
|
||||
[loadingImageView setBackgroundColor:[UIColor whiteColor]];
|
||||
[loadingImageView setContentMode:UIViewContentModeCenter];
|
||||
[loadingImageView setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
|
||||
[loadingImageView setFrame:self.tableView.frame];
|
||||
[loadingView addSubview:loadingImageView];
|
||||
|
||||
self.tableView.backgroundView = loadingView;
|
||||
self.tableView.backgroundView.opaque = YES;
|
||||
|
||||
self.tableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
|
||||
}
|
||||
|
@ -236,6 +252,17 @@
|
|||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
if([contacts count] == 0) {
|
||||
self.tableView.backgroundView.hidden = NO;
|
||||
self.searchController.searchBar.hidden = YES;
|
||||
_addGroup = self.navigationItem.rightBarButtonItem!=nil ? _addGroup : self.navigationItem.rightBarButtonItem;
|
||||
self.navigationItem.rightBarButtonItem = nil;
|
||||
}
|
||||
else {
|
||||
self.tableView.backgroundView.hidden = YES;
|
||||
self.searchController.searchBar.hidden = NO;
|
||||
self.navigationItem.rightBarButtonItem = self.navigationItem.rightBarButtonItem!=nil ? self.navigationItem.rightBarButtonItem : _addGroup;
|
||||
}
|
||||
|
||||
if (self.searchController.active) {
|
||||
return (NSInteger)[searchResults count];
|
||||
|
|
|
@ -89,6 +89,9 @@ typedef enum : NSUInteger {
|
|||
@property (nonatomic, strong) TSVideoAttachmentAdapter *currentMediaAdapter;
|
||||
|
||||
@property (nonatomic, retain) NSTimer *readTimer;
|
||||
@property (nonatomic, retain) UIButton *callButton;
|
||||
@property (nonatomic, retain) UIButton *messageButton;
|
||||
@property (nonatomic, retain) UIButton *attachButton;
|
||||
|
||||
@property (nonatomic, retain) NSIndexPath *lastDeliveredMessageIndexPath;
|
||||
|
||||
|
@ -131,11 +134,29 @@ typedef enum : NSUInteger {
|
|||
[self inputToolbar].hidden= YES; // user has requested they leave the group. further sends disallowed
|
||||
self.navigationItem.rightBarButtonItem = nil;
|
||||
}
|
||||
else if(![self isTextSecureReachable] ){
|
||||
[self inputToolbar].hidden= YES; // only RedPhone
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"btnPhone--white"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(callAction)];;
|
||||
|
||||
}
|
||||
}
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self.navigationController.navigationBar setTranslucent:NO];
|
||||
|
||||
_callButton = [[UIButton alloc] init];
|
||||
[_callButton setBackgroundImage:[UIImage imageNamed:@"btnPhone--blue"] forState:UIControlStateNormal];
|
||||
[_callButton addTarget:self action:@selector(callAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_callButton setFrame:CGRectMake(0, 0, 30, 30)];
|
||||
|
||||
_messageButton = [[UIButton alloc] init];
|
||||
[_messageButton setBackgroundImage:[UIImage imageNamed:@"btnSend--blue"] forState:UIControlStateNormal];
|
||||
[_messageButton setFrame:CGRectMake(0, 0, 30, 30)];
|
||||
|
||||
_attachButton = [[UIButton alloc] init];
|
||||
[_attachButton setBackgroundImage:[UIImage imageNamed:@"btnAttachments--blue"] forState:UIControlStateNormal];
|
||||
[_attachButton setFrame:CGRectMake(0, 0, 30, 30)];
|
||||
|
||||
[super viewDidLoad];
|
||||
|
||||
[self markAllMessagesAsRead];
|
||||
|
@ -167,8 +188,15 @@ typedef enum : NSUInteger {
|
|||
|
||||
-(void) initializeTextView {
|
||||
[self.inputToolbar.contentView.textView setFont:[UIFont ows_regularFontWithSize:17.f]];
|
||||
[self.inputToolbar.contentView.rightBarButtonItem.titleLabel setFont:[UIFont ows_mediumFontWithSize:15.f]];
|
||||
[self.inputToolbar.contentView.rightBarButtonItem setTitleColor:[UIColor ows_materialBlueColor] forState:UIControlStateNormal];
|
||||
self.inputToolbar.contentView.leftBarButtonItem = _attachButton;
|
||||
|
||||
if(!isGroupConversation&& [self isRedPhoneReachable] && ![((TSContactThread*)_thread).contactIdentifier isEqualToString:[SignalKeyingStorage.localNumber toE164]]) {
|
||||
self.inputToolbar.contentView.rightBarButtonItem = _callButton;
|
||||
self.inputToolbar.contentView.rightBarButtonItem.enabled = YES;
|
||||
}
|
||||
else {
|
||||
self.inputToolbar.contentView.rightBarButtonItem = _messageButton;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)viewWillAppear:(BOOL)animated
|
||||
|
@ -234,7 +262,7 @@ typedef enum : NSUInteger {
|
|||
|
||||
|
||||
- (IBAction)didSelectShow:(id)sender {
|
||||
|
||||
if (isGroupConversation) {
|
||||
UIBarButtonItem *spaceEdge = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
|
||||
|
||||
spaceEdge.width = 40;
|
||||
|
@ -245,29 +273,15 @@ typedef enum : NSUInteger {
|
|||
UIBarButtonItem *spaceMiddleWords = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
|
||||
|
||||
|
||||
if (!isGroupConversation) {
|
||||
|
||||
//UIBarButtonItem* contactAddOrLaunch = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"contact-add@1x"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:nil];
|
||||
|
||||
UIBarButtonItem* contactSecurity = [[UIBarButtonItem alloc]initWithImage:[[UIImage imageNamed:@"contact-security@1x"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(showFingerprint)];
|
||||
|
||||
|
||||
if ([self isRedPhoneReachable] && ![((TSContactThread*)_thread).contactIdentifier isEqualToString:[SignalKeyingStorage.localNumber toE164]]) {
|
||||
UIBarButtonItem * callButton = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"contact-call@1x"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(callAction)];
|
||||
self.navController.dropDownToolbar.items = @[spaceEdge, callButton,spaceMiddleWords, contactSecurity, spaceEdge];
|
||||
}
|
||||
else {
|
||||
self.navController.dropDownToolbar.items = @[spaceMiddleWords, contactSecurity, spaceMiddleWords];
|
||||
}
|
||||
}
|
||||
else {
|
||||
UIBarButtonItem *groupUpdateButton = [[UIBarButtonItem alloc] initWithTitle:@"Update" style:UIBarButtonItemStylePlain target:self action:@selector(updateGroup)];
|
||||
UIBarButtonItem *groupLeaveButton = [[UIBarButtonItem alloc] initWithTitle:@"Leave" style:UIBarButtonItemStylePlain target:self action:@selector(leaveGroup)];
|
||||
|
||||
UIBarButtonItem *showGroupMembersButton = [[UIBarButtonItem alloc] initWithTitle:@"Members" style:UIBarButtonItemStylePlain target:self action:@selector(showGroupMembers)];
|
||||
|
||||
self.navController.dropDownToolbar.items =@[spaceEdge, groupUpdateButton, spaceMiddleWords, groupLeaveButton, spaceMiddleWords, showGroupMembersButton, spaceEdge];
|
||||
}
|
||||
|
||||
for(UIButton *button in self.navController.dropDownToolbar.items) {
|
||||
[button setTintColor:[UIColor ows_materialBlueColor]];
|
||||
}
|
||||
|
@ -281,9 +295,13 @@ typedef enum : NSUInteger {
|
|||
// [self.navController toggleToolbar:sender];
|
||||
[self setNavigationTitle];
|
||||
}
|
||||
}
|
||||
|
||||
-(void) setNavigationTitle {
|
||||
NSString* navTitle = !isGroupConversation ? self.thread.name : ((TSGroupThread*)self.thread).groupModel.groupName;
|
||||
if(isGroupConversation && [navTitle length]==0) {
|
||||
navTitle = @"New Group";
|
||||
}
|
||||
self.navController.activeNavigationBarTitle = nil;
|
||||
self.title = navTitle;
|
||||
}
|
||||
|
@ -291,8 +309,11 @@ typedef enum : NSUInteger {
|
|||
-(void)initializeToolbars {
|
||||
|
||||
self.navController = (APNavigationController*)self.navigationController;
|
||||
//self.navController.activeBarButtonTitle = @"Hide";
|
||||
if(!isGroupConversation) {
|
||||
self.navigationItem.rightBarButtonItem = nil;
|
||||
}
|
||||
[self setNavigationTitle];
|
||||
|
||||
[self hideInputIfNeeded];
|
||||
}
|
||||
|
||||
|
@ -342,24 +363,52 @@ typedef enum : NSUInteger {
|
|||
return [[Environment getCurrent].contactsManager isPhoneNumberRegisteredWithRedPhone:[self phoneNumberForThread]];
|
||||
}
|
||||
|
||||
|
||||
-(BOOL)isTextSecureReachable {
|
||||
if(isGroupConversation) {
|
||||
return YES;
|
||||
}
|
||||
else {
|
||||
PhoneNumber *number = [self phoneNumberForThread];
|
||||
Contact *contact = [[Environment.getCurrent contactsManager] latestContactForPhoneNumber:number];
|
||||
return [contact isTextSecureContact];
|
||||
}
|
||||
}
|
||||
|
||||
-(PhoneNumber*)phoneNumberForThread
|
||||
{
|
||||
NSString * contactId = [(TSContactThread*)self.thread contactIdentifier];
|
||||
return [PhoneNumber tryParsePhoneNumberFromUserSpecifiedText:contactId];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
-(void)callAction
|
||||
{
|
||||
if ([self isRedPhoneReachable]) {
|
||||
PhoneNumber *number = [self phoneNumberForThread];
|
||||
Contact *contact = [[Environment.getCurrent contactsManager] latestContactForPhoneNumber:number];
|
||||
|
||||
[Environment.phoneManager initiateOutgoingCallToContact:contact atRemoteNumber:number];
|
||||
} else {
|
||||
DDLogWarn(@"Tried to initiate a call but contact has no RedPhone identifier");
|
||||
}
|
||||
}
|
||||
|
||||
- (void)textViewDidChange:(UITextView *)textView {
|
||||
if([textView.text length]>0) {
|
||||
self.inputToolbar.contentView.rightBarButtonItem = _messageButton;
|
||||
self.inputToolbar.contentView.rightBarButtonItem.enabled = YES;
|
||||
}
|
||||
else if(!isGroupConversation) {
|
||||
self.inputToolbar.contentView.rightBarButtonItem = _callButton;
|
||||
self.inputToolbar.contentView.rightBarButtonItem.enabled = YES;
|
||||
}
|
||||
else {
|
||||
self.inputToolbar.contentView.rightBarButtonItem.enabled = NO;
|
||||
}
|
||||
|
||||
}
|
||||
#pragma mark - JSQMessagesViewController method overrides
|
||||
|
||||
- (void)didPressSendButton:(UIButton *)button
|
||||
|
@ -376,7 +425,12 @@ typedef enum : NSUInteger {
|
|||
[[TSMessagesManager sharedManager] sendMessage:message inThread:self.thread];
|
||||
[self finishSendingMessage];
|
||||
}
|
||||
if(!isGroupConversation) {
|
||||
self.inputToolbar.contentView.rightBarButtonItem = _callButton;
|
||||
self.inputToolbar.contentView.rightBarButtonItem.enabled = YES;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - JSQMessages CollectionView DataSource
|
||||
|
|
|
@ -47,6 +47,9 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
|
||||
contacts = [Environment getCurrent].contactsManager.textSecureContacts;
|
||||
|
||||
|
||||
self.tableView.tableHeaderView.frame = CGRectMake(0, 0, 400, 44);
|
||||
self.tableView.tableHeaderView = self.tableView.tableHeaderView;
|
||||
contacts = [contacts filter:^int(Contact* contact) {
|
||||
for(PhoneNumber* number in [contact parsedPhoneNumbers]) {
|
||||
if([[number toE164] isEqualToString:[SignalKeyingStorage.localNumber toE164]]) {
|
||||
|
@ -61,7 +64,7 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
[self initializeKeyboardHandlers];
|
||||
|
||||
if(_thread==nil) {
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"Create" style:UIBarButtonItemStylePlain target:self action:@selector(createGroup)];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[[UIImage imageNamed:@"add-conversation"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(createGroup)];
|
||||
self.navigationItem.title = @"New Group";
|
||||
|
||||
}
|
||||
|
@ -73,7 +76,7 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
[self setupGroupImageButton:_thread.groupModel.groupImage];
|
||||
}
|
||||
// Select the contacts already selected:
|
||||
for (NSInteger r = 0; r < [_tableView numberOfRowsInSection:0]-1; r++) {
|
||||
for (NSInteger r = 0; r < [_tableView numberOfRowsInSection:0]; r++) {
|
||||
// TODOGROUP this will not scale well
|
||||
NSMutableSet *usersInGroup = [NSMutableSet setWithArray:_thread.groupModel.groupMemberIds];
|
||||
NSMutableArray *contactPhoneNumbers = [[NSMutableArray alloc] init];
|
||||
|
@ -82,7 +85,7 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
}
|
||||
[usersInGroup intersectSet:[NSSet setWithArray:contactPhoneNumbers]];
|
||||
if([usersInGroup count]>0) {
|
||||
[_tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:(r+1) inSection:0]
|
||||
[_tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:r inSection:0]
|
||||
animated:NO
|
||||
scrollPosition:UITableViewScrollPositionNone];
|
||||
}
|
||||
|
@ -131,7 +134,7 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
-(void)updateGroup {
|
||||
NSMutableArray* mut = [[NSMutableArray alloc]init];
|
||||
for (NSIndexPath* idx in _tableView.indexPathsForSelectedRows) {
|
||||
[mut addObjectsFromArray:[[contacts objectAtIndex:(NSUInteger)idx.row-1] textSecureIdentifiers]];
|
||||
[mut addObjectsFromArray:[[contacts objectAtIndex:(NSUInteger)idx.row] textSecureIdentifiers]];
|
||||
}
|
||||
[mut addObject:[SignalKeyingStorage.localNumber toE164]]; // Also add the originator
|
||||
_groupModel = [[TSGroupModel alloc] initWithTitle:_nameGroupTextField.text memberIds:[NSMutableArray arrayWithArray:[[NSSet setWithArray:mut] allObjects]] image:_thread.groupModel.groupImage groupId:_thread.groupModel.groupId];
|
||||
|
@ -146,7 +149,7 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
NSMutableArray* mut = [[NSMutableArray alloc]init];
|
||||
|
||||
for (NSIndexPath* idx in _tableView.indexPathsForSelectedRows) {
|
||||
[mut addObjectsFromArray:[[contacts objectAtIndex:(NSUInteger)idx.row-1] textSecureIdentifiers]];
|
||||
[mut addObjectsFromArray:[[contacts objectAtIndex:(NSUInteger)idx.row] textSecureIdentifiers]];
|
||||
}
|
||||
// Also add the originator
|
||||
[mut addObject:[SignalKeyingStorage.localNumber toE164]];
|
||||
|
@ -249,7 +252,7 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return (NSInteger)[contacts count]+1;
|
||||
return (NSInteger)[contacts count];
|
||||
|
||||
}
|
||||
|
||||
|
@ -259,20 +262,13 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
|
||||
if (cell == nil) {
|
||||
|
||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: indexPath.row == 0 ? @"HeaderCell" : @"GroupSearchCell"];
|
||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"GroupSearchCell"];
|
||||
}
|
||||
if (indexPath.row > 0) {
|
||||
NSUInteger row = (NSUInteger)indexPath.row;
|
||||
Contact* contact = contacts[row-1];
|
||||
Contact* contact = contacts[row];
|
||||
|
||||
cell.textLabel.attributedText = [self attributedStringForContact:contact inCell:cell];
|
||||
|
||||
} else {
|
||||
cell.textLabel.text = @"Add People:";
|
||||
cell.textLabel.textColor = [UIColor lightGrayColor];
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
}
|
||||
|
||||
tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
|
||||
return cell;
|
||||
|
@ -282,19 +278,15 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];
|
||||
if(indexPath.row>0) {
|
||||
cell.accessoryType = UITableViewCellAccessoryCheckmark;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];
|
||||
if(indexPath.row>0) {
|
||||
cell.accessoryType = UITableViewCellAccessoryNone;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Text Field Delegate
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
@property (nonatomic, retain) IBOutlet UIButton *inboxButton;
|
||||
@property (nonatomic, retain) IBOutlet UIButton *archiveButton;
|
||||
@property (nonatomic, retain) IBOutlet UILabel *inboxCountLabel;
|
||||
@property (nonatomic, strong) IBOutlet UIImageView *emptyBoxImage;
|
||||
|
||||
@property (nonatomic, retain) CallState* latestCall;
|
||||
|
||||
-(IBAction)selectedInbox:(id)sender;
|
||||
|
|
|
@ -40,8 +40,6 @@ static NSString* const kCallSegue = @"2.0_6.0_Call_Segue";
|
|||
static NSString* const kShowSignupFlowSegue = @"showSignupFlow";
|
||||
|
||||
@interface SignalsViewController ()
|
||||
@property (nonatomic, strong) UILabel *emptyViewLabel;
|
||||
@property (nonatomic, strong) UIImageView *emptyBoxImage;
|
||||
@property (nonatomic, strong) YapDatabaseConnection *editingDbConnection;
|
||||
@property (nonatomic, strong) YapDatabaseConnection *uiDatabaseConnection;
|
||||
@property (nonatomic, strong) YapDatabaseViewMappings *threadMappings;
|
||||
|
@ -82,7 +80,7 @@ static NSString* const kShowSignupFlowSegue = @"showSignupFlow";
|
|||
-(void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
[self updateTableViewHeader];
|
||||
[self checkIfEmptyView];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated{
|
||||
|
@ -181,7 +179,7 @@ static NSString* const kShowSignupFlowSegue = @"showSignupFlow";
|
|||
[thread removeWithTransaction:transaction];
|
||||
}];
|
||||
_inboxCount -= (self.viewingThreadsIn == kArchiveState) ? 1 : 0;
|
||||
[self updateTableViewHeader];
|
||||
[self checkIfEmptyView];
|
||||
}
|
||||
|
||||
- (void)tableViewCellTappedArchive:(InboxTableViewCell*)cell {
|
||||
|
@ -192,7 +190,7 @@ static NSString* const kShowSignupFlowSegue = @"showSignupFlow";
|
|||
[self.editingDbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[thread saveWithTransaction:transaction];
|
||||
}];
|
||||
[self updateTableViewHeader];
|
||||
[self checkIfEmptyView];
|
||||
}
|
||||
|
||||
|
||||
|
@ -260,7 +258,7 @@ static NSString* const kShowSignupFlowSegue = @"showSignupFlow";
|
|||
[self.threadMappings updateWithTransaction:transaction];
|
||||
}];
|
||||
[self.tableView reloadData];
|
||||
[self updateTableViewHeader];
|
||||
[self checkIfEmptyView];
|
||||
|
||||
}
|
||||
|
||||
|
@ -355,7 +353,7 @@ static NSString* const kShowSignupFlowSegue = @"showSignupFlow";
|
|||
|
||||
[self.tableView endUpdates];
|
||||
[self updateInboxCountLabel];
|
||||
[self updateTableViewHeader];
|
||||
[self checkIfEmptyView];
|
||||
}
|
||||
|
||||
|
||||
|
@ -367,46 +365,16 @@ static NSString* const kShowSignupFlowSegue = @"showSignupFlow";
|
|||
|
||||
}
|
||||
|
||||
- (void)updateTableViewHeader{
|
||||
_emptyViewLabel = nil;
|
||||
_emptyBoxImage = nil;
|
||||
self.tableView.tableHeaderView = nil;
|
||||
// Something like this can be used to put in a tutorial image. currently malformatted.
|
||||
// if (userHasNeverSentMessage) {
|
||||
// _emptyBoxImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"first-screen"] highlightedImage:[UIImage imageNamed:@"first-screen"]];
|
||||
// self.tableView.tableHeaderView = _emptyBoxImage;
|
||||
// }
|
||||
// else
|
||||
if ((self.viewingThreadsIn == kInboxState && [self.threadMappings numberOfItemsInGroup:TSInboxGroup]==0) ||
|
||||
(self.viewingThreadsIn == kArchiveState && [self.threadMappings numberOfItemsInGroup:TSArchiveGroup]==0)) {
|
||||
CGRect r = CGRectMake(0, 60, 300, 70);
|
||||
_emptyViewLabel = [[UILabel alloc]initWithFrame:r];
|
||||
_emptyViewLabel.textColor = [UIColor grayColor];
|
||||
_emptyViewLabel.font = [UIFont ows_regularFontWithSize:18.f];
|
||||
_emptyViewLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_emptyViewLabel.numberOfLines = 2;
|
||||
- (void)checkIfEmptyView{
|
||||
[_tableView setHidden:NO];
|
||||
if (self.viewingThreadsIn == kInboxState && [self.threadMappings numberOfItemsInGroup:TSInboxGroup]==0) {
|
||||
_emptyBoxImage.image = [UIImage imageNamed:@"uiEmptyContact"];
|
||||
[_tableView setHidden:YES];
|
||||
|
||||
NSString* firstLine = @"";
|
||||
NSString* secondLine = @"";
|
||||
|
||||
if(self.viewingThreadsIn == kInboxState) {
|
||||
// Check if this is the first launch
|
||||
firstLine = @"Done. Done. Done.";
|
||||
secondLine = @"Tip: add a conversation as a reminder.";
|
||||
}
|
||||
else {
|
||||
firstLine = @"Squeaky Freaking Clean.";
|
||||
secondLine = @"None. Zero. Zilch. Nada.";
|
||||
}
|
||||
NSMutableAttributedString *fullLabelString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n%@",firstLine,secondLine]];
|
||||
|
||||
[fullLabelString addAttribute:NSFontAttributeName value:[UIFont ows_boldFontWithSize:17.f] range:NSMakeRange(0,firstLine.length)];
|
||||
[fullLabelString addAttribute:NSFontAttributeName value:[UIFont ows_regularFontWithSize:16.f] range:NSMakeRange(firstLine.length + 1, secondLine.length)];
|
||||
[fullLabelString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0,firstLine.length)];
|
||||
[fullLabelString addAttribute:NSForegroundColorAttributeName value:[UIColor ows_darkGrayColor] range:NSMakeRange(firstLine.length + 1, secondLine.length)];
|
||||
|
||||
_emptyViewLabel.attributedText = fullLabelString;
|
||||
self.tableView.tableHeaderView = _emptyViewLabel;
|
||||
else if (self.viewingThreadsIn == kArchiveState && [self.threadMappings numberOfItemsInGroup:TSArchiveGroup]==0) {
|
||||
_emptyBoxImage.image = [UIImage imageNamed:@"uiEmptyArchive"];
|
||||
[_tableView setHidden:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue