Skip to content
Snippets Groups Projects
Commit da79fbf4 authored by Bruno Muniz's avatar Bruno Muniz :apple:
Browse files

When going through a UI flow, menu item turns colored

parent 2732eebc
No related branches found
No related tags found
2 merge requests!54Releasing 1.1.4,!41When going through a UI flow, menu item turns colored
...@@ -51,6 +51,7 @@ public final class MenuController: UIViewController { ...@@ -51,6 +51,7 @@ public final class MenuController: UIViewController {
image: viewModel.avatar image: viewModel.avatar
) )
screenView.select(item: previousItem)
screenView.xxdkVersionLabel.text = "XXDK \(viewModel.xxdk)" screenView.xxdkVersionLabel.text = "XXDK \(viewModel.xxdk)"
screenView.buildLabel.text = Localized.Menu.build(viewModel.build) screenView.buildLabel.text = Localized.Menu.build(viewModel.build)
screenView.versionLabel.text = Localized.Menu.version(viewModel.version) screenView.versionLabel.text = Localized.Menu.version(viewModel.version)
......
...@@ -40,9 +40,17 @@ final class MenuSectionButton: UIControl { ...@@ -40,9 +40,17 @@ final class MenuSectionButton: UIControl {
notificationLabel.text = " \(count) " notificationLabel.text = " \(count) "
} }
func set(title: String, image: UIImage, color: UIColor = Asset.neutralWeak.color) { func set(color: UIColor) {
titleLabel.text = title
titleLabel.textColor = color titleLabel.textColor = color
imageView.image = image.withTintColor(color)
if let image = imageView.image {
imageView.image = image.withTintColor(color)
}
}
func set(title: String, image: UIImage) {
titleLabel.text = title
titleLabel.textColor = Asset.neutralWeak.color
imageView.image = image.withTintColor(Asset.neutralWeak.color)
} }
} }
...@@ -18,20 +18,9 @@ final class MenuView: UIView { ...@@ -18,20 +18,9 @@ final class MenuView: UIView {
init() { init() {
super.init(frame: .zero) super.init(frame: .zero)
setup()
}
required init?(coder: NSCoder) { nil }
private func setup() {
backgroundColor = Asset.neutralDark.color backgroundColor = Asset.neutralDark.color
chatsButton.set( chatsButton.set(title: Localized.Menu.chats, image: Asset.menuChats.image)
title: Localized.Menu.chats,
image: Asset.menuChats.image,
color: Asset.brandPrimary.color
)
scanButton.set(title: Localized.Menu.scan, image: Asset.menuScan.image) scanButton.set(title: Localized.Menu.scan, image: Asset.menuScan.image)
requestsButton.set(title: Localized.Menu.requests, image: Asset.menuRequests.image) requestsButton.set(title: Localized.Menu.requests, image: Asset.menuRequests.image)
contactsButton.set(title: Localized.Menu.contacts, image: Asset.menuContacts.image) contactsButton.set(title: Localized.Menu.contacts, image: Asset.menuContacts.image)
...@@ -64,33 +53,42 @@ final class MenuView: UIView { ...@@ -64,33 +53,42 @@ final class MenuView: UIView {
addSubview(infoStackView) addSubview(infoStackView)
setupConstraints() setupConstraints()
setupAccessibility()
} }
private func setupConstraints() { required init?(coder: NSCoder) { nil }
headerView.snp.makeConstraints { make in
make.top.equalTo(safeAreaLayoutGuide).offset(20) func select(item: MenuItem) {
make.left.equalToSuperview().offset(30) switch item {
make.right.equalToSuperview().offset(-24) case .chats:
chatsButton.set(color: Asset.brandPrimary.color)
case .contacts:
contactsButton.set(color: Asset.brandPrimary.color)
case .requests:
requestsButton.set(color: Asset.brandPrimary.color)
case .scan:
scanButton.set(color: Asset.brandPrimary.color)
case .settings:
settingsButton.set(color: Asset.brandPrimary.color)
case .profile, .dashboard, .join:
break
} }
}
stackView.snp.makeConstraints { make in private func setupConstraints() {
make.left.equalToSuperview().offset(26) headerView.snp.makeConstraints {
make.top.equalTo(headerView.snp.bottom).offset(75) $0.top.equalTo(safeAreaLayoutGuide).offset(20)
$0.left.equalToSuperview().offset(30)
$0.right.equalToSuperview().offset(-24)
} }
infoStackView.snp.makeConstraints { make in stackView.snp.makeConstraints {
make.bottom.equalTo(safeAreaLayoutGuide).offset(-20) $0.left.equalToSuperview().offset(26)
make.left.equalToSuperview().offset(20) $0.top.equalTo(headerView.snp.bottom).offset(75)
} }
}
private func setupAccessibility() { infoStackView.snp.makeConstraints {
scanButton.accessibilityIdentifier = Localized.Accessibility.Menu.scan $0.bottom.equalTo(safeAreaLayoutGuide).offset(-20)
chatsButton.accessibilityIdentifier = Localized.Accessibility.Menu.chats $0.left.equalToSuperview().offset(20)
headerView.accessibilityIdentifier = Localized.Accessibility.Menu.header }
contactsButton.accessibilityIdentifier = Localized.Accessibility.Menu.contacts
requestsButton.accessibilityIdentifier = Localized.Accessibility.Menu.requests
settingsButton.accessibilityIdentifier = Localized.Accessibility.Menu.settings
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment