From f4e4da6dc541c7c1a7d6315afd8cb67173b1e0e6 Mon Sep 17 00:00:00 2001 From: Alinson Xavier Date: Sun, 31 Mar 2019 06:39:24 -0500 Subject: [PATCH] iOS: use actual data for checkmarks on main screen --- .../Frontend/MainScreenController.swift | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/ios/Application/Frontend/MainScreenController.swift b/ios/Application/Frontend/MainScreenController.swift index b5d1a36d7..0689faf14 100644 --- a/ios/Application/Frontend/MainScreenController.swift +++ b/ios/Application/Frontend/MainScreenController.swift @@ -61,8 +61,13 @@ class MainScreenCell : UITableViewCell { fatalError() } - func setColor(_ color: Color) { + func update(name: String, + color: Color, + values: [KotlinInt]) { + + label.text = name label.textColor = color.uicolor + ring.component = Ring(color: color, percentage: Double.random(in: 0...1), thickness: 2.5, @@ -70,20 +75,12 @@ class MainScreenCell : UITableViewCell { theme: theme, label: false) ring.setNeedsDisplay() - let isNumerical = Int.random(in: 1...4) == 1 - for btn in buttons { - if isNumerical { - btn.component = NumberButton(color: color, - value: Double.random(in: 0...5000), - threshold: 2000, - units: "steps", - theme: theme) - } else { - btn.component = CheckmarkButton(value: Int32.random(in: 0...2), - color: color, - theme: theme) - } - btn.setNeedsDisplay() + + for i in 0.. UIView? { let component = HabitListHeader(today: LocalDate(year: 2019, month: 3, day: 24), - nButtons: 3, + nButtons: Int32(nButtons), theme: theme, fmt: IosLocalDateFormatter()) return ComponentView(frame: CGRect(x: 0, y: 0, width: 100, height: CGFloat(theme.checkmarkButtonSize)),