diff --git a/packages/suite-analytics/src/constants.ts b/packages/suite-analytics/src/constants.ts index ca7a5acf6bc..6ba78991849 100644 --- a/packages/suite-analytics/src/constants.ts +++ b/packages/suite-analytics/src/constants.ts @@ -68,6 +68,7 @@ export enum EventType { SettingsDeviceUpdateAutoLock = 'settings/device/update-auto-lock', SettingsDeviceChangeOrientation = 'settings/device/change-orientation', SettingsDeviceChangeHapticFeedback = 'settings/device/change-haptic-feedback', + SettingsDeviceChangeBrightness = 'settings/device/change-brightness', SettingsDeviceWipe = 'settings/device/wipe', SettingsDeviceChangePassphraseProtection = 'settings/device/change-passphrase-protection', SettingsGeneralChangeLanguage = 'settings/general/change-language', diff --git a/packages/suite/src/support/messages.ts b/packages/suite/src/support/messages.ts index 76906ba3fbd..32c6a2f3d94 100644 --- a/packages/suite/src/support/messages.ts +++ b/packages/suite/src/support/messages.ts @@ -2478,13 +2478,21 @@ export default defineMessages({ id: 'TR_DEVICE_SETTINGS_CHANGE_PIN_TITLE', }, TR_DEVICE_SETTINGS_HAPTIC_FEEDBACK_DESC: { - defaultMessage: "Enable haptic feedback for device interactions", + defaultMessage: 'Enable haptic feedback for device interactions', id: 'TR_DEVICE_SETTINGS_HAPTIC_FEEDBACK_DESC', }, TR_DEVICE_SETTINGS_HAPTIC_FEEDBACK_TITLE: { defaultMessage: 'Haptic feedback', id: 'TR_DEVICE_SETTINGS_HAPTIC_FEEDBACK_TITLE', }, + TR_DEVICE_SETTINGS_BRIGHTNESS_DESC: { + defaultMessage: 'Enable brightness customization for the display on the device', + id: 'TR_DEVICE_SETTINGS_BRIGHTNESS_DESC', + }, + TR_DEVICE_SETTINGS_BRIGHTNESS_TITLE: { + defaultMessage: 'Display Brightness', + id: 'TR_DEVICE_SETTINGS_BRIGHTNESS_TITLE', + }, TR_DEVICE_SETTINGS_WIPE_CODE_TITLE: { defaultMessage: 'Set up wipe code', id: 'TR_DEVICE_SETTINGS_WIPE_CODE_TITLE', diff --git a/packages/suite/src/views/settings/SettingsDevice/Brightness.tsx b/packages/suite/src/views/settings/SettingsDevice/Brightness.tsx new file mode 100644 index 00000000000..dd3814d3ddb --- /dev/null +++ b/packages/suite/src/views/settings/SettingsDevice/Brightness.tsx @@ -0,0 +1,55 @@ +import { Switch } from '@trezor/components'; +import { SettingsSectionItem } from 'src/components/settings'; +import { ActionColumn, TextColumn, Translation } from 'src/components/suite'; +import { SettingsAnchor } from 'src/constants/suite/anchors'; +import { useDevice, useDispatch, useSelector } from '../../../hooks/suite'; +import { applySettings } from 'src/actions/settings/deviceSettingsActions'; +import { analytics, EventType } from '@trezor/suite-analytics'; + +interface DeviceLabelProps { + isDeviceLocked: boolean; +} + +export const Brightness = ({ isDeviceLocked }: DeviceLabelProps) => { + const dispatch = useDispatch(); + const { device } = useDevice(); + + const showDebugMenu = useSelector(state => state.suite.settings.debug.showDebugMenu); + + const isSupportedDevice = true; //device?.features?.capabilities?.includes('Capability_Brightness'); + + if (!showDebugMenu || !isSupportedDevice) { + return null; + } + + const brightnessEnabled = true; // device?.features?.brightness ?? false; + + const handleChange = () => { + dispatch( + applySettings({ + // brightness: !brightnessEnabled + }), + ); + analytics.report({ + type: EventType.SettingsDeviceChangeHapticFeedback, + payload: { value: !brightnessEnabled }, + }); + }; + + return ( + + } + description={} + /> + + + + + ); +}; diff --git a/packages/suite/src/views/settings/SettingsDevice/HapticFeedback.tsx b/packages/suite/src/views/settings/SettingsDevice/HapticFeedback.tsx index 479a2cd77d7..20d49c1004b 100644 --- a/packages/suite/src/views/settings/SettingsDevice/HapticFeedback.tsx +++ b/packages/suite/src/views/settings/SettingsDevice/HapticFeedback.tsx @@ -45,7 +45,7 @@ export const HapticFeedback = ({ isDeviceLocked }: DeviceLabelProps) => { isChecked={hapticEnabled} onChange={handleChange} isDisabled={isDeviceLocked} - dataTest="@settings/device/pin-switch" + dataTest="@settings/device/haptic-switch" /> diff --git a/packages/suite/src/views/settings/SettingsDevice/SettingsDevice.tsx b/packages/suite/src/views/settings/SettingsDevice/SettingsDevice.tsx index 2bee7ffb395..2e8dd2a6b2e 100644 --- a/packages/suite/src/views/settings/SettingsDevice/SettingsDevice.tsx +++ b/packages/suite/src/views/settings/SettingsDevice/SettingsDevice.tsx @@ -29,6 +29,7 @@ import { ChangeLanguage } from './ChangeLanguage'; import { EnableViewOnly } from './EnableViewOnly'; import { selectSuiteFlags } from 'src/reducers/suite/suiteReducer'; import { HapticFeedback } from './HapticFeedback'; +import { Brightness } from './Brightness'; const deviceSettingsUnavailable = (device?: TrezorDevice, transport?: Partial) => { const noTransportAvailable = transport && !transport.type; @@ -158,6 +159,7 @@ export const SettingsDevice = () => { + {pinProtection && }