Composer Update - Typing and sending a message

This commit is contained in:
Gil Eluard
2021-03-15 14:27:59 +01:00
parent aa3aafb0b0
commit eefe1e2157
39 changed files with 1103 additions and 1210 deletions
@@ -292,9 +292,12 @@
}
else
{
self.unsentMessagesContentView.hidden = YES;
// We keep the current message if any
[self resetIcon];
self.messageLabel.text = nil;
self.iconImageView.image = [UIImage imageNamed:@"scrolldown"];
self.iconImageView.tintColor = ThemeService.shared.theme.textPrimaryColor;
}
@@ -128,7 +128,7 @@
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<accessibility key="accessibilityConfiguration" identifier="RoomExtrasInfosView"/>
<constraints>
<constraint firstItem="qhJ-5H-64e" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="4o2-V9-a4L"/>
@@ -38,4 +38,10 @@
}
}
- (void)setMaxHeight:(int)height
{
maxHeight = MIN(height, 112);
maxNumberOfLines = 0;
}
@end
@@ -74,11 +74,6 @@ typedef enum : NSUInteger
@property (weak, nonatomic) IBOutlet UIView *mainToolbarView;
@property (weak, nonatomic) IBOutlet UIView *separatorView;
@property (strong, nonatomic) IBOutlet MXKImageView *pictureView;
@property (strong, nonatomic) IBOutlet UIImageView *encryptedRoomIcon;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mainToolbarMinHeightConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mainToolbarHeightConstraint;
@@ -86,15 +81,8 @@ typedef enum : NSUInteger
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *messageComposerContainerTrailingConstraint;
@property (weak, nonatomic) IBOutlet UIButton *attachMediaButton;
@property (weak, nonatomic) IBOutlet UIButton *voiceCallButton;
@property (weak, nonatomic) IBOutlet UIButton *hangupCallButton;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *voiceCallButtonWidthConstraint;
/**
Tell whether the call option is supported. YES by default.
*/
@property (nonatomic) BOOL supportCallOption;
@property (weak, nonatomic) IBOutlet UIImageView *inputTextBackgroundView;
/**
Tell whether the filled data will be sent encrypted. NO by default.
@@ -106,9 +94,4 @@ typedef enum : NSUInteger
*/
@property (nonatomic) RoomInputToolbarViewSendMode sendMode;
/**
Tell whether a call is active.
*/
@property (nonatomic) BOOL activeCall;
@end
@@ -60,14 +60,11 @@
{
[super awakeFromNib];
_supportCallOption = YES;
_sendMode = RoomInputToolbarViewSendModeSend;
self.rightInputToolbarButton.hidden = YES;
[self.rightInputToolbarButton setTitleColor:ThemeService.shared.theme.tintColor forState:UIControlStateNormal];
[self.rightInputToolbarButton setTitleColor:ThemeService.shared.theme.tintColor forState:UIControlStateHighlighted];
[self.rightInputToolbarButton setTitle:nil forState:UIControlStateNormal];
[self.rightInputToolbarButton setTitle:nil forState:UIControlStateHighlighted];
self.isEncryptionEnabled = _isEncryptionEnabled;
}
@@ -80,8 +77,6 @@
// Remove default toolbar background color
self.backgroundColor = [UIColor clearColor];
self.separatorView.backgroundColor = ThemeService.shared.theme.lineBreakColor;
// Custom the growingTextView display
growingTextView.layer.cornerRadius = 0;
growingTextView.layer.borderWidth = 0;
@@ -99,35 +94,14 @@
}
self.attachMediaButton.accessibilityLabel = NSLocalizedStringFromTable(@"room_accessibility_upload", @"Vector", nil);
self.voiceCallButton.accessibilityLabel = NSLocalizedStringFromTable(@"room_accessibility_call", @"Vector", nil);
self.hangupCallButton.accessibilityLabel = NSLocalizedStringFromTable(@"room_accessibility_hangup", @"Vector", nil);
self.hangupCallButton.tintColor = ThemeService.shared.theme.noticeColor;
self.voiceCallButton.tintColor = ThemeService.shared.theme.tintColor;
self.attachMediaButton.tintColor = ThemeService.shared.theme.tintColor;
UIImage *image = [UIImage imageNamed:@"input_text_background"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(9, 15, 10, 16)];
self.inputTextBackgroundView.image = image;
}
#pragma mark -
- (void)setSupportCallOption:(BOOL)supportCallOption
{
if (_supportCallOption != supportCallOption)
{
_supportCallOption = supportCallOption;
if (supportCallOption)
{
self.voiceCallButtonWidthConstraint.constant = 46;
}
else
{
self.voiceCallButtonWidthConstraint.constant = 0;
}
[self setNeedsUpdateConstraints];
}
}
- (void)setIsEncryptionEnabled:(BOOL)isEncryptionEnabled
{
_isEncryptionEnabled = isEncryptionEnabled;
@@ -140,28 +114,6 @@
_sendMode = sendMode;
[self updatePlaceholder];
[self updateToolbarButtonLabel];
}
- (void)updateToolbarButtonLabel
{
NSString *title;
switch (_sendMode)
{
case RoomInputToolbarViewSendModeReply:
title = NSLocalizedStringFromTable(@"room_action_reply", @"Vector", nil);
break;
case RoomInputToolbarViewSendModeEdit:
title = NSLocalizedStringFromTable(@"save", @"Vector", nil);
break;
default:
title = [NSBundle mxk_localizedStringForKey:@"send"];
break;
}
[self.rightInputToolbarButton setTitle:title forState:UIControlStateNormal];
[self.rightInputToolbarButton setTitle:title forState:UIControlStateHighlighted];
}
- (void)updatePlaceholder
@@ -219,17 +171,6 @@
self.placeholder = placeholder;
}
- (void)setActiveCall:(BOOL)activeCall
{
if (_activeCall != activeCall)
{
_activeCall = activeCall;
self.voiceCallButton.hidden = (_activeCall || !self.rightInputToolbarButton.hidden);
self.hangupCallButton.hidden = (!_activeCall || !self.rightInputToolbarButton.hidden);
}
}
#pragma mark - HPGrowingTextView delegate
- (void)growingTextViewDidChange:(HPGrowingTextView *)hpGrowingTextView
@@ -242,23 +183,23 @@
[super growingTextViewDidChange:hpGrowingTextView];
if (self.rightInputToolbarButton.isEnabled && self.rightInputToolbarButton.isHidden)
if (self.rightInputToolbarButton.isEnabled && !self.rightInputToolbarButton.alpha)
{
self.rightInputToolbarButton.hidden = NO;
self.attachMediaButton.hidden = YES;
self.voiceCallButton.hidden = YES;
self.hangupCallButton.hidden = YES;
self.messageComposerContainerTrailingConstraint.constant = self.frame.size.width - self.rightInputToolbarButton.frame.origin.x + 4;
[UIView animateWithDuration:.4 delay:0 usingSpringWithDamping:0.7 initialSpringVelocity:8 options:UIViewAnimationOptionCurveEaseIn animations:^{
self.rightInputToolbarButton.alpha = 1;
self.messageComposerContainerTrailingConstraint.constant = self.frame.size.width - self.rightInputToolbarButton.frame.origin.x + 4;
[self layoutIfNeeded];
} completion:^(BOOL finished) {
}];
}
else if (!self.rightInputToolbarButton.isEnabled && !self.rightInputToolbarButton.isHidden)
else if (!self.rightInputToolbarButton.isEnabled && self.rightInputToolbarButton.alpha)
{
self.rightInputToolbarButton.hidden = YES;
self.attachMediaButton.hidden = NO;
self.voiceCallButton.hidden = _activeCall;
self.hangupCallButton.hidden = !_activeCall;
self.messageComposerContainerTrailingConstraint.constant = self.frame.size.width - self.attachMediaButton.frame.origin.x + 4;
[UIView animateWithDuration:.4 delay:0 usingSpringWithDamping:0.7 initialSpringVelocity:8 options:UIViewAnimationOptionCurveEaseIn animations:^{
self.rightInputToolbarButton.alpha = 0;
self.messageComposerContainerTrailingConstraint.constant = 8;
[self layoutIfNeeded];
} completion:^(BOOL finished) {
}];
}
}
@@ -374,66 +315,6 @@
NSLog(@"[RoomInputToolbarView] Attach media is not supported");
}
}
else if (button == self.voiceCallButton)
{
if ([self.delegate respondsToSelector:@selector(roomInputToolbarView:placeCallWithVideo:)])
{
// Ask the user the kind of the call: voice or video?
actionSheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
__weak typeof(self) weakSelf = self;
[actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"voice", @"Vector", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
if (weakSelf)
{
typeof(self) self = weakSelf;
self->actionSheet = nil;
[self.delegate roomInputToolbarView:self placeCallWithVideo:NO];
}
}]];
[actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"video", @"Vector", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
if (weakSelf)
{
typeof(self) self = weakSelf;
self->actionSheet = nil;
[self.delegate roomInputToolbarView:self placeCallWithVideo:YES];
}
}]];
[actionSheet addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"]
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
if (weakSelf)
{
typeof(self) self = weakSelf;
self->actionSheet = nil;
}
}]];
[actionSheet popoverPresentationController].sourceView = self.voiceCallButton;
[actionSheet popoverPresentationController].sourceRect = self.voiceCallButton.bounds;
[self.window.rootViewController presentViewController:actionSheet animated:YES completion:nil];
}
}
else if (button == self.hangupCallButton)
{
if ([self.delegate respondsToSelector:@selector(roomInputToolbarViewHangupCall:)])
{
[self.delegate roomInputToolbarViewHangupCall:self];
}
}
[super onTouchUpInside:button];
}
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -16,127 +16,65 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="a84-Vc-6ud" userLabel="MainToolBar View">
<rect key="frame" x="0.0" y="0.0" width="600" height="46"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3ln-yI-ef9" userLabel="Separator View">
<rect key="frame" x="10" y="0.0" width="580" height="1"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="WBM-ts-zPX"/>
</constraints>
</view>
<view clipsSubviews="YES" contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="dd4-pE-Es1" userLabel="Picture View" customClass="MXKImageView">
<rect key="frame" x="13" y="8" width="30" height="30"/>
<color key="backgroundColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="PictureView"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="gwh-Qs-gY1"/>
<constraint firstAttribute="height" constant="30" id="wMB-Ec-D9s"/>
</constraints>
</view>
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="e2e_unencrypted" translatesAutoresizingMaskIntoConstraints="NO" id="fRI-9x-jgw">
<rect key="frame" x="41" y="7" width="28" height="28"/>
<accessibility key="accessibilityConfiguration" identifier="EncryptedRoomIcon"/>
<constraints>
<constraint firstAttribute="height" constant="28" id="JHs-nc-tML"/>
<constraint firstAttribute="width" constant="28" id="K0H-Va-ZsL"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QWp-NV-uh5" userLabel="Message Composer Container">
<rect key="frame" x="62" y="4" width="443" height="38"/>
<rect key="frame" x="62" y="4" width="530" height="38"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="input_text_background" translatesAutoresizingMaskIntoConstraints="NO" id="uH7-Q7-hpZ">
<rect key="frame" x="0.0" y="0.0" width="530" height="40"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wgb-ON-N29" customClass="KeyboardGrowingTextView">
<rect key="frame" x="0.0" y="0.0" width="443" height="38"/>
<rect key="frame" x="0.0" y="1" width="530" height="38"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="GrowingTextView"/>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="wgb-ON-N29" firstAttribute="top" secondItem="QWp-NV-uh5" secondAttribute="top" id="0jt-Ye-2DW"/>
<constraint firstItem="wgb-ON-N29" firstAttribute="top" secondItem="QWp-NV-uh5" secondAttribute="top" constant="1" id="0jt-Ye-2DW"/>
<constraint firstAttribute="trailing" secondItem="wgb-ON-N29" secondAttribute="trailing" id="30f-rE-CKj"/>
<constraint firstItem="uH7-Q7-hpZ" firstAttribute="leading" secondItem="wgb-ON-N29" secondAttribute="leading" id="AV7-0I-eqc"/>
<constraint firstItem="wgb-ON-N29" firstAttribute="leading" secondItem="QWp-NV-uh5" secondAttribute="leading" id="N7q-ch-iRz"/>
<constraint firstAttribute="bottom" secondItem="wgb-ON-N29" secondAttribute="bottom" id="fFG-SH-Hjh"/>
<constraint firstItem="uH7-Q7-hpZ" firstAttribute="top" secondItem="wgb-ON-N29" secondAttribute="top" constant="-1" id="TH3-h8-9e9"/>
<constraint firstItem="uH7-Q7-hpZ" firstAttribute="trailing" secondItem="wgb-ON-N29" secondAttribute="trailing" id="YkL-m0-I7G"/>
<constraint firstAttribute="bottom" secondItem="wgb-ON-N29" secondAttribute="bottom" constant="-1" id="fFG-SH-Hjh"/>
<constraint firstItem="uH7-Q7-hpZ" firstAttribute="bottom" secondItem="wgb-ON-N29" secondAttribute="bottom" constant="1" id="mAh-nF-xXj"/>
</constraints>
</view>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="G8Z-CM-tGs" userLabel="send Button">
<rect key="frame" x="550" y="0.0" width="46" height="46"/>
<button opaque="NO" alpha="0.0" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="G8Z-CM-tGs" userLabel="send Button">
<rect key="frame" x="550" y="6" width="46" height="36"/>
<accessibility key="accessibilityConfiguration" identifier="SendButton"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="46" id="KnT-92-5v2"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<state key="normal" title="Send"/>
<state key="normal" image="send_icon"/>
<connections>
<action selector="onTouchUpInside:" destination="iN0-l3-epB" eventType="touchUpInside" id="Y9g-uz-rAz"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Hga-l8-Wua" userLabel="attach Button">
<rect key="frame" x="508" y="0.0" width="46" height="46"/>
<rect key="frame" x="10" y="0.0" width="46" height="46"/>
<accessibility key="accessibilityConfiguration" identifier="AttachButton"/>
<constraints>
<constraint firstAttribute="width" constant="46" id="O2T-T8-EjV"/>
<constraint firstAttribute="width" secondItem="Hga-l8-Wua" secondAttribute="height" multiplier="1:1" id="f0T-3f-BJu"/>
</constraints>
<state key="normal" image="upload_icon"/>
<state key="highlighted" image="upload_icon"/>
<connections>
<action selector="onTouchUpInside:" destination="iN0-l3-epB" eventType="touchUpInside" id="WbU-WH-gwL"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Owf-M8-qJi" userLabel="voice call Button">
<rect key="frame" x="554" y="0.0" width="46" height="46"/>
<accessibility key="accessibilityConfiguration" identifier="VoiceCallButton"/>
<constraints>
<constraint firstAttribute="width" secondItem="Owf-M8-qJi" secondAttribute="height" multiplier="1:1" id="1Ni-y7-Nsa"/>
<constraint firstAttribute="width" constant="46" id="9FZ-CI-diT"/>
</constraints>
<state key="normal" image="voice_call_hangon_icon">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" image="voice_call_hangon_icon"/>
<connections>
<action selector="onTouchUpInside:" destination="iN0-l3-epB" eventType="touchUpInside" id="Cxg-BO-TfK"/>
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2nY-YP-BvA" userLabel="hangup call Button">
<rect key="frame" x="554" y="0.0" width="46" height="46"/>
<accessibility key="accessibilityConfiguration" identifier="HangupCallButton"/>
<constraints>
<constraint firstAttribute="width" secondItem="2nY-YP-BvA" secondAttribute="height" multiplier="1:1" id="59L-Jf-tXO"/>
</constraints>
<state key="normal" image="voice_call_hangup_icon">
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<state key="highlighted" image="voice_call_hangup_icon"/>
<connections>
<action selector="onTouchUpInside:" destination="iN0-l3-epB" eventType="touchUpInside" id="PB3-d8-Kbf"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="fRI-9x-jgw" firstAttribute="top" secondItem="a84-Vc-6ud" secondAttribute="top" constant="7" id="08y-JY-NN5"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="46" id="1FO-iu-urG"/>
<constraint firstItem="G8Z-CM-tGs" firstAttribute="top" secondItem="a84-Vc-6ud" secondAttribute="top" id="8cV-eb-Kog"/>
<constraint firstItem="3ln-yI-ef9" firstAttribute="leading" secondItem="a84-Vc-6ud" secondAttribute="leading" constant="10" id="BwP-sF-qE1"/>
<constraint firstItem="Hga-l8-Wua" firstAttribute="leading" secondItem="a84-Vc-6ud" secondAttribute="leading" constant="10" id="31r-fn-347"/>
<constraint firstItem="QWp-NV-uh5" firstAttribute="leading" secondItem="a84-Vc-6ud" secondAttribute="leading" constant="62" id="ErD-eB-stF"/>
<constraint firstItem="Owf-M8-qJi" firstAttribute="leading" secondItem="Hga-l8-Wua" secondAttribute="trailing" id="GKh-R5-jqV"/>
<constraint firstItem="fRI-9x-jgw" firstAttribute="leading" secondItem="a84-Vc-6ud" secondAttribute="leading" constant="41" id="GvU-rY-bWW"/>
<constraint firstItem="dd4-pE-Es1" firstAttribute="leading" secondItem="a84-Vc-6ud" secondAttribute="leading" constant="13" id="Jem-U2-oEq"/>
<constraint firstAttribute="bottom" secondItem="Hga-l8-Wua" secondAttribute="bottom" id="KTO-RJ-mKf"/>
<constraint firstAttribute="bottom" secondItem="QWp-NV-uh5" secondAttribute="bottom" constant="4" id="NGr-2o-sOP"/>
<constraint firstAttribute="trailing" secondItem="3ln-yI-ef9" secondAttribute="trailing" constant="10" id="RXB-PN-3n8"/>
<constraint firstAttribute="trailing" secondItem="G8Z-CM-tGs" secondAttribute="trailing" constant="4" id="Sua-LC-3yW"/>
<constraint firstAttribute="bottom" secondItem="Owf-M8-qJi" secondAttribute="bottom" id="Wo7-Qc-PSL"/>
<constraint firstItem="QWp-NV-uh5" firstAttribute="top" secondItem="a84-Vc-6ud" secondAttribute="top" constant="4" id="WyZ-3i-OHi"/>
<constraint firstAttribute="height" constant="46" id="Yjj-ua-rbe"/>
<constraint firstAttribute="bottom" secondItem="2nY-YP-BvA" secondAttribute="bottom" id="asf-hj-bby"/>
<constraint firstAttribute="trailing" secondItem="2nY-YP-BvA" secondAttribute="trailing" id="gNM-BS-Uwc"/>
<constraint firstAttribute="trailing" secondItem="QWp-NV-uh5" secondAttribute="trailing" constant="95" id="hXO-cY-Jgz"/>
<constraint firstItem="2nY-YP-BvA" firstAttribute="width" secondItem="Owf-M8-qJi" secondAttribute="width" id="mHj-eR-atg"/>
<constraint firstItem="Hga-l8-Wua" firstAttribute="top" secondItem="a84-Vc-6ud" secondAttribute="top" id="pPH-Fp-phr"/>
<constraint firstAttribute="trailing" secondItem="Owf-M8-qJi" secondAttribute="trailing" id="vCd-Md-dvr"/>
<constraint firstAttribute="bottom" secondItem="G8Z-CM-tGs" secondAttribute="bottom" id="vpk-lw-TnO"/>
<constraint firstItem="dd4-pE-Es1" firstAttribute="top" secondItem="a84-Vc-6ud" secondAttribute="top" constant="8" id="xjT-If-1cd"/>
<constraint firstItem="3ln-yI-ef9" firstAttribute="top" secondItem="a84-Vc-6ud" secondAttribute="top" id="yUF-5t-x03"/>
<constraint firstAttribute="trailing" secondItem="QWp-NV-uh5" secondAttribute="trailing" constant="8" id="hXO-cY-Jgz"/>
<constraint firstAttribute="bottom" secondItem="G8Z-CM-tGs" secondAttribute="bottom" constant="4" id="vpk-lw-TnO"/>
</constraints>
</view>
</subviews>
@@ -153,9 +91,8 @@
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="attachMediaButton" destination="Hga-l8-Wua" id="Osr-ek-c91"/>
<outlet property="encryptedRoomIcon" destination="fRI-9x-jgw" id="cfG-Sr-Fga"/>
<outlet property="growingTextView" destination="wgb-ON-N29" id="nwF-uV-Ng9"/>
<outlet property="hangupCallButton" destination="2nY-YP-BvA" id="a0m-xv-sVg"/>
<outlet property="inputTextBackgroundView" destination="uH7-Q7-hpZ" id="Wa3-2W-8gN"/>
<outlet property="mainToolbarHeightConstraint" destination="Yjj-ua-rbe" id="Lu8-UC-Vbo"/>
<outlet property="mainToolbarMinHeightConstraint" destination="1FO-iu-urG" id="2U6-h2-0zQ"/>
<outlet property="mainToolbarView" destination="a84-Vc-6ud" id="5p3-Ft-0gv"/>
@@ -164,19 +101,14 @@
<outlet property="messageComposerContainerLeadingConstraint" destination="ErD-eB-stF" id="Ha9-DG-Nw2"/>
<outlet property="messageComposerContainerTopConstraint" destination="WyZ-3i-OHi" id="OcO-1f-bNA"/>
<outlet property="messageComposerContainerTrailingConstraint" destination="hXO-cY-Jgz" id="lHZ-MU-vyC"/>
<outlet property="pictureView" destination="dd4-pE-Es1" id="rb6-z2-pJ9"/>
<outlet property="rightInputToolbarButton" destination="G8Z-CM-tGs" id="NCk-5m-aNF"/>
<outlet property="separatorView" destination="3ln-yI-ef9" id="HQ3-B4-Goj"/>
<outlet property="voiceCallButton" destination="Owf-M8-qJi" id="krT-w1-mfT"/>
<outlet property="voiceCallButtonWidthConstraint" destination="9FZ-CI-diT" id="jYt-Pe-8DY"/>
</connections>
<point key="canvasLocation" x="139" y="152"/>
<point key="canvasLocation" x="137.59999999999999" y="151.12443778110946"/>
</view>
</objects>
<resources>
<image name="e2e_unencrypted" width="14" height="12"/>
<image name="upload_icon" width="24" height="24"/>
<image name="voice_call_hangon_icon" width="24" height="24"/>
<image name="voice_call_hangup_icon" width="24" height="24"/>
<image name="input_text_background" width="30" height="20"/>
<image name="send_icon" width="36" height="36"/>
<image name="upload_icon" width="36" height="36"/>
</resources>
</document>
@@ -35,9 +35,11 @@
@interface RoomTitleView : MXKRoomTitleView <UIGestureRecognizerDelegate>
@property (weak, nonatomic) IBOutlet UIView *titleMask;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *displayNameCenterXConstraint;
@property (weak, nonatomic) IBOutlet UIImageView *roomDetailsIconImageView;
@property (weak, nonatomic) IBOutlet UIImageView *badgeImageView;
@property (weak, nonatomic) IBOutlet MXKImageView *pictureView;
@property (weak, nonatomic) IBOutlet UILabel *missedDiscussionsBadgeLabel;
@property (weak, nonatomic) IBOutlet UILabel *typingLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *displayNameCenterYConstraint;
/**
The room preview data may be used when mxRoom instance is not available
@@ -49,6 +51,11 @@
*/
@property (nonatomic) id<RoomTitleViewTapGestureDelegate> tapGestureDelegate;
/**
the typing notification string to be displayed (default nil if notification is hidden).
*/
@property (copy, nonatomic) NSString *typingNotificationString;
/**
The method used to handle the gesture recognized by a receiver.
*/
+33 -3
View File
@@ -54,8 +54,8 @@
{
[super layoutSubviews];
self.roomDetailsIconImageView.image = self.roomDetailsIconImageView.image;
self.pictureView.layer.cornerRadius = self.pictureView.bounds.size.width / 2.;
if (self.superview)
{
// Force the title view layout by adding 2 new constraints on the UINavigationBarContentView instance.
@@ -84,7 +84,7 @@
self.backgroundColor = UIColor.clearColor;
self.displayNameTextField.textColor = (self.mxRoom.summary.displayname.length ? ThemeService.shared.theme.textPrimaryColor : ThemeService.shared.theme.textSecondaryColor);
self.roomDetailsIconImageView.tintColor = ThemeService.shared.theme.textPrimaryColor;
self.typingLabel.textColor = ThemeService.shared.theme.textSecondaryColor;
}
- (void)setRoomPreviewData:(RoomPreviewData *)roomPreviewData
@@ -133,4 +133,34 @@
}
}
- (void)setTypingNotificationString:(NSString *)typingNotificationString
{
if (typingNotificationString.length > 0)
{
self.typingLabel.text = typingNotificationString;
[self layoutIfNeeded];
[UIView animateWithDuration:.3 animations:^{
self.typingLabel.alpha = 1;
self.displayNameCenterYConstraint.constant = -8;
[self layoutIfNeeded];
}];
}
else
{
[UIView animateWithDuration:.3 animations:^{
self.typingLabel.alpha = 0;
self.displayNameCenterYConstraint.constant = 0;
[self layoutIfNeeded];
} completion:^(BOOL finished) {
self.typingLabel.text = nil;
}];
}
}
- (NSString *)typingNotificationString
{
return self.typingLabel.text;
}
@end
+42 -29
View File
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -13,69 +13,82 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SUm-iW-DRR">
<rect key="frame" x="-26" y="22" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" alpha="0.0" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fIP-Sr-o0e">
<rect key="frame" x="50" y="23.5" width="31" height="14.5"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LDd-c1-ILP" customClass="MXKImageView">
<rect key="frame" x="6" y="6" width="32" height="32"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="32" id="bwy-tq-mM3"/>
<constraint firstAttribute="width" constant="32" id="g4Z-ot-kFP"/>
</constraints>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="encryption_normal" translatesAutoresizingMaskIntoConstraints="NO" id="Ky3-cy-HAx">
<rect key="frame" x="231.5" y="13.5" width="14" height="14"/>
<rect key="frame" x="31" y="24" width="14" height="14"/>
<accessibility key="accessibilityConfiguration" identifier="RoomDetailsIconImageView"/>
<constraints>
<constraint firstAttribute="width" constant="14" id="7xE-aD-sld"/>
<constraint firstAttribute="width" secondItem="Ky3-cy-HAx" secondAttribute="height" multiplier="1:1" id="peq-8l-eJv"/>
</constraints>
</imageView>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="Room Name" textAlignment="center" adjustsFontSizeToFit="NO" minimumFontSize="14" translatesAutoresizingMaskIntoConstraints="NO" id="6uH-I3-RQg">
<rect key="frame" x="249.5" y="9" width="101" height="23"/>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="Room Name" adjustsFontSizeToFit="NO" minimumFontSize="14" translatesAutoresizingMaskIntoConstraints="NO" id="6uH-I3-RQg">
<rect key="frame" x="50" y="11" width="550" height="22"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="DisplayNameTextField"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<textInputTraits key="textInputTraits" returnKeyType="next"/>
<connections>
<outlet property="delegate" destination="BkF-x3-7fX" id="xX7-jB-9va"/>
</connections>
</textField>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="details_icon" translatesAutoresizingMaskIntoConstraints="NO" id="S3Y-wJ-HOe">
<rect key="frame" x="357.5" y="14.5" width="6" height="12"/>
<accessibility key="accessibilityConfiguration" identifier="RoomDetailsIconImageView"/>
<constraints>
<constraint firstAttribute="width" constant="6" id="XTx-6p-2wB"/>
<constraint firstAttribute="height" constant="12" id="tXh-eB-ave"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sD9-l7-azQ">
<rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration" identifier="RoomTitle"/>
<constraints>
<constraint firstItem="6uH-I3-RQg" firstAttribute="centerX" secondItem="BkF-x3-7fX" secondAttribute="centerX" id="3uN-6W-rVZ"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="S3Y-wJ-HOe" secondAttribute="trailing" id="3z3-Ye-wh3"/>
<constraint firstItem="6uH-I3-RQg" firstAttribute="leading" secondItem="LDd-c1-ILP" secondAttribute="trailing" constant="12" id="0pG-0z-gpD"/>
<constraint firstItem="LDd-c1-ILP" firstAttribute="centerY" secondItem="BkF-x3-7fX" secondAttribute="centerY" id="33h-dC-S1U"/>
<constraint firstAttribute="bottom" secondItem="sD9-l7-azQ" secondAttribute="bottom" id="4rX-5O-LrO"/>
<constraint firstItem="sD9-l7-azQ" firstAttribute="leading" secondItem="BkF-x3-7fX" secondAttribute="leading" id="AJc-Aa-sht"/>
<constraint firstItem="S3Y-wJ-HOe" firstAttribute="centerY" secondItem="6uH-I3-RQg" secondAttribute="centerY" id="Jjq-ss-0kj"/>
<constraint firstItem="6uH-I3-RQg" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="BkF-x3-7fX" secondAttribute="leading" constant="8" id="KW6-05-QLM"/>
<constraint firstItem="6uH-I3-RQg" firstAttribute="leading" secondItem="Ky3-cy-HAx" secondAttribute="trailing" constant="4" id="Kis-Qb-UuJ"/>
<constraint firstItem="Ky3-cy-HAx" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="BkF-x3-7fX" secondAttribute="leading" id="MHL-wh-61l"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="6uH-I3-RQg" secondAttribute="trailing" constant="8" id="PUM-di-dAZ"/>
<constraint firstItem="6uH-I3-RQg" firstAttribute="top" secondItem="BkF-x3-7fX" secondAttribute="top" constant="9" id="Piq-rp-Pae"/>
<constraint firstItem="SUm-iW-DRR" firstAttribute="centerY" secondItem="BkF-x3-7fX" secondAttribute="centerY" id="Blv-SJ-r6v"/>
<constraint firstItem="Ky3-cy-HAx" firstAttribute="bottom" secondItem="LDd-c1-ILP" secondAttribute="bottom" id="HZy-1x-eyX"/>
<constraint firstAttribute="trailing" secondItem="6uH-I3-RQg" secondAttribute="trailing" id="Kb4-Vb-TTr"/>
<constraint firstItem="fIP-Sr-o0e" firstAttribute="bottom" secondItem="LDd-c1-ILP" secondAttribute="bottom" id="Urx-H8-DNp"/>
<constraint firstItem="sD9-l7-azQ" firstAttribute="top" secondItem="BkF-x3-7fX" secondAttribute="top" id="YrR-1c-h56"/>
<constraint firstItem="Ky3-cy-HAx" firstAttribute="centerY" secondItem="6uH-I3-RQg" secondAttribute="centerY" id="ayN-Hv-q7s"/>
<constraint firstItem="SUm-iW-DRR" firstAttribute="leading" secondItem="LDd-c1-ILP" secondAttribute="leading" constant="-32" id="a67-jx-TI9"/>
<constraint firstItem="Ky3-cy-HAx" firstAttribute="centerX" secondItem="LDd-c1-ILP" secondAttribute="trailing" id="dFD-E8-CjR"/>
<constraint firstItem="LDd-c1-ILP" firstAttribute="leading" secondItem="BkF-x3-7fX" secondAttribute="leading" constant="6" id="dyY-AX-IVc"/>
<constraint firstItem="6uH-I3-RQg" firstAttribute="centerY" secondItem="BkF-x3-7fX" secondAttribute="centerY" id="fvR-gc-5Ls"/>
<constraint firstAttribute="trailing" secondItem="sD9-l7-azQ" secondAttribute="trailing" id="q9f-Hp-g5N"/>
<constraint firstItem="S3Y-wJ-HOe" firstAttribute="leading" secondItem="6uH-I3-RQg" secondAttribute="trailing" constant="7" id="qbS-km-tTO"/>
<constraint firstItem="fIP-Sr-o0e" firstAttribute="leading" secondItem="6uH-I3-RQg" secondAttribute="leading" id="uQW-MI-dPz"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="badgeImageView" destination="Ky3-cy-HAx" id="fhw-3u-04C"/>
<outlet property="displayNameCenterXConstraint" destination="3uN-6W-rVZ" id="rck-yU-24s"/>
<outlet property="displayNameCenterYConstraint" destination="fvR-gc-5Ls" id="hzE-KD-Am7"/>
<outlet property="displayNameTextField" destination="6uH-I3-RQg" id="MfX-LQ-C2K"/>
<outlet property="displayNameTextFieldTopConstraint" destination="Piq-rp-Pae" id="jnL-Hz-TWn"/>
<outlet property="roomDetailsIconImageView" destination="S3Y-wJ-HOe" id="bhR-6E-8St"/>
<outlet property="missedDiscussionsBadgeLabel" destination="SUm-iW-DRR" id="rZo-yq-GyJ"/>
<outlet property="pictureView" destination="LDd-c1-ILP" id="0bS-2V-Sj7"/>
<outlet property="titleMask" destination="sD9-l7-azQ" id="I9b-wF-iNH"/>
<outlet property="typingLabel" destination="fIP-Sr-o0e" id="5IK-Gj-Med"/>
</connections>
<point key="canvasLocation" x="137.59999999999999" y="153.82308845577214"/>
</view>
</objects>
<resources>
<image name="details_icon" width="6" height="11"/>
<image name="encryption_normal" width="16" height="16"/>
</resources>
</document>