Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuuviColor generated enum #1778

Merged
merged 6 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .swiftgen.assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
xcassets:
- inputs: ./Common/RuuviLocalization/Sources/Resources/RuuviColors.xcassets
outputs:
- templatePath: ./Common/RuuviLocalization/Templates/xcassets-swift5.stencil
output: ./Common/RuuviLocalization/Sources/RuuviColor.swift
params:
forceProvidesNamespaces: true
publicAccess: true
enumName: RuuviColor

strings:
- inputs: ./Common/RuuviLocalization/Sources/Resources/en.lproj/Localizable.strings
outputs:
- templatePath: ./Common/RuuviLocalization/Templates/strings-swift5.stencil
output: ./Common/RuuviLocalization/Sources/RuuviLocalization.swift
params:
forceProvidesNamespaces: true
publicAccess: true
enumName: RuuviLocalization
25 changes: 25 additions & 0 deletions .swiftgen.localizable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
json:
- inputs: ./station.localization/station.localization.json
outputs:
- templatePath: ./Common/RuuviLocalization/Templates/Localizable_en.strings.stencil
output: ./Common/RuuviLocalization/Sources/Resources/en.lproj/Localizable.strings
- inputs: ./station.localization/station.localization.json
outputs:
- templatePath: ./Common/RuuviLocalization/Templates/Localizable_sv.strings.stencil
output: ./Common/RuuviLocalization/Sources/Resources/sv.lproj/Localizable.strings
- inputs: ./station.localization/station.localization.json
outputs:
- templatePath: ./Common/RuuviLocalization/Templates/Localizable_ru.strings.stencil
output: ./Common/RuuviLocalization/Sources/Resources/ru.lproj/Localizable.strings
- inputs: ./station.localization/station.localization.json
outputs:
- templatePath: ./Common/RuuviLocalization/Templates/Localizable_fi.strings.stencil
output: ./Common/RuuviLocalization/Sources/Resources/fi.lproj/Localizable.strings
- inputs: ./station.localization/station.localization.json
outputs:
- templatePath: ./Common/RuuviLocalization/Templates/Localizable_fr.strings.stencil
output: ./Common/RuuviLocalization/Sources/Resources/fr.lproj/Localizable.strings
- inputs: ./station.localization/station.localization.json
outputs:
- templatePath: ./Common/RuuviLocalization/Templates/Localizable_de.strings.stencil
output: ./Common/RuuviLocalization/Sources/Resources/de.lproj/Localizable.strings

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import RuuviLocalization
import UIKit

final class FeatureTogglesViewController: UITableViewController {
Expand All @@ -22,7 +23,7 @@ final class FeatureTogglesViewController: UITableViewController {
private static let featureCellReuseIdentifier = "FeatureCellReuseIdentifier"

private func setupViews() {
view.backgroundColor = RuuviColor.ruuviPrimary
view.backgroundColor = RuuviColor.primary.color
headerView.addSubview(sourceSwitch)
headerView.addSubview(sourceLabel)
tableView.tableHeaderView = headerView
Expand All @@ -44,7 +45,7 @@ final class FeatureTogglesViewController: UITableViewController {

let sourceSwitch = sourceSwitch
sourceSwitch.onTintColor = .clear
sourceSwitch.thumbTintColor = RuuviColor.ruuviTintColor
sourceSwitch.thumbTintColor = RuuviColor.tintColor.color

let sourceLabel = sourceLabel
headerView.translatesAutoresizingMaskIntoConstraints = false
Expand Down Expand Up @@ -106,10 +107,10 @@ extension FeatureTogglesViewController {
let feature = features[indexPath.row]
cell.textLabel?.text = Self.title(for: feature)
cell.textLabel?.font = UIFont.Muli(.bold, size: 16)
cell.textLabel?.textColor = RuuviColor.ruuviMenuTextColor
cell.textLabel?.textColor = RuuviColor.menuTextColor.color
if featureToggleService.isEnabled(feature) {
cell.accessoryType = .checkmark
cell.tintColor = RuuviColor.ruuviTintColor
cell.tintColor = RuuviColor.tintColor.color
} else {
cell.accessoryType = .none
}
Expand All @@ -136,7 +137,7 @@ extension FeatureTogglesViewController {
label.text = "Use local feature toggles"
label.textAlignment = .right
label.font = UIFont.Muli(.bold, size: 16)
label.textColor = RuuviColor.ruuviMenuTextColor
label.textColor = RuuviColor.menuTextColor.color
return label
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ extension AboutPresenter {
)
attrString.addAttribute(
.foregroundColor,
value: RuuviColor.ruuviTintColor ?? UIColor.blue,
value: RuuviColor.tintColor.color,
range: changelogRange
)

Expand All @@ -80,7 +80,7 @@ extension AboutPresenter {
.range(of: versionText)
attrString.addAttribute(
.foregroundColor,
value: RuuviColor.dashboardIndicatorTextColor ?? UIColor.label,
value: RuuviColor.dashboardIndicator.color,
range: regularRange
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ extension AboutViewController {
// make text color white
attrString.addAttribute(
.foregroundColor,
value: RuuviColor.ruuviTextColor ?? UIColor.label,
value: RuuviColor.textColor.color,
range: NSRange(location: 0, length: attrString.length)
)

aboutTextView.attributedText = attrString
aboutTextView.textColor = RuuviColor.ruuviTextColor
aboutTextView.textColor = RuuviColor.textColor.color
}

private func setUpChangelogTapGesture() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import RuuviLocalization
import UIKit

protocol BackgroundSelectionButtonViewDelegate: NSObjectProtocol {
Expand All @@ -10,7 +11,7 @@ class BackgroundSelectionButtonView: UIView {
// UI
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = RuuviColor.ruuviTextColor
label.textColor = RuuviColor.textColor.color
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.Muli(.bold, size: 16)
Expand All @@ -21,11 +22,11 @@ class BackgroundSelectionButtonView: UIView {
let iv = UIImageView()
iv.contentMode = .scaleAspectFit
iv.backgroundColor = .clear
iv.tintColor = RuuviColor.ruuviTintColor
iv.tintColor = RuuviColor.tintColor.color
return iv
}()

lazy var seprator = UIView(color: RuuviColor.ruuviLineColor)
lazy var seprator = UIView(color: RuuviColor.lineColor.color)

override init(frame: CGRect) {
super.init(frame: frame)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import RuuviLocalization
import UIKit

// swiftlint:disable:next type_name
Expand All @@ -21,7 +22,7 @@ class BackgroundSelectionUploadProgressView: UIView {
let iv = UIImageView()
iv.contentMode = .scaleAspectFit
iv.backgroundColor = .clear
iv.tintColor = RuuviColor.ruuviTintColor
iv.tintColor = RuuviColor.tintColor.color
iv.isUserInteractionEnabled = true
iv.image = UIImage(systemName: "xmark.circle.fill")
let tap = UITapGestureRecognizer(target: self, action: #selector(handleCancelTap))
Expand All @@ -42,7 +43,7 @@ class BackgroundSelectionUploadProgressView: UIView {

private extension BackgroundSelectionUploadProgressView {
func setUpUI() {
backgroundColor = RuuviColor.ruuviGraphBGColor
backgroundColor = RuuviColor.graphBGColor.color
layer.cornerRadius = 4
clipsToBounds = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private extension BackgroundSelectionViewController {
}

func setUpBaseView() {
view.backgroundColor = RuuviColor.dashboardBGColor
view.backgroundColor = RuuviColor.dashboardBG.color
}

func setUpHeaderView() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ class BackgroundSelectionViewHeader: UICollectionReusableView {

private lazy var descriptionLabel: UILabel = {
let label = UILabel()
label.textColor = RuuviColor.ruuviTextColor
label.textColor = RuuviColor.textColor.color
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.Muli(.regular, size: 16)
label.text = RuuviLocalization.changeBackgroundMessage
return label
}()

lazy var seprator = UIView(color: RuuviColor.ruuviLineColor)
lazy var seprator = UIView(color: RuuviColor.lineColor.color)
lazy var takePhotoButton = BackgroundSelectionButtonView(
title: RuuviLocalization.takePhoto,
icon: "camera.fill",
Expand All @@ -37,7 +37,7 @@ class BackgroundSelectionViewHeader: UICollectionReusableView {

private lazy var selectFromDefaultLabel: UILabel = {
let label = UILabel()
label.textColor = RuuviColor.ruuviTextColor
label.textColor = RuuviColor.textColor.color
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.Muli(.bold, size: 16)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// swiftlint:disable file_length
import Humidity
import RuuviLocal
import RuuviLocalization
import RuuviOntology
import RuuviService
// swiftlint:disable file_length
import UIKit

class CardsViewController: UIViewController {
Expand Down Expand Up @@ -56,7 +56,7 @@ class CardsViewController: UIViewController {

// Base
private lazy var cardBackgroundView = CardsBackgroundView()
private lazy var chartViewBackground = UIView(color: RuuviColor.ruuviGraphBGColor)
private lazy var chartViewBackground = UIView(color: RuuviColor.graphBGColor.color)

// Header View
// Ruuvi Logo
Expand Down Expand Up @@ -261,7 +261,7 @@ private extension CardsViewController {
}

func setUpBaseView() {
view.backgroundColor = RuuviColor.ruuviPrimary
view.backgroundColor = RuuviColor.primary.color

view.addSubview(cardBackgroundView)
cardBackgroundView.fillSuperview()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import Charts
import Foundation
import RuuviLocalization

enum TagChartsHelper {
static func newDataSet(entries: [ChartDataEntry] = []) -> LineChartDataSet {
let lineChartDataSet = LineChartDataSet(entries: entries)
lineChartDataSet.axisDependency = .left
lineChartDataSet.setColor(RuuviColor.ruuviGraphLineColor ?? RuuviColor.fallbackGraphLineColor)
lineChartDataSet.setColor(RuuviColor.graphLineColor.color)
lineChartDataSet.lineWidth = 1.5
lineChartDataSet.drawCirclesEnabled = false
lineChartDataSet.circleRadius = 0.8
lineChartDataSet.drawValuesEnabled = false
lineChartDataSet.fillAlpha = 1
lineChartDataSet.fillColor = RuuviColor.ruuviGraphFillColor ?? RuuviColor.fallbackGraphFillColor
lineChartDataSet.highlightColor = RuuviColor.ruuviGraphFillColor ?? RuuviColor.fallbackGraphFillColor
lineChartDataSet.fillColor = RuuviColor.graphFillColor.color
lineChartDataSet.highlightColor = RuuviColor.graphFillColor.color
lineChartDataSet.highlightLineDashLengths = [2, 1, 0]
lineChartDataSet.highlightLineWidth = 1
lineChartDataSet.drawCircleHoleEnabled = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Charts
import RuuviLocalization
import RuuviService
import UIKit

Expand All @@ -21,7 +22,7 @@ class TagChartsMarkerView: MarkerImage {
private let yBottomPadding: CGFloat = 32.0

init(
color: UIColor? = RuuviColor.ruuviGraphMarkerColor,
color: UIColor? = RuuviColor.graphMarkerColor.color,
font: UIFont = UIFont.Muli(.regular, size: 8),
textColor: UIColor = .white
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class TagChartsViewController: UIViewController {
titleColor: .white,
title: RuuviLocalization.day1,
icon: RuuviAssets.dropDownArrowImage,
iconTintColor: RuuviColor.logoTintColor,
iconTintColor: RuuviColor.logoTintColor.color,
iconSize: .init(width: 14, height: 14),
preccedingIcon: false
)
Expand Down
Loading