Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
app
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Sunrise Social

A native android app for scuttlebutt, written by the sunrise choir.

APK first install

If you've just installed the apk and wondering how to get going please read the instructions here

Contents

Overview

Sunrise social is a native android app written in kotlin. It has three main parts:

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.

Patchql knows how to parse the server's append only log, and uses it to build indexes in a sqlite3 database using the diesel-rs ORM.

The app makes graphql requests to patchql via the android apollo library to build views.

Cool features

  • 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.

Project status

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.

Todos

See the project

Dev Setup

Requirements:

  • 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 git@github.com:sunrise-choir/ssb-patchql-android.git
git clone git@github.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.

Go development

If you need to extend the go code, follow the instructions in the readme to build bindings with go-mobile.

You need to manually copy the generated bindings into this project. Copy the .aar and .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 / Restart in 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 /data/data/social.sunrise.app/
  • blob loading needs some work. It asks the sbot if it has the blob, if it doesn't we want it 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.

Contributing

Thanks

  • 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

About

A native Android app for Scuttlebutt, written by the Sunrise Choir 🌅 📱

Resources

License

Sponsor this project

Packages

No packages published

Languages