Constrain size
This commit is contained in:
parent
5d91bcf8b5
commit
23a0943b12
|
@ -18,6 +18,7 @@ import MastodonUI
|
|||
final class ProfileHeaderViewModel {
|
||||
|
||||
static let avatarImageMaxSizeInPixel = CGSize(width: 400, height: 400)
|
||||
static let bannerImageMaxSizeInPixel = CGSize(width: 1500, height: 500)
|
||||
static let maxProfileFieldCount = 4
|
||||
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
|
|
|
@ -217,7 +217,13 @@ extension ProfileViewModel {
|
|||
let authorization = authenticationBox.userAuthorization
|
||||
|
||||
// TODO: constrain size?
|
||||
let _header: UIImage? = headerProfileInfo.header
|
||||
let _header: UIImage? = {
|
||||
guard let image = headerProfileInfo.header else { return nil }
|
||||
guard image.size.width <= ProfileHeaderViewModel.bannerImageMaxSizeInPixel.width else {
|
||||
return image.af.imageScaled(to: ProfileHeaderViewModel.bannerImageMaxSizeInPixel)
|
||||
}
|
||||
return image
|
||||
}()
|
||||
|
||||
let _avatar: UIImage? = {
|
||||
guard let image = headerProfileInfo.avatar else { return nil }
|
||||
|
|
Loading…
Reference in New Issue