Move visibility switch to extension
This commit is contained in:
parent
2b3660086d
commit
157492a6af
|
@ -0,0 +1,20 @@
|
|||
// Copyright © 2023 Mastodon gGmbH. All rights reserved.
|
||||
|
||||
import UIKit
|
||||
import CoreDataStack
|
||||
import MastodonAsset
|
||||
|
||||
extension MastodonVisibility {
|
||||
|
||||
public var image: UIImage {
|
||||
let asset: ImageAsset
|
||||
switch self {
|
||||
case .public: asset = Asset.Scene.Compose.earth
|
||||
case .unlisted: asset = Asset.Scene.Compose.people
|
||||
case .private: asset = Asset.Scene.Compose.peopleAdd
|
||||
case .direct: asset = Asset.Scene.Compose.mention
|
||||
case ._other: asset = Asset.Scene.Compose.questionmarkCircle
|
||||
}
|
||||
return asset.image.withRenderingMode(.alwaysTemplate)
|
||||
}
|
||||
}
|
|
@ -285,17 +285,8 @@ extension StatusView.ViewModel {
|
|||
.store(in: &disposeBag)
|
||||
|
||||
$visibility
|
||||
.map {
|
||||
switch $0 {
|
||||
case .public: return Asset.Scene.Compose.earth
|
||||
case .unlisted: return Asset.Scene.Compose.people
|
||||
case .private: return Asset.Scene.Compose.peopleAdd
|
||||
case .direct: return Asset.Scene.Compose.mention
|
||||
case ._other: return Asset.Scene.Compose.questionmarkCircle
|
||||
}
|
||||
}
|
||||
.sink {
|
||||
authorView.visibilityIconImageView.image = $0.image.withRenderingMode(.alwaysTemplate)
|
||||
.sink { visibility in
|
||||
authorView.visibilityIconImageView.image = visibility.image
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue