Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.2.0 #4341

Merged
merged 31 commits into from
Jun 7, 2022
Merged

5.2.0 #4341

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
76515a4
5.2.0
metamaskbot May 16, 2022
3dad3f1
Format changelog
Cal-L May 16, 2022
5381c67
Fix check for empty tokens list (#4345)
wachunei May 16, 2022
a155f0d
Fix homepage scripts and env import (#4344)
Fatxx May 16, 2022
5737d9c
Make reveal SRP blur view dynamic (#4315)
Cal-L May 16, 2022
cd244bf
Update changelog
Cal-L May 17, 2022
3becfde
Bugfix/fix subtitle mapping (#4349)
rickycodes May 17, 2022
6c43e4b
Update changelog
Cal-L May 17, 2022
047fc0c
Update build numbers
Cal-L May 17, 2022
13ab998
[5.2.0][FIX] Alignment of check icon with option on select component …
tommasini May 23, 2022
3ca296c
[5.2.0][FIX] Secret Recovery Phrase text alignment (#4369)
tommasini May 23, 2022
37442a4
[5.2.0][FIX] M3 - Warning on legit address (#4376)
tommasini May 23, 2022
bd64bd0
Fixes double tab opening when using `metamask://dapp/` deep link sche…
andreahaku May 23, 2022
494f328
Fix order id retrieve in checkout (#4366)
wachunei May 23, 2022
8a22652
Fix overriding network and account for orders being processed (#4364)
wachunei May 23, 2022
8cb3f1d
Error handling when no crypto currencies available on selected region…
alaahd May 23, 2022
e809f0a
bug patch - tx-details to display provider link and integrate the or…
VikChawla May 23, 2022
ebccb9a
Refactor "Transaction" to "Order" when referring to fiat order (#4375)
wachunei May 23, 2022
8727fc0
Add On-Ramp Aggregator Analytics (#4362)
wachunei May 23, 2022
addd65a
Bump build number
May 23, 2022
f038c72
[FIX] Add margin and check to AssetActionButton text (#4381)
May 24, 2022
fc971dc
Additional fixes for double tab opened with metamask://dapp/ schema (…
andreahaku May 25, 2022
3525dfe
Remove canOpenUrl from onramp linking (#4391)
wachunei May 25, 2022
d324963
Fix provider support string (#4387)
wachunei May 25, 2022
c18c22b
Bump build number
May 25, 2022
4aace57
Fix wrong analytics event (#4408)
wachunei May 26, 2022
ef3ac7b
Remove Harmony from supported networks (#4409)
wachunei May 26, 2022
7ba7892
removes `metamask://dapp/` schema support until stable on Android (#4…
andreahaku May 26, 2022
58b78c9
Bump build number
andreahaku May 26, 2022
e2e5480
Update CHANGELOG
May 31, 2022
dcdada4
Merge main
Jun 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@

## Current Main Branch

## 5.1.1 - May 12, 2022
- [#4254](https://github.com/MetaMask/metamask-mobile/pull/4254): [FIX] Crashes on Android devices when using the app in split screen
- [#4052](https://github.com/MetaMask/metamask-mobile/pull/4052): [FEAT] Download attachments in browser on iOS
- [4174](https://github.com/MetaMask/metamask-mobile/pull/4174): [IMPROVEMENT] Use checksum standard format
- [#4318](https://github.com/MetaMask/metamask-mobile/pull/4318): [FIX] Send flow confusables bug
- [#4315](https://github.com/MetaMask/metamask-mobile/pull/4315): [IMPROVEMENT] Make reveal SRP blur view dynamic
## 5.2.0 - May 17, 2022
- [#4349](https://github.com/MetaMask/metamask-mobile/pull/4349): [FIX] Subtitle mapping
- [#4344](https://github.com/MetaMask/metamask-mobile/pull/4344): [FIX] Fix homepage scripts and env import
- [#4345](https://github.com/MetaMask/metamask-mobile/pull/4345): [FIX] Fix check for empty tokens list
- [#3696](https://github.com/MetaMask/metamask-mobile/pull/3696): [FEATURE] Fiat on Ramp Aggregator
- [#4303](https://github.com/MetaMask/metamask-mobile/pull/4303): [IMPROVEMENT] Add support for env variable for MM_HOMEPAGE
- [#4331](https://github.com/MetaMask/metamask-mobile/pull/4331): [IMPROVEMENT] Fix addressbook and browser test
- [#4170](https://github.com/MetaMask/metamask-mobile/pull/4170): [FIX] Copy to clipboard for Android version 9 and below
- [#4328](https://github.com/MetaMask/metamask-mobile/pull/4328): [FIX] Fix generate-static-assets
- [#4318](https://github.com/MetaMask/metamask-mobile/pull/4318): [FIX] Fix confusables bug
- [#4316](https://github.com/MetaMask/metamask-mobile/pull/4316): [IMPROVEMENT] GIVEN, WHEN, THEN - Template Update
- [#4167](https://github.com/MetaMask/metamask-mobile/pull/4167): [IMPROVEMENT] Adds support for 'dapp/' urls support on 'metamask://' and fixes DL opening to Apple Store
- [#4175](https://github.com/MetaMask/metamask-mobile/pull/4175): [Fix] Favourites not showing when home button is pressed in browser tab menu
- [#4278](https://github.com/MetaMask/metamask-mobile/pull/4278): [IMPROVEMENT] Convert back to spaces
- [#4249](https://github.com/MetaMask/metamask-mobile/pull/4249): [IMPROVEMENT] patch cross-fetch instead of skipping
- [#4174](https://github.com/MetaMask/metamask-mobile/pull/4174): [IMPROVEMENT] Address now is in the checksum standard format
- [#4182](https://github.com/MetaMask/metamask-mobile/pull/4182): [IMPROVEMENT] Standardize prettier configuration
- [#4183](https://github.com/MetaMask/metamask-mobile/pull/4183): [FIX] excluded audit because no available patch

## 5.1.0 - May 5, 2022
- [#3929](https://github.com/MetaMask/metamask-mobile/pull/3929): [IMPROVEMENT] Defaults to current network if chain id not specified in QR codes
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 906
versionName "5.1.1"
versionCode 913
versionName "5.2.0"
multiDexEnabled true
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy "minReactNative", "minReactNative46"
Expand Down
16 changes: 10 additions & 6 deletions app/components/UI/AccountOverview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { allowedToBuy } from '../FiatOrders';
import AssetSwapButton from '../Swaps/components/AssetSwapButton';
import ClipboardManager from '../../../core/ClipboardManager';
import { ThemeContext, mockTheme } from '../../../util/theme';
import Routes from '../../../constants/navigation/Routes';

const createStyles = (colors) =>
StyleSheet.create({
Expand Down Expand Up @@ -308,13 +309,16 @@ class AccountOverview extends PureComponent {
};

onBuy = () => {
this.props.navigation.navigate('FiatOnRampAggregator');
this.props.navigation.navigate(Routes.FIAT_ON_RAMP_AGGREGATOR.ID);
InteractionManager.runAfterInteractions(() => {
Analytics.trackEvent(ANALYTICS_EVENT_OPTS.WALLET_BUY_ETH);
AnalyticsV2.trackEvent(AnalyticsV2.ANALYTICS_EVENTS.ONRAMP_OPENED, {
button_location: 'Home Screen',
button_copy: 'Buy',
});
Analytics.trackEventWithParameters(
AnalyticsV2.ANALYTICS_EVENTS.BUY_BUTTON_CLICKED,
{
text: 'Buy',
location: 'Wallet',
chain_id_destination: this.props.chainId,
},
);
});
};

Expand Down
16 changes: 9 additions & 7 deletions app/components/UI/AssetOverview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import Engine from '../../../core/Engine';
import Logger from '../../../util/Logger';
import Analytics from '../../../core/Analytics';
import AnalyticsV2 from '../../../util/analyticsV2';
import { ANALYTICS_EVENT_OPTS } from '../../../util/analytics';
import { allowedToBuy } from '../FiatOrders';
import AssetSwapButton from '../Swaps/components/AssetSwapButton';
import NetworkMainAssetLogo from '../NetworkMainAssetLogo';
Expand Down Expand Up @@ -182,13 +181,16 @@ class AssetOverview extends PureComponent {
};

onBuy = () => {
this.props.navigation.navigate('FiatOnRampAggregator');
this.props.navigation.navigate(Routes.FIAT_ON_RAMP_AGGREGATOR.ID);
InteractionManager.runAfterInteractions(() => {
Analytics.trackEvent(ANALYTICS_EVENT_OPTS.WALLET_BUY_ETH);
AnalyticsV2.trackEvent(AnalyticsV2.ANALYTICS_EVENTS.ONRAMP_OPENED, {
button_location: 'Token Screen',
button_copy: 'Buy',
});
Analytics.trackEventWithParameters(
AnalyticsV2.ANALYTICS_EVENTS.BUY_BUTTON_CLICKED,
{
text: 'Buy',
location: 'Token Screen',
chain_id_destination: this.props.chainId,
},
);
});
};

Expand Down
182 changes: 111 additions & 71 deletions app/components/UI/FiatOnRampAggregator/Views/AmountToBuy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import ErrorViewWithReporting from '../components/ErrorViewWithReporting';
import { Colors } from '../../../../util/theme/models';
import { CryptoCurrency } from '@consensys/on-ramp-sdk';
import Routes from '../../../../constants/navigation/Routes';
import useAnalytics from '../hooks/useAnalytics';

// TODO: Convert into typescript and correctly type
const Text = BaseText as any;
Expand Down Expand Up @@ -94,10 +95,11 @@ const AmountToBuy = () => {
const navigation = useNavigation();
const { colors } = useTheme();
const styles = createStyles(colors);
const trackEvent = useAnalytics();
const [amountFocused, setAmountFocused] = useState(false);
const [amount, setAmount] = useState('0');
const [amountNumber, setAmountNumber] = useState(0);
const [tokens, setTokens] = useState<CryptoCurrency[]>([]);
const [tokens, setTokens] = useState<CryptoCurrency[] | null>(null);
const [error, setError] = useState<string | null>(null);
const keyboardHeight = useRef(1000);
const keypadOffset = useSharedValue(1000);
Expand All @@ -122,16 +124,6 @@ const AmountToBuy = () => {
const [isRegionModalVisible, toggleRegionModal, , hideRegionModal] =
useModalHandler(false);

useEffect(() => {
navigation.setOptions(
getFiatOnRampAggNavbar(
navigation,
{ title: strings('fiat_on_ramp_aggregator.amount_to_buy') },
colors,
),
);
}, [navigation, colors]);

/**
* Grab the current state of the SDK via the context.
*/
Expand Down Expand Up @@ -341,6 +333,80 @@ const AmountToBuy = () => {
setSelectedPaymentMethodId,
]);

/**
* * Derived values
*/

const isFetching =
isFetchingSdkCryptoCurrencies ||
isFetchingPaymentMethods ||
isFetchingFiatCurrencies ||
isFetchingDefaultFiatCurrency ||
isFetchingCountries;

/**
* Get the fiat currency object by id
*/
const currentFiatCurrency = useMemo(() => {
const currency =
fiatCurrencies?.find?.((curr) => curr.id === selectedFiatCurrencyId) ||
defaultFiatCurrency;
return currency;
}, [fiatCurrencies, defaultFiatCurrency, selectedFiatCurrencyId]);

const currentPaymentMethod = useMemo(
() =>
filteredPaymentMethods?.find?.(
(method) => method.id === selectedPaymentMethodId,
),
[filteredPaymentMethods, selectedPaymentMethodId],
);

/**
* Format the amount for display (iOS only)
*/
const displayAmount = useMemo(() => {
if (Device.isIos() && Intl && Intl?.NumberFormat) {
return amountFocused
? amount
: new Intl.NumberFormat().format(amountNumber);
}
return amount;
}, [amount, amountFocused, amountNumber]);

const amountIsBelowMinimum = useMemo(
() => amountNumber !== 0 && limits && amountNumber < limits.minAmount,
[amountNumber, limits],
);

const amountIsAboveMaximum = useMemo(
() => amountNumber !== 0 && limits && amountNumber > limits.maxAmount,
[amountNumber, limits],
);

const amountIsValid = useMemo(
() => !amountIsBelowMinimum && !amountIsAboveMaximum,
[amountIsBelowMinimum, amountIsAboveMaximum],
);

const handleCancelPress = useCallback(() => {
trackEvent('ONRAMP_CANCELED', {
location: 'Amount to Buy Screen',
chain_id_destination: selectedChainId,
});
}, [selectedChainId, trackEvent]);

useEffect(() => {
navigation.setOptions(
getFiatOnRampAggNavbar(
navigation,
{ title: strings('fiat_on_ramp_aggregator.amount_to_buy') },
colors,
handleCancelPress,
),
);
}, [navigation, colors, handleCancelPress]);

/**
* * Keypad style, handlers and effects
*/
Expand All @@ -353,7 +419,7 @@ const AmountToBuy = () => {
}));

useEffect(() => {
keypadOffset.value = amountFocused ? 40 : keyboardHeight.current + 40;
keypadOffset.value = amountFocused ? 40 : keyboardHeight.current + 80;
}, [amountFocused, keyboardHeight, keypadOffset]);

/**
Expand Down Expand Up @@ -488,64 +554,26 @@ const AmountToBuy = () => {
navigation.navigate(Routes.FIAT_ON_RAMP_AGGREGATOR.GET_QUOTES, {
amount: amountNumber,
asset: selectedAsset,
fiatCurrency: currentFiatCurrency,
});
}, [amountNumber, navigation, selectedAsset]);

/**
* * Derived values
*/

const isFetching =
isFetchingSdkCryptoCurrencies ||
isFetchingPaymentMethods ||
isFetchingFiatCurrencies ||
isFetchingDefaultFiatCurrency ||
isFetchingCountries;

/**
* Get the fiat currency object by id
*/
const currentFiatCurrency = useMemo(() => {
const currency =
fiatCurrencies?.find?.((curr) => curr.id === selectedFiatCurrencyId) ||
defaultFiatCurrency;
return currency;
}, [fiatCurrencies, defaultFiatCurrency, selectedFiatCurrencyId]);

const currentPaymentMethod = useMemo(
() =>
filteredPaymentMethods?.find?.(
(method) => method.id === selectedPaymentMethodId,
),
[filteredPaymentMethods, selectedPaymentMethodId],
);

/**
* Format the amount for display (iOS only)
*/
const displayAmount = useMemo(() => {
if (Device.isIos() && Intl && Intl?.NumberFormat) {
return amountFocused
? amount
: new Intl.NumberFormat().format(amountNumber);
}
return amount;
}, [amount, amountFocused, amountNumber]);

const amountIsBelowMinimum = useMemo(
() => amountNumber !== 0 && limits && amountNumber < limits.minAmount,
[amountNumber, limits],
);

const amountIsAboveMaximum = useMemo(
() => amountNumber !== 0 && limits && amountNumber > limits.maxAmount,
[amountNumber, limits],
);
trackEvent('ONRAMP_QUOTES_REQUESTED', {
currency_source: currentFiatCurrency?.symbol as string,
currency_destination: selectedAsset?.symbol as string,
payment_method_id: selectedPaymentMethodId as string,
chain_id_destination: selectedChainId,
amount: amountNumber,
location: 'Amount to Buy Screen',
});
}, [
amountNumber,
currentFiatCurrency,
navigation,
selectedAsset,
selectedChainId,
selectedPaymentMethodId,
trackEvent,
]);

const amountIsValid = useMemo(
() => !amountIsBelowMinimum && !amountIsAboveMaximum,
[amountIsBelowMinimum, amountIsAboveMaximum],
);
const retryMethod = useCallback(() => {
if (!error) {
return null;
Expand Down Expand Up @@ -650,7 +678,7 @@ const AmountToBuy = () => {
);
}

if (!isFetching && (!tokens || tokens.length === 0)) {
if (!isFetching && tokens && tokens.length === 0) {
return (
<ScreenLayout>
<ScreenLayout.Body>
Expand All @@ -659,11 +687,21 @@ const AmountToBuy = () => {
'fiat_on_ramp_aggregator.no_tokens_available',
{
network: NETWORKS_NAMES[selectedChainId],
region: selectedRegion?.name,
},
)}
ctaOnPress={() => navigation.goBack()}
ctaLabel={strings('fiat_on_ramp_aggregator.try_different_region')}
ctaOnPress={toggleRegionModal as () => void}
/>
</ScreenLayout.Body>
<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 Expand Up @@ -784,7 +822,7 @@ const AmountToBuy = () => {
'fiat_on_ramp_aggregator.select_a_cryptocurrency_description',
{ network: NETWORKS_NAMES[selectedChainId] },
)}
tokens={tokens}
tokens={tokens ?? []}
onItemPress={handleAssetPress}
/>
<FiatSelectModal
Expand All @@ -801,6 +839,7 @@ const AmountToBuy = () => {
paymentMethods={filteredPaymentMethods}
selectedPaymentMethodId={selectedPaymentMethodId}
onItemPress={handleChangePaymentMethod}
location={'Amount to Buy Screen'}
/>
<RegionModal
isVisible={isRegionModalVisible}
Expand All @@ -809,6 +848,7 @@ const AmountToBuy = () => {
data={countries}
dismiss={hideRegionModal as () => void}
onRegionPress={handleRegionPress}
location={'Amount to Buy Screen'}
/>
</ScreenLayout>
);
Expand Down
Loading