Fakultas Ilmu Komputer UI

Commit e86ad54e authored by Zafir Rasyidi Taufik's avatar Zafir Rasyidi Taufik
Browse files

Merge branch 'zafir/add-documentation' into 'staging'

Add README documentation

See merge request !10
parents 50a74332 bd825af2
Pipeline #82565 passed with stages
in 21 minutes and 14 seconds
# **TBACare - Mobile**
The repository for TBACare mobile codebase
# **TBCare - Mobile**
The repository for TBCare mobile codebase
## **Table of Contents**
- [Status](#status)
- [Prerequisites](#prerequisites)
......@@ -8,7 +8,6 @@ The repository for TBACare mobile codebase
- [Setup](#setup)
- [Smartphone setup](#smartphone-setup)
- [Emulator setup](#emulator-setup)
- [Emulator script](#emulator-script)
- [Commands](#commands)
- [Troubleshooting](#troubleshooting)
- [Maintainers](#maintainers)
......@@ -36,7 +35,8 @@ Install the following packages/tools:
Create **.env** file in the root project and fill the file with the following format:
```bash
API_MAIN_URL=http://localhost:8000
API_MAIN_URL=http://localhost:8000 # Make sure no '/' is appended at the end
GOOGLE_CLIENT_ID=<GOOGLE_CLIENT_ID located in the environment variables of the repository>
```
Install all dependencies by run this command in the root of project
......@@ -56,57 +56,28 @@ npm i
Ensure that you have enabled **USB debugging** on you phone settings. If you have problem to do that, try [this](https://www.google.com/search?q=how+to+enable+usb+debugging+on+my+awesome+smartphone&oq=how+to+enable+usb+debugging+on+my+awesome+smartphone&aqs=chrome..69i57.14114j0j7&sourceid=chrome&ie=UTF-8).
* #### **Emulator setup**
Ensure that you have create you own emulator with **maximum API level is 25** in android studio. Then, run your emulator either from android studio or by this **awesome script** (without android studio)
- [Windows](https://drive.google.com/file/d/1fORYyKV66_9xYGuae6YZejRyUIHCL6n8/view?usp=sharing)
- [Unix](https://www.google.com/search?q=zonk&oq=zonk&aqs=chrome..69i57j0l7.693j0j7&sourceid=chrome&ie=UTF-8)
Ensure that you have create you own emulator with **maximum API level is 25** in android studio. Then, run your emulator from android studio
* Until this point, the previous dev team has found no way to run the code in WSL with the emulator outside of WSL, thus all development is done outside of WSL
Put that script somewhere in your computer, so it able to be executed in terminal. Test it by run this command:
```bash
emulator
```
##### **Emulator script**
1. Listing of available emulators and show two emulators.
```bash
emulator list
```
```bash
Name: API_25
Device: pixel_xl (Google)
Path: C:\Users\HP\.android\avd\API_25.avd
Target: Google APIs (Google Inc.)
Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/x86
Skin: pixel_xl_silver
Sdcard: 512M
The following Android Virtual Devices could not be loaded:
Name: Pixel_3_XL_API_25
Path: C:\Users\HP\.android\avd\Pixel_3_XL_API_25.avd
Error: Google pixel_3_xl no longer exists as a device
```
2. Run a specific emulator by name.
```bash
emulator run API_25
```
```bash
emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037
Failed to open /qemu.conf, err: 2
Windows Hypervisor Platform accelerator is operational
Your emulator is out of date, please update by launching Android Studio:
- Start Android Studio
- Select menu "Tools > Android > SDK Manager"
- Click "SDK Tools" tab
- Check "Android Emulator" checkbox
- Click "OK"
```
### **Commands**
Assume you have setted up everything.
* #### Run android
* for debug version
```
npx react-native run-android --variant=debug
```
npx react-native run-android
* for release version
```
npx react-native run-android --variant=release
```
* #### Run ios
* for debug version
```
npx react-native run-ios --variant=debug
```
* for release version
```
npx react-native run-ios
npx react-native run-ios --variant=release
```
* #### Build APK locally
```
......@@ -144,6 +115,22 @@ Assume you have setted up everything.
npm i
```
* ### **Backend running in WSL**
If the local backend server is running in WSL, run this command
```
adb reverse tcp:8000 tcp:8000
```
* ### **Incorrect keystore**
If the emulator previously was built using a the debug version, then attempted to build using the release version, or vice versa, run this command first then try again
```
adb uninstall com.tbcare
```
* ### **Protected data**
Protected data such as keystore passwords, google client id, etc. are saved in the environment variables of the repository. Ask a maintainer to view/edit them for CI/CD usage
## **Maintainers**
- Dave Nathanael
- Irwanto
......
......@@ -24,6 +24,7 @@ const testProps = {
cache: {},
}
jest.setTimeout(30000);
jest.mock('axios');
const mockedAxios = axios as jest.Mocked<typeof axios>;
......
......@@ -12,6 +12,7 @@ import ReactTestRenderer, {act} from 'react-test-renderer';
jest.mock('axios');
jest.useFakeTimers();
jest.setTimeout(30000);
const Stack = createStackNavigator();
const testProps = {
services: {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment