88 TouchableHighlight ,
99 View ,
1010 ImageBackground ,
11- InteractionManager ,
1211 StatusBar ,
1312} from 'react-native'
1413import Logger from 'react-native-file-log'
@@ -25,13 +24,7 @@ import wavesBGDark from '../../assets/images/waves-bg-dark.png'
2524import ShockIcon from '../../res/icons'
2625import btcConvert from '../../services/convertBitcoin'
2726import * as CSS from '../../res/css'
28- import { getUSDRate , getWalletBalance } from '../../store/actions/WalletActions'
2927import { fetchNodeInfo } from '../../store/actions/NodeActions'
30- import {
31- fetchRecentTransactions ,
32- fetchRecentPayments ,
33- fetchRecentInvoices ,
34- } from '../../store/actions/HistoryActions'
3528import { subscribeOnChats } from '../../store/actions/ChatActions'
3629import {
3730 invoicesRefreshForced ,
@@ -61,13 +54,8 @@ import { Color } from 'shock-common/dist/constants'
6154 * @prop {string|null } totalBalance
6255 * @prop {number } USDRate
6356 * @prop {boolean } testnet
64- * @prop {() => Promise<void> } fetchRecentTransactions
65- * @prop {() => Promise<void> } fetchRecentPayments
66- * @prop {() => Promise<void> } fetchRecentInvoices
67- * @prop {() => Promise<import('../../store/actions/WalletActions').WalletBalance> } getWalletBalance
6857 * @prop {() => Promise<import('../../store/actions/NodeActions').GetInfo> } fetchNodeInfo
6958 * @prop {() => Promise<Schema.Chat[]> } subscribeOnChats
70- * @prop {() => Promise<number> } getUSDRate
7159 * @prop {{notifyDisconnect:boolean, notifyDisconnectAfterSeconds:number} } settings
7260 * @prop {() => void } forceInvoicesRefresh
7361 * @prop {boolean } isOnline
@@ -106,12 +94,6 @@ class WalletOverview extends React.PureComponent {
10694 ) ) ,
10795 }
10896
109- /** @type {null|ReturnType<typeof setInterval> } */
110- balanceIntervalID = null
111-
112- /** @type {null|ReturnType<typeof setInterval> } */
113- exchangeRateIntervalID = null
114-
11597 didFocus = { remove ( ) { } }
11698
11799 subs = [ ( ) => { } ]
@@ -122,104 +104,19 @@ class WalletOverview extends React.PureComponent {
122104 const {
123105 fetchNodeInfo,
124106 subscribeOnChats,
125- fetchRecentTransactions,
126- fetchRecentInvoices,
127- navigation,
128107 forceInvoicesRefresh,
129108 forcePaymentsRefresh,
130- getMoreFeed,
131109 forceChainTXsRefresh,
132110 } = this . props
133111
134112 forcePaymentsRefresh ( )
135113 forceInvoicesRefresh ( )
136- getMoreFeed ( )
137114 forceChainTXsRefresh ( )
138115
139- this . didFocus = navigation . addListener ( 'didFocus' , ( ) => {
140- this . balanceIntervalID = setTimeout ( this . getWalletBalance , 4000 )
141- this . exchangeRateIntervalID = setTimeout ( this . getUSDRate , 4000 )
142- this . recentPaymentsIntervalID = setTimeout ( this . fetchRecentPayments , 4000 )
143- } )
144-
145- navigation . addListener ( 'didBlur' , ( ) => {
146- if ( this . balanceIntervalID ) {
147- clearTimeout ( this . balanceIntervalID )
148- }
149-
150- if ( this . exchangeRateIntervalID ) {
151- clearTimeout ( this . exchangeRateIntervalID )
152- }
153-
154- if ( this . recentPaymentsIntervalID ) {
155- clearTimeout ( this . recentPaymentsIntervalID )
156- }
157- } )
158-
159116 this . startNotificationService ( )
160117
161118 subscribeOnChats ( )
162- await Promise . all ( [
163- fetchRecentInvoices ( ) ,
164- fetchRecentTransactions ( ) ,
165- fetchRecentPayments ( ) ,
166- fetchNodeInfo ( ) ,
167- ] )
168- }
169-
170- fetchRecentPayments = ( ) =>
171- InteractionManager . runAfterInteractions ( ( ) => {
172- const { fetchRecentPayments } = this . props
173- try {
174- fetchRecentPayments ( )
175- this . recentPaymentsIntervalID = setTimeout (
176- this . fetchRecentPayments ,
177- 4000 ,
178- )
179- return
180- } catch ( err ) {
181- this . recentPaymentsIntervalID = setTimeout (
182- this . fetchRecentPayments ,
183- 4000 ,
184- )
185- }
186- } )
187-
188- getUSDRate = ( ) =>
189- InteractionManager . runAfterInteractions ( ( ) => {
190- const { getUSDRate } = this . props
191- try {
192- getUSDRate ( )
193- this . exchangeRateIntervalID = setTimeout ( this . getUSDRate , 4000 )
194- return
195- } catch ( err ) {
196- this . exchangeRateIntervalID = setTimeout ( this . getUSDRate , 4000 )
197- }
198- } )
199-
200- getWalletBalance = ( ) =>
201- InteractionManager . runAfterInteractions ( ( ) => {
202- const { getWalletBalance } = this . props
203- try {
204- getWalletBalance ( )
205- this . balanceIntervalID = setTimeout ( this . getWalletBalance , 4000 )
206- return
207- } catch ( err ) {
208- this . balanceIntervalID = setTimeout ( this . getWalletBalance , 4000 )
209- }
210- } )
211-
212- componentWillUnmount ( ) {
213- if ( this . balanceIntervalID ) {
214- clearInterval ( this . balanceIntervalID )
215- }
216-
217- if ( this . exchangeRateIntervalID ) {
218- clearInterval ( this . exchangeRateIntervalID )
219- }
220- //if (!SocketManager.socket?.connected) {
221- // SocketManager.socket.disconnect()
222- //}
119+ await fetchNodeInfo ( )
223120 }
224121
225122 onPressRequest = ( ) => {
@@ -438,12 +335,7 @@ const mapStateToProps = state => {
438335}
439336
440337const mapDispatchToProps = {
441- getUSDRate,
442- getWalletBalance,
443- fetchRecentTransactions,
444338 fetchNodeInfo,
445- fetchRecentInvoices,
446- fetchRecentPayments,
447339 subscribeOnChats,
448340 forceInvoicesRefresh : invoicesRefreshForced ,
449341 forcePaymentsRefresh : paymentsRefreshForced ,
0 commit comments