diff --git a/Kit/Widgets/Battery.swift b/Kit/Widgets/Battery.swift index 8374c9d3..09cf6347 100644 --- a/Kit/Widgets/Battery.swift +++ b/Kit/Widgets/Battery.swift @@ -537,21 +537,29 @@ public class BatteryDetailsWidget: WidgetWrapper { if let percentage = self.percentage { value = "\(Int((percentage.rounded(toPlaces: 2)) * 100))%" } - width = self.drawTwoRows( - first: value, - second: Double(self.time*60).printSecondsToHoursMinutesSeconds(short: isShortTimeFormat), - x: x - ).rounded(.up) + if self.time > 0 { + width = self.drawTwoRows( + first: value, + second: Double(self.time*60).printSecondsToHoursMinutesSeconds(short: isShortTimeFormat), + x: x + ).rounded(.up) + } else { + width = self.drawOneRow(value: value, x: x).rounded(.up) + } case "timeAndPercentage": var value = "n/a" if let percentage = self.percentage { value = "\(Int((percentage.rounded(toPlaces: 2)) * 100))%" } - width = self.drawTwoRows( - first: Double(self.time*60).printSecondsToHoursMinutesSeconds(short: isShortTimeFormat), - second: value, - x: x - ).rounded(.up) + if self.time > 0 { + width = self.drawTwoRows( + first: Double(self.time*60).printSecondsToHoursMinutesSeconds(short: isShortTimeFormat), + second: value, + x: x + ).rounded(.up) + } else { + width = self.drawOneRow(value: value, x: x).rounded(.up) + } default: break }