Commit f563e155 authored by Olivier Soldano's avatar Olivier Soldano Committed by Anthony Léonard

hide bestId in conversation when duplicated

If the bestId of a conversation matches the bestName,
the duplicate is hidden from view, and updates the constraints
to center the bestName tag.

Change-Id: I3012069be6098c851cdba71642439ba7df074a3f
Reviewed-by: default avatarAnthony Léonard <anthony.leonard@savoirfairelinux.com>
parent 13c69e30
......@@ -56,7 +56,7 @@
__unsafe_unretained IBOutlet NSButton* sentContactRequestButton;
IBOutlet MessagesVC* messagesViewVC;
IBOutlet NSLayoutConstraint* titleHoverButtonConstraint;
IBOutlet NSLayoutConstraint *titleCenteredConstraint;
IBOutlet NSLayoutConstraint* titleTopConstraint;
std::string convUid_;
......@@ -147,16 +147,14 @@
// Setup UI elements according to new conversation
NSString* bestName = bestNameForConversation(*conv, *convModel_);
NSString* bestId = bestIDForConversation(*conv, *convModel_);
if (bestName == bestId) {
bestId = @(model->owner.contactModel->getContact(conv->participants[0]).profileInfo.uri.c_str());
}
[conversationTitle setStringValue: bestName];
[conversationID setStringValue: bestId];
BOOL hideCMPopupButton = [bestNameForConversation(*conv, *convModel_) isEqualTo:bestIDForConversation(*conv, *convModel_)];
BOOL hideBestId = [bestNameForConversation(*conv, *convModel_) isEqualTo:bestIDForConversation(*conv, *convModel_)];
[titleHoverButtonConstraint setActive:hideCMPopupButton];
[titleTopConstraint setActive:!hideCMPopupButton];
[conversationID setHidden:hideBestId];
[titleCenteredConstraint setActive:hideBestId];
[titleTopConstraint setActive:!hideBestId];
}
- (void)loadView {
......
......@@ -14,6 +14,7 @@
<outlet property="messagesViewVC" destination="iH6-17-JsM" id="uxH-Ra-lSr"/>
<outlet property="sendButton" destination="UJf-cF-RAo" id="8PF-7G-w1d"/>
<outlet property="sendPanel" destination="Rth-di-Tls" id="vCd-kM-DLc"/>
<outlet property="titleCenteredConstraint" destination="uTp-kU-NmC" id="ccn-92-zaA"/>
<outlet property="titleTopConstraint" destination="32s-Wp-DE1" id="fms-Yu-vrn"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
......@@ -244,7 +245,7 @@
</connections>
</customView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ucx-6g-eJw">
<rect key="frame" x="68" y="559" width="39" height="22"/>
<rect key="frame" x="68" y="533" width="39" height="48"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" sendsActionOnEndEditing="YES" alignment="left" placeholderString="Title" id="HnC-1N-RmR">
<font key="font" metaFont="system" size="18"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
......@@ -295,6 +296,7 @@
<constraint firstAttribute="trailing" secondItem="Sn1-dJ-QCw" secondAttribute="trailing" constant="20" id="m05-gh-crH"/>
<constraint firstItem="Rth-di-Tls" firstAttribute="trailing" secondItem="EJD-f8-Xqd" secondAttribute="trailing" id="mga-Tu-Ikb"/>
<constraint firstItem="Rth-di-Tls" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="qz7-sE-9Ml"/>
<constraint firstItem="ucx-6g-eJw" firstAttribute="centerY" secondItem="ooq-vs-Xt1" secondAttribute="centerY" id="uTp-kU-NmC" userLabel="centeredTitle"/>
</constraints>
<point key="canvasLocation" x="514" y="354"/>
</customView>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment