Skip to content

Commit

Permalink
Merge branch 'main' into yarn-1.22.22
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat authored Apr 24, 2024
2 parents 75828e7 + c11dd2e commit 3f3a1f5
Show file tree
Hide file tree
Showing 238 changed files with 7,375 additions and 964 deletions.
3 changes: 3 additions & 0 deletions .github/guidelines/LABELING_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Every PR shall include one the QA labels below:
Once PR has been tested by QA (only if the PR was labeled with `needs-qa`):
- **QA Passed**: If the PR was labeled with `needs-qa`, this label must be added once QA has signed off

### Optional labels:
- **regression-develop**: This label can manually be added to a bug report issue at the time of its creation if the bug is present on development branch (i.e. `main`), but is not yet released in production.

### Labels prohibited when PR needs to be merged:
Any PR that includes one of the following labels can not be merged:

Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/crowdin-branch-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Crowdin - Branch and Label Cleanup for merged localization PR
# This action should delete the branch from Crowdin after the localization PR is
# merged to the original branch. It should also remove the "ready-for-translation" label

# TODO: Add trigger for merge of localization PR.
on: workflow_dispatch

jobs:
prestep:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.extract_current_branch.outputs.branch }}
pr: ${{ steps.get-prs.outputs.pr }}
modified_branch_name: ${{ steps.extract_modified_branch_name.outputs.modified_branch_name }}
steps:
- name: Extract current branch name
shell: bash
run: |
echo "running on branch ${GITHUB_REF##*/}"
echo "other version: ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT"
id: extract_current_branch

- name: Get PR with Label for this branch
id: get-prs
run: |
LABEL="ready-for-translation"
API_URL="https://api.github.com/repos/Metamask/crowdin-sandbox/pulls?head:${{steps.extract_current_branch.outputs.branch}}&state=open&per_page=100"
# Fetch the list of open pull requests with the specified label using curl
PRS=$(curl -sS --header "Authorization: Bearer $GITHUB_TOKEN" "$API_URL")
PR=$(echo "$PRS" | jq -r '.[] | select(.labels[].name == "'"$LABEL"'") | .number | @json')
echo "Found PR: $PR"
echo "pr=$PR" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CURRENT_BRANCH: ${{ steps.extract_current_branch.outputs.branch }}

- name: Modified branch name
run: echo "modified_branch_name="${{ steps.extract_current_branch.outputs.branch }} | sed 's#/#-#g'"" >> "$GITHUB_OUTPUT"
id: extract_modified_branch_name

github_cleanup:
runs-on: ubuntu-latest
needs: prestep
steps:
- name: Remove label from PR
uses: actions/github-script@v3
if: needs.prestep.outputs.pr != null || needs.prestep.outputs.pr != ''
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const label = "ready-for-translation";
await github.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ needs.prestep.outputs.pr }},
name: label
});
crowdin_cleanup:
runs-on: ubuntu-latest
needs: prestep
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ needs.prestep.outputs.branch }}

- name: Delete branch within Crowdin
if: needs.prestep.outputs.branch != 'main'
uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d
with:
command: ${{ needs.prestep.outputs.modified_branch_name }}
command_args: -v
54 changes: 54 additions & 0 deletions .github/workflows/crowdin-branch-pr-ready-for-translation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Crowdin - Ready for translations label added, push to crowdin

# When an individual is working on a feature which requires translations, they can
# add a label "ready-for-translation" which will trigger this action to push the
# source and translation files to Crowdin. We will always push main as the base of
# the crowdin branch creation and then push in the changes over the top. This ensures
# that the translations which have already been done and approved previously do not
# show as needing to be translated again in the crowdin branch.

# TODO: switch to trigger on label add once testing complete
on: workflow_dispatch

jobs:
crowdin-upload:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

steps:
- name: Extract current branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT"
id: extract_current_branch

- name: Modified branch name
run: echo "modified_branch_name="${{ steps.extract_current_branch.outputs.branch }} | sed 's#/#-#g'"" >> "$GITHUB_OUTPUT"
id: extract_modified_branch_name

- name: Checkout
uses: actions/checkout@v3
with:
ref: main

- name: Crowdin push main as baseline
uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d
with:
crowdin_branch_name: ${{ steps.extract_modified_branch_name.outputs.modified_branch_name }}
upload_sources: true
upload_translations_args: --import-eq-suggestions --auto-approve-imported --verbose
upload_translations: true

- name: Checkout Branch and push to crowdin
uses: actions/checkout@v3
with:
ref: ${{ steps.extract_current_branch.outputs.branch }}
- name: Crowdin sources push
uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d
with:
crowdin_branch_name: ${{ steps.extract_modified_branch_name.outputs.modified_branch_name }}
upload_sources: true
upload_sources_args: --auto-update --verbose
upload_translations: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Crowdin - Find all branches with translations and trigger completion checks
# This workflow will run on a schedule. It will pull all pull requests with a label of
# ready-for-translation and create a matrix of the associated branches to run the
# crowdin-reusable-translation-download.yml workflow on.
# That workflow will check the status of the translations and if complete create a pull
# request with the translations off of the branch.

permissions:
contents: write
pull-requests: write

# TODO: Add a schedule to run this workflow twice a day(?) once the testing is complete
on: workflow_dispatch

jobs:
run-check-and-download-for-branch:
needs: get-branches
if: ${{ needs.get-branches.outputs.matrix != '[]' && needs.get-branches.outputs.matrix != '' }}
strategy:
fail-fast: false
matrix:
branch: ${{fromJson(needs.get-branches.outputs.matrix)}}
uses: ./.github/workflows/crowdin-reusable-translation-download.yml
with:
branch: ${{ matrix.branch }}
secrets:
gh_token: ${{ secrets.GITHUB_TOKEN }}
crowdin_personal_token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
crowdin_project_id: ${{ secrets.CROWDIN_PROJECT_ID }}

get-branches:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix-outputs.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Get Branches with Label
id: get-branches
run: |
GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"
LABEL="ready-for-translation"
API_URL="https://api.github.com/repos/Metamask/crowdin-sandbox/pulls?state=open&per_page=100"
# Fetch the list of open pull requests with the specified label using curl
PRS=$(curl -sS --header "Authorization: Bearer $GITHUB_TOKEN" "$API_URL")
BRANCHES=$(echo "$PRS" | jq -r '[.[] | select(.labels[].name == "'"$LABEL"'") | .head.ref] | @json')
echo "Found branches: $BRANCHES"
echo "branches=$BRANCHES" >> "$GITHUB_OUTPUT"
- name: Set up matrix
id: matrix-outputs
run: |
# Parse the branches output and create a matrix
BRANCHES="${{ toJson(steps.get-branches.outputs.branches) }}"
echo "Creating matrix from branches..."
MATRIX="${BRANCHES}"
echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"
68 changes: 68 additions & 0 deletions .github/workflows/crowdin-reusable-translation-download.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Crowdin - Check translation progress and download if complete (unless main)
# This is a reusable workflow that is called by crowdin-pull-branch-pr-completed-translations
# across all branches which have a label of "ready-for-translation" aka being translated.
# This workflow will check the translation progress and download the translations if
# they are 100% translated. If the branch that is running this is main it will skip completion
# check and just pull whatever translations are available.


permissions:
contents: write
pull-requests: write

on:
workflow_call:
inputs:
branch:
required: true
type: string
secrets:
gh_token:
required: true
crowdin_project_id:
required: true
crowdin_personal_token:
required: true

jobs:
crowdin:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.gh_token }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.crowdin_personal_token }}
CROWDIN_PROJECT_ID: ${{ secrets.crowdin_project_id }}

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}

- name: Modified branch name
run: echo "modified_branch_name="${{ inputs.branch }} | sed 's#/#-#g'"" >> "$GITHUB_OUTPUT"
id: extract_modified_branch_name

- name: Check translation progress
# when main just pull whatever you have (aka skip this) - need to test
if: ${{ inputs.branch != 'main' }}
uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d
with:
command: 'status translation'
command_args: '-b ${{ steps.extract_modified_branch_name.outputs.modified_branch_name }} --fail-if-incomplete'

- name: Synchronize with Crowdin
uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d
with:
crowdin_branch_name: ${{ steps.extract_modified_branch_name.outputs.modified_branch_name }}
upload_sources: false
upload_translations: false
download_translations: true
skip_untranslated_strings: true
export_only_approved: true
localization_branch_name: l10n_crowdin_translations_${{ inputs.branch }}

create_pull_request: true
skip_ref_checkout: true
pull_request_title: New Crowdin translations for ${{ inputs.branch }}
pull_request_body: New Crowdin pull request with translations for ${{ inputs.branch }}
pull_request_base_branch_name: ${{ inputs.branch }}
31 changes: 31 additions & 0 deletions .github/workflows/crowdin-upload-both-sources-translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Crowdin - Upload Both Sources and Translations Crowdin Action
# This action is intended to ensure our main branch on crowdin is in sync with our
# main branch on github and will run on every push to main that has changes to any
# locales files.

# TODO: Change to trigger on merge to main when locales files are changed (after testing)
# This should replace the current crowdin_action.yml file (after testing)
on: workflow_dispatch

jobs:
crowdin-upload:
runs-on: ubuntu-latest
steps:
- name: Extract current branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT"
id: extract_current_branch
- name: Checkout
uses: actions/checkout@v3

- name: Crowdin push
uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d
with:
crowdin_branch_name: ${{ steps.extract_current_branch.outputs.branch }}
upload_sources: true
upload_translations: true
upload_translations_args: --import-eq-suggestions --auto-approve-imported --verbose
download_translations: false
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
3 changes: 0 additions & 3 deletions .iyarc
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# Excluded and patched using this current patch patches/request+2.88.2.patch
GHSA-p8p7-x288-28g6

# ReDoS vulnerability, no impact to this application, and fix not backported yet to the versions we use
GHSA-c2qf-rxjj-qqgw
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

## Current Main Branch

## 7.20.0 - Apr 1, 2024
## 7.20.1 - Apr 18, 2024
### Fixed
- [#9092](https://github.com/MetaMask/metamask-mobile/pull/9092): fix: check HD keyring

## 7.20.0 - Apr 12, 2024
### Added
- [#8982](https://github.com/MetaMask/metamask-mobile/pull/8982): feat: Update gas fee controller to version 6.1.2
- [#9079](https://github.com/MetaMask/metamask-mobile/pull/9079): feat: Update controller utils to 5.0.2
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ android {
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1308
versionName "7.20.0"
versionCode 1314
versionName "7.20.1"
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy 'react-native-camera', 'general'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
7 changes: 7 additions & 0 deletions app/actions/notification/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,10 @@ export function removeNotVisibleNotifications() {
type: 'REMOVE_NOT_VISIBLE_NOTIFICATIONS',
};
}

export function updateNotificationStatus(notificationsSettings) {
return {
type: 'UPDATE_NOTIFICATION_STATUS',
notificationsSettings,
};
}
7 changes: 7 additions & 0 deletions app/actions/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ export function setUseBlockieIcon(useBlockieIcon) {
useBlockieIcon,
};
}

export function toggleBasicFunctionality(basicFunctionalityEnabled) {
return {
type: 'TOGGLE_BASIC_FUNCTIONALITY',
basicFunctionalityEnabled,
};
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export const BADGE_BADGENETWORK_TEST_ID = 'badge-badgenetwork';
export const BADGE_BADGESTATUS_TEST_ID = 'badge-badgestatus';
export const BADGE_BADGENOTIFICATIONS_TEST_ID = 'badge-badgenotifications';
12 changes: 9 additions & 3 deletions app/component-library/components/Badges/Badge/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/* eslint-disable react/prop-types */
import React from 'react';

// External dependencies.
import BadgeNetwork from './variants/BadgeNetwork';
import BadgeStatus from './variants/BadgeStatus';
import BadgeNotifications from './variants/BadgeNotifications';

// Internal dependencies.
import { BadgeProps, BadgeVariant } from './Badge.types';
import {
BADGE_BADGENETWORK_TEST_ID,
BADGE_BADGESTATUS_TEST_ID,
BADGE_BADGENOTIFICATIONS_TEST_ID,
} from './Badge.constants';

const Badge = ({ variant, ...props }: BadgeProps) => {
Expand All @@ -18,6 +17,13 @@ const Badge = ({ variant, ...props }: BadgeProps) => {
return <BadgeNetwork testID={BADGE_BADGENETWORK_TEST_ID} {...props} />;
case BadgeVariant.Status:
return <BadgeStatus testID={BADGE_BADGESTATUS_TEST_ID} {...props} />;
case BadgeVariant.NotificationsKinds:
return (
<BadgeNotifications
testID={BADGE_BADGENOTIFICATIONS_TEST_ID}
{...props}
/>
);
default:
throw new Error('Invalid Badge Variant');
}
Expand Down
Loading

0 comments on commit 3f3a1f5

Please sign in to comment.