import { useCallback } from 'react'; import { useSelector } from 'react-redux'; import { DEVICE_LOW_BATTERY_PERCENTAGE_THRESHOLD, selectIsDeviceConnectedViaBluetoothLowOnBattery, } from '@suite-common/device'; import { useAlert } from '@suite-native/alerts'; import { Translation } from '@suite-native/intl'; export const useDeviceLowBatteryAlert = () => { const isDeviceConnectedViaBluetoothLowOnBattery = useSelector( selectIsDeviceConnectedViaBluetoothLowOnBattery, ); const { showAlert } = useAlert(); const showLowBatteryAlertIfNecessary = useCallback(() => { if (isDeviceConnectedViaBluetoothLowOnBattery) { showAlert({ title: , description: ( ), primaryButtonTitle: , primaryButtonColorProps: { intent: 'critical', priority: 'primary' }, }); return true; } return false; }, [isDeviceConnectedViaBluetoothLowOnBattery, showAlert]); return { showLowBatteryAlertIfNecessary, }; };