Files
letro-ios/ElementX/Sources/Other/Pills/PillUtilities.swift
Mauro a18eff9201 Accessibiliy Tests part 2 (#4325)
* running all the tests

* setting up CI

* fixed the workflow

* workflow on pull request, just to make it appear

* removed the test to run var

* fix archived tests name

* improved the tests, by filtering out some noise

* pr suggestions and added an improvement to the filtering

* improved the interrupt handler

* improved the UI interruption monitor handler

* some more refinement to handle the interruptor + false positive for non human readable labels

* reverted wrong commit

* ready for review, removed the on pull request check

* pr suggestions
2025-07-18 10:33:45 +02:00

43 lines
1.4 KiB
Swift

//
// Copyright 2023, 2024 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
// Please see LICENSE files in the repository root for full details.
//
import Foundation
enum PillUtilities {
static let atRoom = "@room"
/// Used by the WYSIWYG as the urlString value to identify @room mentions
static let composerAtRoomURLString = "#"
/// Used only to mock the max width in previews since the real max width is calculated by the line fragment width
static let mockMaxWidth: CGFloat = 235
private static let roomDecoration = "#"
static func roomPillDisplayText(roomName: String?, rawRoomText: String) -> String {
guard let roomName else {
return rawRoomText
}
return "\(roomDecoration)\(roomName)"
}
private static let eventDecoration = "💬 > "
static func eventPillDisplayText(roomName: String?, rawRoomText: String) -> String {
guard let roomName else {
return "\(eventDecoration)\(rawRoomText)"
}
return "\(eventDecoration)\(roomDecoration)\(roomName)"
}
private static let userDecoration = "@"
static func userPillDisplayText(username: String?, userID: String) -> String {
guard let username else {
return userID
}
return "\(userDecoration)\(username)"
}
}