Skip to content

Commit 0bb2f60

Browse files
Update NSExtensionPointVersion
1 parent 21a6b76 commit 0bb2f60

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

Apple Juice Widget/Info.plist

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
<key>NSExtensionAttributes</key>
2828
<dict>
2929
<key>NSExtensionPointVersion</key>
30-
<string>2.0</string>
30+
<string>3.0</string>
3131
</dict>
32+
<key>NSExtensionMainNibFile</key>
33+
<string>TodayViewController</string>
3234
<key>NSExtensionPointIdentifier</key>
3335
<string>com.apple.widget-extension</string>
3436
<key>NSExtensionPrincipalClass</key>

Apple Juice.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@
516516
"@executable_path/../Frameworks",
517517
"@executable_path/../../../../Frameworks",
518518
);
519-
MACOSX_DEPLOYMENT_TARGET = 10.12;
519+
MACOSX_DEPLOYMENT_TARGET = 10.10;
520520
PRODUCT_BUNDLE_IDENTIFIER = "io.raphaelhanneken.applejuice.Apple-Juice-Widget";
521521
PRODUCT_NAME = "$(TARGET_NAME)";
522522
SKIP_INSTALL = YES;
@@ -538,7 +538,7 @@
538538
"@executable_path/../Frameworks",
539539
"@executable_path/../../../../Frameworks",
540540
);
541-
MACOSX_DEPLOYMENT_TARGET = 10.12;
541+
MACOSX_DEPLOYMENT_TARGET = 10.10;
542542
PRODUCT_BUNDLE_IDENTIFIER = "io.raphaelhanneken.applejuice.Apple-Juice-Widget";
543543
PRODUCT_NAME = "$(TARGET_NAME)";
544544
SKIP_INSTALL = YES;

Apple Juice/ApplicationController.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ final class ApplicationController: NSObject {
2626
do {
2727
self.battery = try BatteryService()
2828
self.statusItem = StatusBarItem(forBattery: self.battery,
29-
withTarget: self,
30-
andAction: #selector(ApplicationController.displayAppMenu(_:)))
29+
withTarget: self,
30+
andAction: #selector(ApplicationController.displayAppMenu(_:)))
3131

3232
self.statusItem?.update(batteryInfo: self.battery)
3333
self.registerAsObserver()
3434
} catch {
3535
self.statusItem = StatusBarItem(forError: error as? BatteryError,
36-
withTarget: self,
37-
andAction: #selector(ApplicationController.displayAppMenu(_:)))
36+
withTarget: self,
37+
andAction: #selector(ApplicationController.displayAppMenu(_:)))
3838
}
3939
}
4040

Apple Juice/BatteryService.swift

+12-12
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,28 @@ final class BatteryService {
4040
}
4141
if charging {
4242
return .charging(percentage: percentage)
43-
} else {
44-
return .discharging(percentage: percentage)
4543
}
44+
45+
return .discharging(percentage: percentage)
4646
}
4747

4848
/// The remaining time until the battery is empty or fully charged
4949
/// in a human readable format, e.g. hh:mm.
5050
var timeRemainingFormatted: String {
5151
// Unwrap required information.
5252
guard let charged = isCharged, let plugged = isPlugged else {
53-
return NSLocalizedString("Unknown", comment: "Translate Unknown")
53+
return NSLocalizedString("Unknown", comment: "")
5454
}
5555
// Check if the battery is charged and plugged into an unlimited power supply.
5656
if charged && plugged {
57-
return NSLocalizedString("Charged", comment: "Translate Charged")
57+
return NSLocalizedString("Charged", comment: "")
5858
}
5959
// The battery is (dis)charging, display the remaining time.
6060
if let time = timeRemaining {
6161
return String(format: "%d:%02d", arguments: [time / 60, time % 60])
62-
} else {
63-
return NSLocalizedString("Calculating", comment: "Translate Calculating")
6462
}
63+
64+
return NSLocalizedString("Calculating", comment: "")
6565
}
6666

6767
/// The remaining time in _minutes_ until the battery is empty or fully charged.
@@ -80,7 +80,7 @@ final class BatteryService {
8080
}
8181
return nil
8282
default:
83-
// Return the estimated time divided by 60 (seconds to minutes).
83+
// The estimated time in minutes
8484
return Int(time / 60)
8585
}
8686
}
@@ -103,14 +103,14 @@ final class BatteryService {
103103
/// The source from which the Mac currently draws its power.
104104
var powerSource: String {
105105
guard let plugged = isPlugged else {
106-
return NSLocalizedString("Unknown", comment: "Translate Unknown")
106+
return NSLocalizedString("Unknown", comment: "")
107107
}
108108
// Check whether the MacBook currently is plugged into a power adapter.
109109
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: "")
113111
}
112+
113+
return NSLocalizedString("Battery", comment: "")
114114
}
115115

116116
/// Checks whether the battery is charging and connected to a power outlet.
@@ -135,7 +135,7 @@ final class BatteryService {
135135
let amperage = getRegistryProperty(forKey: .amperage) as? Double else {
136136
return nil
137137
}
138-
return round(((voltage * amperage) / 1_000_000) * 10) / 10
138+
return round((voltage * amperage) / 1_000_000)
139139
}
140140

141141
/// Current flowing into or out of the battery.

Apple Juice/Info.plist

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.7.0</string>
20+
<string>1.7.1</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>333</string>
24+
<string>334</string>
2525
<key>LSApplicationCategoryType</key>
2626
<string>public.app-category.utilities</string>
2727
<key>LSMinimumSystemVersion</key>

0 commit comments

Comments
 (0)