Skip to content

Commit

Permalink
Fixed warnings and added todos
Browse files Browse the repository at this point in the history
  • Loading branch information
dinsen committed Jul 3, 2024
1 parent 0b9e438 commit e9909f5
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ extension LoanCalculatorDemoViewModel {

var accentColor: UIColor? {
switch self {
// TODO: Should we keep the extention for this use case?
case .dnb: return UIColor.dynamicColor(
defaultColor: UIColor(hex: "#377A82"),
darkModeColor: UIColor(hex: "#3AA8B4")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private extension Array where Element == SelectionItemModel {
attribute.value == "color:tjt-price-highlight" else {
return
}

// TODO: What token/color?
currentStyle.foregroundColor = .dynamicColor(defaultColor: .red, darkModeColor: .yellow)
}
}
Expand Down
1 change: 1 addition & 0 deletions Demo/Sources/DNA/Color/ColorDemoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class ColorDemoView: UIView, Demoable {

lazy var items: [ColorItem] = {
return [
// TODO: Should we change this to Warp tokens?
ColorItem(color: .accentPea, title: "accentPea"),
ColorItem(color: .accentPrimaryBlue, title: "accentPrimaryBlue"),
ColorItem(color: .accentSecondaryBlue, title: "accentSecondaryBlue"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"location" : "https://github.com/warp-ds/warp-ios.git",
"state" : {
"branch" : "nmp-app",
"revision" : "6faf0aaa9c5f7afa566753ebcf4ab55819358c37"
"revision" : "10d1d851fd303bceaa68dd830094bde374e3ad32"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,3 @@ private class CloseButton: UIButton {
bounds.insetBy(dx: -touchPointInset, dy: -touchPointInset).contains(point)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ final class EarthHourHeaderView: UIView {

private let earthRotationDegrees = 15
// ignore
private lazy var fillColor = UIColor(r: 27, g: 64, b: 134)
private lazy var fillColor = UIColor(r: 27, g: 64, b: 134) // TODO: What color?

private(set) lazy var closeButton: UIButton = {
let button = UIButton(withAutoLayout: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class RefreshControl: UIRefreshControl {
/// Set progress based on the current scroll position and begin refreshing if needed.
private func handleLoadingProgress() {
let pullDistance = superview.flatMap({ $0.bounds.height / 5 }) ?? defaultPullDistance
let progress = min(max(topOffset, 0.0), pullDistance) / pullDistance
_ = min(max(topOffset, 0.0), pullDistance) / pullDistance

if topOffset >= pullDistance {
beginRefreshing()
Expand Down
2 changes: 1 addition & 1 deletion FinniversKit/Sources/DNA/Color/Color+SwiftUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ extension Color {
@available(*, deprecated, message: "Use Warp backgroundPrimary instead")
public static var nmpBrandControlSelected: Color { Color(UIColor.nmpBrandControlSelected) }
@available(*, deprecated, message: "Use Warp backgroundPrimary instead")
public static var nmpBrandDecoration: Color { Color(UIColor.nmpBrandDecoration) }
public static var nmpBrandDecoration: Color { Color(UIColorWarp.UIToken.backgroundPrimary) }
}
// swiftlint:enable opening_brace
4 changes: 2 additions & 2 deletions FinniversKit/Sources/DNA/Color/UIColor+FinniversKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ extension CGColor {
@available(*, deprecated, message: "Use Warp backgroundPrimary instead")
public class var nmpBrandControlSelected: UIColor { Config.colorProvider.nmpBrandControlSelected }
@available(*, deprecated, message: "Use Warp backgroundPrimary instead")
public class var nmpBrandDecoration: UIColor { Config.colorProvider.nmpBrandDecoration }
public class var nmpBrandDecoration: UIColor { Config.colorProviderWarp.UIToken.backgroundPrimary }

// Deprecated
@available(*, deprecated, message: "Replace with textAction, nmpBrandControlSelected or nmpBrandDecoration")
Expand Down Expand Up @@ -354,7 +354,7 @@ extension CGColor {
@available(*, deprecated, message: "Use Warp backgroundPrimary instead")
public class var nmpBrandControlSelected: CGColor { Config.colorProvider.nmpBrandControlSelected.cgColor }
@available(*, deprecated, message: "Use Warp backgroundPrimary instead")
public class var nmpBrandDecoration: CGColor { Config.colorProvider.nmpBrandDecoration.cgColor }
public class var nmpBrandDecoration: CGColor { Config.colorProviderWarp.UIToken.backgroundPrimary.cgColor }
}

// MARK: - FINN UIColors (deprecated)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Copyright © 2020 FINN.no AS. All rights reserved.
//

import Warp

public class ConfettiView: UIView {

// MARK: - Private properties
Expand All @@ -12,8 +14,8 @@ public class ConfettiView: UIView {
]
// ignore
private let confettiColors: [UIColor] = [
.nmpBrandDecoration,
.nmpBrandColorSecondary,
Warp.UIToken.backgroundPrimary,
.nmpBrandColorSecondary, // TODO: What color?
.green400,
.red400
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public final class DrumMachineView: UIView {
slider.translatesAutoresizingMaskIntoConstraints = false
slider.minimumValue = 80
slider.maximumValue = 160
slider.tintColor = .accentPea
slider.tintColor = .accentPea // TODO: What color?
return slider
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ enum Instrument: String {
var color: UIColor {
switch self {
case .kick:
return .accentPea
return .accentPea // TODO: What color?
case .snare:
return .yellow
return .yellow // TODO: What color?
case .hats:
return .red400
return .red400 // TODO: What color?
case .cat:
return .accentSecondaryBlue
return .accentSecondaryBlue // TODO: What color?
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SwiftUIHostingCollectionViewCell<Content: View>: UICollectionViewCe
parent?.addChild(controller)

contentView.addSubview(controller.view)

NSLayoutConstraint.activate([
controller.view.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
controller.view.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ public class SwiftUIHostingTableViewCell<Content: View>: UITableViewCell {
controller.view.translatesAutoresizingMaskIntoConstraints = false
controller.view.backgroundColor = .clear
self.controller = controller

parent?.addChild(controller)

contentView.addSubview(controller.view)

NSLayoutConstraint.activate([
controller.view.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
controller.view.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
controller.view.topAnchor.constraint(equalTo: contentView.topAnchor),
controller.view.bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
])

if let parent {
controller.didMove(toParent: parent)
}

controller.view.layoutIfNeeded()
}
}
Expand Down

0 comments on commit e9909f5

Please sign in to comment.