-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature(wallet-mobile): Redirect universal & deeplinks #3155
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
03b8f4e
chore(links): build the parser
stackchain 829a062
chore(links,wallet-mobile): bumped version
stackchain b81cad4
chore(links,wallet-mobile): links state
stackchain a503cbe
chore(links,wallet-mobile): deeplinks
stackchain e300892
chore(theme,wallet-mobile): updates and fixes
stackchain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 was deleted.
Oops, something went wrong.
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
93 changes: 37 additions & 56 deletions
93
...Exchange/useCases/ShowExchangeResultOrderScreen/ShowExchangeResultOrderScreen.stories.tsx
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 |
---|---|---|
@@ -1,73 +1,54 @@ | ||
import {NavigationRouteContext, RouteProp} from '@react-navigation/native' | ||
import {actions} from '@storybook/addon-actions' | ||
import {storiesOf} from '@storybook/react-native' | ||
import {exchangeDefaultState, ExchangeProvider, successManagerMock} from '@yoroi/exchange' | ||
import {produce} from 'immer' | ||
import {LinksProvider} from '@yoroi/links' | ||
import React from 'react' | ||
|
||
import {ModalProvider} from '../../../../components' | ||
import {InitialLinkProvider, useInitialLink} from '../../../../IntialLinkManagerProvider' | ||
import {SelectedWalletProvider} from '../../../../SelectedWallet' | ||
import {mocks as walletMocks} from '../../../../yoroi-wallets/mocks' | ||
import {ExchangeInitRoutes} from '../../common/useNavigateTo' | ||
import {ShowExchangeResultOrderScreen} from './ShowExchangeResultOrderScreen' | ||
|
||
storiesOf('Exchange ShowExchangeResultOrderScreen', module) | ||
.addDecorator((story) => <InitialLinkProvider>{story()}</InitialLinkProvider>) | ||
.add('no params', () => <Init />) | ||
.add('no info', () => <ShowExchangeResultOrderScreen onClose={() => actions('onClose')} />) | ||
.add('with params', () => <WithParams />) | ||
|
||
const Init = () => { | ||
const {setInitialUrl} = useInitialLink() | ||
const initialState = produce(exchangeDefaultState, (draft) => { | ||
draft.orderType = 'buy' | ||
}) | ||
|
||
React.useEffect(() => { | ||
setInitialUrl( | ||
'yoroi://ramp-on-off/result?&status=success&fiatAmount=10000&coinAmount=5000&coin=ADA&fiat=USD&provider=encryptus', | ||
) | ||
}, [setInitialUrl]) | ||
storiesOf('Exchange ShowExchangeResultOrderScreen', module).add('with deep link data', () => <WithDeepLinkData />) | ||
|
||
const WithDeepLinkData = () => { | ||
return ( | ||
<SelectedWalletProvider wallet={{...walletMocks.wallet}}> | ||
<ModalProvider> | ||
<ExchangeProvider manager={successManagerMock} initialState={{...initialState, providerId: 'encryptus'}}> | ||
<ShowExchangeResultOrderScreen onClose={() => actions('onClose')} /> | ||
</ExchangeProvider> | ||
<LinksProvider | ||
initialState={{ | ||
authorizations: new Map(), | ||
action: { | ||
info: { | ||
version: 1, | ||
feature: 'exchange', | ||
useCase: 'order/show-create-result', | ||
params: { | ||
coin: 'ADA', | ||
coinAmount: 1, | ||
fiat: 'USD', | ||
fiatAmount: 1, | ||
provider: 'encryptus', | ||
status: 'success', | ||
appId: 'a386e806-92f4-4796-ad61-7a1485b6e745', | ||
authorization: 'fca6fc26-abc6-4cdc-bdce-5910cc3c0a01', | ||
isSandbox: true, | ||
message: 'Your order number 131234 is under processing, bare with us.', | ||
redirectTo: 'https://yoroi-wallet.com/about', | ||
orderType: 'buy', | ||
}, | ||
}, | ||
isTrusted: false, | ||
}, | ||
}} | ||
> | ||
<ExchangeProvider | ||
manager={successManagerMock} | ||
initialState={{...exchangeDefaultState, providerId: 'encryptus'}} | ||
> | ||
<ShowExchangeResultOrderScreen /> | ||
</ExchangeProvider> | ||
</LinksProvider> | ||
</ModalProvider> | ||
</SelectedWalletProvider> | ||
) | ||
} | ||
|
||
const WithParams = () => { | ||
const {setInitialUrl} = useInitialLink() | ||
const params: RouteProp<ExchangeInitRoutes, 'exchange'>['params'] = { | ||
coin: 'ADA', | ||
coinAmount: 100, | ||
fiat: 990, | ||
fiatAmount: 199, | ||
status: 'success', | ||
} | ||
const initialState = produce(exchangeDefaultState, (draft) => { | ||
draft.orderType = 'buy' | ||
}) | ||
|
||
React.useEffect(() => { | ||
setInitialUrl( | ||
'yoroi://ramp-on-off/result?&status=success&fiatAmount=10000&coinAmount=5000&coin=ADA&fiat=USD&provider=encryptus', | ||
) | ||
}, [setInitialUrl]) | ||
return ( | ||
<NavigationRouteContext.Provider value={{key: 'key', name: 'name', params}}> | ||
<SelectedWalletProvider wallet={{...walletMocks.wallet}}> | ||
<ModalProvider> | ||
<ExchangeProvider manager={successManagerMock} initialState={{...initialState, providerId: 'encryptus'}}> | ||
<ShowExchangeResultOrderScreen onClose={() => actions('onClose')} /> | ||
</ExchangeProvider> | ||
</ModalProvider> | ||
</SelectedWalletProvider> | ||
</NavigationRouteContext.Provider> | ||
) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it makes immer works with sets and maps