new-vtrc-mobile — Repository Map
บทนี้ (branch: master) แผนที่ src/ และการจัด navigation ของ rewrite แบบ TypeScript
แผนที่โฟลเดอร์
new-vtrc-mobile/ (branch: master)
├── App.tsx / index.js / shim.js # shim = Buffer/process/crypto polyfill
├── app.json # name: MyNewProject
├── package.json / tsconfig.json # path alias @/* → src/*
├── android/ / ios/ # native shells; SSL cert ใน android assets
├── __tests__/ # 18 test files
└── src/
├── assets/svg/
├── components/ # button, form, general, layout, modal, toast
├── constants/ # HostAPI, APIKey, RSAKey, OrganizationID, Theme*
├── features/auth/ # authSlice.ts, types.ts
├── graphql/queries|mutations/ # auth, news
├── i18n.ts / locales/th.json,en.json
├── navigation/ # Root, Auth, BottomTab, Home, Menu, Setting, MyTabbar
├── providers/AppProviders.tsx
├── redux/store.ts, hooks.ts
├── screens/ # Login, Home, Menu, Setting, CheckEmpCode
├── services/ # authService, newsService, schema
├── types/
└── utils/ # ApiRequest, Auth, CSID, EncryptCrypto, ...TS rewrite evidence: src/ เป็น .ts/.tsx ล้วน; alias @/* ใน tsconfig.json
Navigation graph (6 screens)
RootNavigator (RootNavigator.tsx:8-18)
├── [isLoggedIn=false] AuthStack → AuthNavigator
│ └── Login (AuthNavigator.tsx:13)
│ └── CheckEmpCode COMMENTED OUT (AuthNavigator.tsx:5,12)
└── [isLoggedIn=true] AppStack → BottomTabNavigator
├── HomeNavigator → Home
├── MenuNavigator → Menu
└── SettingNavigator → Setting| Screen file | Route | Wired? | Content state | Citation |
|---|---|---|---|---|
Login/LoginScreen.tsx | Login | ใช่ | Full auth UI | AuthNavigator.tsx:13 |
CheckEmpCode/CheckEmpCode.tsx | CheckEmpCode | ไม่ | Stub (language button) | AuthNavigator.tsx:5,12 |
Home/HomeScreen.tsx | Home | ใช่ | Fetch news, UI ว่างมาก | HomeNavigator |
Menu/MenuScreen.tsx | Menu | ใช่ | Placeholder ว่าง | MenuNavigator |
Setting/SettingScreen.tsx | Setting | ใช่ | Logout button | SettingNavigator |
Route types: navigation/types.ts
GraphQL / REST surface ที่ wire แล้ว
| Op | Type | Where | Citation |
|---|---|---|---|
GENERATE_CAPTCHA | query | auth flow | graphql/queries/auth.ts |
VERIFY_EMP_CODE_LOGIN | query | after SSO | graphql/queries/auth.ts |
LOGIN | mutation | login step 2 | graphql/mutations/auth.ts |
LOGOUT | mutation | Setting | graphql/mutations/auth.ts |
FETCH_PROFILE (+ related) | query | post-login | graphql/queries/auth.ts |
FETCH_LIST_POST | query | Home news | graphql/queries/news.ts |
POST /SSOService/checkEmpLogin | REST | emp-code step | authService.ts |
ApiRequest.ts ติด apiKey header + optional Bearer; SSL pinning ด้วย cert name ที่อ้างใน request (fallback axios)
Module notes
| Module | บทบาท | Citation |
|---|---|---|
utils/EncryptCrypto.ts | RSA publicEncrypt / privateDecrypt password | EncryptCrypto.ts:4-24 |
utils/CSID.ts | SHA256 device fingerprint → publicEncrypt → csID | CSID.ts:7-27 |
constants/RSAKey.ts | Hardcoded public + private key pair | RSAKey.ts:1-38 |
utils/Auth.ts | AsyncStorage helpers สำหรับ token + placeholder refresh URL | Auth.ts |
redux/store.ts | persist auth ผ่าน AsyncStorage | store.ts:20-25 |
features/auth/authSlice.ts | isLoggedIn, tokens, encrypted password, profile | authSlice.ts |
รายละเอียด crypto/storage → 02-auth-crypto-storage