Whitelisted iOS/Android app for a single Discourse site that supports push notifications via OneSignal.
For a demonstration check out SWAPD or TekInvestor on the App Store or Google Play.
- Install your packages:
yarn install
- Link the iOS libraries via
cd ios && pod install
- And run the app in the simulator using:
react-native run-ios
# or
react-native run-android
See the React Native docs for more details.
You need to open an account at OneSignal to be able to send Push Notifications (PNs) from your Discourse site, and receive them in the app. Steps:
- Register an App ID on the Apple portal (developer.apple.com)
- Open an account with OneSignal (free), create a new app, and generate certificates for iOS and Android (see Onesignal documentation for steps on each platform)
- Add the discourse-onesignal plugin to your Discourse instance and configure it: enable notifications, add your OneSignal App ID and the OneSignal REST API key.
- in your app's
app.variables.js
file, add the OneSignal App ID
To simplify managing your app and keeping up with changes in the repo, you can use the included Fastlane scripts.
- Create a private git repository that Fastlane's
match
script uses to generate and update your app's certificates. - Copy the
fastlane/example1
folder and the.env.example1
file and rename them using your app's name (for this guide, we will assume the copied items arefastlane/yourapp
and.env.yourapp
). - Update the variables in the folder and the ENV file, as well as the logo.png and splash.png images.
- iOS: Create an App Store Connect API Key and follow the instructions in https://docs.fastlane.tools/app-store-connect-api/, and update the
fastlane/yourapp/key.json
file with the key details. - Android: generate or copy over your app's keystore and secrets in the respective files in
fastlane/yourapp
.
You should now be ready to run Fastlane scripts for your app's environment. by appending --env yourapp
to any Fastlane commands.
To update the app name and assets, run:
cd fastlane
fastlane switch --env yourapp
To generate (or update) iOS certificates, run:
cd fastlane
fastlane ios certificates --env yourapp
To build your app for iOS, run:
cd fastlane
fastlane ios install --env yourapp
# will install the app on a connected device or simulator
fastlane ios release --env yourapp
# will build and upload the app to TestFlight
To build your app for Android, run:
cd fastlane
fastlane android apk --env yourapp
# will build an apk in android/app/build/outputs/apk/
fastlane android release --env yourapp
# will create a bundle android/app/build/outputs/bundle/