-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix/8850 add battery check during ESC (#5138)
* feat(libs): add LOW_BATTERY_PERCENTAGE environment variable * feat(common): add low battery check in battery statuses hook * feat(llm): move battery check drawer into firmware update screen * feat(llm): prevent re-display of fw update drawer post-cancellation * feat(llm,common,env): add changeset * feat(llm): don't open fw update drawer only when cancelled * feat(llm): remove getEnv from battery warning drawer * chore: add logs to getBatteryStatus * feat(common): return custom task event for unknown apdu for battery stat * feat(llm): fix eslint warning * feat(llm): fix typo * feat(common): improve tracer for get battery statuses * feat(common): remove error when UnknownApdu is set for battery check --------- Co-authored-by: Alexandre Magaud <[email protected]>
- Loading branch information
1 parent
95acaec
commit 9d35080
Showing
11 changed files
with
230 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"live-mobile": patch | ||
"@ledgerhq/live-common": patch | ||
"@ledgerhq/live-env": patch | ||
--- | ||
|
||
add low battery warning during early security check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
apps/ledger-live-mobile/src/screens/FirmwareUpdate/BatteryWarningDrawer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from "react"; | ||
import QueuedDrawer, { Props as QueuedDrawerProps } from "../../components/QueuedDrawer"; | ||
import { Button, Flex, IconBadge, IconsLegacy, Text } from "@ledgerhq/native-ui"; | ||
import { useTranslation } from "react-i18next"; | ||
import { GetBatteryStatusesActionState } from "@ledgerhq/live-common/deviceSDK/actions/getBatteryStatuses"; | ||
import { Device } from "@ledgerhq/types-devices"; | ||
|
||
type Props = QueuedDrawerProps & { | ||
state: GetBatteryStatusesActionState; | ||
lowBatteryPercentage: number; | ||
device: Device; | ||
onRetry: () => void; | ||
onQuit: () => void; | ||
}; | ||
|
||
const BatteryWarningDrawer: React.FC<Props> = ({ | ||
device, | ||
state, | ||
lowBatteryPercentage, | ||
onRetry, | ||
onQuit, | ||
...props | ||
}) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<> | ||
<QueuedDrawer noCloseButton {...props}> | ||
<Flex> | ||
<Flex alignItems="center" justifyContent="center" mb={8}> | ||
<IconBadge | ||
iconColor="primary.c100" | ||
iconSize={32} | ||
Icon={IconsLegacy.BatteryHalfMedium} | ||
/> | ||
<Text fontSize={7} fontWeight="semiBold" textAlign="center" mt={6}> | ||
{t("FirmwareUpdate.staxBatteryLow")} | ||
</Text> | ||
<Text fontSize={4} textAlign="center" color="neutral.c80" mt={6}> | ||
{t("FirmwareUpdate.staxBatteryLowDescription", { | ||
lowBatteryPercentage, | ||
})} | ||
</Text> | ||
</Flex> | ||
|
||
<Button type="main" outline={false} onPress={onRetry} mt={6} alignSelf="stretch"> | ||
{t("FirmwareUpdate.retryBatteryCheck")} | ||
</Button> | ||
<Button type="default" outline={false} onPress={onQuit} mt={6}> | ||
{t("FirmwareUpdate.quitUpdate")} | ||
</Button> | ||
</Flex> | ||
</QueuedDrawer> | ||
</> | ||
); | ||
}; | ||
|
||
export default BatteryWarningDrawer; |
Oops, something went wrong.
9d35080
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
web-tools – ./apps/web-tools
ledger-live-tools.vercel.app
web-tools-git-develop-ledgerhq.vercel.app
web-tools-ledgerhq.vercel.app
ledger-live.vercel.app
live.ledger.tools