-
Notifications
You must be signed in to change notification settings - Fork 635
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transaction Simulation Cleanup (#5977)
* lots of sign transaction sheet cleanup including original ticket fix * fix toHex ref * mwp * create mwp secure store and wrap app in provider * add android intents and clena up app.tsx * idk * changes * handshake request * basic impl * update some comments * some progress today at least * move business logic off App.tsx * move backup check to wallet screen * latest changes * use suspense and lazy to fix oop issue * expose config * recursively handle incoming actions * only process one incoming message at once * UNDO THIS PROBABLY * progress on personal sign * personal sign working * send transactions working * cleanup * fix lint and other calls to getRequestDisplayDetails * Update src/handlers/deeplinks.ts * fml * add switch eth chain * lint * fix lint * code review changes
- Loading branch information
Showing
44 changed files
with
2,831 additions
and
1,901 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { useCallback, useEffect, useRef, useState } from 'react'; | ||
import { AppState, AppStateStatus, Linking } from 'react-native'; | ||
import { analyticsV2 } from '@/analytics'; | ||
import store from '@/redux/store'; | ||
import { walletConnectLoadState } from '@/redux/walletconnect'; | ||
|
||
type AppStateChangeHandlerProps = { | ||
walletReady: boolean; | ||
}; | ||
|
||
export function AppStateChangeHandler({ walletReady }: AppStateChangeHandlerProps) { | ||
const [appState, setAppState] = useState(AppState.currentState); | ||
const eventSubscription = useRef<ReturnType<typeof AppState.addEventListener> | null>(null); | ||
|
||
const handleAppStateChange = useCallback( | ||
(nextAppState: AppStateStatus) => { | ||
if (appState === 'background' && nextAppState === 'active') { | ||
store.dispatch(walletConnectLoadState()); | ||
} | ||
setAppState(nextAppState); | ||
analyticsV2.track(analyticsV2.event.appStateChange, { | ||
category: 'app state', | ||
label: nextAppState, | ||
}); | ||
}, | ||
[appState] | ||
); | ||
|
||
useEffect(() => { | ||
if (!walletReady) return; | ||
|
||
eventSubscription.current = AppState.addEventListener('change', handleAppStateChange); | ||
|
||
return () => eventSubscription.current?.remove(); | ||
}, [handleAppStateChange]); | ||
|
||
return null; | ||
} |
Oops, something went wrong.