Skip to content

Commit

Permalink
Merge pull request #5263 from EdgeApp/william/router-types
Browse files Browse the repository at this point in the history
Router types
  • Loading branch information
swansontec authored Sep 23, 2024
2 parents bafaddd + 2469445 commit 468194f
Show file tree
Hide file tree
Showing 56 changed files with 388 additions and 347 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/scenes/ChangePasswordScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('ChangePasswordScene', () => {

const actual = renderer.render(
<FakeProviders initialState={rootState}>
<ChangePasswordScene {...fakeSceneProps('changePassword', {})} />
<ChangePasswordScene {...fakeSceneProps('changePassword', undefined)} />
</FakeProviders>
)

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/scenes/ChangePinScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('ChangePinComponent', () => {

const actual = renderer.render(
<FakeProviders initialState={rootState}>
<ChangePinScene {...fakeSceneProps('changePin', {})} />
<ChangePinScene {...fakeSceneProps('changePin', undefined)} />
</FakeProviders>
)

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/scenes/DefaultFiatSettingScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('DefaultFiatSettingComponent', () => {

const actual = renderer.render(
<DefaultFiatSettingComponent
{...fakeSceneProps('defaultFiatSetting', {})}
{...fakeSceneProps('defaultFiatSetting', undefined)}
supportedFiats={[
{
label: 'Dollars',
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/scenes/FioAddressListScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('FioAddressList', () => {

const actual = renderer.render(
<FioAddressList
{...fakeSceneProps('fioAddressList', {})}
{...fakeSceneProps('fioAddressList', undefined)}
fioAddresses={[
{
name: 'fio@edge',
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/scenes/FioAddressRegisterScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('FioAddressRegister', () => {

const actual = renderer.render(
<FioAddressRegister
{...fakeSceneProps('fioAddressRegister', {})}
{...fakeSceneProps('fioAddressRegister', undefined)}
fioWallets={[fakeWallet]}
fioPlugin={
{
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/scenes/FioDomainRegisterScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('FioDomainRegister', () => {

const actual = renderer.render(
<FioDomainRegister
{...fakeSceneProps('fioDomainRegister', {})}
{...fakeSceneProps('fioDomainRegister', undefined)}
fioWallets={[fakeWallet]}
fioPlugin={
{
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/scenes/SettingsScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('SettingsScene', () => {
it('should render SettingsScene', () => {
const renderer = TestRenderer.create(
<FakeProviders initialState={mockState}>
<SettingsScene {...fakeSceneProps('settingsOverview', {})} />
<SettingsScene {...fakeSceneProps('settingsOverview', undefined)} />
</FakeProviders>
)

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/scenes/SwapSuccessScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('SwapSuccessSceneComponent', () => {

const renderer = TestRenderer.create(
<FakeProviders initialState={fakeState}>
<SwapSuccessScene {...fakeSceneProps('swapSuccess', {})} />
<SwapSuccessScene {...fakeSceneProps('swapSuccess', undefined)} />
</FakeProviders>
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ exports[`ChangePasswordScene should render with loading props 1`] = `
{
"key": "changePassword-0",
"name": "changePassword",
"params": {},
"params": undefined,
}
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ exports[`ChangePinComponent should render with loading props 1`] = `
{
"key": "changePin-0",
"name": "changePin",
"params": {},
"params": undefined,
}
}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/actions/BackupModalActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const showBackupModal = (props: { navigation: NavigationBase; forgetLogin
})
.then((userSel?: BackupModalResult) => {
if (userSel === 'upgrade') {
navigation.navigate('upgradeUsername', {})
navigation.navigate('upgradeUsername')
}
})
.finally(() => {
Expand All @@ -43,7 +43,7 @@ export const checkAndShowLightBackupModal = (account: EdgeAccount, navigation: N
})
.then((userSel?: BackupForTransferModalResult) => {
if (userSel === 'upgrade') {
navigation.navigate('upgradeUsername', {})
navigation.navigate('upgradeUsername')
}
})
.finally(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/actions/DeepLinkingActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ async function handleLink(navigation: NavigationBase, dispatch: Dispatch, state:
} else {
showError(lstrings.azteco_service_unavailable)
}
navigation.navigate('homeTab', { screen: 'home' })
navigation.navigate('home')
break
}

Expand Down
17 changes: 13 additions & 4 deletions src/actions/LoginActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,11 @@ export function initializeAccount(navigation: NavigationBase, account: EdgeAccou
// during account creation
await readLocalAccountSettings(account)

const newAccountFlow = async (navigation: NavigationProp<'createWalletSelectCrypto'>, items: WalletCreateItem[]) => {
navigation.replace('edgeTabs', { screen: 'homeTab', params: { screen: 'home' } })
const newAccountFlow = async (
navigation: NavigationProp<'createWalletSelectCrypto' | 'createWalletSelectCryptoNewAccount'>,
items: WalletCreateItem[]
) => {
navigation.replace('edgeTabs', { screen: 'home' })
const createWalletsPromise = createCustomWallets(account, fiatCurrencyCode, items, dispatch).catch(error => showError(error))

// New user FIO handle registration flow (if env is properly configured)
Expand All @@ -114,7 +117,13 @@ export function initializeAccount(navigation: NavigationBase, account: EdgeAccou

performance.mark('loginEnd', { detail: { isNewAccount: newAccount } })
} else {
rootNavigation.replace('edgeApp', {})
rootNavigation.replace('edgeApp', {
screen: 'edgeAppStack',
params: {
screen: 'edgeTabs',
params: { screen: 'home' }
}
})
referralPromise.catch(() => console.log(`Failed to load account referral info`))

performance.mark('loginEnd', { detail: { isNewAccount: newAccount } })
Expand Down Expand Up @@ -157,7 +166,7 @@ export function initializeAccount(navigation: NavigationBase, account: EdgeAccou

// Check for security alerts:
if (hasSecurityAlerts(account)) {
navigation.push('securityAlerts', {})
navigation.push('securityAlerts')
hideSurvey = true
}

Expand Down
2 changes: 1 addition & 1 deletion src/actions/RecoveryReminderActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ async function showReminderModal(navigation: NavigationBase) {
}}
/>
))
if (reply === 'ok') navigation.push('passwordRecovery', {})
if (reply === 'ok') navigation.push('passwordRecovery')
}
7 changes: 3 additions & 4 deletions src/actions/ScanActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { config } from '../theme/appConfig'
import { RequestAddressLink } from '../types/DeepLinkTypes'
import { Dispatch, RootState, ThunkAction } from '../types/reduxTypes'
import { NavigationBase } from '../types/routerTypes'
import { getCurrencyCode, getWalletTokenId } from '../util/CurrencyInfoHelpers'
import { getCurrencyCode } from '../util/CurrencyInfoHelpers'
import { parseDeepLink } from '../util/DeepLinkParser'
import { logActivity } from '../util/logger'
import { makeCurrencyCodeTable, upgradeCurrencyCodes } from '../util/tokenIdTools'
Expand Down Expand Up @@ -103,14 +103,13 @@ export const doRequestAddress = async (navigation: NavigationBase, account: Edge
<WalletListModal bridge={bridge} navigation={navigation} headerTitle={lstrings.select_wallet} allowedAssets={edgeAssets} showCreateWallet />
)).then(async result => {
if (result?.type === 'wallet') {
const { walletId, currencyCode } = result
const { walletId, tokenId } = result
const { currencyWallets } = account
const wallet = currencyWallets[walletId]
const tokenId = getWalletTokenId(wallet, currencyCode)

// TODO: Extend getReceiveAddress() to generate the full bitcion:XXXX address instead of using raw addresses here
const { publicAddress } = await wallet.getReceiveAddress({ tokenId })
jsonPayloadMap[`${currencyWallets[walletId].currencyInfo.currencyCode}_${currencyCode}`] = publicAddress
jsonPayloadMap[`${currencyWallets[walletId].currencyInfo.currencyCode}_${getCurrencyCode(wallet, tokenId)}`] = publicAddress
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/actions/SettingsActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export function showRestoreWalletsModal(navigation: NavigationBase): ThunkAction
)
logActivity(`Restore Wallets: ${account.username}`)

navigation.navigate('homeTab', { screen: 'home' })
navigation.navigate('home')
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/FioAddress/DomainListModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class DomainListModalComponent extends React.Component<Props, State> {
registerNewDomain = () => {
const { bridge, navigation } = this.props
bridge.resolve(undefined)
navigation.navigate('fioDomainRegister', {})
navigation.navigate('fioDomainRegister')
}

selectItem = (value: any) => this.props.bridge.resolve(value)
Expand Down
Loading

0 comments on commit 468194f

Please sign in to comment.