Skip to content

Commit

Permalink
LSPS1: Add btn to retry and to navigate to settings view in case of t…
Browse files Browse the repository at this point in the history
…imeout error
  • Loading branch information
shubhamkmr04 committed May 1, 2024
1 parent addeb6e commit f4a6832
Showing 1 changed file with 46 additions and 3 deletions.
49 changes: 46 additions & 3 deletions views/Settings/LSPS1/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,18 @@ export default class LSPS1 extends React.Component<LSPS1Props, LSPS1State> {
<ErrorMessage message="Node pubkey and host are not set" />
)}

{LSPStore?.error && LSPStore?.error_msg && (
<ErrorMessage message={LSPStore.error_msg} />
)}
{LSPStore?.error &&
LSPStore?.error_msg &&
LSPStore?.error_msg !==
'Did not receive response from server' && (
<ErrorMessage message={LSPStore.error_msg} />
)}
</View>
{LSPStore.loading ? (
<LoadingIndicator />
) : (LSPStore?.error && LSPStore?.error_msg) ===
'Did not receive response from server' ? (
<ErrorMessage message={LSPStore.error_msg} />
) : (
<>
<ScrollView style={{ flex: 1 }}>
Expand Down Expand Up @@ -1186,6 +1192,43 @@ export default class LSPS1 extends React.Component<LSPS1Props, LSPS1State> {
</View>
</>
)}

{!LSPStore.loading &&
LSPStore.error &&
LSPStore.error_msg ===
'Did not receive response from server' && (
<View
style={{
position: 'absolute',
width: '100%',
bottom: 0
}}
>
<Button
title="Retry"
onPress={() => {
if (BackendUtils.supportsLSPS1rest()) {
LSPStore.getInfoREST();
} else {
this.connectPeer();
this.subscribeToCustomMessages();
this.sendCustomMessage_lsps1();
}
}}
/>

<Button
onPress={() => {
this.props.navigation.navigate(
'LSPS1Settings'
);
}}
title="Go to Settings"
containerStyle={{ paddingVertical: 20 }}
secondary
/>
</View>
)}
</Screen>
);
}
Expand Down

0 comments on commit f4a6832

Please sign in to comment.