mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
use UIIimage to generate the local thumbnail for the avatar image so that snapshotting works fine and performance are improved
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
enum CreateRoomScreenErrorType: Error {
|
||||
case failedCreatingRoom
|
||||
@@ -31,7 +31,19 @@ struct CreateRoomScreenViewState: BindableState {
|
||||
let isKnockingFeatureEnabled: Bool
|
||||
var aliasLocalPart: String
|
||||
var bindings: CreateRoomScreenViewStateBindings
|
||||
var avatarMediaInfo: MediaInfo?
|
||||
var avatarMediaInfo: MediaInfo? {
|
||||
didSet {
|
||||
switch avatarMediaInfo {
|
||||
case .image(_, let thumbnailURL, _):
|
||||
avatarImage = UIImage(contentsOfFile: thumbnailURL.path(percentEncoded: false))
|
||||
default:
|
||||
avatarImage = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var avatarImage: UIImage?
|
||||
|
||||
var canCreateRoom: Bool {
|
||||
!roomName.isEmpty && aliasErrors.isEmpty
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user