Skip to content

Commit

Permalink
Merge branch 'ci/bitrise-message-check' of https://github.com/MetaMas…
Browse files Browse the repository at this point in the history
…k/metamask-mobile into ci/bitrise-message-check
  • Loading branch information
Cal-L committed Feb 27, 2024
2 parents f005813 + 68c61c0 commit d904c62
Show file tree
Hide file tree
Showing 71 changed files with 2,005 additions and 873 deletions.
12 changes: 12 additions & 0 deletions app/actions/transaction/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ export function setTransactionObject(transaction) {
};
}

/**
* Sets the current transaction ID only.
*
* @param {object} transactionId - Id of the current transaction.
*/
export function setTransactionId(transactionId) {
return {
type: 'SET_TRANSACTION_ID',
transactionId,
};
}

/**
* Enable selectable tokens (ERC20 and Ether) to send in a transaction
*
Expand Down
218 changes: 21 additions & 197 deletions app/components/UI/BrowserBottomBar/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,204 +1,28 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`BrowserBottomBar should render correctly 1`] = `
<ElevatedView
elevation={11}
style={
<BrowserBottomBar
canGoBack={true}
canGoForward={false}
goBack={[Function]}
goForward={[Function]}
metrics={
Object {
"backgroundColor": "#FFFFFF",
"borderColor": "#D6D9DC",
"borderTopWidth": 0.5,
"flex": 0,
"flexDirection": "row",
"justifyContent": "space-between",
"addTraitsToUser": [Function],
"checkDataDeleteStatus": [Function],
"createDataDeletionTask": [Function],
"enable": [Function],
"getDeleteRegulationCreationDate": [Function],
"getDeleteRegulationId": [Function],
"getMetaMetricsId": [Function],
"isDataRecorded": [Function],
"isEnabled": [Function],
"trackAnonymousEvent": [Function],
"trackEvent": [Function],
}
}
>
<TouchableOpacity
disabled={false}
onPress={[Function]}
style={
Object {
"alignItems": "center",
"flex": 1,
"height": 24,
"justifyContent": "space-around",
"paddingBottom": 30,
"paddingTop": 30,
"textAlign": "center",
"width": 24,
}
}
testID="back-arrow-button"
>
<Icon
allowFontScaling={false}
name="angle-left"
size={24}
style={
Array [
Object {
"color": "#24272A",
"height": 24,
"textAlign": "center",
"width": 24,
},
Object {},
]
}
/>
</TouchableOpacity>
<TouchableOpacity
disabled={true}
onPress={[Function]}
style={
Object {
"alignItems": "center",
"flex": 1,
"height": 24,
"justifyContent": "space-around",
"paddingBottom": 30,
"paddingTop": 30,
"textAlign": "center",
"width": 24,
}
}
testID="go-forward-button"
>
<Icon
allowFontScaling={false}
name="angle-right"
size={24}
style={
Array [
Object {
"color": "#24272A",
"height": 24,
"textAlign": "center",
"width": 24,
},
Object {
"color": "#BBC0C5",
},
]
}
/>
</TouchableOpacity>
<TouchableOpacity
onPress={[Function]}
style={
Object {
"alignItems": "center",
"flex": 1,
"height": 24,
"justifyContent": "space-around",
"paddingBottom": 30,
"paddingTop": 30,
"textAlign": "center",
"width": 24,
}
}
testID="search-button"
>
<Icon
allowFontScaling={false}
name="search"
size={24}
style={
Object {
"color": "#24272A",
"height": 24,
"textAlign": "center",
"width": 24,
}
}
/>
</TouchableOpacity>
<TouchableOpacity
onPress={[Function]}
style={
Object {
"alignItems": "center",
"flex": 1,
"height": 24,
"justifyContent": "space-around",
"paddingBottom": 30,
"paddingTop": 30,
"textAlign": "center",
"width": 24,
}
}
testID="show-tabs-button"
>
<Component
style={
Object {
"height": 24,
"marginTop": 0,
"width": 24,
}
}
/>
</TouchableOpacity>
<TouchableOpacity
onPress={[Function]}
style={
Object {
"alignItems": "center",
"flex": 1,
"height": 24,
"justifyContent": "space-around",
"paddingBottom": 30,
"paddingTop": 30,
"textAlign": "center",
"width": 24,
}
}
testID="home-button"
>
<Icon
allowFontScaling={false}
name="home"
size={22}
style={
Object {
"color": "#24272A",
"height": 24,
"textAlign": "center",
"width": 24,
}
}
/>
</TouchableOpacity>
<TouchableOpacity
onPress={[Function]}
style={
Object {
"alignItems": "center",
"flex": 1,
"height": 24,
"justifyContent": "space-around",
"paddingBottom": 30,
"paddingTop": 30,
"textAlign": "center",
"width": 24,
}
}
testID="options-button"
>
<Icon
allowFontScaling={false}
name="more-horiz"
size={22}
style={
Object {
"color": "#24272A",
"height": 24,
"textAlign": "center",
"width": 24,
}
}
/>
</TouchableOpacity>
</ElevatedView>
showTabs={[Function]}
showUrlModal={[Function]}
toggleOptions={[Function]}
/>
`;
13 changes: 9 additions & 4 deletions app/components/UI/BrowserBottomBar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons';
import FeatherIcons from 'react-native-vector-icons/Feather';
import { MetaMetricsEvents } from '../../../core/Analytics';
import AnalyticsV2 from '../../../util/analyticsV2';

import Device from '../../../util/device';
import { ThemeContext, mockTheme } from '../../../util/theme';
Expand All @@ -21,6 +20,7 @@ import {
OPTIONS_BUTTON,
SEARCH_BUTTON,
} from '../../../../wdio/screen-objects/testIDs/BrowserScreen/BrowserScreen.testIds';
import { withMetricsAwareness } from '../../../components/hooks/useMetrics';

// NOTE: not needed anymore. The use of BottomTabBar already accomodates the home indicator height
// TODO: test on an android device
Expand Down Expand Up @@ -67,7 +67,7 @@ const createStyles = (colors) =>
* Browser bottom bar that contains icons for navigation
* tab management, url change and other options
*/
export default class BrowserBottomBar extends PureComponent {
class BrowserBottomBar extends PureComponent {
static propTypes = {
/**
* Boolean that determines if you can navigate back
Expand Down Expand Up @@ -101,17 +101,21 @@ export default class BrowserBottomBar extends PureComponent {
* Function that toggles the options menu
*/
toggleOptions: PropTypes.func,
/**
* Metrics injected by withMetricsAwareness HOC
*/
metrics: PropTypes.object,
};

trackSearchEvent = () => {
AnalyticsV2.trackEvent(MetaMetricsEvents.BROWSER_SEARCH_USED, {
this.props.metrics.trackEvent(MetaMetricsEvents.BROWSER_SEARCH_USED, {
option_chosen: 'Browser Bottom Bar Menu',
number_of_tabs: undefined,
});
};

trackNavigationEvent = (navigationOption) => {
AnalyticsV2.trackEvent(MetaMetricsEvents.BROWSER_NAVIGATION, {
this.props.metrics.trackEvent(MetaMetricsEvents.BROWSER_NAVIGATION, {
option_chosen: navigationOption,
os: Platform.OS,
});
Expand Down Expand Up @@ -213,3 +217,4 @@ export default class BrowserBottomBar extends PureComponent {
}

BrowserBottomBar.contextType = ThemeContext;
export default withMetricsAwareness(BrowserBottomBar);
12 changes: 5 additions & 7 deletions app/components/UI/CollectibleContracts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
TouchableOpacity,
StyleSheet,
View,
InteractionManager,
Image,
Platform,
FlatList,
Expand All @@ -15,7 +14,6 @@ import { fontStyles } from '../../../styles/common';
import { strings } from '../../../../locales/i18n';
import Engine from '../../../core/Engine';
import CollectibleContractElement from '../CollectibleContractElement';
import Analytics from '../../../core/Analytics/Analytics';
import { MetaMetricsEvents } from '../../../core/Analytics';
import {
collectibleContractsSelector,
Expand Down Expand Up @@ -46,6 +44,7 @@ import {
NFT_TAB_CONTAINER_ID,
} from '../../../../wdio/screen-objects/testIDs/Screens/WalletView.testIds';
import Logger from '../../../util/Logger';
import { useMetrics } from '../../../components/hooks/useMetrics';

const createStyles = (colors) =>
StyleSheet.create({
Expand Down Expand Up @@ -110,6 +109,7 @@ const CollectibleContracts = ({
(singleCollectible) => singleCollectible.isCurrentlyOwned === true,
);
const { colors } = useTheme();
const { trackEvent } = useMetrics();
const styles = createStyles(colors);
const [isAddNFTEnabled, setIsAddNFTEnabled] = useState(true);
const [refreshing, setRefreshing] = useState(false);
Expand Down Expand Up @@ -274,11 +274,9 @@ const CollectibleContracts = ({
const goToAddCollectible = useCallback(() => {
setIsAddNFTEnabled(false);
navigation.push('AddAsset', { assetType: 'collectible' });
InteractionManager.runAfterInteractions(() => {
Analytics.trackEvent(MetaMetricsEvents.WALLET_ADD_COLLECTIBLES);
setIsAddNFTEnabled(true);
});
}, [navigation]);
trackEvent(MetaMetricsEvents.WALLET_ADD_COLLECTIBLES);
setIsAddNFTEnabled(true);
}, [navigation, trackEvent]);

const renderFooter = useCallback(
() => (
Expand Down
2 changes: 1 addition & 1 deletion app/components/UI/ComponentErrorBoundary/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import Logger from '../../../util/Logger';
import { trackErrorAsAnalytics } from '../../../util/analyticsV2';
import trackErrorAsAnalytics from '../../../util/metrics/TrackError/trackErrorAsAnalytics';

class ComponentErrorBoundary extends React.Component {
state = { error: null };
Expand Down
3 changes: 2 additions & 1 deletion app/components/UI/DeleteWalletModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import Device from '../../../util/device';
import Routes from '../../../constants/navigation/Routes';
import { DeleteWalletModalSelectorsIDs } from '../../../../e2e/selectors/Modals/DeleteWalletModal.selectors';
import generateTestId from '../../../../wdio/utils/generateTestId';
import { trackEventV2 as trackEvent } from '../../../util/analyticsV2';
import { MetaMetricsEvents } from '../../../core/Analytics';
import { useMetrics } from '../../../components/hooks/useMetrics';

const DELETE_KEYWORD = 'delete';

Expand All @@ -35,6 +35,7 @@ if (Device.isAndroid() && UIManager.setLayoutAnimationEnabledExperimental) {
const DeleteWalletModal = () => {
const navigation = useNavigation();
const { colors, themeAppearance } = useTheme();
const { trackEvent } = useMetrics();
const styles = createStyles(colors);

const modalRef = useRef<ReusableModalRef>(null);
Expand Down
Loading

0 comments on commit d904c62

Please sign in to comment.