AvatarView: Update AvatarViewDataProtocol, add possibility to set a defaut image.

This commit is contained in:
SBiOSoftWhare
2021-06-30 23:25:15 +02:00
parent 8e1c8caaea
commit 652831fdbd
6 changed files with 84 additions and 15 deletions
@@ -14,19 +14,28 @@
// limitations under the License.
//
import Foundation
import UIKit
enum AvatarFallbackImage {
/// matrixItem represent a Matrix item like a room, space, user
/// matrixItemId: Matrix item identifier (user id or room id)
/// displayName: Matrix item display name (user or room display name)
case matrixItem(_ matrixItemId: String, _ displayName: String?)
/// Normal image with optional content mode
case image(_ image: UIImage, _ contentMode: UIView.ContentMode? = nil)
}
/// AvatarViewDataProtocol describe a view data that should be given to an AvatarView sublcass
protocol AvatarViewDataProtocol {
/// Matrix item identifier (user id or room id)
var matrixItemId: String { get }
/// Matrix item display name (user or room display name)
var displayName: String? { get }
/// Matrix item avatar URL (user or room avatar url)
var avatarUrl: String? { get }
var avatarUrl: String? { get }
/// Matrix media handler
var mediaManager: MXMediaManager { get }
/// Fallback image used when avatarUrl is nil
var fallbackImage: AvatarFallbackImage? { get }
}