Skip to content

Commit

Permalink
Merge branch 'main' into salim/fix-non-regression-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
salimtb authored Oct 16, 2024
2 parents b5f5ea6 + 7700dae commit 5809ba9
Show file tree
Hide file tree
Showing 138 changed files with 8,827 additions and 2,646 deletions.
1 change: 0 additions & 1 deletion .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
ignores:
- '@metamask/oss-attribution-generator'
- 'webpack-cli'
- '@react-native-community/datetimepicker'
- '@react-native-community/slider'
- 'patch-package'
- '@lavamoat/allow-scripts'
Expand Down
28 changes: 8 additions & 20 deletions .detoxrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
configurations: {
'ios.sim.apiSpecs': {
device: 'ios.simulator',
app: 'ios.debug',
app: 'ios.qa',
testRunner: {
args: {
"$0": "node e2e/api-specs/run-api-spec-tests.js",
Expand All @@ -41,10 +41,9 @@ module.exports = {
device: 'ios.simulator',
app: 'ios.release',
},
// because e2e run on debug mode in bitrise
'android.emu.bitrise.debug': {
device: 'android.bitrise.emulator',
app: 'android.bitrise.debug',
'ios.sim.qa': {
device: 'ios.simulator',
app: 'ios.qa',
},

'android.emu.debug': {
Expand Down Expand Up @@ -86,32 +85,21 @@ module.exports = {
binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/MetaMask.app',
build: 'yarn start:ios:e2e',
},
'ios.release': {
'ios.qa': {
type: 'ios.app',
binaryPath:
'ios/build/Build/Products/Release-iphonesimulator/MetaMask.app',
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='production' yarn build:ios:release:e2e",
},
'android.bitrise.debug': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/prod/debug/app-prod-debug.apk',
build: 'yarn start:android:e2e',
'ios/build/Build/Products/Release-iphonesimulator/MetaMask-QA.app',
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='qa' yarn build:ios:qa",
},
'android.debug': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/prod/debug/app-prod-debug.apk',
build: 'yarn start:android:e2e',
},
'android.release': {
type: 'android.apk',
binaryPath:
'android/app/build/outputs/apk/prod/release/app-prod-release.apk',
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='production' yarn build:android:release:e2e",
},
'android.qa': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/qa/release/app-qa-release.apk',
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='qa' yarn build:android:qa:e2e",
build: "METAMASK_BUILD_TYPE='main' METAMASK_ENVIRONMENT='qa' yarn build:android:qa",
},
},
};
2 changes: 1 addition & 1 deletion .github/scripts/get-next-semver-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ VERSION_BRANCHES=$(git branch -r | grep -o 'release/[0-9]*\.[0-9]*\.[0-9]*' | gr
VERSION_TAGS=$(git tag | grep -o 'v[0-9]*\.[0-9]*\.[0-9]*' | grep -o '[0-9]*\.[0-9]*\.[0-9]*' | sort --version-sort | tail -n 1)

# Get the version from package.json
VERSION_PACKAGE=$(node -p "require('./package.json').version")
VERSION_PACKAGE=$(node -p "require('../../package.json').version")

# Compare versions and keep the highest one
HIGHEST_VERSION=$(printf "%s\n%s\n%s" "$VERSION_BRANCHES" "$VERSION_TAGS" "$VERSION_PACKAGE" | sort --version-sort | tail -n 1)
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ android {
release {
manifestPlaceholders.isDebug = false
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro", "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro", "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules.pro"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const styleSheet = StyleSheet.create({
justifyContent: 'flex-start',
},
accountNameLabelText: {
marginLeft: 4,
paddingHorizontal: 8,
borderWidth: 1,
borderRadius: 8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ const AccountBase = ({

<View style={styles.accountNameLabel}>
<Text variant={TextVariant.BodyMDBold}>{accountName}</Text>
{accountTypeLabel && (
</View>
{accountTypeLabel && (
<View style={styles.accountNameLabel}>
<Text
variant={TextVariant.BodySM}
variant={TextVariant.BodyMDBold}
style={styles.accountNameLabelText}
>
{strings(accountTypeLabel)}
</Text>
)}
</View>
)}
</View>
</View>
<View>
Expand Down
12 changes: 6 additions & 6 deletions app/components/Base/Title/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const Title: React.FC<TitleProps> = ({

return (
<Text
style={[
style.text,
centered && style.centered,
hero && style.hero,
externalStyle,
]}
style={{
...style.text,
...(centered ? style.centered : {}),
...(hero ? style.hero : {}),
...(typeof externalStyle === 'object' ? externalStyle : {}),
}}
{...props}
/>
);
Expand Down
11 changes: 10 additions & 1 deletion app/components/Nav/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ import OptionsSheet from '../../UI/SelectOptionSheet/OptionsSheet';
import FoxLoader from '../../../components/UI/FoxLoader';
import { AppStateEventProcessor } from '../../../core/AppStateEventListener';
import MultiRpcModal from '../../../components/Views/MultiRpcModal/MultiRpcModal';
import { trace, TraceName, TraceOperation } from '../../../util/trace';

const clearStackNavigatorOptions = {
headerShown: false,
Expand Down Expand Up @@ -354,7 +355,15 @@ const App = (props) => {
setOnboarded(!!existingUser);
try {
if (existingUser) {
await Authentication.appTriggeredAuth();
await trace(
{
name: TraceName.BiometricAuthentication,
op: TraceOperation.BiometricAuthentication,
},
async () => {
await Authentication.appTriggeredAuth();
},
);
// we need to reset the navigator here so that the user cannot go back to the login screen
navigator.reset({ routes: [{ name: Routes.ONBOARDING.HOME_NAV }] });
} else {
Expand Down
1 change: 0 additions & 1 deletion app/components/Nav/Main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ const MainFlow = () => (
mode={'modal'}
screenOptions={{
headerShown: false,
cardStyle: { backgroundColor: importedColors.transparent },
}}
>
<Stack.Screen name={'Main'} component={ConnectedMain} />
Expand Down
14 changes: 12 additions & 2 deletions app/components/UI/Name/Name.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,21 @@ const UnknownEthereumAddress: React.FC<{ address: string }> = ({ address }) => {
);
};

const Name: React.FC<NameProperties> = ({ type, value }) => {
const Name: React.FC<NameProperties> = ({
chainId,
preferContractSymbol,
type,
value,
}) => {
if (type !== NameType.EthereumAddress) {
throw new Error('Unsupported NameType: ' + type);
}
const displayName = useDisplayName(type, value);
const displayName = useDisplayName(
type,
value,
chainId,
preferContractSymbol,
);
const { styles } = useStyles(styleSheet, {
displayNameVariant: displayName.variant,
});
Expand Down
3 changes: 3 additions & 0 deletions app/components/UI/Name/Name.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ViewProps } from 'react-native';
import { Hex } from '@metamask/utils';

/**
* The name types supported by the NameController.
Expand All @@ -11,6 +12,8 @@ export enum NameType {
}

export interface NameProperties extends ViewProps {
chainId?: Hex;
preferContractSymbol?: boolean;
type: NameType;
value: string;
}
63 changes: 45 additions & 18 deletions app/components/UI/Navbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1824,34 +1824,61 @@ export const getSettingsNavigationOptions = (title, themeColors) => {
};
};

export function getStakingNavbar(title, navigation, themeColors) {
/**
*
* @param {String} title - Navbar Title.
* @param {NavigationProp<ParamListBase>} navigation Navigation object returned from useNavigation hook.
* @param {ThemeColors} themeColors theme.colors returned from useStyles hook.
* @param {{ backgroundColor?: string, hasCancelButton?: boolean, hasBackButton?: boolean }} [options] - Optional options for navbar.
* @returns Staking Navbar Component.
*/
export function getStakingNavbar(title, navigation, themeColors, options) {
const { hasBackButton = true, hasCancelButton = true } = options ?? {};

const innerStyles = StyleSheet.create({
headerStyle: {
backgroundColor:
options?.backgroundColor ?? themeColors.background.default,
shadowOffset: null,
},
headerLeft: {
marginHorizontal: 16,
},
headerButtonText: {
color: themeColors.primary.default,
fontSize: 14,
...fontStyles.normal,
},
headerStyle: {
backgroundColor: themeColors.background.default,
shadowColor: importedColors.transparent,
elevation: 0,
},
});

function navigationPop() {
navigation.goBack();
}

return {
headerTitle: () => (
<NavbarTitle title={title} disableNetwork translate={false} />
),
headerLeft: () => <View />,
headerRight: () => (
<TouchableOpacity
onPress={() => navigation.dangerouslyGetParent()?.pop()}
style={styles.closeButton}
>
<Text style={innerStyles.headerButtonText}>
{strings('navigation.cancel')}
</Text>
</TouchableOpacity>
<MorphText variant={TextVariant.HeadingMD}>{title}</MorphText>
),
headerStyle: innerStyles.headerStyle,
headerLeft: () =>
hasBackButton ? (
<ButtonIcon
size={ButtonIconSizes.Lg}
iconName={IconName.ArrowLeft}
onPress={navigationPop}
style={innerStyles.headerLeft}
/>
) : null,
headerRight: () =>
hasCancelButton ? (
<TouchableOpacity
onPress={() => navigation.dangerouslyGetParent()?.pop()}
style={styles.closeButton}
>
<Text style={innerStyles.headerButtonText}>
{strings('navigation.cancel')}
</Text>
</TouchableOpacity>
) : null,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import NotificationContent from './Content';

describe('NotificationContent', () => {
const title = 'Welcome to the new Test!';
const createdAt = '2024-04-26T16:35:03.147606Z';
const yesterday = new Date().setDate(new Date().getDate() - 1);
const createdAt = new Date(yesterday).toISOString(); // Relative date: one day before current date
const description = {
start:
'We are excited to announce the launch of our brand new website and app!',
end: 'Ethereum',
};

it('renders correctly', () => {
it('render matches snapshot', () => {
const { toJSON } = renderWithProvider(
<NotificationContent
title={title}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`NotificationContent renders correctly 1`] = `
exports[`NotificationContent render matches snapshot 1`] = `
<View
style={
{
Expand Down Expand Up @@ -47,7 +47,7 @@ exports[`NotificationContent renders correctly 1`] = `
}
}
>
6 months ago
Yesterday
</Text>
</View>
<View
Expand Down
Loading

0 comments on commit 5809ba9

Please sign in to comment.