This repo contains the source code and export script to generate the content for Sefaria's iOS App AND Sefaria's Android App.
We're using React-Native, so much of the app is written in JavaScript and we deploy almost the same code to both Android and iOS. There are minor differences in native packages that we use and a small amount of native code we've written ourselves.
If you haven't already done so, install React Native for your development environment using the React Native CLI Quickstart. Follow the instructions on the "React Native CLI Quickstart" tab (not "Expo CLI Quickstart") for your operating system. You should follow the instructions for both iOS and Android. Skip the "Creating a new application" section since you'll be using this repo as the project.
brew install node
brew install watchman
git clone https://github.com/Sefaria/Sefaria-iOS/
cd Sefaria-Mobile
npm install
npm run setup
brew install cocoapods
cd ios
pod install
Firebase requires that you download the Google service files for Android and iOS to make Firebase work. These aren't included in the repo since they are private. For Sefaria employees, you can access these files from the Firebase Project Settings. If you don't have access to Firebase, please reach out to your friendly coworker :).
Put GoogleService-Info.plist
in the ios
directory.
Put google-services.json
in the android/app
directory.
To build and start the simulator:
From the root of the repo, run npx react-native start
.
From another terminal, run npx react-native run-ios
or npx react-native run-android
Alternatively for iOS, you can open /ios/ReaderApp.xcworkspace
and hit run.
It's quite natural to want to test the app against a local instance of Sefaria-Project. This can be done relatively simply.
- Set
Api._baseHost
to the10.0.2.2:8000
this is a special alias that maps to localhost on your development machine - Ensure that
10.0.2.2
is inALLOWED_HOSTS
in local_settings.py
in your Sefaria-Project repo.
- Set
Api._baseHost
to thelocalhost:8000
To simulate deep linking, use these commands in your terminal
For Android:
adb shell am start -W -a android.intent.action.VIEW -d "<INSERT_URL_HERE>" org.sefaria.sefaria
For iOS:
xcrun simctl openurl booted <INSERT_URL_HERE>