Skip to content

Commit 96d23f6

Browse files
committed
FullCharge: Describe the arming basis the device will actually use
Found on hardware during the device pass for the previous commit, which put the reconnect card in front of non-Pixel adapters for the first time and so exposed copy that had only ever been read on a Pixel. The dashboard off-state promised "a quick unplug/replug at the 80% limit". On an SM-G781B that was wrong twice: One UI reports no hold for the gesture to wait on, and the card directly above it read "85% limit". Split it into a hold variant and an any-level variant, chosen by the same effective basis the on-state already used, and drop the hardcoded number from both since the hold wording was equally wrong at 85%. Onboarding said "Reconnect at the 80% hold". That page runs before any adapter resolves, so it cannot name a basis or a limit at all.
1 parent ca8a126 commit 96d23f6

3 files changed

Lines changed: 51 additions & 2 deletions

File tree

app/src/main/java/eu/darken/amply/main/ui/dashboard/DashboardScreen.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,11 @@ private fun QuickFullChargeCard(
839839
when {
840840
enabled && anyLevel -> stringResource(R.string.dashboard_reconnect_body_on_any_level)
841841
enabled -> stringResource(R.string.dashboard_reconnect_body_on)
842+
// The off-state has to describe the basis this device would actually use. Naming
843+
// the hold where it can never happen was wrong twice over on a legacy Samsung: it
844+
// promised a hold the ROM does not report, and named 80% next to that device's
845+
// real 85% limit shown one card above.
846+
anyLevel -> stringResource(R.string.dashboard_reconnect_body_off_any_level)
842847
else -> stringResource(R.string.dashboard_reconnect_body_off)
843848
},
844849
style = MaterialTheme.typography.bodySmall,

app/src/main/res/values/strings.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<string name="onboarding_feature_fullcharge_title">Charge fully once</string>
6565
<string name="onboarding_feature_fullcharge_body">Protection returns automatically at full or when unplugged.</string>
6666
<string name="onboarding_feature_shortcut_title">Optional reconnect gesture</string>
67-
<string name="onboarding_feature_shortcut_body" formatted="false">Reconnect at the 80% hold to request one full charge.</string>
67+
<string name="onboarding_feature_shortcut_body">Unplug and reconnect quickly to request one full charge.</string>
6868
<string name="onboarding_next_action">Next</string>
6969
<string name="onboarding_continue_action">Get started</string>
7070
<string name="onboarding_caveats_title">Before you start</string>
@@ -536,7 +536,8 @@
536536
<string name="dashboard_reconnect_title">Reconnect gesture</string>
537537
<string name="dashboard_reconnect_body_on" formatted="false">At the 80% limit, unplug for at least 2 seconds and reconnect within 10. An ongoing notification keeps the gesture reliable.</string>
538538
<string name="dashboard_reconnect_body_on_any_level">At any charge level while a protective policy is set, unplug for at least 2 seconds and reconnect within 10. An ongoing notification keeps the gesture reliable.</string>
539-
<string name="dashboard_reconnect_body_off" formatted="false">Optionally use a quick unplug/replug at the 80% limit to charge fully once.</string>
539+
<string name="dashboard_reconnect_body_off">Optionally use a quick unplug/replug while your charge limit is holding to charge fully once.</string>
540+
<string name="dashboard_reconnect_body_off_any_level">Optionally use a quick unplug/replug at any charge level to charge fully once.</string>
540541
<string name="settings_charging_title">Charging</string>
541542
<string name="settings_charging_subtitle_on">Reconnect gesture on</string>
542543
<string name="settings_charging_subtitle_off">Reconnect gesture off</string>

app/src/test/java/eu/darken/amply/main/ui/dashboard/DashboardScreenGestureTest.kt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,49 @@ class DashboardScreenGestureTest {
7676
compose.onAllNodesWithContentDescription(string(R.string.action_settings)).assertCountEquals(1)
7777
}
7878

79+
// Found on a real SM-G781B: the off-state copy promised a hold that One UI never reports AND
80+
// named 80% while the card directly above it read "85% limit". An adapter that can only arm
81+
// any-level must describe that, in the off state too.
82+
@Test
83+
fun `an any-level-only device describes the basis it will actually use`() {
84+
render(
85+
state = DashboardUiState(
86+
onboardingComplete = true,
87+
quickFullChargeEnabled = false,
88+
charging = ChargingState(
89+
adapterResolved = true,
90+
reconnectSupported = true,
91+
reconnectAnyLevelOnly = true,
92+
),
93+
),
94+
)
95+
96+
compose.onNode(hasScrollAction())
97+
.performScrollToNode(hasText(string(R.string.dashboard_reconnect_title)))
98+
compose.onNodeWithText(string(R.string.dashboard_reconnect_body_off_any_level)).assertExists()
99+
compose.onAllNodesWithText(string(R.string.dashboard_reconnect_body_off)).assertCountEquals(0)
100+
}
101+
102+
// The hold wording survives where the hold can actually happen (Pixel with the sub-option off).
103+
@Test
104+
fun `a full-support device keeps the limit-hold wording`() {
105+
render(
106+
state = DashboardUiState(
107+
onboardingComplete = true,
108+
quickFullChargeEnabled = false,
109+
charging = ChargingState(
110+
adapterResolved = true,
111+
reconnectSupported = true,
112+
reconnectAnyLevelOnly = false,
113+
),
114+
),
115+
)
116+
117+
compose.onNode(hasScrollAction())
118+
.performScrollToNode(hasText(string(R.string.dashboard_reconnect_title)))
119+
compose.onNodeWithText(string(R.string.dashboard_reconnect_body_off)).assertExists()
120+
}
121+
79122
@Test
80123
fun `the hero states the policy and is not a navigation surface`() {
81124
render(

0 commit comments

Comments
 (0)