Skip to content

Commit 10853e7

Browse files
author
DevelopLab
committed
1. Add 'Limit Voltage'
1 parent 931af31 commit 10853e7

File tree

7 files changed

+44
-16
lines changed

7 files changed

+44
-16
lines changed

BatteryInfo.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@
355355
CLANG_ENABLE_MODULES = YES;
356356
CODE_SIGN_IDENTITY = "Apple Development";
357357
CODE_SIGN_STYLE = Automatic;
358-
CURRENT_PROJECT_VERSION = 10;
358+
CURRENT_PROJECT_VERSION = 11;
359359
DEVELOPMENT_TEAM = X2WABLB38D;
360360
FRAMEWORK_SEARCH_PATHS = (
361361
/System/Library/Frameworks,
@@ -378,7 +378,7 @@
378378
"$(inherited)",
379379
"$(PROJECT_DIR)/BatteryInfo",
380380
);
381-
MARKETING_VERSION = 1.1.4;
381+
MARKETING_VERSION = 1.1.5;
382382
OTHER_CFLAGS = "-Wno-error=unguarded-availability-new";
383383
OTHER_LDFLAGS = "";
384384
PRODUCT_BUNDLE_IDENTIFIER = com.developlab.BatteryInfo;
@@ -404,7 +404,7 @@
404404
CLANG_ENABLE_MODULES = YES;
405405
CODE_SIGN_IDENTITY = "Apple Development";
406406
CODE_SIGN_STYLE = Automatic;
407-
CURRENT_PROJECT_VERSION = 10;
407+
CURRENT_PROJECT_VERSION = 11;
408408
DEVELOPMENT_TEAM = X2WABLB38D;
409409
FRAMEWORK_SEARCH_PATHS = (
410410
/System/Library/Frameworks,
@@ -427,7 +427,7 @@
427427
"$(inherited)",
428428
"$(PROJECT_DIR)/BatteryInfo",
429429
);
430-
MARKETING_VERSION = 1.1.4;
430+
MARKETING_VERSION = 1.1.5;
431431
OTHER_CFLAGS = "-Wno-error=unguarded-availability-new";
432432
OTHER_LDFLAGS = "";
433433
PRODUCT_BUNDLE_IDENTIFIER = com.developlab.BatteryInfo;

BatteryInfo/Localizable.xcstrings

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,22 @@
10361036
}
10371037
}
10381038
},
1039+
"LimitVoltage" : {
1040+
"localizations" : {
1041+
"en" : {
1042+
"stringUnit" : {
1043+
"state" : "translated",
1044+
"value" : "Limit Voltage: %@V"
1045+
}
1046+
},
1047+
"zh-Hans" : {
1048+
"stringUnit" : {
1049+
"state" : "translated",
1050+
"value" : "限制电压: %@V"
1051+
}
1052+
}
1053+
}
1054+
},
10391055
"Manual" : {
10401056
"localizations" : {
10411057
"en" : {
@@ -1412,7 +1428,7 @@
14121428
"en" : {
14131429
"stringUnit" : {
14141430
"state" : "translated",
1415-
"value" : "Serial Number %@"
1431+
"value" : "Serial Number: %@"
14161432
}
14171433
},
14181434
"zh-Hans" : {

BatteryInfo/ViewController/AllBatteryDataViewController.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class AllBatteryDataViewController: UIViewController, UITableViewDataSource, UIT
8080
switch section {
8181
case 0: return 2
8282
case 1: return 2
83-
case 2: return 2
83+
case 2: return 3
8484
case 3:
8585
if isDeviceCharging() || chargerHaveName() {
8686
return 8
@@ -166,6 +166,12 @@ class AllBatteryDataViewController: UIViewController, UITableViewDataSource, UIT
166166
cell.textLabel?.text = String.localizedStringWithFormat(NSLocalizedString("BootVoltage", comment: ""), NSLocalizedString("Unknown", comment: ""))
167167
}
168168
} else if indexPath.row == 2 {
169+
if let limitVoltage = batteryInfo?.chargerData?.vacVoltageLimit {
170+
cell.textLabel?.text = String.localizedStringWithFormat(NSLocalizedString("LimitVoltage", comment: ""), String(format: "%.2f", Double(limitVoltage) / 1000))
171+
} else {
172+
cell.textLabel?.text = String.localizedStringWithFormat(NSLocalizedString("LimitVoltage", comment: ""), NSLocalizedString("Unknown", comment: ""))
173+
}
174+
} else if indexPath.row == 3 {
169175
if let bestAdapterIndex = batteryInfo?.bestAdapterIndex {
170176
cell.textLabel?.text = String.localizedStringWithFormat(NSLocalizedString("BestAdapterInfo", comment: ""), String(bestAdapterIndex + 1))
171177
} else {

BatteryInfo/ViewController/HomeViewController.swift

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,13 @@ class HomeViewController: UIViewController, UITableViewDataSource, UITableViewDe
150150
case 1: return 9 // 电池信息
151151
case 2: // 充电信息
152152
if settingsUtils.getForceShowChargeingData() {
153-
return 10
153+
return 11
154154
} else {
155155
if isDeviceCharging() || isChargeByWatts() {
156156
if isNotCharging() { // 判断是否停止充电
157-
return 10
157+
return 11
158158
} else {
159-
return 9
159+
return 10
160160
}
161161
} else {
162162
return 1
@@ -376,26 +376,32 @@ class HomeViewController: UIViewController, UITableViewDataSource, UITableViewDe
376376
} else {
377377
cell.textLabel?.text = String.localizedStringWithFormat(NSLocalizedString("PowerOptions", comment: ""), NSLocalizedString("Unknown", comment: ""))
378378
}
379-
} else if indexPath.row == 6 { // 充电实时电压
379+
} else if indexPath.row == 6 { // 限制电压
380+
if let limitVoltage = batteryInfo?.chargerData?.vacVoltageLimit {
381+
cell.textLabel?.text = String.localizedStringWithFormat(NSLocalizedString("LimitVoltage", comment: ""), String(format: "%.2f", Double(limitVoltage) / 1000))
382+
} else {
383+
cell.textLabel?.text = String.localizedStringWithFormat(NSLocalizedString("LimitVoltage", comment: ""), NSLocalizedString("Unknown", comment: ""))
384+
}
385+
} else if indexPath.row == 7 { // 充电实时电压
380386
if let voltage = batteryInfo?.chargerData?.chargingVoltage {
381387
cell.textLabel?.text = String.localizedStringWithFormat(NSLocalizedString("ChargingVoltage", comment: ""), String(format: "%.2f", Double(voltage) / 1000))
382388
} else {
383389
cell.textLabel?.text = String.localizedStringWithFormat(NSLocalizedString("ChargingVoltage", comment: ""), NSLocalizedString("Unknown", comment: ""))
384390
}
385-
} else if indexPath.row == 7 { // 充电实时电流
391+
} else if indexPath.row == 8 { // 充电实时电流
386392
if let current = batteryInfo?.chargerData?.chargingCurrent {
387393
cell.textLabel?.text = String.localizedStringWithFormat(NSLocalizedString("ChargingCurrent", comment: ""), String(format: "%.2f", Double(current) / 1000))
388394
} else {
389395
cell.textLabel?.text = String.localizedStringWithFormat(NSLocalizedString("ChargingCurrent", comment: ""), NSLocalizedString("Unknown", comment: ""))
390396
}
391-
} else if indexPath.row == 8 { // 计算的充电功率
397+
} else if indexPath.row == 9 { // 计算的充电功率
392398
if let current = batteryInfo?.chargerData?.chargingCurrent, let voltage = batteryInfo?.chargerData?.chargingVoltage {
393399
let power = (Double(voltage) / 1000) * (Double(current) / 1000)
394400
cell.textLabel?.text = String.localizedStringWithFormat(NSLocalizedString("CalculatedChargingPower", comment: ""), String(format: "%.2f", power))
395401
} else {
396402
cell.textLabel?.text = String.localizedStringWithFormat(NSLocalizedString("CalculatedChargingPower", comment: ""), NSLocalizedString("Unknown", comment: ""))
397403
}
398-
} else if indexPath.row == 9 {
404+
} else if indexPath.row == 10 {
399405
if let reason = batteryInfo?.chargerData?.notChargingReason {
400406
if reason == 0 { // 电池充电状态正常
401407
cell.textLabel?.text = NSLocalizedString("BatteryChargeNormal", comment: "")

BatteryInfo/ViewController/SettingsViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import UIKit
33

44
class SettingsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
55

6-
let versionCode = "1.1.4"
6+
let versionCode = "1.1.5"
77

88
private var tableView = UITableView()
99

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ include $(THEOS)/makefiles/common.mk
55

66
# 使用 Xcode 项目构建
77
XCODEPROJ_NAME = BatteryInfo
8-
BUILD_VERSION = "1.1.4"
8+
BUILD_VERSION = "1.1.5"
99

1010
# 指定 Theos 使用 xcodeproj 规则
1111
include $(THEOS_MAKE_PATH)/xcodeproj.mk

control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: com.developlab.batteryinfo
22
Name: Battery Info
3-
Version: 1.1.4
3+
Version: 1.1.5
44
Architecture: iphoneos-arm
55
Description: Battery information
66
Maintainer: developlab

0 commit comments

Comments
 (0)