Skip to content

Commit

Permalink
[Android]: Random bug fixes (#5195)
Browse files Browse the repository at this point in the history
* fix gradient on bottom of nft send sheet

* fix zora eth to weth swap decimal place

* adjust detection for button navigation

* Update src/hooks/useSwapAdjustedAmounts.ts

* fix overflow issue with language sheet

* fix lint
  • Loading branch information
walmat authored and benisgold committed Nov 21, 2023
1 parent 2dd078a commit 8a1a0ad
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 20 deletions.
9 changes: 6 additions & 3 deletions src/components/send/SendAssetFormCollectible.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Column } from '../layout';
import { useDimensions, useImageMetadata } from '@/hooks';
import styled from '@/styled-thing';
import { padding, position } from '@/styles';
import { IS_ANDROID } from '@/env';

const defaultImageDimensions = { height: 512, width: 512 };

Expand Down Expand Up @@ -127,9 +128,11 @@ export default function SendAssetFormCollectible({
{buttonRenderer}
{txSpeedRenderer}
</ButtonWrapper>
<GradientToggler isVisible={!isGradientVisible}>
<Gradient isTallPhone={isTallPhone} />
</GradientToggler>
{!IS_ANDROID && (
<GradientToggler isVisible={!isGradientVisible}>
<Gradient isTallPhone={isTallPhone} />
</GradientToggler>
)}
</Footer>
</Column>
);
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/statusBarHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ export const isUsingButtonNavigation = () => {
const deviceHeight = Dimensions.get('screen').height;
const windowHeight = Dimensions.get('window').height;
const bottomNavBarHeight = deviceHeight - windowHeight;
return bottomNavBarHeight > 80;
return bottomNavBarHeight > 24;
};
8 changes: 7 additions & 1 deletion src/hooks/useSwapAdjustedAmounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
WMATIC_POLYGON_ADDRESS,
WBNB_BSC_ADDRESS,
WETH_ARBITRUM_ADDRESS,
WETH_ZORA_ADDRESS,
} from '@/references';
import { fromWei, updatePrecisionToDisplay } from '@/helpers/utilities';
import { ethereumUtils } from '@/utils';
Expand Down Expand Up @@ -63,7 +64,12 @@ export default function useSwapAdjustedAmounts(tradeDetails: Quote) {
(tradeDetails.buyTokenAddress === ETH_ADDRESS &&
tradeDetails.sellTokenAddress === WETH_ARBITRUM_ADDRESS) ||
(tradeDetails.sellTokenAddress === ETH_ADDRESS &&
tradeDetails.buyTokenAddress === WETH_ARBITRUM_ADDRESS)
tradeDetails.buyTokenAddress === WETH_ARBITRUM_ADDRESS) ||
// zora eth <-> weth swap
(tradeDetails.buyTokenAddress === ETH_ADDRESS &&
tradeDetails.sellTokenAddress === WETH_ZORA_ADDRESS) ||
(tradeDetails.sellTokenAddress === ETH_ADDRESS &&
tradeDetails.buyTokenAddress === WETH_ZORA_ADDRESS)
) {
amountReceivedSold = fromWei(amountReceivedSold.toString());
}
Expand Down
1 change: 1 addition & 0 deletions src/references/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const WETH_POLYGON_ADDRESS =
'0x7ceb23fd6bc0add59e62ac25578270cff1b9f619';
export const WETH_ARBITRUM_ADDRESS =
'0x82af49447d8a07e3bd95bd0d56f35241523fbab1';
export const WETH_ZORA_ADDRESS = '0x4200000000000000000000000000000000000006';
export const DAI_POLYGON_ADDRESS = '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063';
export const WMATIC_POLYGON_ADDRESS =
'0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270';
Expand Down
52 changes: 37 additions & 15 deletions src/screens/SettingsSheet/components/LanguageSection.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import lang from 'i18n-js';
import React, { useCallback } from 'react';
import { resources, supportedLanguages } from '../../../languages';
import Menu from './Menu';
Expand All @@ -6,6 +7,8 @@ import MenuItem from './MenuItem';
import { analytics } from '@/analytics';
import { pickBy } from '@/helpers/utilities';
import { useAccountSettings } from '@/hooks';
import { BackgroundProvider, Box, Inline, Inset, Text } from '@/design-system';
import { SimpleSheet } from '@/components/sheet/SimpleSheet';

const languagesWithWalletTranslations = Object.keys(
pickBy(resources, language => language?.translation?.wallet) // Only show languages that have 'wallet' translations available.
Expand All @@ -28,21 +31,40 @@ const LanguageSection = () => {
);

return (
<MenuContainer>
<Menu>
{languageListItems.map(({ name, code }: any) => (
<MenuItem
key={code}
onPress={() => onSelectLanguage(code)}
rightComponent={
code === language && <MenuItem.StatusIcon status="selected" />
}
size={52}
titleComponent={<MenuItem.Title text={name} />}
/>
))}
</Menu>
</MenuContainer>
<BackgroundProvider color="surfaceSecondary">
{({ backgroundColor }) => (
<SimpleSheet backgroundColor={backgroundColor as string}>
<Inset top="20px" horizontal="20px" bottom="60px">
<Inline alignHorizontal="center" alignVertical="center">
<Box paddingBottom="12px">
<Text size="22pt" weight="heavy" color="label">
{lang.t('settings.language')}
</Text>
</Box>
</Inline>
<Box>
<MenuContainer>
<Menu>
{languageListItems.map(({ name, code }: any) => (
<MenuItem
key={code}
onPress={() => onSelectLanguage(code)}
rightComponent={
code === language && (
<MenuItem.StatusIcon status="selected" />
)
}
size={52}
titleComponent={<MenuItem.Title text={name} />}
/>
))}
</Menu>
</MenuContainer>
</Box>
</Inset>
</SimpleSheet>
)}
</BackgroundProvider>
);
};

Expand Down

0 comments on commit 8a1a0ad

Please sign in to comment.