From 61aedd51b64b16b4151381cec3559178f3e0536d Mon Sep 17 00:00:00 2001
From: kkostiuk <kateryna.kostiuk@savoirfairelinux.com>
Date: Tue, 25 May 2021 09:26:59 -0400
Subject: [PATCH] conversations: fix tab selection

Keep conversation tab selected when receive contact request

Change-Id: Ie6ccc761836c6dcda6c9c506e3a0bb1eeba40f3b
---
 .../Features/ContactRequests/Cells/ContactRequestCell.xib | 8 ++++----
 .../Conversations/SmartList/SmartlistViewController.swift | 3 +++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Ring/Ring/Features/ContactRequests/Cells/ContactRequestCell.xib b/Ring/Ring/Features/ContactRequests/Cells/ContactRequestCell.xib
index 12d59417e..f873069a7 100644
--- a/Ring/Ring/Features/ContactRequests/Cells/ContactRequestCell.xib
+++ b/Ring/Ring/Features/ContactRequests/Cells/ContactRequestCell.xib
@@ -37,7 +37,7 @@
                                 <nil key="highlightedColor"/>
                             </label>
                             <stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" alignment="center" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="klf-Xm-XH9">
-                                <rect key="frame" x="313" y="6" width="132" height="40"/>
+                                <rect key="frame" x="315" y="6" width="130" height="40"/>
                                 <subviews>
                                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="feR-9F-sZM">
                                         <rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
@@ -62,7 +62,7 @@
                                         </userDefinedRuntimeAttributes>
                                     </button>
                                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fWB-HR-tae">
-                                        <rect key="frame" x="46" y="0.0" width="40" height="40"/>
+                                        <rect key="frame" x="45" y="0.0" width="40" height="40"/>
                                         <constraints>
                                             <constraint firstAttribute="width" constant="40" id="BU4-ED-Mry"/>
                                             <constraint firstAttribute="height" constant="40" id="fQt-vU-mXY"/>
@@ -84,7 +84,7 @@
                                         </userDefinedRuntimeAttributes>
                                     </button>
                                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Pni-bm-rkr">
-                                        <rect key="frame" x="92" y="0.0" width="40" height="40"/>
+                                        <rect key="frame" x="90" y="0.0" width="40" height="40"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="40" id="Bee-OT-mx8"/>
                                             <constraint firstAttribute="width" constant="40" id="dsw-SF-fZe"/>
@@ -108,7 +108,7 @@
                                     </button>
                                 </subviews>
                                 <constraints>
-                                    <constraint firstAttribute="width" constant="132" id="SA1-7h-Opo"/>
+                                    <constraint firstAttribute="width" constant="130" id="SA1-7h-Opo"/>
                                 </constraints>
                             </stackView>
                         </subviews>
diff --git a/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.swift b/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.swift
index 1aaef66b3..2f96e5c88 100644
--- a/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.swift
+++ b/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.swift
@@ -243,6 +243,9 @@ class SmartlistViewController: UIViewController, StoryboardBased, ViewModelBased
             requestsBadge.setTitle(String(requests), for: .normal)
             return
         }
+        if segmentControlContainer.isHidden {
+            conversationsSegmentControl.selectedSegmentIndex = 0
+        }
         segmentControlContainer.isHidden = false
         let unreadMessages = messages
         let unreadRequests = requests
-- 
GitLab