Skip to content

Commit

Permalink
Settings: Embedded node: add ability to clear payment routing profile
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloudis committed Jul 29, 2023
1 parent 80a412b commit 2d978fd
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 7 deletions.
5 changes: 4 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"general.network": "Network",
"general.tapToLearnMore": "Tap to learn more.",
"general.lsp": "Lightning Service Provider (LSP)",
"general.success": "Success",
"components.CollapsedQr.show": "Show QR",
"components.CollapsedQr.hide": "Hide QR",
"components.CollapsedQr.startNfc": "Start NFC broadcast",
Expand Down Expand Up @@ -628,11 +629,13 @@
"views.Settings.Seed.backupComplete": "I've backed up my 24 words",
"views.Settings.EmbeddedNode.title": "Embedded node",
"views.Settings.EmbeddedNode.expressGraphSync": "Enable express graph sync (EGS)",
"views.Settings.EmbeddedNode.expressGraphSync.subtitle": "Download Lightning network's gossip data on startup. This while make pathfinding when trying to make a payment much more reliable. Restart the app to take effect.",
"views.Settings.EmbeddedNode.expressGraphSync.subtitle": "Download Lightning network's gossip data on startup. This will make pathfinding when trying to make a payment much more reliable. Restart the app to take effect. Also known as Speedloader.",
"views.Settings.EmbeddedNode.expressGraphSyncMobile": "Allow express graph sync on mobile",
"views.Settings.EmbeddedNode.expressGraphSyncMobile.subtitle": "By default, express graph sync will only occur when you're on WiFi as files are typically ~100 MB. This will allow EGS downloads to happen on mobile connections.",
"views.Settings.EmbeddedNode.resetExpressGraphSyncOnStartup": "Reset express graph sync on startup",
"views.Settings.EmbeddedNode.resetExpressGraphSyncOnStartup.subtitle": "Force a new download of the express graph sync data on startup.",
"views.Settings.EmbeddedNode.resetMissionControl": "Reset payment routing profile",
"views.Settings.EmbeddedNode.resetMissionControl.subtitle": "This will reset the mission control state. Can be helpful if you are having issues finding routes while making payments.",
"views.Settings.LSP.enableLSP": "Enable Lightning Service Provider (LSP)",
"views.Settings.LSP.enableLSP.subtitle": "The LSP will get you connected to the Lightning network by opening up payment channels for you.",
"views.Transaction.title": "Transaction",
Expand Down
58 changes: 56 additions & 2 deletions views/Settings/EmbeddedNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Text, View } from 'react-native';
import { ListItem } from 'react-native-elements';
import { inject, observer } from 'mobx-react';

import Button from '../../components/Button';
import Screen from '../../components/Screen';
import Header from '../../components/Header';

Expand All @@ -12,6 +13,8 @@ import { localeString } from '../../utils/LocaleUtils';
import { themeColor } from '../../utils/ThemeUtils';
import Switch from '../../components/Switch';

import { resetMissionControl } from '../../lndmobile';

interface EmbeddedNodeProps {
navigation: any;
SettingsStore: SettingsStore;
Expand All @@ -21,6 +24,7 @@ interface EmbeddedNodeState {
expressGraphSync: boolean | undefined;
expressGraphSyncMobile: boolean | undefined;
resetExpressGraphSyncOnStartup: boolean | undefined;
resetMissionControlSuccess: boolean | undefined;
}

@inject('SettingsStore')
Expand All @@ -32,7 +36,8 @@ export default class EmbeddedNode extends React.Component<
state = {
expressGraphSync: false,
expressGraphSyncMobile: false,
resetExpressGraphSyncOnStartup: false
resetExpressGraphSyncOnStartup: false,
resetMissionControlSuccess: false
};

async UNSAFE_componentWillMount() {
Expand All @@ -52,7 +57,8 @@ export default class EmbeddedNode extends React.Component<
const {
expressGraphSync,
expressGraphSyncMobile,
resetExpressGraphSyncOnStartup
resetExpressGraphSyncOnStartup,
resetMissionControlSuccess
} = this.state;
const { updateSettings, embeddedLndNetwork }: any = SettingsStore;

Expand Down Expand Up @@ -245,6 +251,54 @@ export default class EmbeddedNode extends React.Component<
</>
</>
)}
<>
<View style={{ margin: 10 }}>
<Button
title={
resetMissionControlSuccess
? localeString('general.success')
: localeString(
'views.Settings.EmbeddedNode.resetMissionControl'
)
}
onPress={async () => {
try {
await resetMissionControl();
this.setState({
resetMissionControlSuccess: true
});

setTimeout(() => {
this.setState({
resetMissionControlSuccess:
false
});
}, 5000);
} catch (e) {
console.log(
'Error on resetMissionControl:',
e
);
}
}}
/>
</View>
<View
style={{
margin: 10
}}
>
<Text
style={{
color: themeColor('secondaryText')
}}
>
{localeString(
'views.Settings.EmbeddedNode.resetMissionControl.subtitle'
)}
</Text>
</View>
</>
</View>
</Screen>
);
Expand Down
4 changes: 0 additions & 4 deletions views/Settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,7 @@ export default class Settings extends React.Component<
</TouchableOpacity>

<View style={styles.separationLine} />
</>
)}

{selectedNode.embeddedLndNetwork === 'Mainnet' && (
<>
<TouchableOpacity
style={styles.columnField}
onPress={() =>
Expand Down

0 comments on commit 2d978fd

Please sign in to comment.