Skip to content

Commit

Permalink
Revert #4568 Changes (#4573)
Browse files Browse the repository at this point in the history
* Revert "[UPGRADE] - update dependencies (#4568)"

This reverts commit e7c2391.

* Add audit fixes
  • Loading branch information
gantunesr authored Jun 23, 2022
1 parent 0713cb3 commit cb29c20
Show file tree
Hide file tree
Showing 25 changed files with 197 additions and 459 deletions.
27 changes: 0 additions & 27 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
# Changelog

## Current Main Branch
- [#4506](https://github.com/MetaMask/metamask-mobile/pull/4506): [IMPROVEMENT] Add OnRamp aggregator translations
- [#4389](https://github.com/MetaMask/metamask-mobile/pull/4389): [FEAT] Easy delete data
- [#4510](https://github.com/MetaMask/metamask-mobile/pull/4510): [IMPROVEMENT] Update RPC URL for xDai
- [#4269](https://github.com/MetaMask/metamask-mobile/pull/4269): [IMPROVEMENT] Show amount being approved by default on approval screens
- [#4495](https://github.com/MetaMask/metamask-mobile/pull/4495): [FIX] WalletConnect Icon on connect screen
- [#4505](https://github.com/MetaMask/metamask-mobile/pull/4505): [FIX] Updated new rpcUrl of gnosischain on test file
- [#4442](https://github.com/MetaMask/metamask-mobile/pull/4442): [FIX] Skip to amount to buy when region is selected
- [#4501](https://github.com/MetaMask/metamask-mobile/pull/4501): [FIX] Add accesible false to pressable group preventing VoiceOver interaction
- [#4247](https://github.com/MetaMask/metamask-mobile/pull/4247): [IMPROVEMENT] Add rounded corners to svg NFTs
- [#4470](https://github.com/MetaMask/metamask-mobile/pull/4470): [FIX] Add minimum required params to orders
- [#4469](https://github.com/MetaMask/metamask-mobile/pull/4469): [FIX] Displaying notification when state changes
- [#4443](https://github.com/MetaMask/metamask-mobile/pull/4443): [FIX] Wrong analytics property for region event
- [#4468](https://github.com/MetaMask/metamask-mobile/pull/4468): [FIX] Wrong amount out for onramp analytics
- [#4418](https://github.com/MetaMask/metamask-mobile/pull/4418): [IMPROVEMENT] Address Verification
- [#3783](https://github.com/MetaMask/metamask-mobile/pull/3783): [FEAT] Add custom networks
- [#4131](https://github.com/MetaMask/metamask-mobile/pull/4131): [FIX] Add method for crypto that are not in ISO4217
- [#4187](https://github.com/MetaMask/metamask-mobile/pull/4187): [IMPROVEMENT] Update copy in Edit & Advance Screens
- [#4060](https://github.com/MetaMask/metamask-mobile/pull/4060): [FIX] Avoid canceling transactions after submission
- [#4478](https://github.com/MetaMask/metamask-mobile/pull/4478): [IMPROVEMENT] Video subtitles
- [#4429](https://github.com/MetaMask/metamask-mobile/pull/4429): [FIX] Prompt camera permission
- [#4440](https://github.com/MetaMask/metamask-mobile/pull/4440): [FIX] Updating instances of "Metamask" to "MetaMask"
- [#4438](https://github.com/MetaMask/metamask-mobile/pull/4438): [FIX] Resolved spelling mistake
- [#4445](https://github.com/MetaMask/metamask-mobile/pull/4445): [FIX] Adding resolutions for security critical packages
- [#3943](https://github.com/MetaMask/metamask-mobile/pull/3943): [FIX] Remove old gas estimation
- [#4070](https://github.com/MetaMask/metamask-mobile/pull/4070): [IMPROVEMENT] Update SelectQRAccounts UI
- [#4178](https://github.com/MetaMask/metamask-mobile/pull/4178): [FIX] Prevent crash when funds warning is pressed
- [#4367](https://github.com/MetaMask/metamask-mobile/pull/4367): [IMPROVEMENT] Make text hex data selectable

## 5.2.0 - May 17, 2022
- [#4349](https://github.com/MetaMask/metamask-mobile/pull/4349): [FIX] Subtitle mapping
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ android {
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 926
versionName "5.3.0"
versionCode 913
versionName "5.2.0"
multiDexEnabled true
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy "minReactNative", "minReactNative46"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Device from '../../../../util/device';
import ErrorMessage from '../../../Views/SendFlow/ErrorMessage';
import { useAppThemeFromContext, mockTheme } from '../../../../util/theme';
import formatNumber from '../../../../util/formatNumber';
import { INTEGER_OR_FLOAT_REGEX } from '../../../../util/number';

const createStyles = (colors) =>
StyleSheet.create({
Expand Down Expand Up @@ -121,8 +120,7 @@ function EditPermission({

const displayErrorMessage = useMemo(
() =>
(!spendLimitUnlimitedSelected &&
!INTEGER_OR_FLOAT_REGEX.test(spendLimitCustomValue)) ||
!spendLimitUnlimitedSelected &&
Number(minimumSpendLimit) > spendLimitCustomValue,
[spendLimitUnlimitedSelected, spendLimitCustomValue, minimumSpendLimit],
);
Expand Down
24 changes: 8 additions & 16 deletions app/components/UI/DrawerView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ class DrawerView extends PureComponent {
currentRoute,
networkOnboarding,
networkOnboardedState,
switchedNetwork: { networkUrl, networkStatus },
switchedNetwork,
networkModalVisible,
} = this.props;
const colors = this.context.colors || mockTheme.colors;
Expand Down Expand Up @@ -1196,19 +1196,9 @@ class DrawerView extends PureComponent {
const fiatBalanceStr = renderFiat(this.currentBalance, currentCurrency);
const accountName = isDefaultAccountName(name) && ens ? ens : name;
const checkIfCustomNetworkExists = networkOnboardedState.filter(
(item) => item.network === sanitizeUrl(networkUrl),
(item) => item.network === sanitizeUrl(switchedNetwork.networkUrl),
);

const networkSwitchedAndInWalletView =
currentRoute === 'WalletView' &&
networkStatus &&
checkIfCustomNetworkExists.length === 0;

const canShowNetworkInfoModal =
showModal ||
networkOnboarding.showNetworkOnboarding ||
networkSwitchedAndInWalletView;

return (
<View style={styles.wrapper} testID={'drawer-screen'}>
<ScrollView>
Expand Down Expand Up @@ -1375,17 +1365,19 @@ class DrawerView extends PureComponent {
isVisible={
networkModalVisible || networkOnboarding.showNetworkOnboarding
}
onBackdropPress={
canShowNetworkInfoModal ? null : this.toggleNetworksModal
}
onBackdropPress={showModal ? null : this.toggleNetworksModal}
onBackButtonPress={showModal ? null : this.toggleNetworksModa}
onSwipeComplete={showModal ? null : this.toggleNetworksModa}
swipeDirection={'down'}
propagateSwipe
backdropColor={colors.overlay.default}
backdropOpacity={1}
>
{canShowNetworkInfoModal ? (
{showModal ||
networkOnboarding.showNetworkOnboarding ||
(currentRoute === 'WalletView' &&
switchedNetwork.networkStatus &&
checkIfCustomNetworkExists.length === 0) ? (
<NetworkInfo
onClose={this.onInfoNetworksModalClose}
type={networkType || networkOnboarding.networkType}
Expand Down
21 changes: 9 additions & 12 deletions app/components/UI/FiatOnRampAggregator/Views/AmountToBuy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -722,27 +722,24 @@ const AmountToBuy = () => {
<ScreenLayout>
<ScreenLayout.Body>
<ErrorView
icon="info"
title={strings('fiat_on_ramp_aggregator.no_tokens_available_title')}
description={strings(
'fiat_on_ramp_aggregator.no_tokens_available',
{
network: NETWORKS_NAMES[selectedChainId],
region: selectedRegion?.name,
},
)}
ctaLabel={strings('fiat_on_ramp_aggregator.change_payment_method')}
ctaOnPress={showPaymentMethodsModal as () => void}
ctaLabel={strings('fiat_on_ramp_aggregator.try_different_region')}
ctaOnPress={toggleRegionModal as () => void}
/>
</ScreenLayout.Body>
<PaymentMethodModal
isVisible={isPaymentMethodModalVisible}
dismiss={hidePaymentMethodModal as () => void}
title={strings('fiat_on_ramp_aggregator.select_payment_method')}
paymentMethods={filteredPaymentMethods}
selectedPaymentMethodId={selectedPaymentMethodId}
onItemPress={handleChangePaymentMethod}
location={'Amount to Buy Screen'}
<RegionModal
isVisible={isRegionModalVisible}
title={strings('fiat_on_ramp_aggregator.region.title')}
description={strings('fiat_on_ramp_aggregator.region.description')}
data={countries}
dismiss={hideRegionModal as () => void}
onRegionPress={handleRegionPress}
/>
</ScreenLayout>
);
Expand Down
46 changes: 7 additions & 39 deletions app/components/UI/FiatOnRampAggregator/components/ErrorView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import { Colors } from '../../../../util/theme/models';
const Text = BaseText as any;
const Title = BaseTitle as any;

type IconType = 'error' | 'info';

const createStyles = (colors: Colors) =>
StyleSheet.create({
screen: {
Expand All @@ -33,55 +31,22 @@ const createStyles = (colors: Colors) =>
row: {
marginVertical: 1,
},
icon: {
errorIcon: {
color: colors.error.default,
fontSize: 38,
marginVertical: 4,
textAlign: 'center',
},
errorIcon: {
color: colors.error.default,
},
infoIcon: {
color: colors.primary.default,
},
});

interface Props {
description: string; // The error description (Required)
title?: string; // The error title, default will be "Error" if not provided (Optional)
ctaLabel?: string; // The CTA button label, default will be "Try again" (Optional)
ctaOnPress?: () => any; // The optional callback to be invoked when pressing the CTA button (Optional)
icon?: IconType;
}

function ErrorIcon({ icon }: { icon: IconType }) {
const { colors } = useTheme();
const styles = createStyles(colors);
let name, style;
switch (icon) {
case 'info': {
name = 'information-outline';
style = styles.infoIcon;
break;
}
case 'error':
default: {
name = 'close-circle-outline';
style = styles.errorIcon;
break;
}
}

return <MaterialCommunityIcons name={name} style={[styles.icon, style]} />;
}

function ErrorView({
description,
title,
ctaLabel,
ctaOnPress,
icon = 'error',
}: Props) {
function ErrorView({ description, title, ctaLabel, ctaOnPress }: Props) {
const { colors } = useTheme();
const styles = createStyles(colors);

Expand All @@ -93,7 +58,10 @@ function ErrorView({
<View style={styles.screen}>
<View style={styles.content}>
<View style={styles.row}>
<ErrorIcon icon={icon} />
<MaterialCommunityIcons
name="close-circle-outline"
style={styles.errorIcon}
/>
</View>

<View style={styles.row}>
Expand Down
2 changes: 2 additions & 0 deletions app/components/UI/NetworkModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ const NetworkModals = (props: NetworkProps) => {
isVisible
toggleModal={showToolTip}
message={strings('networks.provider')}
clickText={undefined}
clickPress={undefined}
/>
)}
<View style={styles.nameWrapper} testID={APPROVE_NETWORK_MODAL_ID}>
Expand Down
66 changes: 25 additions & 41 deletions app/components/UI/Swaps/components/InfoModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,8 @@ const createStyles = (colors) =>
paddingHorizontal: 20,
},
messageLimit: {
width: '80%',
},
infoContainer: {
flexDirection: 'row',
justifyContent: 'space-between',
width: '100%',
width: '90%',
marginVertical: 10,
},
});

Expand All @@ -66,41 +62,12 @@ function InfoModal({
toggleModal,
message,
propagateSwipe,
urlText,
url,
clickText,
clickPress,
}) {
const { colors } = useAppThemeFromContext() || mockTheme;
const styles = createStyles(colors);

const CloseButton = () => (
<TouchableOpacity
onPress={toggleModal}
hitSlop={{ top: 20, left: 20, right: 20, bottom: 20 }}
>
<IonicIcon name="ios-close" style={styles.closeIcon} size={30} />
</TouchableOpacity>
);

const InfoView = () => {
if (!message) {
return <CloseButton />;
}

return (
<View style={styles.infoContainer}>
<Text style={styles.messageLimit}>
<Text>{message} </Text>
{urlText && (
<Text link onPress={url}>
{urlText}
</Text>
)}
</Text>
<CloseButton />
</View>
);
};

return (
<Modal
isVisible={isVisible}
Expand All @@ -111,12 +78,29 @@ function InfoModal({
style={styles.modal}
propagateSwipe={propagateSwipe}
backdropColor={colors.overlay.default}
backdropOpacity={1}
backdropOpacity={clickText ? 0.2 : 1}
>
<SafeAreaView style={styles.modalView}>
<View style={styles.title}>
{title && <Title>{title}</Title>}
<InfoView />
{message && (
<Text style={styles.messageLimit}>
<Text>{message} </Text>
{clickText && (
<Text link onPress={clickPress}>
{clickText}
</Text>
)}
</Text>
)}
{!message && (
<TouchableOpacity
onPress={toggleModal}
hitSlop={{ top: 20, left: 20, right: 20, bottom: 20 }}
>
<IonicIcon name="ios-close" style={styles.closeIcon} size={30} />
</TouchableOpacity>
)}
</View>
{body && <View style={styles.body}>{body}</View>}
</SafeAreaView>
Expand All @@ -130,8 +114,8 @@ InfoModal.propTypes = {
toggleModal: PropTypes.func,
propagateSwipe: PropTypes.bool,
message: PropTypes.string,
urlText: PropTypes.string,
url: PropTypes.func,
clickText: PropTypes.string,
clickPress: PropTypes.func,
};

export default InfoModal;
Loading

0 comments on commit cb29c20

Please sign in to comment.