Skip to content

Commit d44c057

Browse files
authored
feature: Comprehensive-error-handling and multi-language support (#138)
* feature: Comprehensive-error-handling and multi-language support * fix: filing ci * fix: lint * format
1 parent 2184c5b commit d44c057

22 files changed

Lines changed: 1926 additions & 28 deletions

mobileapp/.detoxrc.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
"type": "android.apk",
1919
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
2020
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug",
21-
"reversePorts": [
22-
8081
23-
]
21+
"reversePorts": [8081]
2422
}
2523
},
2624
"devices": {

mobileapp/.eslintrc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,19 @@ module.exports = {
2525
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
2626
},
2727
ignorePatterns: ["node_modules/", "dist/", ".expo/"],
28+
overrides: [
29+
{
30+
files: ["e2e/**/*.js"],
31+
env: {
32+
jest: true,
33+
},
34+
globals: {
35+
beforeAll: true,
36+
beforeEach: true,
37+
describe: true,
38+
it: true,
39+
device: true,
40+
},
41+
},
42+
],
2843
};

mobileapp/app/_layout.tsx

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,27 @@ import {
99
Outfit_500Medium,
1010
Outfit_700Bold,
1111
} from "@expo-google-fonts/outfit";
12+
import { ErrorBoundary } from "../src/components/ErrorBoundary";
13+
import { ToastManager } from "../src/components/Toast";
14+
import { useOfflineDetection } from "../src/hooks/useNetworkStatus";
15+
import "../src/locales/i18n"; // Initialize i18n
16+
17+
function LayoutContent() {
18+
useOfflineDetection();
19+
20+
return (
21+
<View style={{ flex: 1 }}>
22+
<StatusBar style="auto" />
23+
<Stack
24+
screenOptions={{
25+
headerShown: false,
26+
contentStyle: { backgroundColor: COLORS.white },
27+
}}
28+
/>
29+
<ToastManager />
30+
</View>
31+
);
32+
}
1233

1334
export default function Layout() {
1435
const [fontsLoaded] = useFonts({
@@ -23,14 +44,8 @@ export default function Layout() {
2344
}
2445

2546
return (
26-
<View style={{ flex: 1 }}>
27-
<StatusBar style="auto" />
28-
<Stack
29-
screenOptions={{
30-
headerShown: false,
31-
contentStyle: { backgroundColor: COLORS.white },
32-
}}
33-
/>
34-
</View>
47+
<ErrorBoundary>
48+
<LayoutContent />
49+
</ErrorBoundary>
3550
);
3651
}

mobileapp/e2e/jest.config.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
/** @type {import('@jest/types').Config.InitialOptions} */
22
module.exports = {
3-
preset: 'jest-expo',
4-
setupFilesAfterEnv: ['<rootDir>/setup.js'],
5-
testEnvironment: 'detox/runners/jest/testEnvironment',
6-
testMatch: ['<rootDir>/**/*.test.js'],
3+
preset: "jest-expo",
4+
setupFilesAfterEnv: ["<rootDir>/setup.js"],
5+
testEnvironment: "detox/runners/jest/testEnvironment",
6+
testMatch: ["<rootDir>/**/*.test.js"],
77
testTimeout: 120000,
88
maxWorkers: 1,
9-
globalSetup: 'detox/runners/jest/globalSetup',
10-
globalTeardown: 'detox/runners/jest/globalTeardown',
11-
reporters: ['detox/runners/jest/reporter'],
9+
globalSetup: "detox/runners/jest/globalSetup",
10+
globalTeardown: "detox/runners/jest/globalTeardown",
11+
reporters: ["detox/runners/jest/reporter"],
1212
testEnvironmentOptions: {
13-
eventListeners: [
14-
'detox/runners/jest/listeners/allure',
15-
],
13+
eventListeners: ["detox/runners/jest/listeners/allure"],
14+
},
15+
globals: {
16+
beforeAll: true,
17+
beforeEach: true,
18+
describe: true,
19+
it: true,
20+
device: true,
1621
},
1722
};

mobileapp/e2e/setup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { device } = require('detox');
1+
const { device } = require("detox");
22

33
beforeAll(async () => {
44
await device.launchApp();

mobileapp/e2e/starter.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
describe('App Boot', () => {
1+
describe("App Boot", () => {
22
beforeAll(async () => {
33
await device.launchApp();
44
});
@@ -7,17 +7,17 @@ describe('App Boot', () => {
77
await device.reloadReactNative();
88
});
99

10-
it('should show welcome screen', async () => {
10+
it("should show welcome screen", async () => {
1111
// Modify these expectations based on your actual welcome screen testID
1212
// await expect(element(by.id('welcome-screen'))).toBeVisible();
1313
});
1414

15-
it('should navigate to wallet creation', async () => {
15+
it("should navigate to wallet creation", async () => {
1616
// await element(by.id('create-wallet-button')).tap();
1717
// await expect(element(by.id('wallet-setup-screen'))).toBeVisible();
1818
});
1919

20-
it('should navigate to merchant dashboard', async () => {
20+
it("should navigate to merchant dashboard", async () => {
2121
// await element(by.id('merchant-login-button')).tap();
2222
// await expect(element(by.id('merchant-dashboard-screen'))).toBeVisible();
2323
});

mobileapp/package-lock.json

Lines changed: 131 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mobileapp/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,22 @@
1818
"@expo-google-fonts/outfit": "^0.4.3",
1919
"@expo/metro-runtime": "~6.1.2",
2020
"@expo/vector-icons": "^15.0.3",
21+
"@react-native-async-storage/async-storage": "^2.0.0",
22+
"@react-native-community/netinfo": "^11.3.1",
2123
"expo": "~54.0.32",
2224
"expo-constants": "^18.0.13",
2325
"expo-font": "~14.0.11",
2426
"expo-haptics": "^15.0.8",
2527
"expo-linking": "^8.0.11",
2628
"expo-router": "^6.0.22",
2729
"expo-status-bar": "~3.0.9",
30+
"i18next": "^23.7.6",
2831
"react": "19.1.0",
2932
"react-dom": "19.1.0",
33+
"react-i18next": "^13.5.0",
3034
"react-native": "0.81.5",
3135
"react-native-gesture-handler": "~2.28.0",
36+
"react-native-localize": "^3.0.2",
3237
"react-native-qrcode-svg": "^6.3.21",
3338
"react-native-safe-area-context": "^5.6.2",
3439
"react-native-screens": "~4.16.0",

0 commit comments

Comments
 (0)