Skip to content
Draft
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions app/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ module.exports = {
'src/components/NavBar/BaseNavBar.tsx',
'src/navigation/index.tsx',
'src/providers/passportDataProvider.tsx',
'src/utils/cloudBackup/helpers.ts',
'src/utils/haptic/index.ts',
'src/services/cloud-backup/helpers.ts',
'src/integrations/haptics/index.ts',
],
rules: {
'sort-exports/sort-exports': 'off',
Expand Down Expand Up @@ -226,13 +226,6 @@ module.exports = {
'no-console': 'off',
},
},
{
// Allow require imports for dynamic imports in proving machine
files: ['src/utils/proving/provingMachine.ts'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
},
},
{
// Allow require imports for conditional loading in navigation
files: ['src/navigation/index.tsx'],
Expand Down
2 changes: 1 addition & 1 deletion app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import App from './App';
import { name as appName } from './app.json';
import tamaguiConfig from './tamagui.config';

import './src/utils/ethers';
import './src/lib/crypto/ethers';
import 'react-native-gesture-handler';

// Set global Buffer before any other imports
Expand Down
6 changes: 3 additions & 3 deletions app/jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,8 @@ NativeModules.PassportReader = {
reset: jest.fn(),
};

// Mock @/utils/passportReader to properly expose the interface expected by tests
jest.mock('./src/utils/passportReader', () => {
// Mock @/integrations/nfc/passportReader to properly expose the interface expected by tests
jest.mock('./src/integrations/nfc/passportReader', () => {
const mockScanPassport = jest.fn();
// Mock the parameter count for scanPassport (iOS native method takes 9 parameters)
Object.defineProperty(mockScanPassport, 'length', { value: 9 });
Expand Down Expand Up @@ -776,7 +776,7 @@ jest.mock('react-native-localize', () => ({
}),
}));

jest.mock('./src/utils/notifications/notificationService', () =>
jest.mock('./src/services/notifications/notificationService', () =>
require('./tests/__setup__/notificationServiceMock.js'),
);

Expand Down
15 changes: 9 additions & 6 deletions app/scripts/tests/aliasImports.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ describe('alias-imports transform', () => {
const appRoot = tempRoot;
const srcDir = join(appRoot, 'src');
const testsSrcDir = join(appRoot, 'tests', 'src');
const fileHaptic = join(srcDir, 'utils', 'haptic.ts');
const fileHaptic = join(srcDir, 'integrations', 'haptics.ts');
const deepSpecDir = join(testsSrcDir, 'deep');
const deepSpecFile = join(deepSpecDir, 'spec.ts');

writeFileEnsured(fileHaptic, 'export const h = 1;\n');
writeFileEnsured(
deepSpecFile,
"import { h } from '../../../src/utils/haptic';\nexport const v = h;\n",
"import { h } from '../../../src/integrations/haptics';\nexport const v = h;\n",
);

const project = new Project({
Expand All @@ -203,21 +203,24 @@ describe('alias-imports transform', () => {
const specFile = project.getSourceFileOrThrow(deepSpecFile);
const imports = specFile.getImportDeclarations();
assert.strictEqual(imports.length, 1);
assert.strictEqual(imports[0].getModuleSpecifierValue(), '@/utils/haptic');
assert.strictEqual(
imports[0].getModuleSpecifierValue(),
'@/integrations/haptics',
);
});

it("transforms deep relative require '../../../src/...' to @src alias from tests", () => {
const appRoot = tempRoot;
const srcDir = join(appRoot, 'src');
const testsSrcDir = join(appRoot, 'tests', 'src');
const fileHaptic = join(srcDir, 'utils', 'haptic.ts');
const fileHaptic = join(srcDir, 'integrations', 'haptics.ts');
const deepSpecDir = join(testsSrcDir, 'deep');
const deepSpecFile = join(deepSpecDir, 'req.ts');

writeFileEnsured(fileHaptic, 'module.exports = { h: 1 };\n');
writeFileEnsured(
deepSpecFile,
"const h = require('../../../src/utils/haptic');\nexport const v = h;\n",
"const h = require('../../../src/integrations/haptics');\nexport const v = h;\n",
);

const project = new Project({
Expand All @@ -232,7 +235,7 @@ describe('alias-imports transform', () => {
transformProjectToAliasImports(project, appRoot);

const specFile = project.getSourceFileOrThrow(deepSpecFile);
assert.ok(specFile.getText().includes("require('@/utils/haptic')"));
assert.ok(specFile.getText().includes("require('@/integrations/haptics')"));
});

it('aliases export star re-exports with ../ from sibling directory', () => {
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
4 changes: 2 additions & 2 deletions app/src/components/Disclosures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import type { Country3LetterCode } from '@selfxyz/common/constants';
import { countryCodes } from '@selfxyz/common/constants';
import type { SelfAppDisclosureConfig } from '@selfxyz/common/utils';
import { BodyText } from '@selfxyz/mobile-sdk-alpha/components';
import { slate200, slate500 } from '@selfxyz/mobile-sdk-alpha/constants/colors';

import CheckMark from '@/images/icons/checkmark.svg';
import { slate200, slate500 } from '@/utils/colors';
import CheckMark from '@/assets/images/icons/checkmark.svg';

interface DisclosureProps {
disclosures: SelfAppDisclosureConfig;
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { ErrorInfo } from 'react';
import React, { Component } from 'react';
import { Text, View } from 'react-native';

import { captureException } from '@/Sentry';
import { flushAllAnalytics, trackNfcEvent } from '@/utils/analytics';
import { captureException } from '@/config/sentry';
import { flushAllAnalytics, trackNfcEvent } from '@/services/analytics';

interface Props {
children: React.ReactNode;
Expand Down
11 changes: 8 additions & 3 deletions app/src/components/FeedbackModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ import React, { useState } from 'react';
import { Alert, Modal, StyleSheet, Text, TextInput, View } from 'react-native';
import { Button, XStack, YStack } from 'tamagui';

import { advercase, dinot } from '@selfxyz/mobile-sdk-alpha';
import { Caption } from '@selfxyz/mobile-sdk-alpha/components';

import { black, slate400, white, zinc800, zinc900 } from '@/utils/colors';
import { advercase, dinot } from '@/utils/fonts';
import {
black,
slate400,
white,
zinc800,
zinc900,
} from '@selfxyz/mobile-sdk-alpha/constants/colors';

interface FeedbackModalProps {
visible: boolean;
Expand Down
8 changes: 4 additions & 4 deletions app/src/components/FeedbackModalScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import {
SecondaryButton,
Title,
} from '@selfxyz/mobile-sdk-alpha/components';
import { white } from '@selfxyz/mobile-sdk-alpha/constants/colors';

import ModalClose from '@/images/icons/modal_close.svg';
import LogoInversed from '@/images/logo_inversed.svg';
import { white } from '@/utils/colors';
import { confirmTap, impactLight } from '@/utils/haptic';
import ModalClose from '@/assets/images/icons/modal_close.svg';
import LogoInversed from '@/assets/images/logo_inversed.svg';
import { confirmTap, impactLight } from '@/integrations/haptics';

const ModalBackDrop = styled(View, {
display: 'flex',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import React from 'react';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { Text, View, XStack, YStack } from 'tamagui';

import { DelayedLottieView } from '@selfxyz/mobile-sdk-alpha';

import CloseWarningIcon from '@/images/icons/close-warning.svg';
import Plus from '@/images/icons/plus_slate600.svg';
import { advercase, DelayedLottieView, dinot } from '@selfxyz/mobile-sdk-alpha';
import {
black,
cyan300,
Expand All @@ -19,9 +16,11 @@ import {
white,
zinc500,
zinc900,
} from '@/utils/colors';
import { extraYPadding } from '@/utils/constants';
import { advercase, dinot } from '@/utils/fonts';
} from '@selfxyz/mobile-sdk-alpha/constants/colors';

import CloseWarningIcon from '@/assets/images/icons/close-warning.svg';
import Plus from '@/assets/images/icons/plus_slate600.svg';
import { extraYPadding } from '@/utils/styleUtils';

interface LoadingUIProps {
animationSource: LottieView['props']['source'];
Expand Down
7 changes: 4 additions & 3 deletions app/src/components/Mnemonic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import React, { useCallback, useState } from 'react';
import { Button, Text, XStack, YStack } from 'tamagui';
import Clipboard from '@react-native-clipboard/clipboard';

import { useSettingStore } from '@/stores/settingStore';
import {
black,
slate50,
Expand All @@ -15,8 +14,10 @@ import {
slate500,
teal500,
white,
} from '@/utils/colors';
import { confirmTap } from '@/utils/haptic';
} from '@selfxyz/mobile-sdk-alpha/constants/colors';

import { confirmTap } from '@/integrations/haptics';
import { useSettingStore } from '@/stores/settingStore';

interface MnemonicProps {
words?: string[];
Expand Down
12 changes: 8 additions & 4 deletions app/src/components/NavBar/AadhaarNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
import type { NativeStackHeaderProps } from '@react-navigation/native-stack';
import { ChevronLeft, HelpCircle } from '@tamagui/lucide-icons';

import { dinot } from '@selfxyz/mobile-sdk-alpha';
import { Button, XStack, YStack } from '@selfxyz/mobile-sdk-alpha/components';
import {
black,
slate100,
slate300,
} from '@selfxyz/mobile-sdk-alpha/constants/colors';

import { NavBar } from '@/components/NavBar/BaseNavBar';
import { black, slate100, slate300 } from '@/utils/colors';
import { extraYPadding } from '@/utils/constants';
import { dinot } from '@/utils/fonts';
import { buttonTap } from '@/utils/haptic';
import { buttonTap } from '@/integrations/haptics';
import { extraYPadding } from '@/utils/styleUtils';

export const AadhaarNavBar = (props: NativeStackHeaderProps) => {
const insets = useSafeAreaInsets();
Expand Down
7 changes: 4 additions & 3 deletions app/src/components/NavBar/DefaultNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import type { TextStyle, ViewStyle } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import type { NativeStackHeaderProps } from '@react-navigation/native-stack';

import { white } from '@selfxyz/mobile-sdk-alpha/constants/colors';

import { NavBar } from '@/components/NavBar/BaseNavBar';
import { white } from '@/utils/colors';
import { extraYPadding } from '@/utils/constants';
import { buttonTap } from '@/utils/haptic';
import { buttonTap } from '@/integrations/haptics';
import { extraYPadding } from '@/utils/styleUtils';

export const DefaultNavBar = (props: NativeStackHeaderProps) => {
const { goBack, canGoBack } = props.navigation;
Expand Down
5 changes: 3 additions & 2 deletions app/src/components/NavBar/DocumentFlowNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { useNavigation } from '@react-navigation/native';
import { HelpCircle } from '@tamagui/lucide-icons';

import { dinot } from '@selfxyz/mobile-sdk-alpha';
import { slate100 } from '@selfxyz/mobile-sdk-alpha/constants/colors';

import { NavBar } from '@/components/NavBar/BaseNavBar';
import { slate100 } from '@/utils/colors';
import { dinot } from '@/utils/fonts';

export const DocumentFlowNavBar = ({
title,
Expand Down
16 changes: 10 additions & 6 deletions app/src/components/NavBar/HomeNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ import { Clipboard as ClipboardIcon } from '@tamagui/lucide-icons';

import type { SelfApp } from '@selfxyz/common/utils/appType';
import { useSelfClient } from '@selfxyz/mobile-sdk-alpha';
import {
black,
charcoal,
slate50,
} from '@selfxyz/mobile-sdk-alpha/constants/colors';

import ActivityIcon from '@/assets/images/icons/activity.svg';
import ScanIcon from '@/assets/images/icons/qr_scan.svg';
import SettingsIcon from '@/assets/images/icons/settings.svg';
import { NavBar } from '@/components/NavBar/BaseNavBar';
import ActivityIcon from '@/images/icons/activity.svg';
import ScanIcon from '@/images/icons/qr_scan.svg';
import SettingsIcon from '@/images/icons/settings.svg';
import { black, charcoal, slate50 } from '@/utils/colors';
import { extraYPadding } from '@/utils/constants';
import { buttonTap } from '@/utils/haptic';
import { buttonTap } from '@/integrations/haptics';
import { extraYPadding } from '@/utils/styleUtils';

export const HomeNavBar = (props: NativeStackHeaderProps) => {
const selfClient = useSelfClient();
Expand Down
10 changes: 7 additions & 3 deletions app/src/components/NavBar/IdDetailsNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
import type { NativeStackHeaderProps } from '@react-navigation/native-stack';

import { Button, Text, View } from '@selfxyz/mobile-sdk-alpha/components';
import {
black,
charcoal,
slate50,
} from '@selfxyz/mobile-sdk-alpha/constants/colors';

import { NavBar } from '@/components/NavBar/BaseNavBar';
import { black, charcoal, slate50 } from '@/utils/colors';
import { extraYPadding } from '@/utils/constants';
import { buttonTap } from '@/utils/haptic';
import { buttonTap } from '@/integrations/haptics';
import { extraYPadding } from '@/utils/styleUtils';

export const IdDetailsNavBar = (props: NativeStackHeaderProps) => {
const insets = useSafeAreaInsets();
Expand Down
6 changes: 3 additions & 3 deletions app/src/components/NavBar/WebViewNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { StyleSheet, Text } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { ExternalLink, X } from '@tamagui/lucide-icons';

import { dinot } from '@selfxyz/mobile-sdk-alpha';
import { Button, XStack } from '@selfxyz/mobile-sdk-alpha/components';
import { black } from '@selfxyz/mobile-sdk-alpha/constants/colors';

import { black } from '@/utils/colors';
import { dinot } from '@/utils/fonts';
import { buttonTap } from '@/utils/haptic';
import { buttonTap } from '@/integrations/haptics';

export interface WebViewNavBarProps {
title?: string;
Expand Down
3 changes: 1 addition & 2 deletions app/src/components/Tips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import React from 'react';
import { Text, View } from 'tamagui';

import { Caption } from '@selfxyz/mobile-sdk-alpha/components';

import { slate500 } from '@/utils/colors';
import { slate500 } from '@selfxyz/mobile-sdk-alpha/constants/colors';

export interface TipProps {
title: string;
Expand Down
8 changes: 6 additions & 2 deletions app/src/components/WebViewFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ import React from 'react';
import { ArrowLeft, ArrowRight, RotateCcw } from '@tamagui/lucide-icons';

import { Button, XStack, YStack } from '@selfxyz/mobile-sdk-alpha/components';
import {
black,
slate50,
slate400,
} from '@selfxyz/mobile-sdk-alpha/constants/colors';

import { black, slate50, slate400 } from '@/utils/colors';
import { buttonTap } from '@/utils/haptic';
import { buttonTap } from '@/integrations/haptics';

export interface WebViewFooterProps {
canGoBack: boolean;
Expand Down
14 changes: 7 additions & 7 deletions app/src/components/homeScreen/idCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ import {
} from '@selfxyz/common/constants';
import type { PassportData } from '@selfxyz/common/types/passport';
import { isAadhaarDocument, isMRZDocument } from '@selfxyz/common/utils/types';
import AadhaarIcon from '@selfxyz/mobile-sdk-alpha/svgs/icons/aadhaar.svg';
import EPassport from '@selfxyz/mobile-sdk-alpha/svgs/icons/epassport.svg';

import { SvgXml } from '@/components/homeScreen/SvgXmlWrapper';
import LogoGray from '@/images/logo_gray.svg';
import { dinot, plexMono } from '@selfxyz/mobile-sdk-alpha';
import {
black,
slate100,
slate300,
slate400,
slate500,
white,
} from '@/utils/colors';
import { dinot, plexMono } from '@/utils/fonts';
} from '@selfxyz/mobile-sdk-alpha/constants/colors';
import AadhaarIcon from '@selfxyz/mobile-sdk-alpha/svgs/icons/aadhaar.svg';
import EPassport from '@selfxyz/mobile-sdk-alpha/svgs/icons/epassport.svg';

import LogoGray from '@/assets/images/logo_gray.svg';
import { SvgXml } from '@/components/homeScreen/SvgXmlWrapper';

// Import the logo SVG as a string
const logoSvg = `<svg width="47" height="46" viewBox="0 0 47 46" fill="none" xmlns="http://www.w3.org/2000/svg">
Expand Down
File renamed without changes.
Loading
Loading