mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 00:52:43 +02:00
Update RiotSwiftUI symbols to triple slash documentation style with function annotations.
This commit is contained in:
@@ -18,11 +18,8 @@ import Foundation
|
||||
import Combine
|
||||
import DesignKit
|
||||
|
||||
/**
|
||||
Simple ViewModel that supports loading an avatar image of a particular size
|
||||
as specified in DesignKit and delivering the UIImage to the UI if possible.
|
||||
*/
|
||||
@available(iOS 14.0, *)
|
||||
/// Simple ViewModel that supports loading an avatar image
|
||||
class AvatarViewModel: InjectableObject, ObservableObject {
|
||||
|
||||
@Inject var avatarService: AvatarServiceProtocol
|
||||
@@ -31,6 +28,13 @@ class AvatarViewModel: InjectableObject, ObservableObject {
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
/// Load an avatar
|
||||
/// - Parameters:
|
||||
/// - mxContentUri: The matrix content URI of the avatar.
|
||||
/// - matrixItemId: The id of the matrix item represented by the avatar.
|
||||
/// - displayName: Display name of the avatar.
|
||||
/// - colorCount: The count of total avatar colors used to generate the stable color index.
|
||||
/// - avatarSize: The size of the avatar to fetch (as defined within DesignKit).
|
||||
func loadAvatar(
|
||||
mxContentUri: String?,
|
||||
matrixItemId: String,
|
||||
@@ -54,9 +58,9 @@ class AvatarViewModel: InjectableObject, ObservableObject {
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
/**
|
||||
Get the first character of a string capialized or else an empty string.
|
||||
*/
|
||||
/// Get the first character of a string capialized or else an empty string.
|
||||
/// - Parameter string: The input string to get the capitalized letter from.
|
||||
/// - Returns: The capitalized first letter.
|
||||
private func firstCharacterCapitalized(_ string: String?) -> String {
|
||||
guard let character = string?.first else {
|
||||
return ""
|
||||
@@ -64,10 +68,13 @@ class AvatarViewModel: InjectableObject, ObservableObject {
|
||||
return String(character).capitalized
|
||||
}
|
||||
|
||||
/**
|
||||
Provides the same color each time for a specified matrixId.
|
||||
Same algorithm as in AvatarGenerator.
|
||||
*/
|
||||
/// Provides the same color each time for a specified matrixId
|
||||
///
|
||||
/// Same algorithm as in AvatarGenerator.
|
||||
/// - Parameters:
|
||||
/// - matrixItemId: the matrix id used as input to create the stable index.
|
||||
/// - colorCount: The number of total colors we want to index in to.
|
||||
/// - Returns: The stable index.
|
||||
private func stableColorIndex(matrixItemId: String, colorCount: Int) -> Int {
|
||||
// Sum all characters
|
||||
let sum = matrixItemId.utf8
|
||||
|
||||
Reference in New Issue
Block a user