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

Merge branch 'menu-colors' into 'development'

When going through a UI flow, menu item turns colored

See merge request elixxir/client-ios!41
parents 61c7d1f3 da79fbf4
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 {
image: viewModel.avatar
)
screenView.select(item: previousItem)
screenView.xxdkVersionLabel.text = "XXDK \(viewModel.xxdk)"
screenView.buildLabel.text = Localized.Menu.build(viewModel.build)
screenView.versionLabel.text = Localized.Menu.version(viewModel.version)
......
......@@ -40,9 +40,17 @@ final class MenuSectionButton: UIControl {
notificationLabel.text = " \(count) "
}
func set(title: String, image: UIImage, color: UIColor = Asset.neutralWeak.color) {
titleLabel.text = title
func set(color: UIColor) {
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 {
init() {
super.init(frame: .zero)
setup()
}
required init?(coder: NSCoder) { nil }
private func setup() {
backgroundColor = Asset.neutralDark.color
chatsButton.set(
title: Localized.Menu.chats,
image: Asset.menuChats.image,
color: Asset.brandPrimary.color
)
chatsButton.set(title: Localized.Menu.chats, image: Asset.menuChats.image)
scanButton.set(title: Localized.Menu.scan, image: Asset.menuScan.image)
requestsButton.set(title: Localized.Menu.requests, image: Asset.menuRequests.image)
contactsButton.set(title: Localized.Menu.contacts, image: Asset.menuContacts.image)
......@@ -64,33 +53,42 @@ final class MenuView: UIView {
addSubview(infoStackView)
setupConstraints()
setupAccessibility()
}
private func setupConstraints() {
headerView.snp.makeConstraints { make in
make.top.equalTo(safeAreaLayoutGuide).offset(20)
make.left.equalToSuperview().offset(30)
make.right.equalToSuperview().offset(-24)
required init?(coder: NSCoder) { nil }
func select(item: MenuItem) {
switch item {
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
make.left.equalToSuperview().offset(26)
make.top.equalTo(headerView.snp.bottom).offset(75)
private func setupConstraints() {
headerView.snp.makeConstraints {
$0.top.equalTo(safeAreaLayoutGuide).offset(20)
$0.left.equalToSuperview().offset(30)
$0.right.equalToSuperview().offset(-24)
}
infoStackView.snp.makeConstraints { make in
make.bottom.equalTo(safeAreaLayoutGuide).offset(-20)
make.left.equalToSuperview().offset(20)
stackView.snp.makeConstraints {
$0.left.equalToSuperview().offset(26)
$0.top.equalTo(headerView.snp.bottom).offset(75)
}
}
private func setupAccessibility() {
scanButton.accessibilityIdentifier = Localized.Accessibility.Menu.scan
chatsButton.accessibilityIdentifier = Localized.Accessibility.Menu.chats
headerView.accessibilityIdentifier = Localized.Accessibility.Menu.header
contactsButton.accessibilityIdentifier = Localized.Accessibility.Menu.contacts
requestsButton.accessibilityIdentifier = Localized.Accessibility.Menu.requests
settingsButton.accessibilityIdentifier = Localized.Accessibility.Menu.settings
infoStackView.snp.makeConstraints {
$0.bottom.equalTo(safeAreaLayoutGuide).offset(-20)
$0.left.equalToSuperview().offset(20)
}
}
}
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