From fc82b6b2b3871f5dad3303a3daa663d822054ee5 Mon Sep 17 00:00:00 2001 From: Aaron DeRuvo Date: Tue, 9 Dec 2025 12:56:05 +0100 Subject: [PATCH] Prepares app for Euclid (#1473) * setup IS_EUCLID build variable for conditionally using euclid desgins create a headless header that only handles the status bar, for the new screens since they manage their own make sure new screens get proper insets add recoveryphrase 3.0 fix country picker * this lint runs twice. once in repo wide lint and once here. so lets just run once to save resources Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/workflows/mobile-bundle-analysis.yml | 1 + .github/workflows/mobile-ci.yml | 5 +- .github/workflows/mobile-deploy.yml | 1 + app/babel.config.cjs | 5 ++ app/jest.config.cjs | 2 +- app/package.json | 4 +- app/scripts/bundle-analyze-ci.cjs | 4 +- .../navbar/HeadlessNavForEuclid.tsx | 17 ++++ app/src/hooks/useSafeAreaInsets.ts | 16 ++++ app/src/navigation/account.ts | 22 +++-- app/src/navigation/documents.ts | 15 +++- .../settings/ShowRecoveryPhraseScreen.tsx | 78 +++++++++++++++-- .../selection/CountryPickerScreen.tsx | 19 ++++- app/src/utils/devUtils.ts | 1 + app/tests/src/hooks/useModal.test.ts | 1 + .../src/integrations/nfc/nfcScanner.test.ts | 83 ++++++++++++++++++- app/tests/src/navigation/index.test.ts | 4 +- packages/mobile-sdk-alpha/package.json | 2 +- .../onboarding/country-picker-screen.tsx | 9 +- .../src/screens/CountrySelection.tsx | 2 +- yarn.lock | 19 +++-- 21 files changed, 273 insertions(+), 37 deletions(-) create mode 100644 app/src/components/navbar/HeadlessNavForEuclid.tsx create mode 100644 app/src/hooks/useSafeAreaInsets.ts diff --git a/.github/workflows/mobile-bundle-analysis.yml b/.github/workflows/mobile-bundle-analysis.yml index 198e572e0..efee6c5f4 100644 --- a/.github/workflows/mobile-bundle-analysis.yml +++ b/.github/workflows/mobile-bundle-analysis.yml @@ -5,6 +5,7 @@ env: JAVA_VERSION: 17 WORKSPACE: ${{ github.workspace }} APP_PATH: ${{ github.workspace }}/app + NODE_ENV: "production" on: pull_request: diff --git a/.github/workflows/mobile-ci.yml b/.github/workflows/mobile-ci.yml index d4c7d060c..0f1fe3c19 100644 --- a/.github/workflows/mobile-ci.yml +++ b/.github/workflows/mobile-ci.yml @@ -90,9 +90,6 @@ jobs: - name: Check App Types run: yarn types working-directory: ./app - - name: Check license headers - run: node scripts/check-license-headers.mjs --check - working-directory: ./ test: runs-on: ubuntu-latest @@ -190,6 +187,8 @@ jobs: env: # Increase Node.js memory to prevent hermes-parser WASM memory errors NODE_OPTIONS: --max-old-space-size=4096 + # Override production NODE_ENV for tests - React's production build doesn't include testing utilities + NODE_ENV: test run: | # Final verification from app directory perspective echo "Final verification before running tests (from app directory)..." diff --git a/.github/workflows/mobile-deploy.yml b/.github/workflows/mobile-deploy.yml index bd63c4e15..4ac61e8f2 100644 --- a/.github/workflows/mobile-deploy.yml +++ b/.github/workflows/mobile-deploy.yml @@ -31,6 +31,7 @@ name: Mobile Deploy env: # Build environment versions RUBY_VERSION: 3.2 + NODE_ENV: "production" JAVA_VERSION: 17 ANDROID_API_LEVEL: 35 ANDROID_NDK_VERSION: 27.0.12077973 diff --git a/app/babel.config.cjs b/app/babel.config.cjs index 44824a90e..f0861d392 100644 --- a/app/babel.config.cjs +++ b/app/babel.config.cjs @@ -26,4 +26,9 @@ module.exports = { }, ], ], + env: { + production: { + plugins: ['transform-remove-console'], + }, + }, }; diff --git a/app/jest.config.cjs b/app/jest.config.cjs index 554f36eca..a7d19eb81 100644 --- a/app/jest.config.cjs +++ b/app/jest.config.cjs @@ -16,7 +16,7 @@ module.exports = { 'node', ], transformIgnorePatterns: [ - 'node_modules/(?!(react-native|@react-native|@react-navigation|@react-native-community|@segment/analytics-react-native|@openpassport|react-native-keychain|react-native-check-version|react-native-nfc-manager|react-native-passport-reader|react-native-gesture-handler|uuid|@stablelib|@react-native-google-signin|react-native-cloud-storage|@react-native-clipboard|@react-native-firebase|@selfxyz|@sentry|@anon-aadhaar|react-native-svg|react-native-svg-circle-country-flags)/)', + 'node_modules/(?!(react-native|@react-native|@react-navigation|@react-native-community|@segment/analytics-react-native|@openpassport|react-native-keychain|react-native-check-version|react-native-nfc-manager|react-native-passport-reader|react-native-gesture-handler|uuid|@stablelib|@react-native-google-signin|react-native-cloud-storage|@react-native-clipboard|@react-native-firebase|@selfxyz|@sentry|@anon-aadhaar|react-native-svg|react-native-svg-circle-country-flags|react-native-blur-effect)/)', ], setupFiles: ['/jest.setup.js'], testMatch: [ diff --git a/app/package.json b/app/package.json index c973651a3..041d09f59 100644 --- a/app/package.json +++ b/app/package.json @@ -58,7 +58,7 @@ "sync-versions": "bundle exec fastlane ios sync_version && bundle exec fastlane android sync_version", "tag:release": "node scripts/tag.cjs release", "tag:remove": "node scripts/tag.cjs remove", - "test": "yarn build:deps && yarn jest:run --passWithNoTests && node --test scripts/tests/*.cjs", + "test": "yarn jest:run --passWithNoTests && node --test scripts/tests/*.cjs", "test:build": "yarn build:deps && yarn types && node ./scripts/bundle-analyze-ci.cjs ios && yarn test", "test:ci": "yarn jest:run --passWithNoTests && node --test scripts/tests/*.cjs", "test:coverage": "yarn jest:run --coverage --passWithNoTests", @@ -105,6 +105,7 @@ "@segment/analytics-react-native": "^2.21.2", "@segment/sovran-react-native": "^1.1.3", "@selfxyz/common": "workspace:^", + "@selfxyz/euclid": "^0.6.0", "@selfxyz/mobile-sdk-alpha": "workspace:^", "@sentry/react": "^9.32.0", "@sentry/react-native": "7.0.1", @@ -209,6 +210,7 @@ "@typescript-eslint/parser": "^8.39.0", "@vitejs/plugin-react-swc": "^3.10.2", "babel-plugin-module-resolver": "^5.0.2", + "babel-plugin-transform-remove-console": "^6.9.4", "constants-browserify": "^1.0.0", "dompurify": "^3.2.6", "eslint": "^8.57.0", diff --git a/app/scripts/bundle-analyze-ci.cjs b/app/scripts/bundle-analyze-ci.cjs index 914cf6afd..f4f7dbe72 100755 --- a/app/scripts/bundle-analyze-ci.cjs +++ b/app/scripts/bundle-analyze-ci.cjs @@ -17,8 +17,8 @@ if (!platform || !['android', 'ios'].includes(platform)) { // Bundle size thresholds in MB - easy to update! const BUNDLE_THRESHOLDS_MB = { // TODO: fix temporary bundle bump - ios: 44, - android: 44, + ios: 45, + android: 45, }; function formatBytes(bytes) { diff --git a/app/src/components/navbar/HeadlessNavForEuclid.tsx b/app/src/components/navbar/HeadlessNavForEuclid.tsx new file mode 100644 index 000000000..d2d651717 --- /dev/null +++ b/app/src/components/navbar/HeadlessNavForEuclid.tsx @@ -0,0 +1,17 @@ +// SPDX-FileCopyrightText: 2025 Social Connect Labs, Inc. +// SPDX-License-Identifier: BUSL-1.1 +// NOTE: Converts to Apache-2.0 on 2029-06-11 per LICENSE. + +import { SystemBars } from 'react-native-edge-to-edge'; +import type { NativeStackHeaderProps } from '@react-navigation/native-stack'; + +export const HeadlessNavForEuclid = (props: NativeStackHeaderProps) => { + return ( + <> +