Potential iOS and Android apps for observ.ing. The two apps share one Rust core built with Crux; each has its own native UI (SwiftUI, Jetpack Compose with Material 3).
This may be superceded by Exact-based work in https://github.com/observ-ing/core, but I figured I'd share what I've got.
shared/: the core. All state and decisions live here: drafts and their upload queue, explore filters, the saved explore list, sessions. It does no I/O itself; it asks the shell for it through effects (HTTP, key-value storage, device location, photo uploads).ios/: SwiftUI shell.Observing/Core.swiftcarries out the effects.ShareExtension/puts the app in other apps' share sheets.android/: Compose shell.app/.../Core.ktcarries out the effects.fake-appview/: a stand-in for the observ.ing server, for end-to-end tests.e2e/: end-to-end Maestro flows that drive the apps.
The Swift and Kotlin versions of the core's types, and the compiled Rust
libraries, are generated into ios/generated and android/generated and are
not checked in.
make test # core and fake appview unit tests
make ios # generate code and ios/Observing.xcodeproj, then build in Xcode
make ios-install # build and install on connected devices (or IOS_DEVICE)
make android # generate code and build android/app/build/outputs/apk/debug
make android-install # build and install on connected devices (or ANDROID_SERIAL)
make e2e-android # end-to-end flows on the "Observing_E2E" emulator
make e2e-ios # end-to-end flows on the "Observing E2E" simulatorMost behavior lives in the core, and shared/src/tests.rs tests it by
playing the shell: sending events and answering effects. What the core can't
cover, such as a screen showing a stale copy of what the core holds, is
covered by end-to-end flows in e2e/flows/, which drive the real apps
against fake-appview.
- The fake appview serves the endpoints the apps use on
127.0.0.1:8787, with any Bearer token counting as one signed-in user. Its responses are checked against the real server's OpenAPI spec, vendored asfake-appview/openapi.json(make openapirefreshes it), and it answers writes whose bodies the spec rejects with a 400 (query parameters aren't checked). Saves are indexed at once unless a flow holds them, which is how the real server's indexing delay is reproduced. Explore's feed comes in pages, as the real one does, and a flow can hold the later pages to act while one loads. Each flow seeds it throughPOST /fake/reset;src/lib.rslists the control endpoints. - Signed in without an account. Debug builds take the server and session
token as launch arguments,
observingUrlandobservingToken(intent extras on Android,-observingUrl ...arguments on iOS). Neither is saved. Release builds ignore them. - Maestro runs the flows. Install it with its
installer,
which puts it in
~/.maestro/bin; the Makefile looks there and onPATH, and turns its analytics off. Flows start withclearState, which wipes the app's data on the device, somake e2e-iosandmake e2e-androideach use a simulator or emulator of their own, created and booted if need be. The Android one runs without a window and stays running for the next run; creating it takes an installed phone system image and the SDK Command-line Tools.ANDROID_SERIALruns the Android flows on another device instead.E2E_RETRIES=2runs flows that fail again, up to twice more, as CI does. Results and failure screenshots are in~/.maestro/tests/.
To look around the apps signed in by hand, run make fake-appview, install
a debug build, and launch it with the arguments:
xcrun simctl launch --terminate-running-process booted ing.observ.app \
-observingUrl http://127.0.0.1:8787 -observingToken fake-token
adb reverse tcp:8787 tcp:8787
adb shell am start -S -n ing.observ.app/.MainActivity \
--es observingUrl http://127.0.0.1:8787 --es observingToken fake-token- Offline recording. A new observation is a draft held by the core and saved to the device on every change. Photos are copied into app storage as JPEGs. Submitting a draft queues it; the queue uploads one draft at a time whenever the device is online and signed in. Deleting an observation queues the deletion the same way and hides the observation at once.
- Before the server indexes an upload. The server indexes what it saves a moment later, so until a reload brings back its copy, the app shows the observation as sent, with its photos from the device, and checks again a few times over the next 45 seconds.
- Sharing. Photos shared from another app start a new observation.
On Android the share opens the app itself. On iOS a share extension
copies the photos into the
group.ing.observ.appapp group and opens the app, which makes the observation when it next comes to the front; signing for a device needs a team that can provide app groups. - Sign-in. observ.ing accepts its session token as a Bearer header but
only issues it as a cookie, so the app shows the sign-in in a web view and
reads the
sessioncookie afterwards. - Explore. The feed takes taxon and date filters on the server. The bounding-box endpoint takes none, so map-area results are filtered in the core. The last results are saved and shown when offline.
- Maps. MapLibre Native with the website's basemaps. Tiles that have been viewed stay in MapLibre's cache (raised to 256 MB) and draw offline.
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.