fix: edit state overlay views display when push profile scene issue

This commit is contained in:
CMK 2021-06-22 19:33:36 +08:00
parent 78a444f14b
commit 526f125cb2
4 changed files with 12 additions and 4 deletions

View File

@ -220,6 +220,9 @@ extension ProfileHeaderViewController {
super.viewDidAppear(animated) super.viewDidAppear(animated)
viewModel.viewDidAppear.value = true viewModel.viewDidAppear.value = true
// set display after view appear
profileHeaderView.setupAvatarOverlayViews()
} }
override func viewDidLayoutSubviews() { override func viewDidLayoutSubviews() {

View File

@ -144,7 +144,7 @@ extension ProfileHeaderViewModel {
return html?.text return html?.text
} }
// check if profile chagned or not // check if profile change or not
func isProfileInfoEdited() -> Bool { func isProfileInfoEdited() -> Bool {
guard isEditing.value else { return false } guard isEditing.value else { return false }

View File

@ -73,10 +73,15 @@ final class ProfileHeaderView: UIView {
imageView.image = placeholderImage imageView.image = placeholderImage
return imageView return imageView
}() }()
func setupAvatarOverlayViews() {
editAvatarBackgroundView.backgroundColor = UIColor.black.withAlphaComponent(0.6)
editAvatarButton.tintColor = .white
}
let editAvatarBackgroundView: UIView = { let editAvatarBackgroundView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = UIColor.black.withAlphaComponent(0.6) view.backgroundColor = .clear // set value after view appeared
view.layer.masksToBounds = true view.layer.masksToBounds = true
view.layer.cornerCurve = .continuous view.layer.cornerCurve = .continuous
view.layer.cornerRadius = ProfileHeaderView.avatarImageViewCornerRadius view.layer.cornerRadius = ProfileHeaderView.avatarImageViewCornerRadius
@ -87,7 +92,7 @@ final class ProfileHeaderView: UIView {
let editAvatarButton: HighlightDimmableButton = { let editAvatarButton: HighlightDimmableButton = {
let button = HighlightDimmableButton() let button = HighlightDimmableButton()
button.setImage(UIImage(systemName: "photo", withConfiguration: UIImage.SymbolConfiguration(pointSize: 28)), for: .normal) button.setImage(UIImage(systemName: "photo", withConfiguration: UIImage.SymbolConfiguration(pointSize: 28)), for: .normal)
button.tintColor = .white button.tintColor = .clear
return button return button
}() }()

View File

@ -58,7 +58,7 @@ final class ProfileViewController: UIViewController, NeedsDependency, MediaPrevi
let refreshControl: UIRefreshControl = { let refreshControl: UIRefreshControl = {
let refreshControl = UIRefreshControl() let refreshControl = UIRefreshControl()
refreshControl.tintColor = .label refreshControl.tintColor = .white
return refreshControl return refreshControl
}() }()