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 5bbfe61 + 64045e9 commit 7827395
Show file tree
Hide file tree
Showing 79 changed files with 1,872 additions and 1,085 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(
isInteractable = true,
shouldNavigateBack = true,
isFullscreen = false,
customMarginTop,
...props
},
ref,
Expand Down Expand Up @@ -105,6 +106,7 @@ const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(
isInteractable={isInteractable}
onClose={onCloseCB}
onOpen={onOpenCB}
customMarginTop={customMarginTop}
ref={bottomSheetDialogRef}
isFullscreen={isFullscreen}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ Boolean that indicates if sheet is swippable. This affects whether or not tappin
| :-------------------------------------------------- | :------------------------------------------------------ | :----------------------------------------------------- |
| boolean | No | true |


### `customMarginTop`

Configure height of the modal by setting the distance between top of modal and top of screen.
| <span style="color:gray;font-size:14px">TYPE</span> | <span style="color:gray;font-size:14px">REQUIRED</span> | <span style="color:gray;font-size:14px">DEFAULT</span> |
| :-------------------------------------------------- | :------------------------------------------------------ | :----------------------------------------------------- |
| number | No | 250

### `children`

Content to wrap in sheet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const BottomSheetDialog = forwardRef<
isInteractable = true,
onClose,
onOpen,
customMarginTop,
...props
},
ref,
Expand All @@ -68,9 +69,10 @@ const BottomSheetDialog = forwardRef<
useSafeAreaInsets();
const { y: frameY } = useSafeAreaFrame();
const { height: screenHeight } = useWindowDimensions();
const marginTop = customMarginTop ?? DEFAULT_BOTTOMSHEETDIALOG_MARGINTOP;
const maxSheetHeight = isFullscreen
? screenHeight - screenTopPadding
: screenHeight - screenTopPadding - DEFAULT_BOTTOMSHEETDIALOG_MARGINTOP;
: screenHeight - screenTopPadding - marginTop;
const { styles } = useStyles(styleSheet, {
maxSheetHeight,
screenBottomPadding,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export interface BottomSheetDialogProps extends ViewProps {
* Optional callback that gets triggered when sheet is opened.
*/
onOpen?: (hasPendingAction?: boolean) => void;
/**
* Customize the top margin of the sheet.
*/
customMarginTop?: number;
}

export interface BottomSheetDialogRef {
Expand Down
16 changes: 7 additions & 9 deletions app/component-library/components/Navigation/TabBar/TabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { useStyles } from '../../../hooks';
import generateTestId from '../../../../../wdio/utils/generateTestId';
import Routes from '../../../../constants/navigation/Routes';
import { useTheme } from '../../../../util/theme';
import Analytics from '../../../../core/Analytics/Analytics';
import { MetaMetricsEvents } from '../../../../core/Analytics';
import { selectChainId } from '../../../../selectors/networkController';
import { getDecimalChainId } from '../../../../util/networks';
import { useMetrics } from '../../../../components/hooks/useMetrics';

// Internal dependencies.
import { TabBarProps } from './TabBar.types';
Expand All @@ -27,6 +27,7 @@ import OnboardingWizard from '../../../../components/UI/OnboardingWizard';

const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
const { colors } = useTheme();
const { trackEvent } = useMetrics();
const { bottom: bottomInset } = useSafeAreaInsets();
const { styles } = useStyles(styleSheet, { bottomInset });
const chainId = useSelector(selectChainId);
Expand Down Expand Up @@ -73,13 +74,10 @@ const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
navigation.navigate(Routes.MODAL.ROOT_MODAL_FLOW, {
screen: Routes.MODAL.WALLET_ACTIONS,
});
Analytics.trackEventWithParameters(
MetaMetricsEvents.ACTIONS_BUTTON_CLICKED,
{
text: '',
chain_id: getDecimalChainId(chainId),
},
);
trackEvent(MetaMetricsEvents.ACTIONS_BUTTON_CLICKED, {
text: '',
chain_id: getDecimalChainId(chainId),
});
break;
case Routes.BROWSER_VIEW:
navigation.navigate(Routes.BROWSER.HOME, {
Expand Down Expand Up @@ -127,7 +125,7 @@ const TabBar = ({ state, descriptors, navigation }: TabBarProps) => {
/>
);
},
[state, descriptors, navigation, colors, chainId],
[state, descriptors, navigation, colors, chainId, trackEvent],
);

const renderTabBarItems = useCallback(
Expand Down
2 changes: 2 additions & 0 deletions app/component-library/components/Tags/TagUrl/TagUrl.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const styleSheet = (params: { theme: Theme; vars: TagUrlStyleSheetVars }) => {
) as ViewStyle,
favicon: {
marginRight: 8,
width: 24,
height: 24,
},
label: {
color: colors.text.alternative,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ exports[`TagUrl should render correctly 1`] = `
size="32"
style={
Object {
"height": 24,
"marginRight": 8,
"width": 24,
}
}
variant="Favicon"
Expand Down
10 changes: 10 additions & 0 deletions app/components/Nav/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ import AsyncStorage from '../../../store/async-storage-wrapper';
import ShowIpfsGatewaySheet from '../../Views/ShowIpfsGatewaySheet/ShowIpfsGatewaySheet';
import ShowDisplayNftMediaSheet from '../../Views/ShowDisplayMediaNFTSheet/ShowDisplayNFTMediaSheet';
import AmbiguousAddressSheet from '../../../../app/components/Views/Settings/Contacts/AmbiguousAddressSheet/AmbiguousAddressSheet';
import SDKDisconnectModal from '../../../../app/components/Views/SDKDisconnectModal/SDKDisconnectModal';
import SDKSessionModal from '../../../../app/components/Views/SDKSessionModal/SDKSessionModal';
import { MetaMetrics } from '../../../core/Analytics';
import trackErrorAsAnalytics from '../../../util/metrics/TrackError/trackErrorAsAnalytics';

Expand Down Expand Up @@ -552,6 +554,14 @@ const App = ({ userLoggedIn }) => {
name={Routes.SHEET.SDK_FEEDBACK}
component={SDKFeedbackModal}
/>
<Stack.Screen
name={Routes.SHEET.SDK_MANAGE_CONNECTIONS}
component={SDKSessionModal}
/>
<Stack.Screen
name={Routes.SHEET.SDK_DISCONNECT}
component={SDKDisconnectModal}
/>
<Stack.Screen
name={Routes.SHEET.ACCOUNT_CONNECT}
component={AccountConnect}
Expand Down
2 changes: 1 addition & 1 deletion app/components/Nav/Main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import {
stopIncomingTransactionPolling,
} from '../../../util/transaction-controller';
///: BEGIN:ONLY_INCLUDE_IF(snaps)
import { SnapsExecutionWebView } from '../../UI/SnapsExecutionWebView';
import { SnapsExecutionWebView } from '../../../lib/snaps';
///: END:ONLY_INCLUDE_IF

const Stack = createStackNavigator();
Expand Down
15 changes: 9 additions & 6 deletions app/components/UI/AccountApproval/showWarningBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
IconSize,
} from '../../../component-library/components/Icons/Icon';
import { CONNECTING_TO_A_DECEPTIVE_SITE } from '../../../constants/urls';
import AnalyticsV2 from '../../../util/analyticsV2';
import { AccordionHeaderHorizontalAlignment } from '../../../component-library/components/Accordions/Accordion';
import { MetaMetrics } from '../../../core/Analytics';

const descriptionArray = [
strings('accounts.fake_metamask'),
Expand All @@ -28,11 +28,14 @@ const descriptionArray = [

const goToLearnMore = () => {
Linking.openURL(CONNECTING_TO_A_DECEPTIVE_SITE);
AnalyticsV2.trackEvent('EXTERNAL_LINK_CLICKED', {
location: 'dapp_connection_request',
text: 'Learn More',
url_domain: CONNECTING_TO_A_DECEPTIVE_SITE,
});
MetaMetrics.getInstance().trackEvent(
{ category: 'EXTERNAL_LINK_CLICKED' },
{
location: 'dapp_connection_request',
text: 'Learn More',
url_domain: CONNECTING_TO_A_DECEPTIVE_SITE,
},
);
};

const ShowWarningBanner = () => {
Expand Down
64 changes: 0 additions & 64 deletions app/components/UI/SnapsExecutionWebView/SnapsExecutionWebView.tsx

This file was deleted.

6 changes: 0 additions & 6 deletions app/components/UI/SnapsExecutionWebView/index.ts

This file was deleted.

14 changes: 4 additions & 10 deletions app/components/UI/Swaps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
swapsTokensWithBalanceSelector,
swapsTopAssetsSelector,
} from '../../../reducers/swaps';
import Analytics from '../../../core/Analytics/Analytics';
import Device from '../../../util/device';
import Engine from '../../../core/Engine';
import AppConstants from '../../../core/AppConstants';
Expand Down Expand Up @@ -88,6 +87,7 @@ import {
SWAP_MAX_SLIPPAGE,
} from '../../../../wdio/screen-objects/testIDs/Screens/QuoteView.js';
import { getDecimalChainId } from '../../../util/networks';
import { useMetrics } from '../../../components/hooks/useMetrics';

const createStyles = (colors) =>
StyleSheet.create({
Expand Down Expand Up @@ -203,6 +203,7 @@ function SwapsAmountView({
const navigation = useNavigation();
const route = useRoute();
const { colors } = useTheme();
const { trackAnonymousEvent } = useMetrics();
const styles = createStyles(colors);

const previousSelectedAddress = useRef();
Expand Down Expand Up @@ -286,15 +287,8 @@ function SwapsAmountView({
)?.symbol,
chain_id: getDecimalChainId(chainId),
};
Analytics.trackEventWithParameters(
MetaMetricsEvents.SWAPS_OPENED,
{},
);
Analytics.trackEventWithParameters(
MetaMetricsEvents.SWAPS_OPENED,
parameters,
true,
);

trackAnonymousEvent(MetaMetricsEvents.SWAPS_OPENED, parameters);
});
} else {
navigation.pop();
Expand Down
Loading

0 comments on commit 7827395

Please sign in to comment.