Skip to content

Commit

Permalink
LSPS1: Using new navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamkmr04 committed May 20, 2024
1 parent 3506476 commit cfc012e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
22 changes: 22 additions & 0 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ import LspExplanationWrappedInvoices from './views/Explanations/LspExplanationWr
import LspExplanationOverview from './views/Explanations/LspExplanationOverview';
import RestoreChannelBackups from './views/Settings/EmbeddedNode/RestoreChannelBackups';

// LSPS1
import LSPS1 from './views/Settings/LSPS1/index';
import LSPS1Settings from './views/Settings/LSPS1/Settings';
import OrdersPane from './views/Settings/LSPS1/OrdersPane';
import Orders from './views/Settings/LSPS1/Order';

import RawTxHex from './views/RawTxHex';

import CustodialWalletWarning from './views/Settings/CustodialWalletWarning';
Expand Down Expand Up @@ -732,6 +738,22 @@ export default class App extends React.PureComponent {
name="TxHex"
component={TxHex}
/>
<Stack.Screen
name="LSPS1"
component={LSPS1}
/>
<Stack.Screen
name="LSPS1Settings"
component={LSPS1Settings}
/>
<Stack.Screen
name="OrdersPane"
component={OrdersPane}
/>
<Stack.Screen
name="LSPS1Order"
component={Orders}
/>
</Stack.Navigator>
</NavigationContainer>
)}
Expand Down
12 changes: 7 additions & 5 deletions views/Channels/ChannelsPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import { localeString } from '../../utils/LocaleUtils';

import Channel from '../../models/Channel';

import NavigationService from '../../NavigationService';

// TODO: does this belong in the model? Or can it be computed from the model?
export enum Status {
Good = 'Good',
Expand All @@ -46,7 +44,7 @@ interface ChannelsProps {
SettingsStore?: SettingsStore;
}

const ColorChangingButton = () => {
const ColorChangingButton = ({ onPress }) => {
const [forward, setForward] = useState(true);
const animation = useRef(new Animated.Value(0)).current;

Expand Down Expand Up @@ -75,7 +73,7 @@ const ColorChangingButton = () => {

return (
<TouchableOpacity
onPress={() => NavigationService.navigate('LSPS1')}
onPress={onPress}
style={[styles.button, { backgroundColor }]}
>
<Text style={styles.buttonText}>
Expand Down Expand Up @@ -237,7 +235,11 @@ export default class ChannelsPane extends React.PureComponent<ChannelsProps> {
{settings?.lsps1ShowPurchaseButton &&
(BackendUtils.supportsLSPS1customMessage() ||
BackendUtils.supportsLSPS1rest()) && (
<ColorChangingButton />
<ColorChangingButton
onPress={() => {
navigation.navigate('LSPS1');
}}
/>
)}
{showSearch && <ChannelsFilter />}
{loading ? (
Expand Down
5 changes: 3 additions & 2 deletions views/Settings/LSPS1/OrdersPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import EncryptedStorage from 'react-native-encrypted-storage';
import moment from 'moment';
import { inject, observer } from 'mobx-react';
import { StackNavigationProp } from '@react-navigation/stack';
import { View, FlatList, TouchableOpacity, Text } from 'react-native';

import Header from '../../../components/Header';
Expand All @@ -16,7 +17,7 @@ import LSPStore from '../../../stores/LSPStore';
import { WarningMessage } from '../../../components/SuccessErrorMessage';

interface OrdersPaneProps {
navigation: any;
navigation: StackNavigationProp<any, any>;
LSPStore: LSPStore;
}

Expand All @@ -41,7 +42,7 @@ export default class OrdersPane extends React.Component<

async componentDidMount() {
const { navigation, LSPStore } = this.props;
navigation.addListener('didFocus', async () => {
navigation.addListener('focus', async () => {
try {
// Retrieve saved responses from encrypted storage
const responseArrayString = await EncryptedStorage.getItem(
Expand Down
3 changes: 2 additions & 1 deletion views/Settings/LSPS1/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from 'react-native';
import EncryptedStorage from 'react-native-encrypted-storage';
import Slider from '@react-native-community/slider';
import { StackNavigationProp } from '@react-navigation/stack';
import { v4 as uuidv4 } from 'uuid';

import CaretDown from '../../../assets/images/SVG/Caret Down.svg';
Expand Down Expand Up @@ -45,7 +46,7 @@ interface LSPS1Props {
ChannelsStore: ChannelsStore;
SettingsStore: SettingsStore;
FiatStore: FiatStore;
navigation: any;
navigation: StackNavigationProp<any, any>;
}

interface LSPS1State {
Expand Down

0 comments on commit cfc012e

Please sign in to comment.