@@ -40,28 +40,28 @@ final class BatteryService {
40
40
}
41
41
if charging {
42
42
return . charging( percentage: percentage)
43
- } else {
44
- return . discharging( percentage: percentage)
45
43
}
44
+
45
+ return . discharging( percentage: percentage)
46
46
}
47
47
48
48
/// The remaining time until the battery is empty or fully charged
49
49
/// in a human readable format, e.g. hh:mm.
50
50
var timeRemainingFormatted : String {
51
51
// Unwrap required information.
52
52
guard let charged = isCharged, let plugged = isPlugged else {
53
- return NSLocalizedString ( " Unknown " , comment: " Translate Unknown " )
53
+ return NSLocalizedString ( " Unknown " , comment: " " )
54
54
}
55
55
// Check if the battery is charged and plugged into an unlimited power supply.
56
56
if charged && plugged {
57
- return NSLocalizedString ( " Charged " , comment: " Translate Charged " )
57
+ return NSLocalizedString ( " Charged " , comment: " " )
58
58
}
59
59
// The battery is (dis)charging, display the remaining time.
60
60
if let time = timeRemaining {
61
61
return String ( format: " %d:%02d " , arguments: [ time / 60 , time % 60 ] )
62
- } else {
63
- return NSLocalizedString ( " Calculating " , comment: " Translate Calculating " )
64
62
}
63
+
64
+ return NSLocalizedString ( " Calculating " , comment: " " )
65
65
}
66
66
67
67
/// The remaining time in _minutes_ until the battery is empty or fully charged.
@@ -80,7 +80,7 @@ final class BatteryService {
80
80
}
81
81
return nil
82
82
default :
83
- // Return the estimated time divided by 60 (seconds to minutes).
83
+ // The estimated time in minutes
84
84
return Int ( time / 60 )
85
85
}
86
86
}
@@ -103,14 +103,14 @@ final class BatteryService {
103
103
/// The source from which the Mac currently draws its power.
104
104
var powerSource : String {
105
105
guard let plugged = isPlugged else {
106
- return NSLocalizedString ( " Unknown " , comment: " Translate Unknown " )
106
+ return NSLocalizedString ( " Unknown " , comment: " " )
107
107
}
108
108
// Check whether the MacBook currently is plugged into a power adapter.
109
109
if plugged {
110
- return NSLocalizedString ( " Power Adapter " , comment: " Translate Power Adapter " )
111
- } else {
112
- return NSLocalizedString ( " Battery " , comment: " Translate Battery " )
110
+ return NSLocalizedString ( " Power Adapter " , comment: " " )
113
111
}
112
+
113
+ return NSLocalizedString ( " Battery " , comment: " " )
114
114
}
115
115
116
116
/// Checks whether the battery is charging and connected to a power outlet.
@@ -135,7 +135,7 @@ final class BatteryService {
135
135
let amperage = getRegistryProperty ( forKey: . amperage) as? Double else {
136
136
return nil
137
137
}
138
- return round ( ( ( voltage * amperage) / 1_000_000 ) * 10 ) / 10
138
+ return round ( ( voltage * amperage) / 1_000_000 )
139
139
}
140
140
141
141
/// Current flowing into or out of the battery.
0 commit comments