- Cool features
- Dev Setup
- Project Status
- Hints, tips and known issues
Sunrise social is a native android app written in kotlin. It has three main parts:
- The android app (this repo)
- patchql (and the android bindings to patchql), written in Rust.
- The scuttlebutt server (and the bindings), written in go by @cryptix, @keks and @PragmaticCypher.
The scuttlebutt server discovers peers on the local network, replicates feeds of friends and publishes new messages. It stores all the feed data in a binary append only log.
- A lot of effort has gone into designing a system that has a responsive ui even when downloading and indexing lots of feeds. This is an ongoing pain with the js flume that manyverse is still suffering with.
- patchql has a database connection pool internally that has a single writer and multiple readers. This means multiple threads can be making graphql queries while a different thread can be processing the offset log into the database.
- Type safety is a good thing. The type safety enforced by rust + diesel goes so well with graphql. We generate a graphql schema from patchql and then copy it into the ssb-patchql-android module. Then the apollo plugin uses the schema to generate classes for us to use in the app.
This app is not ready for the play store yet.
In some ways it's proof that sunrise choir is making a stack that will be useful and production ready. But it needs more work! Can you help us out? Please chip in. We're actively seeking contributors.
See the project
- Rust using rustup
- Android SDK + Android Studio
- Android NDK
- Go and go-mobile (Optional, only needed if you want to develop the go stack)
- An android phone to develop on. I have tested that images for the emulator do run, but I haven't worked out how to get networking going.
Install the rust cross-compilers for android:
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
Get the repos:
mkdir sunrise_social; cd sunrise_social git clone firstname.lastname@example.org:sunrise-choir/ssb-patchql-android.git git clone email@example.com:sunrise-choir/sunrise-social-android-app.git
Open the project in Android Studio:
Open android studio -> close any open projects -> "Open existing Android Studio Project" -> browse to "sunrise_social" folder and select the "sunrise-social-android-app" folder (it should have a special icon in the file explorer.)
Build and install:
The first build will take a while because it needs to build all the rust code. Builds after that are much faster.
You need to manually copy the generated bindings into this project. Copy the
.jar files in the
app folder of the go project into the app folder of this project eg: In the go project directory:
cp app/* <path-to-this-repo>/app
Doing the first onboarding after an install.
The order of this is important, follow it exactly. It matters that patchwork follows the phone first.
- with your phone and you computer on the same local network
- open the app
- open patchwork
- in patchwork, wait for the phone to be discovered as a local peer (takes a minute or so)
- follow the phone in patchwork
- in the app, use the drawer menu (swipes in from the left) and select "Peers"
- You should see the IP and Pub key of patchwork. Select it.
- select follow
- this should trigger the phone to start replicating.
- Wait for a minute while the sbot reconnects to patchwork. Then try pushing the home button on the bottom menu every so often, it will refresh with new content as it is downloaded and indexed. The ui will never block while indexing / replicating is happening.
Note: This behaviour comes from the go sbot, it will change in the future but it's workable for development.
Hints, tips and known issues
- replication in go is unexpectedly slow. Cryptix gets replication speeds ~100 times faster on an iphone with comparable specs to my andoid phone. We're not sure if it's about fs access or what.
- If you update the graphql schema or queries, or you change the gobot .aar file, you should do a
File->Invalidate Caches / Restartin android studio. In fact, do this any time you think android studio is being spooky.
- If you can find the files the app creates in
- blob loading needs some work. It asks the sbot if it has the blob, if it doesn't we
wantit and then that's it. So later if we ask for it again (when we scroll or refresh or navigate) we might get it then.
- Check out the sunrise choir contribution guidelines.
- We have a code of conduct
- Important your must accept the contributor licence agreement if you're going to submit code.
- Many many many thanks to @cryptix. I truly couldn't have done it without his kind and generous help. I'm sure at times supporting this has been a cause of extra stress on top of lots of other stuff, so I'm very grateful.
- Of course, none of this would exist without the generosity and vision of @ahdinosaur. Please support sunrise choir on open collective