Skip to content

Commit

Permalink
improve disable logic for save button, remove unused ModalStore
Browse files Browse the repository at this point in the history
  • Loading branch information
myxmaster committed Jan 26, 2025
1 parent 5b6464b commit cf02081
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions views/Settings/WalletConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { Route } from '@react-navigation/native';
import { StackNavigationProp } from '@react-navigation/stack';

import { hash, LNC_STORAGE_KEY } from '../../backends/LNC/credentialStore';
import ModalStore from '../../stores/ModalStore';

import AddressUtils, { CUSTODIAL_LNDHUBS } from '../../utils/AddressUtils';
import ConnectionFormatUtils from '../../utils/ConnectionFormatUtils';
Expand Down Expand Up @@ -66,7 +65,6 @@ import {
interface WalletConfigurationProps {
navigation: StackNavigationProp<any, any>;
SettingsStore: SettingsStore;
ModalStore: ModalStore;
route: Route<
'WalletConfiguration',
{
Expand Down Expand Up @@ -140,7 +138,7 @@ const ScanBadge = ({ onPress }: { onPress: () => void }) => (
</TouchableOpacity>
);

@inject('SettingsStore', 'ModalStore')
@inject('SettingsStore')
@observer
export default class WalletConfiguration extends React.Component<
WalletConfigurationProps,
Expand Down Expand Up @@ -2314,12 +2312,40 @@ export default class WalletConfiguration extends React.Component<
disabled={
loading ||
hostError ||
(host &&
!ValidationUtils.isValidHostname(
host
)) ||
portError ||
(port &&
!ValidationUtils.isValidPort(
port
)) ||
macaroonHexError ||
(macaroonHex &&
!ValidationUtils.hasValidMacaroonChars(
macaroonHex
)) ||
runeError ||
(rune &&
!ValidationUtils.hasValidRuneChars(
rune
)) ||
lndhubUrlError ||
(lndhubUrl &&
!ValidationUtils.isValidHostAndPort(
lndhubUrl
)) ||
customMailboxServerError ||
(customMailboxServer &&
!ValidationUtils.isValidHttpsHostAndPort(
customMailboxServer
)) ||
pairingPhraseError ||
(pairingPhrase &&
!ValidationUtils.hasValidPairingPhraseCharsAndWordcount(
pairingPhrase
)) ||
// Required input check
// Port is optional, it will fallback to 80 or 443
(implementation === 'lndhub' &&
Expand Down

0 comments on commit cf02081

Please sign in to comment.