#
Mobile
Welcome to Fanzeal mobile apps repository. This monorepo contains all the React Native source code for Fanzeal apps and other shared packages.
#
Table of contents
Structure Setup development environment Development Internationalization Coding conventions Internal packages
Common issues
#
Structure
apps- Apps that only use packages and aren't aware of other appspackages- Packages that may use external and/or other monorepo packages
#
Setup development environment
Setup your environment using the Expo instructions.
These tools are required to run the app:
#
Android
- Java: one of the easiest ways to get Java installed is using jenv. Read more
here . - Gradle:
brew install gradle
#
Development
To run the app, use the following commands:
pnpm ios
pnpm android
Tips:
- Copy
.env.exampleto.envand fill in any nessary environment variables. - Sometimes you'll need to prebuild native code to make sure the app builds correctly. Using this command
npx expo prebuild --clean. - To clear the cache, using this command
npx expo start --clear
#
Internationalization
Usage:
import { t } from '@lingui/macro'
import { useLingui } from '@lingui/react'
const { i18n } = useLingui()
t(i18n)`Your string`
Extract & compile
# Extract the messages
pnpm -F mobile intl:extract
# Compile the messages to runtime catalogs
pnpm -F mobile intl:compile
The workflow is as follows:
- Wrap messsage in Trans macro or use
tfunction - Run
pnpm intl:extractcommand to generate message catalogs - Translate message catalogs (send them to translators). You can use any tool that supports editing
.poformat like Poedit - Run
pnpm intl:compileto create runtime catalogs - Load the runtime catalog
#
Coding conventions
- Always using alias (
@) when importing modules. For example:import { ComponentX } from "@/components/ComponentX".
#
Internal packages
We publish our internal packages (E.g: @fzap/**) to AWS CodeArtifact. In order to use these packages, please follow the below steps:
- Login to AWS. (Contact Tue or Jason for the account)
- Login to AWS CodeArtifact:
make codeartifact-loginoraws codeartifact login --tool npm --domain fzap --domain-owner 156493436061 --repository fzap - Edit registry configurations in
.npmrc. Read more about registry and authentication settings
# .npmrc
# ...other .npmrc settings
@fzap:registry=https://fzap-156493436061.d.codeartifact.us-east-1.amazonaws.com/npm/fzap/
registry=https://registry.npmjs.org/
- Run
pnpm installto recreate the modules registry since we changed the registry configurations. - Run
pnpm add @fzap/**to install the packages similar to other NPM packages.
#
Custom components
#
Common issues
#
Cannot build project on iOS with error code 70
xcodebuild error 70 means that the target for the build was not found. It could be mismatch of iOS versions, parameters, or (if using real device) the UDID being wrong.
#
Java version is incompatible
Currently, the app is only compatible with Java 17. Following these steps below to install Java 17:
Install
jenv- Java version manager: https://github.com/jenv/jenv?tab=readme-ov-file#11-installing-jenvDownload JDK 17: https://www.oracle.com/java/technologies/downloads/#java17
Add Java 17 as global version:
jenv add /Library/Java/JavaVirtualMachines/jdk-<version>.jdk/Contents/Home jenv global 17Test Java version if it is 17:
java --version