- Production email sources for Apple Sign-in on Apple Developer Center
- Production Firebase credentials on the environment folders
- Change firebase env to production on .env
- Add REVERSED_CLIENT_ID to URL Types
- Key restriction for maps API
- Key restriction for other google APIs
To build for prod, you need to do the following:
- make sure you've updated your .env file with the values from Mobile-Env-Prod in 1PW
- copy Info.plist from environments/prod to ios/CardsAndTreasure
- copy GoogleService-Info.plist from environments/prod to ios/
- Using nvm or n make sure your node version is v14.16.
- Install Watchman
brew install watchman
. - Install CocoaPods
sudo gem install cocoapods -v 1.10.1
. - Install/Update Java
https://java.com/en/download/
. - Clone this repo.
- If you want to make use of the
yarn set:dev
andyarn set:prod
commands place prod and dev .env files in the prod and dev folders under environments. Otherwise do the following three things: - Copy the dev .env file from 1Password into the root project folder.
- Copy the dev GoogleService-Info.plist from ./environments/dev/ into ./ios/.
- Copy the dev Info.plist from ./environments/dev/ into ./ios/cardsandtreasure/.
- Make sure Xcode and Android Studio are installed and run
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
. - Open the /android folder with Android Studio to generate a local.properties file in that folder pointing at your android SDK path.
- To prepare the app dependencies run
yarn install
,yarn clean:ios
andyarn generate
. On M1 the chip you'll need to aliaspod
in your .zshrc file: alias pod='arch -x86_64 pod'. - Run
yarn ios
to build the app and run the simulator. You can run a specific simulator by appending a device tag like soyarn ios --simulator="iPhone SE (2nd generation)"
. You can find a list of available devices withxcrun simctl list devices
. On M1 the chip you need to run yarn ios through a rosetta terminal. - Run
yarn husky install
to get support for pre-commit hooks.
It happens sometimes that you want to do something like tests push notifications or see how the app performs on a real device. Now you have to build and run the app from your local dev environment onto an actual iPhone.
Basically you need to build the project using react native and then open it in Xcode to build on your iPhone. You'll need to be signed in as a developer in Xcode, and your device will need to be registered. Detailed instructions below:
- Plug your iPhone into your MacBook.
- If you're not already part of the Apple dev team, ask someone to go to
appstoreconnect.apple.com/access/users
and add you as a developer. - You'll need the UDID for your phone in the next step. In finder locate your iPhone and click on the device description E.g., iPhone 6 Plus - 11.91GB.... This will reveal the UDID.
- Login to your developer account and add your phone to the device list here
developer.apple.com/account/resources/devices/list
. - Create a new development certificate and download it here
developer.apple.com/account/resources/certificates/list
. - After building the iOS code (using
yarn clean:ios
or some other weirdly names command) open the .xcworkspace file from the ios folder in xcode. - In the menu go to Xcode -> Preferences -> Accounts and add your apple developer account.
- Back in the menu go to Product -> Destination -> iOS Device and select your iPhone.
- Now when you click run in Xcode the app will build on your phone (keep an eye on your device for prompts during the build process).
The first time you create a new build for testflight run the instructions below, but for subsequent builds you can just run yarn dist <version> <build>
e.g., yarn dist 0.25 10
(the dist command will require you to change permissions on the distribute.sh script: e.g., chmod +x scripts/distribute.sh
).
- Download or generate a distribution certificate for Cartes et Tresor Inc from
developer.apple.com/account/resources/certificates/list
. - Run
yarn ios:clean
to build the React-Native project for ios. - Open ios/CardsAndTreasure.xcworkspace in Xcode.
- Go to Xcode > Preferences > Accounts then select the "Cards and Treasure" profile and click Manage Certificates and make sure that you have a distribution certificate, then close this menu.
- On the project screen in Xcode, under the General tab, increment the build string OR version fields.
- In the run menu (where you would normally select the iOS device for the simulator) choose "Any iOS Device (arm64, armv7)" with a hammer icon beside it (don't build yet).
- From the menu bar click Product > Archive and wait for the app to build.
- When the archiving completes select "Distribute App" > "App Store Connect" > "Upload" > etc etc defaults and follow the upload process. Once the upload completes and Apple processes the new build, as long as it's a newer version or build of the current version, testers will be prompted to use the new version.
- Log in to appstoreconnect.apple.com.
- Click through to "My Apps" > "Cards and Treasure" > "TestFlight". Once the new release finishes processing you will need to fill out a form about encryption and US government export controls.
- Click on the build number for the new version in the testflight menu and fill out and save the release description.
If yarn ios
fails, it might have to do with your global node/nvm versions (reference). Try this:
- When in doubt wipe out ios/Pods the podfile lock and Xcode/DerivedData.
- Go to your
bash_profile/zshrc
and comment the three nvm initialization lines (export NVM_DIR="$HOME/.nvm" [...]
) - Open a new terminal and do
node -v
, if it still finds something it means that you have a global version somewhere. - Do
brew uses --installed node
. This will show you what is still using node. - Do
brew uninstall --force yarn
it wasyarn
that was still using a version of node, in my case. This automatically uninstalls its node/npm dependency. - Uncomment the nvm initialization lines
- Reinstall yarn using nvm's npm with
npm i -g yarn
.
If you have different packages that come up, replace yarn
with the packages that you need to reinstall.
mobile
├── src
│ ├── components
│ ├── i18n
│ ├── utils
│ ├── models
│ ├── navigators
│ ├── screens
│ ├── services
│ ├── theme
│ ├── app.tsx
├── test
├── README.md
├── android
├── index.js
├── ios
├── .env
└── package.json
This is where React components live. Each component will have a directory containing the .tsx
file, and optionally .presets
, and .props
files for larger components.
This is where the translations live.
This is where the app's models live.
This is where the navigators live.
This is where the screen components live. A screen is a React component which will take up the entire screen and be part of the navigation hierarchy.
Any services that interface with the outside world live here (think REST APIs, Push Notifications, etc.).
Here lives the application theme, including spacing, colors, and typography and tachyons config.
This is the place for helpers and utilities. Things like date helpers, formatters, etc. are often found here.
This directory will hold Jest configs and mocks
This is the entry point to the app. This is where you will find the main App component which renders the rest of the application.