Skip to content

Commit e1279c4

Browse files
committed
Merge branch 'main' into feat/add_activity_type
2 parents 1bd95c7 + 1b37ba2 commit e1279c4

39 files changed

Lines changed: 289 additions & 159 deletions

File tree

packages/battery_plus/battery_plus/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 6.2.2
2+
3+
- **FIX**(battery_plus): Improve battery save mode check on Xiaomi devices ([#3555](https://github.com/fluttercommunity/plus_plugins/issues/3555)). ([32ba69ba](https://github.com/fluttercommunity/plus_plugins/commit/32ba69bafc6cc787eeb8e9df58eb572d22f4d42d))
4+
15
## 6.2.1
26

37
- **REFACTOR**(all): Use range of flutter_lints for broader compatibility ([#3371](https://github.com/fluttercommunity/plus_plugins/issues/3371)). ([8a303add](https://github.com/fluttercommunity/plus_plugins/commit/8a303add3dee1acb8bac5838246490ed8a0fe408))

packages/battery_plus/battery_plus/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ android {
3838
}
3939

4040
defaultConfig {
41-
minSdk 19
41+
minSdk 21
4242
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
4343
}
4444

packages/battery_plus/battery_plus/android/src/main/kotlin/dev/fluttercommunity/plus/battery/BatteryPlusPlugin.kt

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import android.os.Build
2020
import java.util.Locale
2121
import android.os.PowerManager
2222
import android.provider.Settings
23-
import androidx.annotation.RequiresApi
2423
import androidx.core.content.ContextCompat
2524
import androidx.core.content.ContextCompat.RECEIVER_NOT_EXPORTED
2625

@@ -51,7 +50,8 @@ class BatteryPlusPlugin : MethodCallHandler, EventChannel.StreamHandler, Flutter
5150
override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
5251
when (call.method) {
5352
"getBatteryLevel" -> {
54-
val currentBatteryLevel = getBatteryLevel()
53+
val currentBatteryLevel =
54+
getBatteryProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
5555
if (currentBatteryLevel != -1) {
5656
result.success(currentBatteryLevel)
5757
} else {
@@ -103,78 +103,75 @@ class BatteryPlusPlugin : MethodCallHandler, EventChannel.StreamHandler, Flutter
103103
val status: Int = if (VERSION.SDK_INT >= VERSION_CODES.O) {
104104
getBatteryProperty(BatteryManager.BATTERY_PROPERTY_STATUS)
105105
} else {
106-
val intent = ContextWrapper(applicationContext).registerReceiver(null, IntentFilter(Intent.ACTION_BATTERY_CHANGED))
106+
val intent = ContextWrapper(applicationContext).registerReceiver(
107+
null,
108+
IntentFilter(Intent.ACTION_BATTERY_CHANGED)
109+
)
107110
intent?.getIntExtra(BatteryManager.EXTRA_STATUS, -1) ?: -1
108111
}
109112
return convertBatteryStatus(status)
110113
}
111114

112-
private fun getBatteryLevel(): Int {
113-
return if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
114-
getBatteryProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
115-
} else {
116-
val intent = ContextWrapper(applicationContext).registerReceiver(null, IntentFilter(Intent.ACTION_BATTERY_CHANGED))
117-
val level = intent!!.getIntExtra(BatteryManager.EXTRA_LEVEL, -1)
118-
val scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1)
119-
(level * 100 / scale)
120-
}
121-
}
122-
123115
private fun isInPowerSaveMode(): Boolean? {
124116
val deviceManufacturer = Build.MANUFACTURER.lowercase(Locale.getDefault())
125117

126-
return if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
127-
when (deviceManufacturer) {
128-
"xiaomi" -> isXiaomiPowerSaveModeActive()
129-
"huawei" -> isHuaweiPowerSaveModeActive()
130-
"samsung" -> isSamsungPowerSaveModeActive()
131-
else -> checkPowerServiceSaveMode()
132-
}
133-
} else {
134-
null
118+
return when (deviceManufacturer) {
119+
"xiaomi" -> isXiaomiPowerSaveModeActive()
120+
"huawei" -> isHuaweiPowerSaveModeActive()
121+
"samsung" -> isSamsungPowerSaveModeActive()
122+
else -> checkPowerServiceSaveMode()
135123
}
136124
}
137125

138126
private fun isSamsungPowerSaveModeActive(): Boolean {
139-
val mode = Settings.System.getString(applicationContext!!.contentResolver, POWER_SAVE_MODE_SAMSUNG_NAME)
140-
return if (mode == null && VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
127+
val mode = Settings.System.getString(
128+
applicationContext!!.contentResolver,
129+
POWER_SAVE_MODE_SAMSUNG_NAME
130+
)
131+
return if (mode == null) {
141132
checkPowerServiceSaveMode()
142133
} else {
143134
mode == POWER_SAVE_MODE_SAMSUNG_VALUE
144135
}
145136
}
146137

147-
@RequiresApi(VERSION_CODES.LOLLIPOP)
148138
private fun isHuaweiPowerSaveModeActive(): Boolean {
149-
val mode = Settings.System.getInt(applicationContext!!.contentResolver, POWER_SAVE_MODE_HUAWEI_NAME, -1)
139+
val mode = Settings.System.getInt(
140+
applicationContext!!.contentResolver,
141+
POWER_SAVE_MODE_HUAWEI_NAME,
142+
-1
143+
)
150144
return if (mode != -1) {
151145
mode == POWER_SAVE_MODE_HUAWEI_VALUE
152146
} else {
153147
// On Devices like the P30 lite, we always get an -1 result code.
154-
// Stackoverflow issue: https://stackoverflow.com/a/70500770
148+
// StackOverflow issue: https://stackoverflow.com/a/70500770
155149
checkPowerServiceSaveMode()
156150
}
157151
}
158152

159-
private fun isXiaomiPowerSaveModeActive(): Boolean? {
160-
val mode = Settings.System.getInt(applicationContext!!.contentResolver, POWER_SAVE_MODE_XIAOMI_NAME, -1)
153+
private fun isXiaomiPowerSaveModeActive(): Boolean {
154+
val mode = Settings.System.getInt(
155+
applicationContext!!.contentResolver,
156+
POWER_SAVE_MODE_XIAOMI_NAME,
157+
-1
158+
)
161159
return if (mode != -1) {
162160
mode == POWER_SAVE_MODE_XIAOMI_VALUE
163161
} else {
164-
null
162+
checkPowerServiceSaveMode()
165163
}
166164
}
167165

168-
@RequiresApi(api = VERSION_CODES.LOLLIPOP)
169166
private fun checkPowerServiceSaveMode(): Boolean {
170167
val powerManager =
171168
applicationContext!!.getSystemService(Context.POWER_SERVICE) as PowerManager
172169
return powerManager.isPowerSaveMode
173170
}
174171

175-
@RequiresApi(api = VERSION_CODES.LOLLIPOP)
176172
private fun getBatteryProperty(property: Int): Int {
177-
val batteryManager = applicationContext!!.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
173+
val batteryManager =
174+
applicationContext!!.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
178175
return batteryManager.getIntProperty(property)
179176
}
180177

packages/battery_plus/battery_plus/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ environment:
88
dependencies:
99
flutter:
1010
sdk: flutter
11-
battery_plus: ^6.2.1
11+
battery_plus: ^6.2.2
1212

1313
dev_dependencies:
1414
flutter_driver:

packages/battery_plus/battery_plus/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: battery_plus
22
description: Flutter plugin for accessing information about the battery state(full, charging, discharging).
3-
version: 6.2.1
3+
version: 6.2.2
44
homepage: https://github.com/fluttercommunity/plus_plugins
55
repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/battery_plus/battery_plus
66
issue_tracker: https://github.com/fluttercommunity/plus_plugins/labels/battery_plus

packages/connectivity_plus/connectivity_plus/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 6.1.4
2+
3+
- **REFACTOR**(connectivity_plus): removed unused code for web ([#3517](https://github.com/fluttercommunity/plus_plugins/issues/3517)). ([55ac8c5f](https://github.com/fluttercommunity/plus_plugins/commit/55ac8c5fa6f1192cf96e63de1506c82e95b00cda))
4+
15
## 6.1.3
26

37
- **FIX**(connectivity_plus): Resolve missing privacy manifest issue for iOS and MacOS ([#3458](https://github.com/fluttercommunity/plus_plugins/issues/3458)). ([dab92074](https://github.com/fluttercommunity/plus_plugins/commit/dab92074cbf7dece71a64854b4357eb5b62e2f4f))

packages/connectivity_plus/connectivity_plus/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ environment:
77
dependencies:
88
flutter:
99
sdk: flutter
10-
connectivity_plus: ^6.1.3
10+
connectivity_plus: ^6.1.4
1111

1212
dev_dependencies:
1313
flutter_driver:

packages/connectivity_plus/connectivity_plus/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: connectivity_plus
22
description: Flutter plugin for discovering the state of the network (WiFi & mobile/cellular) connectivity on Android and iOS.
3-
version: 6.1.3
3+
version: 6.1.4
44
homepage: https://github.com/fluttercommunity/plus_plugins
55
repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/connectivity_plus/connectivity_plus
66
issue_tracker: https://github.com/fluttercommunity/plus_plugins/labels/connectivity_plus

packages/device_info_plus/device_info_plus/CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 11.5.0
2+
3+
- **FIX**(device_info_plus): Specify correct Dart and Flutter version requirements ([#3597](https://github.com/fluttercommunity/plus_plugins/issues/3597)). ([6ebc0ead](https://github.com/fluttercommunity/plus_plugins/commit/6ebc0ead68df477f06c6d4738a69a9e56223cf47))
4+
- **FEAT**(device_info_plus): Add identifier for iPhone 16e ([#3596](https://github.com/fluttercommunity/plus_plugins/issues/3596)). ([e1152bb8](https://github.com/fluttercommunity/plus_plugins/commit/e1152bb87d702ff86aaf29e9b7362d8dfd3247e0))
5+
- **FEAT**(device_info_plus): Add storage information ([#3536](https://github.com/fluttercommunity/plus_plugins/issues/3536)). ([fefe6ce7](https://github.com/fluttercommunity/plus_plugins/commit/fefe6ce7a04c01c39f0cf0ecd0855bce1d701883))
6+
7+
## 11.4.0
8+
9+
- **FEAT**(device_info_plus): add ram information ([#3535](https://github.com/fluttercommunity/plus_plugins/issues/3535)). ([160a0182](https://github.com/fluttercommunity/plus_plugins/commit/160a01824cb8a245aec52eb3f5a1fa804ef791eb))
10+
- **FEAT**(device_info_plus): allow to mock device info ([#3525](https://github.com/fluttercommunity/plus_plugins/issues/3525)). ([f78f32c4](https://github.com/fluttercommunity/plus_plugins/commit/f78f32c47fef8045f34944899f6082303182b615))
11+
112
## 11.3.3
213

314
- **FIX**(device_info_plus): handle nullability on getString(DEVICE_NAME) ([#3507](https://github.com/fluttercommunity/plus_plugins/issues/3507)). ([3201e056](https://github.com/fluttercommunity/plus_plugins/commit/3201e056b2a44ce74a3a9218fba59d71d9795379))
@@ -11,7 +22,7 @@
1122

1223
## 11.3.1
1324

14-
- Retracted release due to [#3496](https://sgithub.com/fluttercommunity/plus_plugins/issues/3496)
25+
- Retracted release due to [#3496](https://github.com/fluttercommunity/plus_plugins/issues/3496)
1526

1627
## 11.3.0
1728

packages/device_info_plus/device_info_plus/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Get current device information from within the Flutter application.
1616

1717
## Requirements
1818

19-
- Flutter >=3.22.0
20-
- Dart >=3.4.0 <4.0.0
19+
- Flutter >=3.29.0
20+
- Dart >=3.7.0 <4.0.0
2121
- iOS >=12.0
2222
- MacOS >=10.14
2323
- Android `compileSDK` 34

0 commit comments

Comments
 (0)