mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Remove IsLowBattery
This commit is contained in:
@ -294,7 +294,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
[TestCase(false, 1.0, false)] // not charging, above cutoff --> no warning
|
[TestCase(false, 1.0, false)] // not charging, above cutoff --> no warning
|
||||||
[TestCase(true, 0.1, false)] // charging, below cutoff --> no warning
|
[TestCase(true, 0.1, false)] // charging, below cutoff --> no warning
|
||||||
[TestCase(false, 0.2, true)] // not charging, at cutoff --> warning
|
[TestCase(false, 0.25, true)] // not charging, at cutoff --> warning
|
||||||
public void TestLowBatteryNotification(bool isCharging, double chargeLevel, bool shouldWarn)
|
public void TestLowBatteryNotification(bool isCharging, double chargeLevel, bool shouldWarn)
|
||||||
{
|
{
|
||||||
AddStep("reset notification lock", () => sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce).Value = false);
|
AddStep("reset notification lock", () => sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce).Value = false);
|
||||||
|
@ -487,7 +487,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
if (!batteryWarningShownOnce.Value)
|
if (!batteryWarningShownOnce.Value)
|
||||||
{
|
{
|
||||||
if (batteryInfo.IsLowBattery)
|
if (!batteryInfo.IsCharging && batteryInfo.ChargeLevel <= 0.25)
|
||||||
{
|
{
|
||||||
notificationOverlay?.Post(new BatteryWarningNotification());
|
notificationOverlay?.Post(new BatteryWarningNotification());
|
||||||
batteryWarningShownOnce.Value = true;
|
batteryWarningShownOnce.Value = true;
|
||||||
|
@ -14,11 +14,5 @@ namespace osu.Game.Utils
|
|||||||
public abstract double ChargeLevel { get; }
|
public abstract double ChargeLevel { get; }
|
||||||
|
|
||||||
public abstract bool IsCharging { get; }
|
public abstract bool IsCharging { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the battery is currently low in charge.
|
|
||||||
/// Returns true if not charging and current charge level is lower than or equal to 25%.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsLowBattery => !IsCharging && ChargeLevel <= 0.25;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user