mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-21 15:50:59 +00:00
Animate avatars by default
This commit is contained in:
parent
11e27d20d9
commit
a566babe3a
5 changed files with 19 additions and 8 deletions
|
@ -70,7 +70,7 @@ public extension AppPreferences {
|
|||
return value
|
||||
}
|
||||
|
||||
return .profiles
|
||||
return .everywhere
|
||||
}
|
||||
set { self[.animateAvatars] = newValue.rawValue }
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public extension AccountViewModel {
|
|||
func avatarURL(profile: Bool = false) -> URL {
|
||||
if !identityContext.appPreferences.shouldReduceMotion,
|
||||
(identityContext.appPreferences.animateAvatars == .everywhere
|
||||
|| identityContext.appPreferences.animateAvatars == .profiles && profile) {
|
||||
|| (identityContext.appPreferences.animateAvatars == .profiles && profile)) {
|
||||
return accountService.account.avatar
|
||||
} else {
|
||||
return accountService.account.avatarStatic
|
||||
|
|
|
@ -4,12 +4,13 @@ import Kingfisher
|
|||
import UIKit
|
||||
import ViewModels
|
||||
|
||||
// swiftlint:disable file_length
|
||||
final class AccountHeaderView: UIView {
|
||||
let headerImageBackgroundView = UIView()
|
||||
let headerImageView = AnimatedImageView()
|
||||
let headerButton = UIButton()
|
||||
let avatarBackgroundView = UIView()
|
||||
let avatarImageView = UIImageView()
|
||||
let avatarImageView = AnimatedImageView()
|
||||
let avatarButton = UIButton()
|
||||
let relationshipButtonsStackView = UIStackView()
|
||||
let followButton = UIButton(type: .system)
|
||||
|
@ -405,3 +406,4 @@ private extension AccountHeaderView {
|
|||
])
|
||||
}
|
||||
}
|
||||
// swiftlint:enable file_length
|
||||
|
|
|
@ -187,12 +187,17 @@ private extension CompositionView {
|
|||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
parentViewModel.$identityContext.map(\.identity)
|
||||
parentViewModel.$identityContext
|
||||
.sink { [weak self] in
|
||||
guard let self = self else { return }
|
||||
|
||||
self.avatarImageView.kf.setImage(with: $0.image)
|
||||
self.changeIdentityButton.accessibilityLabel = $0.handle
|
||||
let avatarURL = $0.appPreferences.animateAvatars == .everywhere
|
||||
&& !$0.appPreferences.shouldReduceMotion
|
||||
? $0.identity.account?.avatar
|
||||
: $0.identity.account?.avatarStatic
|
||||
|
||||
self.avatarImageView.kf.setImage(with: avatarURL)
|
||||
self.changeIdentityButton.accessibilityLabel = $0.identity.handle
|
||||
self.changeIdentityButton.accessibilityHint =
|
||||
NSLocalizedString("compose.change-identity-button.accessibility-hint", comment: "")
|
||||
}
|
||||
|
|
|
@ -65,8 +65,12 @@ private extension SecondaryNavigationTitleView {
|
|||
}
|
||||
|
||||
func applyViewModel() {
|
||||
avatarImageView.kf.setImage(with: viewModel.identityContext.identity.image)
|
||||
avatarImageView.autoPlayAnimatedImage = viewModel.identityContext.appPreferences.animateAvatars == .everywhere
|
||||
let avatarURL = viewModel.identityContext.appPreferences.animateAvatars == .everywhere
|
||||
&& !viewModel.identityContext.appPreferences.shouldReduceMotion
|
||||
? viewModel.identityContext.identity.account?.avatar
|
||||
: viewModel.identityContext.identity.account?.avatarStatic
|
||||
|
||||
avatarImageView.kf.setImage(with: avatarURL)
|
||||
|
||||
if let displayName = viewModel.identityContext.identity.account?.displayName,
|
||||
!displayName.isEmpty {
|
||||
|
|
Loading…
Reference in a new issue