mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Merge branch 'pr-152' into feature/lock-screen
THIS IS A MERGE COMMIT FOR TESTING THE INLINE BATTERY THINGY
This commit is contained in:
commit
3e0d0969e7
1 changed files with 20 additions and 2 deletions
|
|
@ -25,7 +25,7 @@ struct LockScreenWeatherWidget: View {
|
||||||
chargingSegment(for: charging)
|
chargingSegment(for: charging)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isInline, let battery = snapshot.battery {
|
if let battery = snapshot.battery {
|
||||||
batterySegment(for: battery)
|
batterySegment(for: battery)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -101,7 +101,7 @@ struct LockScreenWeatherWidget: View {
|
||||||
private func batterySegment(for info: LockScreenWeatherSnapshot.BatteryInfo) -> some View {
|
private func batterySegment(for info: LockScreenWeatherSnapshot.BatteryInfo) -> some View {
|
||||||
switch snapshot.widgetStyle {
|
switch snapshot.widgetStyle {
|
||||||
case .inline:
|
case .inline:
|
||||||
EmptyView()
|
inlineBatterySegment(for: info)
|
||||||
case .circular:
|
case .circular:
|
||||||
circularBatterySegment(for: info)
|
circularBatterySegment(for: info)
|
||||||
}
|
}
|
||||||
|
|
@ -206,6 +206,24 @@ struct LockScreenWeatherWidget: View {
|
||||||
.layoutPriority(1)
|
.layoutPriority(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func inlineBatterySegment(for info: LockScreenWeatherSnapshot.BatteryInfo) -> some View {
|
||||||
|
let level = clampedBatteryLevel(info.batteryLevel)
|
||||||
|
|
||||||
|
return HStack(alignment: .firstTextBaseline, spacing: 6) {
|
||||||
|
// Optional icon (laptop vs battery glyph)
|
||||||
|
Image(systemName: info.usesLaptopSymbol ? "laptopcomputer" : batteryIconName(for: level))
|
||||||
|
.font(.system(size: 20, weight: .semibold))
|
||||||
|
.symbolRenderingMode(.hierarchical)
|
||||||
|
|
||||||
|
// ✅ The actual percentage text you want in inline style
|
||||||
|
Text("\(level)%")
|
||||||
|
.font(inlinePrimaryFont)
|
||||||
|
.lineLimit(1)
|
||||||
|
.minimumScaleFactor(0.85)
|
||||||
|
}
|
||||||
|
.layoutPriority(1)
|
||||||
|
}
|
||||||
|
|
||||||
private func circularBluetoothSegment(for info: LockScreenWeatherSnapshot.BluetoothInfo) -> some View {
|
private func circularBluetoothSegment(for info: LockScreenWeatherSnapshot.BluetoothInfo) -> some View {
|
||||||
let clamped = clampedBatteryLevel(info.batteryLevel)
|
let clamped = clampedBatteryLevel(info.batteryLevel)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue