Skip to content

Commit

Permalink
Merge branch 'feature/tx-review' into feature/tx-review-token-details
Browse files Browse the repository at this point in the history
  • Loading branch information
banklesss committed Oct 4, 2024
2 parents b37bf4a + 81123b3 commit 0f6e61d
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 149 deletions.
3 changes: 0 additions & 3 deletions apps/wallet-mobile/src/AppNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
useShowDarkThemeAnnouncementScreen,
} from './features/Initialization/DarkThemeAnnouncement/DarkThemeAnnouncement'
import {useDeepLinkWatcher} from './features/Links/common/useDeepLinkWatcher'
import {PortfolioScreen} from './features/Portfolio/useCases/PortfolioScreen'
import {SearchProvider} from './features/Search/SearchContext'
import {SetupWalletNavigator} from './features/SetupWallet/SetupWalletNavigator'
import {useHasWallets} from './features/WalletManager/common/hooks/useHasWallets'
Expand Down Expand Up @@ -202,8 +201,6 @@ export const AppNavigator = () => {
<Stack.Screen name="storybook" component={StorybookScreen} />

<Stack.Screen name="playground" component={Playground} />

<Stack.Screen name="portfolio-dashboard" component={PortfolioScreen} />
</Stack.Group>
)}
</Stack.Navigator>
Expand Down
2 changes: 0 additions & 2 deletions apps/wallet-mobile/src/features/Dev/DeveloperScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ export const DeveloperScreen = () => {
onPress={() => storageVersionMaker(rootStorage).remove()}
/>

<Button title="Portfolio" style={styles.button} onPress={() => navigation.navigate('portfolio-dashboard')} />

<Button
title="Logout"
style={styles.button}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {useTheme} from '@yoroi/theme'
import * as React from 'react'

import {Boundary} from '../../components/Boundary/Boundary'
import {defaultStackNavigationOptions, Portfolio2Routes} from '../../kernel/navigation'
import {defaultStackNavigationOptions, PortfolioRoutes} from '../../kernel/navigation'
import {SearchProvider} from '../Search/SearchContext'
import {NetworkTag} from '../Settings/ChangeNetwork/NetworkTag'
import {TxDetails} from '../Transactions/useCases/TxDetails/TxDetails'
Expand All @@ -15,7 +15,7 @@ import ExportTokenTransactions from './useCases/PortfolioTokenDetails/ExportToke
import {PortfolioTokenDetailsScreen} from './useCases/PortfolioTokenDetails/PortfolioTokenDetailsScreen'
import {PortfolioTokenListScreen} from './useCases/PortfolioTokensList/PortfolioTokenListScreen'

const Stack = createStackNavigator<Portfolio2Routes>()
const Stack = createStackNavigator<PortfolioRoutes>()

export const PortfolioNavigator = () => {
const {atoms, color} = useTheme()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import {NavigationProp, useNavigation} from '@react-navigation/native'
import {Portfolio} from '@yoroi/types'
import * as React from 'react'

import {Portfolio2Routes, useParams} from '../../../../kernel/navigation'
import {PortfolioRoutes, useParams} from '../../../../kernel/navigation'
import {isEmptyString} from '../../../../kernel/utils'

export const useNavigateTo = () => {
const navigation = useNavigation<NavigationProp<Portfolio2Routes>>()
const navigation = useNavigation<NavigationProp<PortfolioRoutes>>()

return React.useRef({
tokensList: () => navigation.navigate('portfolio-tokens-list'),
Expand All @@ -15,7 +15,17 @@ export const useNavigateTo = () => {
nftsList: () => navigation.navigate('portfolio-nfts', {screen: 'nft-gallery'}),
nftDetails: (id: Portfolio.Token.Id) =>
navigation.navigate('portfolio-nfts', {screen: 'nft-details', params: {id}, initial: false}),
send: () => navigation.navigate('history', {screen: 'send-start-tx'}),
resetTabAndSend: () => {
navigation.reset({index: 0, routes: [{name: 'dashboard-portfolio'}]})
navigation.navigate('history', {screen: 'send-start-tx'})
},
resetTabAndSwap: () => {
navigation.reset({index: 0, routes: [{name: 'dashboard-portfolio'}]})
navigation.navigate('history', {
screen: 'swap-start-swap',
params: {screen: 'token-swap'},
})
},
swap: () =>
navigation.navigate('history', {
screen: 'swap-start-swap',
Expand All @@ -33,7 +43,7 @@ export const useNavigateTo = () => {
} as const).current
}

type PortfolioTokenDetailParams = Portfolio2Routes['portfolio-token-details']
type PortfolioTokenDetailParams = PortfolioRoutes['portfolio-token-details']

const isPortfolioTokenDetailParams = (
params?: PortfolioTokenDetailParams | object | undefined,
Expand Down
110 changes: 0 additions & 110 deletions apps/wallet-mobile/src/features/Portfolio/useCases/PortfolioScreen.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ export const Actions = ({tokenInfo}: Props) => {
from_asset: [
{asset_name: portfolioPrimaryTokenInfo.name, asset_ticker: portfolioPrimaryTokenInfo.ticker, policy_id: ''},
],
to_asset: [
{asset_name: tokenInfo.name ?? '', asset_ticker: tokenInfo.ticker ?? '', policy_id: tokenInfo.id ?? ''},
],
to_asset: [{asset_name: tokenInfo.name, asset_ticker: tokenInfo.ticker, policy_id: tokenInfo.id}],
order_type: swap.orderData.type,
slippage_tolerance: swap.orderData.slippage,
})

navigateTo.swap()
navigateTo.resetTabAndSwap()
}

return (
Expand All @@ -64,7 +62,7 @@ export const Actions = ({tokenInfo}: Props) => {
outlineOnLight
title={strings.send.toLocaleUpperCase()}
startContent={<Icon.Send color={colors.primary} size={24} />}
onPress={navigateTo.send}
onPress={navigateTo.resetTabAndSend}
/>

<Button
Expand Down
10 changes: 3 additions & 7 deletions apps/wallet-mobile/src/kernel/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const defaultMaterialTopTabNavigationOptions = (
// ROUTES
export type WalletTabRoutes = {
history: NavigatorScreenParams<TxHistoryRoutes>
portfolio: NavigatorScreenParams<Portfolio2Routes>
portfolio: NavigatorScreenParams<PortfolioRoutes>
discover: NavigatorScreenParams<DiscoverRoutes>
menu: NavigatorScreenParams<MenuRoutes>
}
Expand Down Expand Up @@ -282,7 +282,7 @@ export type DashboardRoutes = {
'delegation-failed-tx': undefined
}

export type Portfolio2Routes = {
export type PortfolioRoutes = {
'dashboard-portfolio': undefined
'portfolio-tokens-list': undefined
'portfolio-token-details': {id: Portfolio.Token.Id}
Expand Down Expand Up @@ -348,11 +348,7 @@ type MenuRoutes = {
'voting-registration': undefined
}

type PortfolioRoutes = {
'portfolio-dashboard': undefined
}

export type AppRoutes = PortfolioRoutes & {
export type AppRoutes = {
'first-run': NavigatorScreenParams<FirstRunRoutes>
developer: undefined
storybook: undefined
Expand Down
32 changes: 16 additions & 16 deletions apps/wallet-mobile/translations/messages/src/AppNavigator.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,59 @@
"defaultMessage": "!!!Enter PIN",
"file": "src/AppNavigator.tsx",
"start": {
"line": 233,
"line": 230,
"column": 17,
"index": 8555
"index": 8390
},
"end": {
"line": 236,
"line": 233,
"column": 3,
"index": 8645
"index": 8480
}
},
{
"id": "components.initialization.custompinscreen.title",
"defaultMessage": "!!!Set PIN",
"file": "src/AppNavigator.tsx",
"start": {
"line": 237,
"line": 234,
"column": 18,
"index": 8665
"index": 8500
},
"end": {
"line": 240,
"line": 237,
"column": 3,
"index": 8763
"index": 8598
}
},
{
"id": "global.actions.dialogs.walletKeysInvalidated.title",
"defaultMessage": "!!!Auth with OS changes",
"file": "src/AppNavigator.tsx",
"start": {
"line": 241,
"line": 238,
"column": 25,
"index": 8790
"index": 8625
},
"end": {
"line": 244,
"line": 241,
"column": 3,
"index": 8904
"index": 8739
}
},
{
"id": "global.actions.dialogs.biometricsChange.message",
"defaultMessage": "!!!Auth with OS changed detected",
"file": "src/AppNavigator.tsx",
"start": {
"line": 245,
"line": 242,
"column": 27,
"index": 8933
"index": 8768
},
"end": {
"line": 248,
"line": 245,
"column": 3,
"index": 9054
"index": 8889
}
}
]

0 comments on commit 0f6e61d

Please sign in to comment.