Improve look

release
Laurent 3 years ago
parent 5f1fdfeea6
commit a500ecb6cb
  1. 8
      LaunchWidget/LaunchWidget.swift
  2. 3
      LaunchWidget/SingleCountdownView.swift
  3. 5
      LeCountdown/Model/Model+Extensions.swift

@ -95,6 +95,7 @@ struct LaunchWidgetEntryView : View {
case .systemSmall, .accessoryInline: case .systemSmall, .accessoryInline:
if let countdown = entry.countdowns.first { if let countdown = entry.countdowns.first {
CountdownSimpleWidgetView(countdown: countdown) CountdownSimpleWidgetView(countdown: countdown)
.background(Image(countdown.imageName))
} else { } else {
VoidView() VoidView()
} }
@ -118,16 +119,9 @@ struct LaunchWidgetEntryView : View {
default: default:
MultiCountdownView(countdowns: entry.countdowns) MultiCountdownView(countdowns: entry.countdowns)
// case .systemMedium: GameStatusWithLastTurnResult(gameStatus)
// case .systemLarge: GameStatusWithStatistics(gameStatus)
// case .systemExtraLarge: GameStatusWithStatisticsExtraLarge(gameStatus)
// case .accessoryCircular: HealthLevelCircular(selectedCharacter)
// case .accessoryRectangular: HealthLevelRectangular(selectedCharacter)
// case .accessoryInline: HealthLevelInline(selectedCharacter)
} }
} }
} }
struct LaunchWidget: Widget { struct LaunchWidget: Widget {

@ -19,7 +19,7 @@ struct SingleCountdownView: View {
VStack { VStack {
Text(countdown.name ?? "") Text(countdown.name ?? "")
Text(countdown.duration.minuteSecond) Text(countdown.duration.minuteSecond)
} }.foregroundColor(Color.white)
.font(self.font) .font(self.font)
.widgetURL(countdown.url) .widgetURL(countdown.url)
} }
@ -78,6 +78,7 @@ struct MultiCountdownView: View {
struct CountdownView_Previews: PreviewProvider { struct CountdownView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
SingleCountdownView(countdown: Countdown.fake(context: PersistenceController.preview.container.viewContext)).previewContext(WidgetPreviewContext(family: .systemSmall))
SingleCountdownView(countdown: Countdown.fake(context: PersistenceController.preview.container.viewContext)).previewContext(WidgetPreviewContext(family: .accessoryRectangular)) SingleCountdownView(countdown: Countdown.fake(context: PersistenceController.preview.container.viewContext)).previewContext(WidgetPreviewContext(family: .accessoryRectangular))
MultiCountdownView(countdowns: self.countdowns(context: PersistenceController.preview.container.viewContext)).previewContext(WidgetPreviewContext(family: .systemMedium)) MultiCountdownView(countdowns: self.countdowns(context: PersistenceController.preview.container.viewContext)).previewContext(WidgetPreviewContext(family: .systemMedium))
} }

@ -24,7 +24,10 @@ extension Countdown {
} }
var imageName: String { var imageName: String {
return self.image ?? "default" if let image {
return image
}
return CoolPic.allCases[0].rawValue
} }
static func fake(context: NSManagedObjectContext) -> Countdown { static func fake(context: NSManagedObjectContext) -> Countdown {

Loading…
Cancel
Save