Skip to content

Commit

Permalink
Merge branch 'main' into fix/push-notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathansoufer authored Sep 17, 2024
2 parents 2556fdc + 9d09b24 commit 5aeff10
Show file tree
Hide file tree
Showing 34 changed files with 1,115 additions and 996 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/check-template-and-add-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ enum RegressionStage {
Production
}

const knownBots = ["metamaskbot", "dependabot", "github-actions", "sentry-io"];
const knownBots = ["metamaskbot", "dependabot", "github-actions", "sentry-io", "devin-ai-integration"];

main().catch((error: Error): void => {
console.error(error);
Expand Down Expand Up @@ -80,7 +80,7 @@ async function main(): Promise<void> {
}

// If author is not part of the MetaMask organisation
if (!(await userBelongsToMetaMaskOrg(octokit, labelable?.author))) {
if (!knownBots.includes(labelable?.author) && !(await userBelongsToMetaMaskOrg(octokit, labelable?.author))) {
// Add external contributor label to the issue
await addLabelToLabelable(octokit, labelable, externalContributorLabel);
}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/add-release-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- main
types:
- closed
merge_group:
types: [checks_requested]

jobs:
add-release-label:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/bump-version-name.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- develop
- main
types: [opened]
merge_group:
types: [checks_requested]

jobs:
bump-version-name:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/check-pr-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
- synchronize
- labeled
- unlabeled
merge_group:
types: [checks_requested]

jobs:
check-pr-labels:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
push:
branches: main
pull_request:
merge_group:
types: [checks_requested]

jobs:
setup:
runs-on: ubuntu-20.04
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ on:
types: [created]
pull_request_target:
types: [opened,closed,synchronize]

merge_group:
types: [checks_requested]

jobs:
CLABot:
if: github.event_name == 'pull_request_target' || contains(github.event.comment.html_url, '/pull/')
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/close-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:
- main
types:
- closed

merge_group:
types: [checks_requested]

jobs:
close-bug-report:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/crowdin_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
- main
schedule:
- cron: "0 */12 * * *"
merge_group:
types: [checks_requested]

jobs:
synchronize-with-crowdin:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr-title-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
branches:
- main
types: [opened,edited]
merge_group:
types: [checks_requested]

jobs:
pr-title-linter:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions app/components/Nav/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import Toast, {
import AccountSelector from '../../../components/Views/AccountSelector';
import AccountConnect from '../../../components/Views/AccountConnect';
import AccountPermissions from '../../../components/Views/AccountPermissions';
import { AccountPermissionsScreens } from '../../../components/Views/AccountPermissions/AccountPermissions.types';
import AccountPermissionsConfirmRevokeAll from '../../../components/Views/AccountPermissions/AccountPermissionsConfirmRevokeAll';
import { SRPQuiz } from '../../Views/Quiz';
import { TurnOffRememberMeModal } from '../../../components/UI/TurnOffRememberMeModal';
Expand Down Expand Up @@ -655,6 +656,7 @@ const App = ({ userLoggedIn }) => {
<Stack.Screen
name={Routes.SHEET.ACCOUNT_PERMISSIONS}
component={AccountPermissions}
initialParams={{ initialScreen: AccountPermissionsScreens.Connected }}
/>
<Stack.Screen
name={Routes.SHEET.REVOKE_ALL_ACCOUNT_PERMISSIONS}
Expand Down
10 changes: 10 additions & 0 deletions app/components/Nav/Main/MainNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ import { selectPermissionControllerState } from '../../../selectors/snaps/permis

import NftDetails from '../../Views/NftDetails';
import NftDetailsFullImage from '../../Views/NftDetails/NFtDetailsFullImage';
import AccountPermissions from '../../../components/Views/AccountPermissions';
import { AccountPermissionsScreens } from '../../../components/Views/AccountPermissions/AccountPermissions.types';

const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
Expand Down Expand Up @@ -322,6 +324,14 @@ const SettingsFlow = () => (
component={ContactForm}
options={ContactForm.navigationOptions}
/>
<Stack.Screen
name="AccountPermissionsAsFullScreen"
component={AccountPermissions}
options={{ headerShown: false }}
initialParams={{
initialScreen: AccountPermissionsScreens.PermissionsSummary,
}}
/>
<Stack.Screen
name="RevealPrivateCredentialView"
component={RevealPrivateCredential}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const createStyles = (params: { theme: Theme }) => {
paddingBottom: Device.isIphoneX() ? 20 : 0,
},
title: {
fontSize: Device.isSmallDevice() ? 18 : 24,
alignSelf: 'center',
marginBottom: 16,
marginTop: 16,
marginRight: 24,
Expand Down Expand Up @@ -98,6 +98,9 @@ const createStyles = (params: { theme: Theme }) => {
},
startAccessory: { flex: 1, paddingLeft: 16 },
endAccessory: { flex: 1, paddingRight: 16 },
editArrow: {
marginHorizontal: 16,
},
});
};

Expand Down
168 changes: 99 additions & 69 deletions app/components/UI/PermissionsSummary/PermissionsSummary.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import StyledButton from '../StyledButton';
import { View } from 'react-native';
import { SafeAreaView, View } from 'react-native';
import { strings } from '../../../../locales/i18n';
import Text from '../../Base/Text';
import { useTheme } from '../../../util/theme';
import { CommonSelectorsIDs } from '../../../../e2e/selectors/Common.selectors';
import Avatar, {
Expand Down Expand Up @@ -32,15 +31,19 @@ import { PermissionsSummaryProps } from './PermissionsSummary.types';
import { useSelector } from 'react-redux';
import { selectNetworkName } from '../../../selectors/networkInfos';
import { USER_INTENT } from '../../../constants/permissions';
import ButtonIcon from '../../../component-library/components/Buttons/ButtonIcon';
import ButtonIcon, {
ButtonIconSizes,
} from '../../../component-library/components/Buttons/ButtonIcon';

const PermissionsSummary = ({
currentPageInformation,
onEdit,
onEditNetworks,
onBack,
onUserAction,
showActionButtons = true,
isInitialDappConnection = true,
isAlreadyConnected = true,
}: PermissionsSummaryProps) => {
const { colors } = useTheme();
const { styles } = useStyles(styleSheet, {});
Expand All @@ -55,6 +58,14 @@ const PermissionsSummary = ({
onUserAction?.(USER_INTENT.Cancel);
};

const handleEditAccountsButtonPress = () => {
onEdit?.();
};

const handleEditNetworksButtonPress = () => {
onEditNetworks?.();
};

const renderTopIcon = () => {
const { currentEnsName, icon } = currentPageInformation;
const url = currentPageInformation.url;
Expand All @@ -71,9 +82,25 @@ const PermissionsSummary = ({
);
};

const handleEditButtonPress = () => {
onEdit?.();
};
function renderHeader() {
return (
<View style={styles.header}>
<View style={styles.startAccessory}>
{onBack && (
<ButtonIcon
size={ButtonIconSizes.Sm}
iconColor={IconColor.Default}
onPress={onBack}
iconName={IconName.ArrowLeft}
/>
)}
</View>

<View style={styles.logoContainer}>{renderTopIcon()}</View>
<View style={styles.endAccessory}></View>
</View>
);
}

function renderAccountPermissionsRequestInfoCard() {
return (
Expand Down Expand Up @@ -115,13 +142,22 @@ const PermissionsSummary = ({
</View>
</View>
<View>
<Button
onPress={handleEditButtonPress}
variant={ButtonVariants.Link}
width={ButtonWidthTypes.Full}
label={strings('permissions.edit')}
size={ButtonSize.Lg}
/>
{isAlreadyConnected ? (
<ButtonIcon
size={ButtonIconSizes.Md}
iconName={IconName.ArrowRight}
onPress={handleEditAccountsButtonPress}
testID={CommonSelectorsIDs.BACK_ARROW_BUTTON}
/>
) : (
<Button
onPress={handleEditAccountsButtonPress}
variant={ButtonVariants.Link}
width={ButtonWidthTypes.Full}
label={strings('permissions.edit')}
size={ButtonSize.Lg}
/>
)}
</View>
</View>
);
Expand Down Expand Up @@ -160,72 +196,66 @@ const PermissionsSummary = ({
</View>
</View>
<View>
<Button
onPress={handleEditButtonPress}
variant={ButtonVariants.Link}
width={ButtonWidthTypes.Full}
label={strings('permissions.edit')}
size={ButtonSize.Lg}
/>
</View>
</View>
);
}

function renderHeader() {
return (
<View style={styles.header}>
<View style={styles.startAccessory}>
{onBack && (
{isAlreadyConnected ? (
<ButtonIcon
iconColor={IconColor.Default}
onPress={onBack}
iconName={IconName.ArrowLeft}
size={ButtonIconSizes.Md}
iconName={IconName.ArrowRight}
onPress={handleEditNetworksButtonPress}
testID={CommonSelectorsIDs.BACK_ARROW_BUTTON}
/>
) : (
<Button
onPress={handleEditNetworksButtonPress}
variant={ButtonVariants.Link}
width={ButtonWidthTypes.Full}
label={strings('permissions.edit')}
size={ButtonSize.Lg}
/>
)}
</View>

<View style={styles.logoContainer}>{renderTopIcon()}</View>
<View style={styles.endAccessory}></View>
</View>
);
}

return (
<View style={styles.mainContainer}>
{renderHeader()}
<Text bold centered primary noMargin style={styles.title}>
{isInitialDappConnection
? strings('permissions.title_dapp_url_wants_to', {
dappUrl: new URL(currentPageInformation.url).hostname,
})
: strings('permissions.title_dapp_url_has_approval_to', {
dappUrl: new URL(currentPageInformation.url).hostname,
})}
</Text>
{renderAccountPermissionsRequestInfoCard()}
{renderNetworkPermissionsRequestInfoCard()}
{showActionButtons && (
<View style={styles.actionButtonsContainer}>
<StyledButton
type={'cancel'}
onPress={cancel}
containerStyle={[styles.buttonPositioning, styles.cancelButton]}
testID={CommonSelectorsIDs.CANCEL_BUTTON}
>
{strings('permissions.cancel')}
</StyledButton>
<StyledButton
type={'confirm'}
onPress={confirm}
containerStyle={[styles.buttonPositioning, styles.confirmButton]}
testID={CommonSelectorsIDs.CONNECT_BUTTON}
>
{strings('confirmation_modal.confirm_cta')}
</StyledButton>
<SafeAreaView>
<View style={styles.mainContainer}>
{renderHeader()}
<View style={styles.title}>
<TextComponent variant={TextVariant.HeadingSM}>
{isInitialDappConnection
? strings('permissions.title_dapp_url_wants_to', {
dappUrl: new URL(currentPageInformation.url).hostname,
})
: strings('permissions.title_dapp_url_has_approval_to', {
dappUrl: new URL(currentPageInformation.url).hostname,
})}
</TextComponent>
</View>
)}
</View>
{renderAccountPermissionsRequestInfoCard()}
{renderNetworkPermissionsRequestInfoCard()}
{showActionButtons && (
<View style={styles.actionButtonsContainer}>
<StyledButton
type={'cancel'}
onPress={cancel}
containerStyle={[styles.buttonPositioning, styles.cancelButton]}
testID={CommonSelectorsIDs.CANCEL_BUTTON}
>
{strings('permissions.cancel')}
</StyledButton>
<StyledButton
type={'confirm'}
onPress={confirm}
containerStyle={[styles.buttonPositioning, styles.confirmButton]}
testID={CommonSelectorsIDs.CONNECT_BUTTON}
>
{strings('confirmation_modal.confirm_cta')}
</StyledButton>
</View>
)}
</View>
</SafeAreaView>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ export interface PermissionsSummaryProps {
url: string;
};
onEdit?: () => void;
onEditNetworks?: () => void;
onBack?: () => void;
onUserAction?: React.Dispatch<React.SetStateAction<USER_INTENT>>;
showActionButtons?: boolean;
isInitialDappConnection?: boolean;
isAlreadyConnected?: boolean;
}
Loading

0 comments on commit 5aeff10

Please sign in to comment.