Skip to content
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

New Swap Scene #4912

Merged
merged 7 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ exports[`LineTextDivider should render with loading props 1`] = `
{
"alignItems": "center",
"flexDirection": "row",
"flexGrow": 1,
"justifyContent": "space-between",
"marginVertical": 11,
"paddingHorizontal": 11,
"width": "100%",
}
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import process from 'process'
import * as React from 'react'
import TestRenderer from 'react-test-renderer'

import { CryptoExchangeQuoteScene } from '../../components/scenes/CryptoExchangeQuoteScene'
import { SwapConfirmationScene } from '../../components/scenes/SwapConfirmationScene'
import { btcCurrencyInfo } from '../../util/fake/fakeBtcInfo'
import { makeFakePlugin } from '../../util/fake/fakeCurrencyPlugin'
import { ethCurrencyInfo } from '../../util/fake/fakeEthInfo'
Expand Down Expand Up @@ -81,7 +81,7 @@ beforeAll(async () => {
ethWallet = await account.waitForCurrencyWallet(ethInfo.id)
})

describe('CryptoExchangeQuoteScreenComponent', () => {
describe('SwapConfirmationScene', () => {
it('should render with loading props', () => {
if (btcWallet == null || ethWallet == null) return
const rootState: FakeState = { ...fakeRootState, core: { account } }
Expand Down Expand Up @@ -133,8 +133,8 @@ describe('CryptoExchangeQuoteScreenComponent', () => {

const renderer = TestRenderer.create(
<FakeProviders initialState={rootState}>
<CryptoExchangeQuoteScene
{...fakeSceneProps('exchangeQuote', {
<SwapConfirmationScene
{...fakeSceneProps('swapConfirmation', {
quotes: [quote],
selectedQuote: quote,
onApprove: () => undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import { describe, expect, it } from '@jest/globals'
import * as React from 'react'
import TestRenderer from 'react-test-renderer'

import { CryptoExchangeScene } from '../../components/scenes/CryptoExchangeScene'
import { SwapCreateScene } from '../../components/scenes/SwapCreateScene'
import { FakeProviders, FakeState } from '../../util/fake/FakeProviders'
import { fakeRootState } from '../../util/fake/fakeRootState'
import { fakeSceneProps } from '../../util/fake/fakeSceneProps'

describe('CryptoExchangeComponent', () => {
describe('SwapCreateScene', () => {
it('should render with loading props', () => {
const rootState: FakeState = { ...fakeRootState }

const renderer = TestRenderer.create(
<FakeProviders initialState={rootState}>
<CryptoExchangeScene {...fakeSceneProps('exchange', {})} />
<SwapCreateScene {...fakeSceneProps('swapCreate', {})} />
</FakeProviders>
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ import { describe, expect, it } from '@jest/globals'
import * as React from 'react'
import { createRenderer } from 'react-test-renderer/shallow'

import { CryptoExchangeSuccessComponent } from '../../components/scenes/CryptoExchangeSuccessScene'
import { SwapSuccessSceneComponent } from '../../components/scenes/SwapSuccessScene'
import { getTheme } from '../../components/services/ThemeContext'
import { fakeSceneProps } from '../../util/fake/fakeSceneProps'

describe('CryptoExchangeSuccessComponent', () => {
describe('SwapSuccessSceneComponent', () => {
it('should render with loading props', () => {
const renderer = createRenderer()

const fakeDisklet: any = {}

const actual = renderer.render(
<CryptoExchangeSuccessComponent {...fakeSceneProps('exchangeSuccess', {})} userId="" disklet={fakeDisklet} theme={getTheme()} />
)
const actual = renderer.render(<SwapSuccessSceneComponent {...fakeSceneProps('swapSuccess', {})} userId="" disklet={fakeDisklet} theme={getTheme()} />)

expect(actual).toMatchSnapshot()
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CryptoExchangeQuoteScreenComponent should render with loading props 1`] = `
exports[`SwapConfirmationScene should render with loading props 1`] = `
[
<BVLinearGradient
colors={
Expand Down Expand Up @@ -864,10 +864,10 @@ exports[`CryptoExchangeQuoteScreenComponent should render with loading props 1`]
{
"alignItems": "center",
"flexDirection": "row",
"flexGrow": 1,
"justifyContent": "space-between",
"marginVertical": 11,
"paddingHorizontal": 11,
"width": "100%",
}
}
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CryptoExchangeComponent should render with loading props 1`] = `
exports[`SwapCreateScene should render with loading props 1`] = `
[
<BVLinearGradient
colors={
Expand Down Expand Up @@ -236,99 +236,6 @@ exports[`CryptoExchangeComponent should render with loading props 1`] = `
}
>
<View>
<View
entering={BaseAnimationMock {}}
layout={BaseAnimationMock {}}
style={
{
"marginLeft": -11,
"marginVertical": 22,
"width": "100%",
}
}
>
<View
style={
[
{
"justifyContent": "center",
"marginHorizontal": 22,
"paddingBottom": 22,
},
null,
undefined,
]
}
>
<View
style={
{
"alignItems": "center",
"flexDirection": "row",
"justifyContent": "space-between",
}
}
>
<Text
adjustsFontSizeToFit={true}
minimumFontScale={0.65}
numberOfLines={1}
style={
[
{
"color": "#FFFFFF",
"fontFamily": "Quicksand-Regular",
"fontSize": 22,
"includeFontPadding": false,
},
{
"fontFamily": "Quicksand-Medium",
"fontSize": 27,
},
null,
]
}
>
Exchange
</Text>
</View>
</View>
<BVLinearGradient
colors={
[
452984831,
452984831,
]
}
endPoint={
{
"x": 1,
"y": 0.5,
}
}
locations={null}
startPoint={
{
"x": 0,
"y": 0.5,
}
}
style={
[
{
"alignSelf": "stretch",
"height": 1,
},
{
"marginBottom": 0,
"marginLeft": 22,
"marginRight": 0,
"marginTop": 0,
},
]
}
/>
</View>
<View
entering={BaseAnimationMock {}}
layout={BaseAnimationMock {}}
Expand Down Expand Up @@ -369,9 +276,11 @@ exports[`CryptoExchangeComponent should render with loading props 1`] = `
"flexGrow": 0,
"flexShrink": 0,
"justifyContent": "center",
"margin": -11,
"opacity": 1,
"padding": 11,
"paddingBottom": 22,
"paddingLeft": 0,
"paddingRight": 0,
"paddingTop": 22,
}
}
>
Expand Down Expand Up @@ -442,7 +351,7 @@ exports[`CryptoExchangeComponent should render with loading props 1`] = `
]
}
>
Select Source Wallet
Select Receiving Wallet
</Text>
</BVLinearGradient>
</View>
Expand All @@ -455,10 +364,10 @@ exports[`CryptoExchangeComponent should render with loading props 1`] = `
{
"alignItems": "center",
"flexDirection": "row",
"flexGrow": 1,
"justifyContent": "space-between",
"marginVertical": 11,
"paddingHorizontal": 11,
"width": "100%",
}
}
>
Expand All @@ -471,35 +380,73 @@ exports[`CryptoExchangeComponent should render with loading props 1`] = `
}
}
/>
<Text
adjustsFontSizeToFit={true}
minimumFontScale={0.65}
numberOfLines={1}
<View
accessibilityState={
{
"busy": undefined,
"checked": undefined,
"disabled": false,
"expanded": undefined,
"selected": undefined,
}
}
accessibilityValue={
{
"max": undefined,
"min": undefined,
"now": undefined,
"text": undefined,
}
}
accessible={false}
collapsable={false}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
[
{
"color": "#FFFFFF",
"fontFamily": "Quicksand-Regular",
"fontSize": 22,
"includeFontPadding": false,
},
{
"marginBottom": 0,
"marginLeft": 0,
"marginRight": 0,
"marginTop": 0,
"opacity": 1,
"paddingBottom": 0,
"paddingLeft": 11,
"paddingRight": 11,
"paddingTop": 0,
}
}
>
<Text
adjustsFontSizeToFit={true}
allowFontScaling={false}
style={
[
{
"color": "#3dd9f4",
"fontFamily": "Quicksand-Medium",
"fontSize": 22,
"paddingHorizontal": 17,
"color": undefined,
"fontSize": 12,
},
{
"textTransform": "lowercase",
"color": "#00f1a2",
"fontSize": 45,
},
],
null,
]
}
>
To
</Text>
{
"fontFamily": "Ionicons",
"fontStyle": "normal",
"fontWeight": "normal",
},
{},
]
}
>
</Text>
</View>
<View
style={
{
Expand Down Expand Up @@ -551,9 +498,11 @@ exports[`CryptoExchangeComponent should render with loading props 1`] = `
"flexGrow": 0,
"flexShrink": 0,
"justifyContent": "center",
"margin": -11,
"opacity": 1,
"padding": 11,
"paddingBottom": 22,
"paddingLeft": 0,
"paddingRight": 0,
"paddingTop": 22,
}
}
>
Expand Down Expand Up @@ -624,7 +573,7 @@ exports[`CryptoExchangeComponent should render with loading props 1`] = `
]
}
>
Select Receiving Wallet
Select Source Wallet
</Text>
</BVLinearGradient>
</View>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CryptoExchangeSuccessComponent should render with loading props 1`] = `
exports[`SwapSuccessSceneComponent should render with loading props 1`] = `
<Memo(SceneWrapperComponent)
hasNotifications={true}
>
Expand Down
2 changes: 1 addition & 1 deletion src/actions/DeepLinkingActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export async function handleLink(navigation: NavigationBase, dispatch: Dispatch,
}

case 'swap': {
navigation.navigate('exchangeTab', { screen: 'exchange' })
navigation.navigate('swapTab', { screen: 'swapCreate' })
return true
}

Expand Down
2 changes: 1 addition & 1 deletion src/actions/ScanActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export function checkAndShowGetCryptoModal(navigation: NavigationBase, wallet: E
if (threeButtonModal === 'buy') {
navigation.navigate('buyTab', { screen: 'pluginListBuy' })
} else if (threeButtonModal === 'exchange') {
navigation.navigate('exchangeTab', { screen: 'exchange', params: { toWalletId: wallet.id, toTokenId: tokenId } })
navigation.navigate('swapTab', { screen: 'swapCreate', params: { toWalletId: wallet.id, toTokenId: tokenId } })
}
} catch (e: any) {
// Don't bother the user with this error, but log it quietly:
Expand Down
Loading
Loading