diff --git a/NextcloudTalk/InputbarViewController.swift b/NextcloudTalk/InputbarViewController.swift index b431be8f9..4a5ababd2 100644 --- a/NextcloudTalk/InputbarViewController.swift +++ b/NextcloudTalk/InputbarViewController.swift @@ -283,7 +283,17 @@ import UIKit let suggestion = self.autocompletionUsers[indexPath.row] - cell.titleLabel.text = suggestion.label + if let details = suggestion.details { + cell.titleLabel.numberOfLines = 2 + + let attributedLabel = (suggestion.label + "\n").withFont(.preferredFont(forTextStyle: .body)) + let attributedDetails = details.withFont(.preferredFont(forTextStyle: .callout)).withTextColor(.secondaryLabel) + attributedLabel.append(attributedDetails) + cell.titleLabel.attributedText = attributedLabel + } else { + cell.titleLabel.numberOfLines = 1 + cell.titleLabel.text = suggestion.label + } if let suggestionUserStatus = suggestion.userStatus { cell.setUserStatus(suggestionUserStatus) diff --git a/NextcloudTalk/MentionSuggestion.swift b/NextcloudTalk/MentionSuggestion.swift index 204dbed2e..8bc5fa590 100644 --- a/NextcloudTalk/MentionSuggestion.swift +++ b/NextcloudTalk/MentionSuggestion.swift @@ -12,6 +12,7 @@ import Foundation public var source: String public var mentionId: String? public var userStatus: String? + public var details: String? init(dictionary: [String: Any]) { self.id = dictionary["id"] as? String ?? "" @@ -19,6 +20,7 @@ import Foundation self.source = dictionary["source"] as? String ?? "" self.mentionId = dictionary["mentionId"] as? String self.userStatus = dictionary["status"] as? String + self.details = dictionary["details"] as? String super.init() } diff --git a/NextcloudTalkTests/UI/UIRoomTest.swift b/NextcloudTalkTests/UI/UIRoomTest.swift index 7246f84b0..5d40759cf 100644 --- a/NextcloudTalkTests/UI/UIRoomTest.swift +++ b/NextcloudTalkTests/UI/UIRoomTest.swift @@ -128,7 +128,8 @@ final class UIRoomTest: XCTestCase { textView.typeText("M") textView.typeText("e") - let autoCompleteCell = app.tables.cells["AutoCompletionCellIdentifier"].staticTexts[newConversationName] + let predicate = NSPredicate(format: "label CONTAINS[c] %@", newConversationName) + let autoCompleteCell = app.tables.cells["AutoCompletionCellIdentifier"].staticTexts.containing(predicate).firstMatch XCTAssert(autoCompleteCell.waitForExistence(timeout: TestConstants.timeoutShort)) autoCompleteCell.tap()