diff --git a/Signal/src/Loki/UserSelectionView.swift b/Signal/src/Loki/UserSelectionView.swift index a6ba5d07d..ff6083775 100644 --- a/Signal/src/Loki/UserSelectionView.swift +++ b/Signal/src/Loki/UserSelectionView.swift @@ -3,7 +3,7 @@ @objc(LKUserSelectionView) final class UserSelectionView : UIView, UITableViewDataSource, UITableViewDelegate { - @objc var users: [String] = [] { didSet { tableView.reloadData() } } + @objc var users: [String] = [] { didSet { tableView.reloadData(); tableView.contentOffset = CGPoint.zero } } @objc var hasGroupContext = false @objc var delegate: UserSelectionViewDelegate? @@ -15,7 +15,7 @@ final class UserSelectionView : UIView, UITableViewDataSource, UITableViewDelega result.register(Cell.self, forCellReuseIdentifier: "Cell") result.separatorStyle = .none result.backgroundColor = .clear - result.contentInset = UIEdgeInsets(top: 10, leading: 0, bottom: 0, trailing: 0) + result.contentInset = UIEdgeInsets(top: 6, leading: 0, bottom: 0, trailing: 0) return result }() @@ -101,12 +101,12 @@ private extension UserSelectionView { stackView.axis = .horizontal stackView.alignment = .center stackView.spacing = 16 - stackView.set(.height, to: 44) + stackView.set(.height, to: 36) contentView.addSubview(stackView) stackView.pin(.leading, to: .leading, of: contentView, withInset: 16) - stackView.pin(.top, to: .top, of: contentView, withInset: 4) + stackView.pin(.top, to: .top, of: contentView, withInset: 8) contentView.pin(.trailing, to: .trailing, of: stackView, withInset: 16) - contentView.pin(.bottom, to: .bottom, of: stackView, withInset: 4) + contentView.pin(.bottom, to: .bottom, of: stackView, withInset: 8) stackView.set(.width, to: UIScreen.main.bounds.width - 2 * 16) // Set up the moderator icon image view moderatorIconImageView.set(.width, to: 20) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m index c004ae8ce..b4d58b40e 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationInputToolbar.m @@ -1095,7 +1095,7 @@ const CGFloat kMaxTextViewHeight = 98; { self.userSelectionView.hasGroupContext = thread.isGroupThread; // Must happen before setting the users self.userSelectionView.users = users; - self.userSelectionViewSizeConstraint.constant = 10 + MIN(users.count, 4) * 52; + self.userSelectionViewSizeConstraint.constant = 6 + MIN(users.count, 4) * 52; [self setNeedsLayout]; [self layoutIfNeeded]; } diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index be2caca11..4e98858b2 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -3769,10 +3769,9 @@ typedef enum : NSUInteger { - (void)textViewDidChange:(UITextView *)textView { - if (textView.text.length > 0) { - [self.typingIndicators didStartTypingOutgoingInputInThread:self.thread]; - } - NSUInteger currentEndIndex = (textView.text.length != 0) ? textView.text.length - 1 : 0; + if (textView.text.length == 0) { return; } + [self.typingIndicators didStartTypingOutgoingInputInThread:self.thread]; + NSUInteger currentEndIndex = textView.text.length - 1; unichar lastCharacter = [textView.text characterAtIndex:currentEndIndex]; NSMutableCharacterSet *allowedCharacters = NSMutableCharacterSet.lowercaseLetterCharacterSet; [allowedCharacters formUnionWithCharacterSet:NSCharacterSet.uppercaseLetterCharacterSet]; diff --git a/SignalServiceKit/src/Loki/API/LokiAPI.swift b/SignalServiceKit/src/Loki/API/LokiAPI.swift index 11c7e805f..f8e89501b 100644 --- a/SignalServiceKit/src/Loki/API/LokiAPI.swift +++ b/SignalServiceKit/src/Loki/API/LokiAPI.swift @@ -322,9 +322,11 @@ public final class LokiAPI : NSObject { candidates.sort { $0.displayName < $1.displayName } if query.count >= 2 { // Filter out any non-matching candidates - candidates = candidates.filter { $0.displayName.contains(query) } + candidates = candidates.filter { $0.displayName.lowercased().contains(query.lowercased()) } // Sort based on where in the candidate the query occurs - candidates.sort { $0.displayName.range(of: query)!.lowerBound < $1.displayName.range(of: query)!.lowerBound } + candidates.sort { + $0.displayName.lowercased().range(of: query.lowercased())!.lowerBound < $1.displayName.lowercased().range(of: query.lowercased())!.lowerBound + } } // Return return candidates.map { $0.id } // Inefficient to do this and then look up the display name again later, but easy to interface with Obj-C