Skip to content

Commit

Permalink
Fix colors on Storyboards (#1784)
Browse files Browse the repository at this point in the history
* Fix RuuviColors on Storyboards
Code the colors instead of using it on storyboard

* menu text color

* ruuvi primary color

* rest colors

* call style
  • Loading branch information
rinat-enikeev authored Dec 15, 2023
1 parent eeb3a90 commit dfb8682
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,19 @@ extension AboutViewController {
configureViews()
setUpChangelogTapGesture()
localize()
styleViews()
output.viewDidLoad()
}

private func styleViews() {
view.backgroundColor = RuuviColor.primary.color
versionLabel.textColor = RuuviColor.dashboardIndicator.color
addedTagsLabel.textColor = RuuviColor.dashboardIndicator.color
storedMeasurementsLabel.textColor = RuuviColor.dashboardIndicator.color
databaseSizeLable.textColor = RuuviColor.dashboardIndicator.color
aboutTextView.tintColor = RuuviColor.tintColor.color
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
DispatchQueue.main.async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ extension MenuTableEmbededViewController {
getMoreSensorsLabel.text = RuuviLocalization.Menu.Label.GetMoreSensors.text
feedbackLabel.text = RuuviLocalization.Menu.Label.Feedback.text
}

func styleViews() {
view.backgroundColor = RuuviColor.primary.color
addANewSensorLabel.textColor = RuuviColor.menuTextColor.color
appSettingsLabel.textColor = RuuviColor.menuTextColor.color
aboutHelpLabel.textColor = RuuviColor.menuTextColor.color
whatToMeasureLabel.textColor = RuuviColor.menuTextColor.color
getMoreSensorsLabel.textColor = RuuviColor.menuTextColor.color
feedbackLabel.textColor = RuuviColor.menuTextColor.color
accountAuthLabel.textColor = RuuviColor.menuTextColor.color
}
}

// MARK: - View lifecycle
Expand All @@ -39,6 +50,7 @@ extension MenuTableEmbededViewController {
override func viewDidLoad() {
super.viewDidLoad()
localize()
styleViews()
}

override func viewWillAppear(_ animated: Bool) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import RuuviLocalization
import UIKit

class MenuTableViewController: UIViewController {
Expand All @@ -14,13 +15,18 @@ extension MenuTableViewController {
override func viewDidLoad() {
super.viewDidLoad()
localize()
styleViews()
configureViews()
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
output.viewWillAppear()
}

private func styleViews() {
view.backgroundColor = RuuviColor.primary.color
}
}

extension MenuTableViewController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,20 @@ class MyRuuviAccountViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
styleViews()
configureViews()
localize()
output.viewDidLoad()
}

private func styleViews() {
view.backgroundColor = RuuviColor.primary.color
loggedInLabel.textColor = RuuviColor.textColor.color
usernameLabel.textColor = RuuviColor.textColor.color
deleteAccountButton.backgroundColor = RuuviColor.orangeColor.color
signoutButton.backgroundColor = RuuviColor.tintColor.color
}

// MARK: - Button actions

@IBAction func backButtonTouchUpInside(_: Any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,23 @@ extension SettingsTableViewController: SettingsViewInput {
appearanceTitleLabel.text = RuuviLocalization.settingsAppearance
alertNotificationsTitleLabel.text = RuuviLocalization.settingsAlertNotifications
updateUILanguage()
tableView.reloadData()
}

func styleViews() {
view.backgroundColor = RuuviColor.primary.color
temperatureTitleLabel.textColor = RuuviColor.menuTextColor.color
humidityTitleLabel.textColor = RuuviColor.menuTextColor.color
pressureTitleLabel.textColor = RuuviColor.menuTextColor.color
languageTitleLabel.textColor = RuuviColor.menuTextColor.color
defaultsTitleLabel.textColor = RuuviColor.menuTextColor.color
devicesTitleLabel.textColor = RuuviColor.menuTextColor.color
heartbeatTitleLabel.textColor = RuuviColor.menuTextColor.color
chartTitleLabel.textColor = RuuviColor.menuTextColor.color
ruuviCloudTitleLabel.textColor = RuuviColor.menuTextColor.color
appearanceTitleLabel.textColor = RuuviColor.menuTextColor.color
alertNotificationsTitleLabel.textColor = RuuviColor.menuTextColor.color
experimentalFunctionsLabel.textColor = RuuviColor.menuTextColor.color
languageValueLabel.textColor = RuuviColor.menuTextColor.color
}

func viewDidShowLanguageChangeDialog() {
Expand Down Expand Up @@ -125,6 +141,7 @@ extension SettingsTableViewController {
updateNavBarTitleFont()
updateUI()
localize()
styleViews()
output.viewDidLoad()
becomeFirstResponder()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ChartSettingsTableViewController: UITableViewController {
super.viewDidLoad()
tableView.sectionFooterHeight = UITableView.automaticDimension
localize()
styleViews()
}

override func viewWillDisappear(_ animated: Bool) {
Expand All @@ -28,6 +29,10 @@ extension ChartSettingsTableViewController: ChartSettingsViewInput {
func localize() {
title = RuuviLocalization.Settings.Label.chart
}

private func styleViews() {
view.backgroundColor = RuuviColor.primary.color
}
}

// MARK: - View lifecycle
Expand All @@ -53,7 +58,9 @@ extension ChartSettingsTableViewController {
let cell = tableView
.dequeueReusableCell(with: ChartSettingsSwitchTableViewCell.self, for: indexPath)
cell.titleLabel.text = title
cell.titleLabel.textColor = RuuviColor.menuTextColor.color
cell.isOnSwitch.isOn = value
cell.isOnSwitch.thumbTintColor = RuuviColor.tintColor.color
cell.delegate = self
return cell
case let .stepper(title, value, unitSingular, unitPlural):
Expand All @@ -67,13 +74,16 @@ extension ChartSettingsTableViewController {
cell.titleLabel.text = title + " "
+ "(" + "\(value)" + " "
+ unit.unitString + ")"
cell.titleLabel.textColor = RuuviColor.menuTextColor.color
cell.prefix = title
cell.stepper.value = Double(value)
cell.stepper.backgroundColor = RuuviColor.tintColor.color
cell.delegate = self
return cell
case let .disclosure(title):
let cell = tableView.dequeueReusableCell(with: ChartSettingsDisclosureTableViewCell.self, for: indexPath)
cell.textLabel?.text = title
cell.textLabel?.textColor = RuuviColor.menuTextColor.color
return cell
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ extension DefaultsViewController {
super.viewDidLoad()
configureViews()
localize()
styleViews()
}

private func styleViews() {
view.backgroundColor = RuuviColor.primary.color
}

override func shouldPerformSegue(withIdentifier identifier: String, sender _: Any?) -> Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ extension DefaultsTableViewController {
override func viewDidLoad() {
super.viewDidLoad()
localize()
styleViews()
}

private func styleViews() {
view.backgroundColor = RuuviColor.primary.color
}
}

Expand All @@ -56,7 +61,9 @@ extension DefaultsTableViewController {
) as! DefaultsPlainTableViewCell
// swiftlint:enable force_cast
cell.titleLabel.text = viewModel.title
cell.titleLabel.textColor = RuuviColor.menuTextColor.color
cell.valueLabel.text = viewModel.value.value ?? RuuviLocalization.na
cell.valueLabel.textColor = RuuviColor.menuTextColor.color
return cell
case .switcher:
// swiftlint:disable force_cast
Expand All @@ -67,7 +74,10 @@ extension DefaultsTableViewController {
) as! DefaultsSwitchTableViewCell
// swiftlint:enable force_cast
cell.titleLabel.text = viewModel.title
cell.titleLabel.textColor = RuuviColor.menuTextColor.color
cell.isOnSwitch.isOn = viewModel.boolean.value ?? false
cell.isOnSwitch.onTintColor = RuuviColor.switchEnabledTint.color
cell.isOnSwitch.thumbTintColor = RuuviColor.tintColor.color
cell.delegate = self
return cell
case .stepper:
Expand Down Expand Up @@ -105,6 +115,8 @@ extension DefaultsTableViewController {
case .decimal:
cell.titleLabel.text = title + " " + "(" + "\(result)" + ")"
}
cell.titleLabel.textColor = RuuviColor.menuTextColor.color
cell.stepper.backgroundColor = RuuviColor.tintColor.color
cell.prefix = title
cell.stepper.value = Double(viewModel.integer.value.bound)
cell.delegate = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ extension HeartbeatViewController {
super.viewDidLoad()
configureViews()
localize()
styleViews()
}

private func styleViews() {
view.backgroundColor = RuuviColor.primary.color
}

override func shouldPerformSegue(withIdentifier identifier: String, sender _: Any?) -> Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ extension HeartbeatTableViewController: HeartbeatViewInput {
bgScanningIntervalValueLabel.text = RuuviLocalization.Heartbeat.Interval.All.string
}
}

func styleViews() {
view.backgroundColor = RuuviColor.primary.color
bgScanningTitleLabel.textColor = RuuviColor.menuTextColor.color
bgScanningIntervalTitleLabel.textColor = RuuviColor.menuTextColor.color
bgScanningIntervalValueLabel.textColor = RuuviColor.textColor.color
bgScanningSwitch.thumbTintColor = RuuviColor.tintColor.color
bgScanningIntervalStepper.backgroundColor = RuuviColor.tintColor.color
}
}

// MARK: - IBActions
Expand All @@ -53,6 +62,7 @@ extension HeartbeatTableViewController {
bindViewModel()
updateUIComponent()
localize()
styleViews()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ class SelectionTableViewController: UITableViewController {
// MARK: - SelectionViewInput

extension SelectionTableViewController: SelectionViewInput {
func localize() {
tableView.reloadData()
func styleViews() {
view.backgroundColor = RuuviColor.primary.color
descriptionTextView.textColor = RuuviColor.textColor.color
}
}

Expand All @@ -48,7 +49,7 @@ extension SelectionTableViewController: SelectionViewInput {
extension SelectionTableViewController {
override func viewDidLoad() {
super.viewDidLoad()
localize()
styleViews()
output.viewDidLoad()
updateUI()
}
Expand All @@ -72,6 +73,9 @@ extension SelectionTableViewController {
return .init()
}

cell.nameLabel.textColor = RuuviColor.textColor.color
cell.tintColor = RuuviColor.tintColor.color

if viewModel?.unitSettingsType == .accuracy,
let item = item as? MeasurementAccuracyType {
let titleProvider = MeasurementAccuracyTitles()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ extension UnitSettingsTableViewController: UnitSettingsViewInput {
func localize() {
tableView.reloadData()
}

private func styleViews() {
view.backgroundColor = RuuviColor.primary.color
}
}

// MARK: - View lifecycle
Expand All @@ -68,6 +72,7 @@ extension UnitSettingsTableViewController {
override func viewDidLoad() {
super.viewDidLoad()
localize()
styleViews()
output.viewDidLoad()
updateUI()
}
Expand Down Expand Up @@ -136,7 +141,8 @@ extension UnitSettingsTableViewController {
cell.valueLbl.text = RuuviLocalization.na
}
}

cell.titleLbl.textColor = RuuviColor.menuTextColor.color
cell.valueLbl.textColor = RuuviColor.menuTextColor.color
return cell
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@ class ShareViewController: UITableViewController {
configureTableView()
setupCustomBackButton()
localize()
styleViews()
output.viewDidLoad()
}

private func styleViews() {
view.backgroundColor = RuuviColor.primary.color
}

// MARK: - TableView

override func numberOfSections(in _: UITableView) -> Int {
Expand Down Expand Up @@ -208,10 +213,13 @@ extension ShareViewController {
} else {
cell.sharingDisabledLabel.text = RuuviLocalization.networkSharingDisabled
}
cell.sharingDisabledLabel.textColor = RuuviColor.textColor.color
cell.sharingDisabledLabel.tintColor = RuuviColor.tintColor.color

let description = RuuviLocalization.ShareViewController.description
cell.descriptionLabel.text = description.trimmingCharacters(in: .whitespacesAndNewlines)
cell.descriptionLabel.textColor = RuuviColor.textColor.color
cell.descriptionLabel.tintColor = RuuviColor.tintColor.color
return cell
}

Expand All @@ -220,20 +228,24 @@ extension ShareViewController {
cell.separatorInset = UIEdgeInsets(top: 0, left: tableView.bounds.width, bottom: 0, right: 0)
cell.emailTextField.placeholder = RuuviLocalization.ShareViewController.EmailTextField.placeholder
cell.emailTextField.delegate = self
cell.emailTextField.textColor = RuuviColor.textColor.color
return cell
}

private func getButtonCell(_ tableView: UITableView, indexPath: IndexPath) -> ShareSendButtonTableViewCell {
let cell = tableView.dequeueReusableCell(with: ShareSendButtonTableViewCell.self, for: indexPath)
cell.sendButton.addTarget(self, action: #selector(didTapSendButton(_:)), for: .touchUpInside)
cell.sendButton.setTitle(RuuviLocalization.TagSettings.Share.title, for: .normal)
cell.sendButton.tintColor = RuuviColor.tintColor.color
cell.separatorInset = UIEdgeInsets(top: 0, left: tableView.bounds.width, bottom: 0, right: 0)
return cell
}

private func getSharedEmailCell(_ tableView: UITableView, indexPath: IndexPath) -> ShareEmailTableViewCell {
let cell = tableView.dequeueReusableCell(with: ShareEmailTableViewCell.self, for: indexPath)
cell.emailLabel.text = viewModel.sharedEmails.value?[indexPath.row]
cell.emailLabel.textColor = RuuviColor.textColor.color
cell.unshareButton.tintColor = RuuviColor.textColor.color
cell.delegate = self
cell.separatorInset = UIEdgeInsets(top: 0, left: tableView.bounds.width, bottom: 0, right: 0)
return cell
Expand Down
Loading

0 comments on commit dfb8682

Please sign in to comment.