caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
Working tree is now the canonical repo. Off-chain play-money + trustless on-chain
(FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution,
mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 23:29:50 +03:00

132 lines
7.7 KiB
Markdown

We're using Expo to help with android and ios builds. You can find more information about Expo here: https://docs.expo.dev/introduction/expo/
## Installing
- The `native/` directory is not part of the yarn workspace, so you have to run `yarn` in the `native/` directory to install dependencies.
- You will need to install the Expo CLI globally: `npm install -g expo-cli`
- You need to set the `SENTRY_AUTH_TOKEN` via `eas:secret` [link](https://docs.expo.dev/build-reference/variables/#using-secrets-in-environment-variables)
- You need to make sure the Predikt team is set as the signer for app builds in Xcode - open up the ios directory in Xcode and set the signing account.
- `ios/` and `android/` are generated: run `npx expo prebuild --clean` before building (see FIREBASE-SETUP.md). They are gitignored.
- You need to register your device for development builds with Expo and install a provisioning profile, see the [Running a build](https://docs.expo.dev/development/build/) section with `eas device:create`
## Configuration
-`app.config.js` is the configuration file that determine basic functioning of the app. If you change it you'll have to clean your `android` and `ios` folders via `yarn clean`
## Developing
1. Connect your phone to your computer
2. **iOS**:
- `yarn build:ios:client:prod` or `yarn build:ios:client:dev` to build a dev client and drag it onto your iPhone to install it.
- `yarn start` or `yarn start:dev` and scan the QR code with camera
- Keep a dev client build in the native directory so you can just drag and drop them onto your phone to install them
3. **Android**:
- `yarn android:dev` or `yarn android:prod` builds and installs the dev client on your device automatically
- Scan the QR code with the app (it opens automatically after installing)
4. **Locally hosted web app**:
- Set the `NEXT_PUBLIC_API_URL` in dev.sh to your local ip address
- Run `dev.sh prod` or `dev.sh dev` to start the local server
- Change the `baseUri` in `App.tsx` to your local ip address
- Follow one of the Android or iOS steps to start the app on your device
- **Note:** when switching between dev and prod you'll have to run `yarn clear` & Ctrl+C to clear the env variable.
- Want to see console logs? (Only works on android):
- Set the `NEXT_PUBLIC_API_URL` in dev.sh to your local ip address
- Change the `baseUri` in `App.tsx` to your local ip address
- `$ yarn android:prod` to start the app on your device
- On your computer, navigate to `chrome://inspect/#devices` in chrome and click inspect on the app
- Want to see app logs of a production build? (Only works on android):
- `$ adb logcat --pid=$(adb shell pidof -s com.predikt.app)`
## Building
- You'll need Predikt's own Android signing credentials to sign android builds for the Google Play store, and to be added to the Predikt Apple Developer team to build iOS apps.
- After changing anything in the `app.config.js` you'll want to run `npx expo prebuild` to clear the android and ios folders
- Before every build we clean and reset the git tree so you'll want to make sure any changes are committed. The dialog will ask you to confirm this.
- After every build your git tree may be dirty with build artifacts. I tried removing these and ended up down in a git-sponsored nightmare, so I wouldn't advise trying to edit these files out of the git history unless you really know what you're doing.
- The following commands build the binaries locally by default. If you remove the `--local` flag it will build in the EAS/Expo cloud, (this tends to be much slower, though).
- Before every submission to the app store you'll want to bump the following fields in `app.config.js`:
- `expo.version`
- `expo.ios.buildNumber`
- `expo.android.versionCode`
**For Internal Testing**
`yarn build:android:preview`
- Builds an Android APK for previewing on a device
- `adb install build_name_here.apk` after it's built to install
`yarn build:ios:prod`
- Builds an iOS IPA that you can upload to TestFlight
`yarn build:ios:preview`
- Builds an iOS IPA for previewing on a device
- Drag and drop onto your plugged in iPhone Finder window to install
**External**
`yarn build:android:prod`
- Builds an Android App Bundle for Google Play distribution
- Upload to Google Play Console
`yarn build:ios:prod`
- Builds an iOS IPA for App Store distribution
- I think we use Transporter once we have our Apple Business Developer account set up
### OTA updates
`eas update --branch default` to publish an over-the-air update to production. I'm pretty sure this only updates apps with the same: `buildNumber`, `versionCode`, `version`
### Adding Environment Variables
- Set the variable in `package.json` (used for local development aka `yarn ios:prod`)
- Add the key-value pair to the `extra.eas` object in `app.config.js` with value `process.env.YOUR_ENV_VARIABLE`
- Set the build variable in `eas.json` for the profile you want (used for eas builds aka `yarn build:ios:prod`)
- Reference it in js: `Constants.expoConfig?.extra?.eas.YOUR_ENV_VARIABLE`
- Run `yarn clear` to clear the env variable between builds
# Icons
find icons [here](https://icons.expo.fyi/)
## Notes
- The dev and prod version of the app use the same application id (`com.predikt.app`). This may not be not ideal but it works.
- Notifications on android dev won't work unless the Firebase server signing key is linked to the application id (`com.predikt.app`). To fully separate you'd need a distinct application id for dev.
- Try out sending push notifications [here](https://expo.dev/notifications) (using the `pushToken` from your `private-user` object)
- Manage releases in the Predikt Google Play Console.
## Monitoring
- Sentry: set to the Predikt Sentry org (see `REPLACE_WITH_SENTRY_ORG` in `app.config.js`), or remove Sentry if unused. See FIREBASE-SETUP.md.
## Updating Expo
- Check out the [helper guide](https://docs.expo.dev/bare/upgrade/?fromSdk=50&toSdk=51)
### Problems with building android after deleting `android/`
- `However we cannot choose between the following variants of project :react-native-iap: - amazonDebugRuntimeElements - playDebugRuntimeElements`
- Add `missingDimensionStrategy 'store', 'play'` to `android/app/build.gradle` in the `defaultConfig` section
- `error: cannot find symbol import ...BuildConfig;`
- Ensure `namespace "com.predikt.app"` is set in `app/build.gradle`
- Ensure the package declaration at the top of any generated Java/Kotlin source matches `com.predikt.app`
## Troubleshooting
- getting an errors on build/install? like `Error: spawn .../native/android/gradlew EACCES`
- Delete the `android` or `ios` folders or run `yarn clean` and try again.
- environment variables not working? like `process.env.API_URL` is undefined
- Try running `yarn clear` and ctrl+c to clear the env variable and try again
- When in doubt: `yarn clean`
- Fastlane build failing? Could be a malformed import
- Pod install erroring out?
- I had to reinstall cocoapods via [these instructions](https://github.com/expo/expo/issues/20707#issuecomment-1377790160)
- Sentry problems? `sentry.properties` file not found or malformed?
- `eas build` couldn't find the sentry.properties file in the `android` directory generated from `eas.json`, so I set its path in eas.json to the root. If it's malformed, check the diff from the ones in the `ios` and `android` directories which are autogenerated from `eas.json`.
- getting the error: ``<PBXResourcesBuildPhase UUID=`13B07F8E1A680F5B00A75B9A`>` attempted to initialize an object with an unknown UUID. `02204F3A4D0242B7A7B338EA` for attribute: `files`. This can be the result of a merge and the unknown UUID is being discarded.` ?
- this probably isn't the real error and is usually in red and located close to the real error. You should scroll down to find the real error.