Skip to content

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


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 fileRouteWired?Content stateCitation
Login/LoginScreen.tsxLoginใช่Full auth UIAuthNavigator.tsx:13
CheckEmpCode/CheckEmpCode.tsxCheckEmpCodeไม่Stub (language button)AuthNavigator.tsx:5,12
Home/HomeScreen.tsxHomeใช่Fetch news, UI ว่างมากHomeNavigator
Menu/MenuScreen.tsxMenuใช่Placeholder ว่างMenuNavigator
Setting/SettingScreen.tsxSettingใช่Logout buttonSettingNavigator

Route types: navigation/types.ts


GraphQL / REST surface ที่ wire แล้ว

OpTypeWhereCitation
GENERATE_CAPTCHAqueryauth flowgraphql/queries/auth.ts
VERIFY_EMP_CODE_LOGINqueryafter SSOgraphql/queries/auth.ts
LOGINmutationlogin step 2graphql/mutations/auth.ts
LOGOUTmutationSettinggraphql/mutations/auth.ts
FETCH_PROFILE (+ related)querypost-logingraphql/queries/auth.ts
FETCH_LIST_POSTqueryHome newsgraphql/queries/news.ts
POST /SSOService/checkEmpLoginRESTemp-code stepauthService.ts

ApiRequest.ts ติด apiKey header + optional Bearer; SSL pinning ด้วย cert name ที่อ้างใน request (fallback axios)


Module notes

ModuleบทบาทCitation
utils/EncryptCrypto.tsRSA publicEncrypt / privateDecrypt passwordEncryptCrypto.ts:4-24
utils/CSID.tsSHA256 device fingerprint → publicEncrypt → csIDCSID.ts:7-27
constants/RSAKey.tsHardcoded public + private key pairRSAKey.ts:1-38
utils/Auth.tsAsyncStorage helpers สำหรับ token + placeholder refresh URLAuth.ts
redux/store.tspersist auth ผ่าน AsyncStoragestore.ts:20-25
features/auth/authSlice.tsisLoggedIn, tokens, encrypted password, profileauthSlice.ts

รายละเอียด crypto/storage → 02-auth-crypto-storage