From 16a4c015d56a240b56ac0830b0ac80ed8aa5cbd6 Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Fri, 27 Sep 2024 18:00:53 -0400 Subject: [PATCH] Update ElectrumSettings.tsx --- screen/settings/ElectrumSettings.tsx | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/screen/settings/ElectrumSettings.tsx b/screen/settings/ElectrumSettings.tsx index 8a39396fc..cac9ca915 100644 --- a/screen/settings/ElectrumSettings.tsx +++ b/screen/settings/ElectrumSettings.tsx @@ -4,7 +4,7 @@ import * as BlueElectrum from '../../blue_modules/BlueElectrum'; import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback'; import { BlueCard, BlueSpacing10, BlueSpacing20, BlueText } from '../../BlueComponents'; import DeeplinkSchemaMatch from '../../class/deeplink-schema-match'; -import presentAlert, { AlertType } from '../../components/Alert'; +import presentAlert from '../../components/Alert'; import Button from '../../components/Button'; import { scanQrHelper } from '../../helpers/scan-qr'; import loc from '../../loc'; @@ -179,19 +179,32 @@ const ElectrumSettings: React.FC = () => { await DefaultPreference.set(BlueElectrum.ELECTRUM_SSL_PORT, sslPort?.toString() || ''); } triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess); - presentAlert({ message: loc.settings.electrum_saved, type: AlertType.Toast }); + presentAlert({ message: loc.settings.electrum_saved }); } catch (error) { triggerHapticFeedback(HapticFeedbackTypes.NotificationError); - presentAlert({ message: (error as Error).message, type: AlertType.Toast }); + presentAlert({ message: (error as Error).message }); } setIsLoading(false); }, [host, port, sslPort, serverExists, serverHistory]); const resetToDefault = useCallback(() => { - setPort(undefined); - setHost(''); - setSslPort(undefined); - save(); + Alert.alert(loc.settings.electrum_reset, loc.settings.electrum_reset_to_default, [ + { + text: loc._.cancel, + onPress: () => console.log('Cancel Pressed'), + style: 'cancel', + }, + { + text: loc._.ok, + style: 'destructive', + onPress: async () => { + setHost(''); + setPort(undefined); + setSslPort(undefined); + await save(); + }, + }, + ]); }, [save]); const selectServer = useCallback(