Skip to main content

ShopShip Customer App

Repo: shopshop_app_customer_native
Stack: React Native 0.73.4 + TypeScript


Yêu cầu môi trường

Trước khi chạy project, cần cài đặt đầy đủ các công cụ sau:

Node.js​

  • Yêu cầu: Node.js >= 18 (theo package.json)

Kiểm tra phiên bản:

node -v

Yarn​

  • Yêu cầu: Yarn 1.22.22 (theo packageManager)

Kiểm tra phiên bản:

yarn -v

Môi trường native React Native​

Cần cài đặt các công cụ sau:

  • Android Studio + Android SDK
  • Xcode (macOS) + CocoaPods
  • ADB (dùng để reverse port khi cần)

Chạy ứng dụng ở môi trường development

1. Cài đặt dependencies​

yarn install

2. Cài đặt iOS Pods (chỉ áp dụng cho iOS)​

yarn pod

3. Chạy Metro​

yarn start

4. Chạy ứng dụng​

Android​

yarn android

iOS​

yarn ios

Reverse port cho Android (nếu cần gọi service local)​

yarn reverse

hoặc

yarn reverse_android

Các cấu hình quan trọng

1. Cấu hình ở cấp độ ứng dụng

File:

app/constant/Constant.ts

Các biến cấu hình quan trọng:

  • APP_ID
  • SCHEME_BASE
  • UNIVERSAL_BASE
  • KEY_GOONG
  • KEY_GOONG_LOCATION
  • KEY_MAPBOX
  • URL_SOCKET

2. Cấu hình API Base URL

File:

app/service/Network/ApiService.ts
const BASE_URL_DEV = "https://dev.admin.shopship.winds.vn";
const BASE_URL_PRODUCT = "https://admin.shopship.winds.vn";

Lưu ý:

Hiện tại code đang set baseURL DEV cho cả hai nhánh.


3. Cấu hình switch domain theo môi trường

File:

app/screens/pages/screens/account/components/VersionWithSwitchDomain.tsx

Các biến:

  • DEV_API_URL
  • STAGING_API_URL
  • PROD_API_URL

4. Cấu hình Deep Link

Deep link cần được cấu hình đồng bộ ở 3 vị trí:

1. React Navigation​

app/navigation/AppNavigator.tsx

Cấu hình prefixes.


2. Android​

android/app/src/main/AndroidManifest.xml
<data android:scheme="..." />

3. iOS​

ios/ShopShipCustomer/Info.plist

Cấu hình:

CFBundleURLTypes

5. Cấu hình Native Keys

Google Maps​

iOS​

ios/ShopShipCustomer/AppDelegate.mm

Android​

android/app/src/main/AndroidManifest.xml

Mapbox Token​

File:

android/gradle.properties

Biến cấu hình:

MAPBOX_DOWNLOADS_TOKEN

6. Cấu hình CodePush

iOS​

File:

ios/ShopShipCustomer/Info.plist

Các key:

  • CodePushDeploymentKey
  • CodePushServerURL

Android​

File:

android/app/src/main/res/values/strings.xml

Các key:

  • CodePushDeploymentKey
  • CodePushServerUrl

Build / Release

Build Android Release​

yarn apk

hoặc

yarn build-apk
yarn build-abb

OTA Release qua CodePush

Android Production​

yarn cpa-n

iOS Production​

yarn cpi-n

Xem lịch sử deployment​

yarn cpa-dep
yarn cpi-dep

Lưu ý quan trọng

Trước khi build hoặc release cần kiểm tra lại:

  • APP_ID
  • Deep link scheme
  • Universal link
  • API domain (dev / staging / prod)
  • Google Maps key
  • Mapbox token
  • CodePush deployment key đúng môi trường
  • google-services.json (Android)
  • GoogleService-Info.plist (iOS)
  • Bundle ID / Package name đúng với môi trường build