Skip to content
Merged
6 changes: 0 additions & 6 deletions .cursorignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ app/android/dev-keystore
circuits/scripts/server/*.sh
!node_modules/**/*.sh

# Fastlane configuration (may contain secrets)
app/fastlane/Fastfile
app/fastlane/helpers.rb

# Test wallets and mock data
app/ios/passport.json
app/ios/OpenPassport/passport.json
Expand Down Expand Up @@ -100,7 +96,6 @@ contracts/ignition/deployments/
**/.pnp.*

# Mobile specific
app/ios/Podfile.lock
app/android/link-assets-manifest.json
app/ios/link-assets-manifest.json

Expand Down Expand Up @@ -162,7 +157,6 @@ app/android/android-passport-reader/app/src/main/assets/tessdata/
# IDE & Editor Files
# ========================================

.vscode/
.idea/
*.swp
*.swo
Expand Down
49 changes: 47 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,49 @@
{
// Performance Optimizations
"files.watcherExclude": {
"**/node_modules/**": true,
"**/.git/**": true,
"**/dist/**": true,
"**/build/**": true,
"**/vendor/**": true,
"**/coverage/**": true,
"**/.nyc_output/**": true,
"**/android/app/build/**": true,
"**/ios/build/**": true,
"**/circuits/build/**": true,
"**/Pods/**": true,
"**/.gradle/**": true,
"**/DerivedData/**": true
},
"search.exclude": {
"**/node_modules": true,
"**/dist": true,
"**/build": true,
"**/vendor": true,
"**/coverage": true,
"**/.nyc_output": true,
"**/android/app/build": true,
"**/ios/build": true,
"**/circuits/build": true
},
"files.exclude": {
"**/node_modules": false,
"**/.git": true,
"**/.DS_Store": true,
"**/Thumbs.db": true
},

// TypeScript Performance (Keep the good stuff)
"typescript.preferences.includePackageJsonAutoImports": "on",
"typescript.suggest.autoImports": true,
"typescript.disableAutomaticTypeAcquisition": true,
"typescript.updateImportsOnFileMove.enabled": "always",
"typescript.suggestionActions.enabled": true,

// Editor Performance (Sensible optimizations only)
"editor.minimap.enabled": false,
"editor.hover.delay": 500,

// Formatting & Linting
"editor.formatOnSave": false,
"editor.formatOnPaste": false,
Expand All @@ -8,8 +53,8 @@
"editor.formatOnSave": true
},

// ESLint Configuration
"eslint.run": "onType",
// ESLint Configuration - Optimized for Performance
"eslint.run": "onSave",
"eslint.format.enable": true,
"eslint.lintTask.enable": true,
"eslint.quiet": false,
Expand Down
12 changes: 5 additions & 7 deletions app/src/RemoteConfig.shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export interface StorageBackend {

export const LOCAL_OVERRIDES_KEY = 'feature_flag_overrides';

// Default feature flags - this should be defined by the consuming application
const defaultFlags: Record<string, string | boolean> = {};

export const clearAllLocalOverrides = async (
storage: StorageBackend,
): Promise<void> => {
Expand All @@ -60,11 +63,6 @@ export const clearLocalOverride = async (
}
};

// Shared interfaces for platform-specific implementations
export const defaultFlags: Record<string, FeatureFlagValue> = {
aesop: false,
};

export const getAllFeatureFlags = async (
remoteConfig: RemoteConfigBackend,
storage: StorageBackend,
Expand Down Expand Up @@ -237,7 +235,7 @@ export const initRemoteConfig = async (
try {
await remoteConfig.fetchAndActivate();
} catch (err) {
console.log('Remote config fetch failed', err);
console.error('Remote config fetch failed', err);
}
};

Expand All @@ -247,7 +245,7 @@ export const refreshRemoteConfig = async (
try {
await remoteConfig.fetchAndActivate();
} catch (err) {
console.log('Remote config refresh failed', err);
console.error('Remote config refresh failed', err);
}
};

Expand Down
11 changes: 7 additions & 4 deletions app/src/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// SPDX-License-Identifier: BUSL-1.1; Copyright (c) 2025 Social Connect Labs, Inc.; Licensed under BUSL-1.1 (see LICENSE); Apache-2.0 from 2029-06-11

import type { ErrorInfo } from 'react';
import React, { Component } from 'react';
import { Text, View } from 'react-native';

import { captureException } from '../Sentry';
import analytics from '../utils/analytics';

const { flush: flushAnalytics } = analytics();
Expand All @@ -25,12 +27,13 @@ class ErrorBoundary extends Component<Props, State> {
return { hasError: true };
}

componentDidCatch() {
componentDidCatch(error: Error, info: ErrorInfo) {
// Flush analytics before the app crashes
flushAnalytics();
// TODO Sentry React docs recommend Sentry.captureReactException(error, info);
// https://docs.sentry.io/platforms/javascript/guides/react/features/error-boundary/
// but ill wait so as to have few changes on native app
captureException(error, {
componentStack: info.componentStack,
errorBoundary: true,
});
}

render() {
Expand Down
1 change: 0 additions & 1 deletion app/src/components/native/QRCodeScanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export const QRCodeScannerView: React.FC<QRCodeScannerViewProps> = ({
if (!isMounted) {
return;
}
console.log(event.nativeEvent.data);
onQRData(null, event.nativeEvent.data);
},
[onQRData, isMounted],
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/native/RCTFragment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function dispatchCommand(
} catch (e) {
// Error creatingthe fragment
// TODO: assert this only happens in dev mode when the fragment is already mounted
console.log(e);
console.warn(e);
if (command === 'create') {
dispatchCommand(fragmentComponentName, viewId, 'destroy');
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const NavigationWithTracking = () => {
const trackScreen = () => {
const currentRoute = navigationRef.getCurrentRoute();
if (currentRoute) {
console.log(`Screen View: ${currentRoute.name}`);
if (__DEV__) console.log(`Screen View: ${currentRoute.name}`);
trackScreenView(`${currentRoute.name}`, {
screenName: currentRoute.name,
});
Expand Down
11 changes: 1 addition & 10 deletions app/src/providers/authProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ const _getSecurely = async function <T>(
fn: () => Promise<string | false>,
formatter: (dataString: string) => T,
): Promise<SignedPayload<T> | null> {
console.log('Starting _getSecurely');

const dataString = await fn();
console.log('Got data string:', dataString ? 'exists' : 'not found');

if (dataString === false) {
console.log('No data string available');
return null;
}

Expand Down Expand Up @@ -111,23 +106,19 @@ async function loadOrCreateMnemonic(): Promise<string | false> {
if (storedMnemonic) {
try {
JSON.parse(storedMnemonic.password);
console.log('Stored mnemonic parsed successfully');
trackEvent(AuthEvents.MNEMONIC_LOADED);
return storedMnemonic.password;
} catch (e: any) {
console.log(
console.error(
'Error parsing stored mnemonic, old secret format was used',
e,
);
console.log('Creating a new one');
trackEvent(AuthEvents.MNEMONIC_RESTORE_FAILED, {
reason: 'unknown_error',
error: e.message,
});
}
}

console.log('No secret found, creating one');
try {
const { mnemonic } = ethers.HDNodeWallet.fromMnemonic(
ethers.Mnemonic.fromEntropy(ethers.randomBytes(32)),
Expand Down
1 change: 0 additions & 1 deletion app/src/screens/dev/MockDataScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ const MockDataScreen: React.FC<MockDataScreenProps> = ({}) => {
};

const handleGenerate = useCallback(async () => {
console.log('selectedDocumentType', selectedDocumentType);
setIsGenerating(true);
try {
const randomPassportNumber = Math.random()
Expand Down
3 changes: 0 additions & 3 deletions app/src/screens/misc/LoadingScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ const LoadingScreen: React.FC<LoadingScreenProps> = ({}) => {
return;
}

console.log('[LoadingScreen] Current proving state:', currentState);
console.log('[LoadingScreen] FCM token available:', !!fcmToken);

// Update UI if passport data is available
if (passportData?.passportMetadata) {
// Update loading text based on current state
Expand Down
10 changes: 0 additions & 10 deletions app/src/screens/misc/SplashScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const SplashScreen: React.FC = ({}) => {
useEffect(() => {
if (!dataLoadInitiatedRef.current) {
dataLoadInitiatedRef.current = true;
console.log('Starting data loading and validation...');

checkBiometricsAvailable()
.then(setBiometricsAvailable)
Expand All @@ -41,7 +40,6 @@ const SplashScreen: React.FC = ({}) => {
const loadDataAndDetermineNextScreen = async () => {
try {
// Initialize native modules first, before any data operations
console.log('Initializing native modules...');
const modulesReady = await initializeNativeModules();
if (!modulesReady) {
console.warn(
Expand All @@ -53,14 +51,7 @@ const SplashScreen: React.FC = ({}) => {

const needsMigration = await checkIfAnyDocumentsNeedMigration();
if (needsMigration) {
console.log(
'Documents need registration state migration, running...',
);
await checkAndUpdateRegistrationStates();
} else {
console.log(
'No documents need registration state migration, skipping...',
);
}

const hasValid = await hasAnyValidRegisteredDocument();
Expand All @@ -82,7 +73,6 @@ const SplashScreen: React.FC = ({}) => {

useEffect(() => {
if (isAnimationFinished && nextScreen) {
console.log(`Navigating to ${nextScreen}`);
requestAnimationFrame(() => {
navigation.navigate(nextScreen as any);
});
Expand Down
1 change: 0 additions & 1 deletion app/src/screens/prove/ConfirmBelongingScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const ConfirmBelongingScreen: React.FC<ConfirmBelongingScreenProps> = ({}) => {
if (token) {
setFcmToken(token);
trackEvent(ProofEvents.FCM_TOKEN_STORED);
console.log('FCM token stored in proving store');
}
}

Expand Down
9 changes: 0 additions & 9 deletions app/src/screens/prove/ProofRequestStatusScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ const SuccessScreen: React.FC = () => {
}

function cancelCountdown() {
console.log('[ProofRequestStatusScreen] Cancelling countdown');
if (timerRef.current) {
clearTimeout(timerRef.current);
timerRef.current = null;
Expand All @@ -75,10 +74,6 @@ const SuccessScreen: React.FC = () => {

useEffect(() => {
if (isFocused) {
console.log(
'[ProofRequestStatusScreen] State update while focused:',
currentState,
);
}
if (currentState === 'completed') {
notificationSuccess();
Expand All @@ -95,10 +90,6 @@ const SuccessScreen: React.FC = () => {
new URL(selfApp.deeplinkCallback);
setCountdown(5);
setCountdownStarted(true);
console.log(
'[ProofRequestStatusScreen] Countdown started:',
countdown,
);
} catch (error) {
console.warn(
'Invalid deep link URL provided:',
Expand Down
1 change: 0 additions & 1 deletion app/src/screens/prove/ProveScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ const ProveScreen: React.FC = () => {
setDefaultDocumentTypeIfNeeded();

if (selectedAppRef.current?.sessionId !== selectedApp.sessionId) {
console.log('[ProveScreen] Selected app updated:', selectedApp);
provingStore.init('disclose');
}
selectedAppRef.current = selectedApp;
Expand Down
3 changes: 1 addition & 2 deletions app/src/screens/recovery/AccountRecoveryChoiceScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ const AccountRecoveryChoiceScreen: React.FC<
passportData,
secret,
);
console.log('User is registered:', isRegistered);
if (!isRegistered) {
console.log(
console.warn(
'Secret provided did not match a registered ID. Please try again.',
);
trackEvent(BackupEvents.CLOUD_RESTORE_FAILED_PASSPORT_NOT_REGISTERED);
Expand Down
4 changes: 1 addition & 3 deletions app/src/screens/recovery/RecoverWithPhraseScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const RecoverWithPhraseScreen: React.FC<
setRestoring(true);
const slimMnemonic = mnemonic?.trim();
if (!slimMnemonic || !ethers.Mnemonic.isValidMnemonic(slimMnemonic)) {
console.log('Invalid mnemonic');
setRestoring(false);
return;
}
Expand All @@ -69,9 +68,8 @@ const RecoverWithPhraseScreen: React.FC<
passportData,
secret as string,
);
console.log('User is registered:', isRegistered);
if (!isRegistered) {
console.log(
console.warn(
'Secret provided did not match a registered passport. Please try again.',
);
reStorePassportDataWithRightCSCA(passportData, csca as string);
Expand Down
10 changes: 0 additions & 10 deletions app/src/stores/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,19 @@ export const database: ProofDB = {
);

// Improved error handling - wrap each setProofStatus call in try-catch
let successfulUpdates = 0;
let failedUpdates = 0;

for (let i = 0; i < stalePending.rows.length; i++) {
const { sessionId } = stalePending.rows.item(i);
try {
await setProofStatus(sessionId, ProofStatus.FAILURE);
successfulUpdates++;
} catch (error) {
console.error(
`Failed to update proof status for session ${sessionId}:`,
error,
);
failedUpdates++;
// Continue with the next iteration instead of stopping the entire loop
}
}

if (stalePending.rows.length > 0) {
console.log(
`Stale proof cleanup: ${successfulUpdates} successful, ${failedUpdates} failed`,
);
}
},
getPendingProofs: async (): Promise<ProofDBResult> => {
const db = await openDatabase();
Expand Down
Loading
Loading