Skip to content

Commit

Permalink
Merge branch 'main' into feat/1940-add-custom-sentry-span
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioAslau committed Oct 22, 2024
2 parents 143731f + 7d4577f commit 3e97438
Show file tree
Hide file tree
Showing 207 changed files with 16,899 additions and 4,469 deletions.
8 changes: 1 addition & 7 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
ignores:
- '@metamask/oss-attribution-generator'
- 'webpack-cli'
- '@react-native-community/datetimepicker'
- '@react-native-community/slider'
- 'patch-package'
- '@lavamoat/allow-scripts'
Expand Down Expand Up @@ -48,22 +49,17 @@ ignores:
- 'rn-nodeify'

## Unused devDependencies to investigate
- '@ethersproject/abi'
- '@metamask/swappable-obj-proxy'
- '@react-native-picker/picker'
- '@rnhooks/keyboard'
- '@segment/sovran-react-native'
- '@tradle/react-native-http'
- 'asyncstorage-down'
- 'buffer'
- 'd3-shape'
- 'dnode'
- 'eciesjs'
- 'eth-block-tracker'
- 'eth-json-rpc-infura'
- 'events'
- 'https-browserify'
- 'obs-store'
- 'path'
- 'pbkdf2'
- 'pify'
Expand All @@ -72,11 +68,9 @@ ignores:
- 'react-native-aes-crypto'
- 'react-native-aes-crypto-forked'
- 'react-native-crypto'
- 'react-native-flash-message'
- 'react-native-level-fs'
- 'react-native-os'
- 'react-native-randombytes'
- 'react-native-redash'
- 'react-native-swipe-gestures'
- 'react-native-tcp'
- 'socket.io-client'
Expand Down
2 changes: 1 addition & 1 deletion .detoxrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
configurations: {
'ios.sim.apiSpecs': {
device: 'ios.simulator',
app: 'ios.qa',
app: process.env.CI ? 'ios.qa' :'ios.debug',
testRunner: {
args: {
"$0": "node e2e/api-specs/run-api-spec-tests.js",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
cache: yarn
- uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 #v1
with:
ruby-version: '3.1.5'
ruby-version: '3.1.6'
bundler-cache: true
env:
BUNDLE_GEMFILE: ios/Gemfile
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@ jobs:
cache: yarn
- name: Install dependencies
run: yarn --immutable
- name: Set Versions
id: set-versions
shell: bash
run: SEMVER_VERSION=${{ github.event.inputs.semver-version }} VERSION_NUMBER=${{ github.event.inputs.version-number }} yarn set-version
- name: Create Release PR
id: create-release-pr
- name: Create Release & Changelog PR
id: create-release-changelog-pr
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./scripts/create-release-pr.sh ${{ github.event.inputs.previous-version-tag }} ${{ github.event.inputs.semver-version }}
./scripts/create-release-pr.sh ${{ github.event.inputs.previous-version-tag }} ${{ github.event.inputs.semver-version }} ${{ github.event.inputs.version-number }}
7 changes: 5 additions & 2 deletions .js.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ export MM_ENABLE_SETTINGS_PAGE_DEV_OPTIONS="true"
# The endpoint used to submit errors and tracing data to Sentry for dev environment.
# export MM_SENTRY_DSN_DEV=

# Multichain Feature flag
export MULTICHAIN_V1=""
# Per dapp selected network (Amon Hen) feature flag
export MM_PER_DAPP_SELECTED_NETWORK=""

export MM_CHAIN_PERMISSIONS=""

#Multichain feature flag specific to UI changes
export MM_MULTICHAIN_V1_ENABLED=""
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.5
3.1.6
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const styleSheet = StyleSheet.create({
justifyContent: 'flex-start',
},
accountNameLabelText: {
marginLeft: 4,
paddingHorizontal: 8,
borderWidth: 1,
borderRadius: 8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ const AccountBase = ({

<View style={styles.accountNameLabel}>
<Text variant={TextVariant.BodyMDBold}>{accountName}</Text>
{accountTypeLabel && (
</View>
{accountTypeLabel && (
<View style={styles.accountNameLabel}>
<Text
variant={TextVariant.BodySM}
variant={TextVariant.BodyMDBold}
style={styles.accountNameLabelText}
>
{strings(accountTypeLabel)}
</Text>
)}
</View>
)}
</View>
</View>
<View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Input: React.FC<InputProps> = ({
isReadonly = false,
onBlur,
onFocus,
autoFocus = false,
autoFocus = true,
...props
}) => {
const [isFocused, setIsFocused] = useState(autoFocus);
Expand Down Expand Up @@ -64,7 +64,7 @@ const Input: React.FC<InputProps> = ({
{...props}
style={styles.base}
editable={!isDisabled && !isReadonly}
autoFocus
autoFocus={autoFocus}
onBlur={onBlurHandler}
onFocus={onFocusHandler}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports[`Input should render correctly 1`] = `
style={
{
"backgroundColor": "#ffffff",
"borderColor": "transparent",
"borderColor": "#0376c9",
"borderWidth": 1,
"color": "#141618",
"fontFamily": "Euclid Circular B",
Expand Down
7 changes: 3 additions & 4 deletions app/components/UI/AssetOverview/TokenDetails/TokenDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useSelector } from 'react-redux';
import i18n from '../../../../../locales/i18n';
import { useStyles } from '../../../../component-library/hooks';
import styleSheet from './TokenDetails.styles';
import { formatAddress, safeToChecksumAddress } from '../../../../util/address';
import { safeToChecksumAddress } from '../../../../util/address';
import { selectTokenList } from '../../../../selectors/tokenListController';
import { selectContractExchangeRates } from '../../../../selectors/tokenRatesController';
import {
Expand Down Expand Up @@ -75,13 +75,12 @@ const TokenDetails: React.FC<TokenDetailsProps> = ({ asset }) => {

const tokenDetails: TokenDetails = asset.isETH
? {
contractAddress: formatAddress(zeroAddress(), 'short'),
contractAddress: zeroAddress(),
tokenDecimal: 18,
tokenList: '',
}
: {
contractAddress:
formatAddress(tokenContractAddress as string, 'short') || null,
contractAddress: tokenContractAddress || null,
tokenDecimal: tokenMetadata?.decimals || null,
tokenList: tokenMetadata?.aggregators.join(', ') || null,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Icon, {
import ClipboardManager from '../../../../../core/ClipboardManager';
import { TokenDetails } from '../TokenDetails';
import TokenDetailsListItem from '../TokenDetailsListItem';
import { formatAddress } from '../../../../../util/address';

interface TokenDetailsListProps {
tokenDetails: TokenDetails;
Expand Down Expand Up @@ -62,7 +63,7 @@ const TokenDetailsList: React.FC<TokenDetailsListProps> = ({
onPress={copyAccountToClipboard}
>
<Text color={TextColor.Primary} variant={TextVariant.BodySM}>
{tokenDetails.contractAddress}
{formatAddress(tokenDetails.contractAddress, 'short')}
</Text>
<Icon
name={IconName.Copy}
Expand Down
4 changes: 2 additions & 2 deletions app/components/UI/CollectibleContracts/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('CollectibleContracts', () => {
AccountsController: MOCK_ACCOUNTS_CONTROLLER_STATE,
NftController: {
allNfts: {
[MOCK_ADDRESS]: {
[MOCK_ADDRESS.toLowerCase()]: {
'0x1': [
{
address: '0x72b1FDb6443338A158DeC2FbF411B71aeB157A42',
Expand Down Expand Up @@ -131,7 +131,7 @@ describe('CollectibleContracts', () => {
},
},
allNftContracts: {
[MOCK_ADDRESS]: {
[MOCK_ADDRESS.toLowerCase()]: {
'0x1': [
{
address: '0x72b1FDb6443338A158DeC2FbF411B71aeB157A42',
Expand Down
22 changes: 4 additions & 18 deletions app/components/UI/LedgerModals/LedgerConfirmationModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -407,24 +407,10 @@ describe('LedgerConfirmationModal', () => {
});

it('calls onRejection when user refuses confirmation', async () => {
const onRejection = jest.fn();
(useLedgerBluetooth as jest.Mock).mockReturnValue({
isSendingLedgerCommands: true,
isAppLaunchConfirmationNeeded: false,
ledgerLogicToRun: jest.fn(),
error: LedgerCommunicationErrors.UserRefusedConfirmation,
});

renderWithProvider(
<LedgerConfirmationModal
onConfirmation={jest.fn()}
onRejection={onRejection}
deviceId={'test'}
/>,
checkLedgerCommunicationErrorFlow(
LedgerCommunicationErrors.UserRefusedConfirmation,
strings('ledger.user_reject_transaction'),
strings('ledger.user_reject_transaction_message'),
);
// eslint-disable-next-line no-empty-function
await act(async () => {});

expect(onRejection).toHaveBeenCalled();
});
});
9 changes: 7 additions & 2 deletions app/components/UI/LedgerModals/LedgerConfirmationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ const LedgerConfirmationModal = ({
});
break;
case LedgerCommunicationErrors.UserRefusedConfirmation:
onReject();
setErrorDetails({
title: strings('ledger.user_reject_transaction'),
subtitle: strings('ledger.user_reject_transaction_message'),
});
break;
case LedgerCommunicationErrors.LedgerHasPendingConfirmation:
setErrorDetails({
Expand Down Expand Up @@ -275,7 +278,9 @@ const LedgerConfirmationModal = ({
isRetryHide={
ledgerError === LedgerCommunicationErrors.UnknownError ||
ledgerError === LedgerCommunicationErrors.NonceTooLow ||
ledgerError === LedgerCommunicationErrors.NotSupported
ledgerError === LedgerCommunicationErrors.NotSupported ||
ledgerError === LedgerCommunicationErrors.BlindSignError ||
ledgerError === LedgerCommunicationErrors.UserRefusedConfirmation
}
/>
</View>
Expand Down
63 changes: 45 additions & 18 deletions app/components/UI/Navbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1824,34 +1824,61 @@ export const getSettingsNavigationOptions = (title, themeColors) => {
};
};

export function getStakingNavbar(title, navigation, themeColors) {
/**
*
* @param {String} title - Navbar Title.
* @param {NavigationProp<ParamListBase>} navigation Navigation object returned from useNavigation hook.
* @param {ThemeColors} themeColors theme.colors returned from useStyles hook.
* @param {{ backgroundColor?: string, hasCancelButton?: boolean, hasBackButton?: boolean }} [options] - Optional options for navbar.
* @returns Staking Navbar Component.
*/
export function getStakingNavbar(title, navigation, themeColors, options) {
const { hasBackButton = true, hasCancelButton = true } = options ?? {};

const innerStyles = StyleSheet.create({
headerStyle: {
backgroundColor:
options?.backgroundColor ?? themeColors.background.default,
shadowOffset: null,
},
headerLeft: {
marginHorizontal: 16,
},
headerButtonText: {
color: themeColors.primary.default,
fontSize: 14,
...fontStyles.normal,
},
headerStyle: {
backgroundColor: themeColors.background.default,
shadowColor: importedColors.transparent,
elevation: 0,
},
});

function navigationPop() {
navigation.goBack();
}

return {
headerTitle: () => (
<NavbarTitle title={title} disableNetwork translate={false} />
),
headerLeft: () => <View />,
headerRight: () => (
<TouchableOpacity
onPress={() => navigation.dangerouslyGetParent()?.pop()}
style={styles.closeButton}
>
<Text style={innerStyles.headerButtonText}>
{strings('navigation.cancel')}
</Text>
</TouchableOpacity>
<MorphText variant={TextVariant.HeadingMD}>{title}</MorphText>
),
headerStyle: innerStyles.headerStyle,
headerLeft: () =>
hasBackButton ? (
<ButtonIcon
size={ButtonIconSizes.Lg}
iconName={IconName.ArrowLeft}
onPress={navigationPop}
style={innerStyles.headerLeft}
/>
) : null,
headerRight: () =>
hasCancelButton ? (
<TouchableOpacity
onPress={() => navigation.dangerouslyGetParent()?.pop()}
style={styles.closeButton}
>
<Text style={innerStyles.headerButtonText}>
{strings('navigation.cancel')}
</Text>
</TouchableOpacity>
) : null,
};
}
18 changes: 18 additions & 0 deletions app/components/UI/PermissionsSummary/PermissionsSummary.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@ const mockInitialState = {
};

describe('PermissionsSummary', () => {
it('should render correctly for network switch', () => {
const { toJSON } = renderWithProvider(
<PermissionsSummary
currentPageInformation={{
currentEnsName: '',
icon: '',
url: 'https://app.uniswap.org/',
}}
customNetworkInformation={{
chainName: 'Sepolia',
chainId: '0x1',
}}
isNetworkSwitch
/>,
{ state: mockInitialState },
);
expect(toJSON()).toMatchSnapshot();
});
it('should render correctly', () => {
const { toJSON } = renderWithProvider(
<PermissionsSummary
Expand Down
Loading

0 comments on commit 3e97438

Please sign in to comment.