-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'NOTIFY-1236/add-GoogleService.plist-build-process' of g…
…ithub.com:MetaMask/metamask-mobile into NOTIFY-1236/add-GoogleService.plist-build-process
- Loading branch information
Showing
47 changed files
with
2,278 additions
and
864 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
23 changes: 23 additions & 0 deletions
23
app/components/UI/Stake/Views/UnstakeConfirmationView/UnstakeConfirmationView.styles.ts
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,23 @@ | ||
import { StyleSheet } from 'react-native'; | ||
import { Theme } from '../../../../../util/theme/models'; | ||
|
||
const styleSheet = (params: { theme: Theme }) => { | ||
const { theme } = params; | ||
const { colors } = theme; | ||
|
||
return StyleSheet.create({ | ||
mainContainer: { | ||
paddingTop: 8, | ||
paddingHorizontal: 16, | ||
backgroundColor: colors.background.alternative, | ||
height: '100%', | ||
justifyContent: 'space-between', | ||
}, | ||
cardsContainer: { | ||
paddingTop: 8, | ||
gap: 8, | ||
}, | ||
}); | ||
}; | ||
|
||
export default styleSheet; |
81 changes: 81 additions & 0 deletions
81
app/components/UI/Stake/Views/UnstakeConfirmationView/UnstakeConfirmationView.test.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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import React from 'react'; | ||
import UnstakeConfirmationView from './UnstakeConfirmationView'; | ||
import renderWithProvider from '../../../../../util/test/renderWithProvider'; | ||
import { Image } from 'react-native'; | ||
import { createMockAccountsControllerState } from '../../../../../util/test/accountsControllerTestUtils'; | ||
import { backgroundState } from '../../../../../util/test/initial-root-state'; | ||
import { UnstakeConfirmationViewProps } from './UnstakeConfirmationView.types'; | ||
|
||
const MOCK_ADDRESS_1 = '0x0'; | ||
const MOCK_ADDRESS_2 = '0x1'; | ||
|
||
const MOCK_ACCOUNTS_CONTROLLER_STATE = createMockAccountsControllerState([ | ||
MOCK_ADDRESS_1, | ||
MOCK_ADDRESS_2, | ||
]); | ||
|
||
const mockInitialState = { | ||
settings: {}, | ||
engine: { | ||
backgroundState: { | ||
...backgroundState, | ||
AccountsController: MOCK_ACCOUNTS_CONTROLLER_STATE, | ||
}, | ||
}, | ||
}; | ||
|
||
jest.mock('../../../../hooks/useIpfsGateway', () => jest.fn()); | ||
|
||
Image.getSize = jest.fn((_uri, success) => { | ||
success(100, 100); // Mock successful response for ETH native Icon Image | ||
}); | ||
|
||
const mockNavigate = jest.fn(); | ||
const mockSetOptions = jest.fn(); | ||
|
||
jest.mock('@react-navigation/native', () => { | ||
const actualReactNavigation = jest.requireActual('@react-navigation/native'); | ||
return { | ||
...actualReactNavigation, | ||
useNavigation: () => ({ | ||
navigate: mockNavigate, | ||
setOptions: mockSetOptions, | ||
}), | ||
}; | ||
}); | ||
|
||
jest.mock('../../hooks/usePoolStakedDeposit', () => ({ | ||
__esModule: true, | ||
default: () => ({ | ||
attemptDepositTransaction: jest.fn(), | ||
}), | ||
})); | ||
|
||
jest.mock('../../hooks/usePooledStakes', () => ({ | ||
__esModule: true, | ||
default: () => ({ | ||
refreshPooledStakes: jest.fn(), | ||
}), | ||
})); | ||
|
||
describe('UnstakeConfirmationView', () => { | ||
it('render matches snapshot', () => { | ||
const props: UnstakeConfirmationViewProps = { | ||
route: { | ||
key: '1', | ||
name: 'params', | ||
params: { | ||
amountWei: '4999820000000000000', | ||
amountFiat: '12894.52', | ||
}, | ||
}, | ||
}; | ||
|
||
const { toJSON } = renderWithProvider( | ||
<UnstakeConfirmationView {...props} />, | ||
{ state: mockInitialState }, | ||
); | ||
|
||
expect(toJSON()).toMatchSnapshot(); | ||
}); | ||
}); |
61 changes: 61 additions & 0 deletions
61
app/components/UI/Stake/Views/UnstakeConfirmationView/UnstakeConfirmationView.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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { View } from 'react-native'; | ||
import React, { useEffect } from 'react'; | ||
import { useNavigation } from '@react-navigation/native'; | ||
import styleSheet from './UnstakeConfirmationView.styles'; | ||
import { useStyles } from '../../../../hooks/useStyles'; | ||
import { getStakingNavbar } from '../../../Navbar'; | ||
import { strings } from '../../../../../../locales/i18n'; | ||
import YouReceiveCard from '../../components/StakingConfirmation/YouReceiveCard/YouReceiveCard'; | ||
import UnstakingTimeCard from '../../components/StakingConfirmation/UnstakeTimeCard/UnstakeTimeCard'; | ||
import { UnstakeConfirmationViewProps } from './UnstakeConfirmationView.types'; | ||
import TokenValueStack from '../../components/StakingConfirmation/TokenValueStack/TokenValueStack'; | ||
import AccountCard from '../../components/StakingConfirmation/AccountCard/AccountCard'; | ||
import ConfirmationFooter from '../../components/StakingConfirmation/ConfirmationFooter/ConfirmationFooter'; | ||
import { FooterButtonGroupActions } from '../../components/StakingConfirmation/ConfirmationFooter/FooterButtonGroup/FooterButtonGroup.types'; | ||
|
||
const MOCK_STAKING_CONTRACT_NAME = 'MM Pooled Staking'; | ||
|
||
const UnstakeConfirmationView = ({ route }: UnstakeConfirmationViewProps) => { | ||
const { styles, theme } = useStyles(styleSheet, {}); | ||
|
||
const navigation = useNavigation(); | ||
|
||
useEffect(() => { | ||
navigation.setOptions( | ||
getStakingNavbar(strings('stake.unstake'), navigation, theme.colors, { | ||
backgroundColor: theme.colors.background.alternative, | ||
hasCancelButton: false, | ||
}), | ||
); | ||
}, [navigation, theme.colors]); | ||
|
||
return ( | ||
<View style={styles.mainContainer}> | ||
<View> | ||
<TokenValueStack | ||
amountWei={route.params.amountWei} | ||
amountFiat={`$${route.params.amountFiat}`} | ||
tokenSymbol="ETH" | ||
/> | ||
<View style={styles.cardsContainer}> | ||
<YouReceiveCard | ||
amountWei={route.params.amountWei} | ||
amountFiat={route.params.amountFiat} | ||
/> | ||
<AccountCard | ||
contractName={MOCK_STAKING_CONTRACT_NAME} | ||
primaryLabel={strings('stake.unstaking_to')} | ||
secondaryLabel={strings('stake.interacting_with')} | ||
/> | ||
<UnstakingTimeCard /> | ||
</View> | ||
</View> | ||
<ConfirmationFooter | ||
valueWei={route.params.amountWei} | ||
action={FooterButtonGroupActions.UNSTAKE} | ||
/> | ||
</View> | ||
); | ||
}; | ||
|
||
export default UnstakeConfirmationView; |
10 changes: 10 additions & 0 deletions
10
app/components/UI/Stake/Views/UnstakeConfirmationView/UnstakeConfirmationView.types.ts
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,10 @@ | ||
import { RouteProp } from '@react-navigation/native'; | ||
|
||
interface UnstakeConfirmationViewRouteParams { | ||
amountWei: string; | ||
amountFiat: string; | ||
} | ||
|
||
export interface UnstakeConfirmationViewProps { | ||
route: RouteProp<{ params: UnstakeConfirmationViewRouteParams }, 'params'>; | ||
} |
Oops, something went wrong.