Skip to content

android-v0.7.0

Choose a tag to compare

@github-actions github-actions released this 17 Sep 22:42
· 11 commits to main since this release
Formalize connection/session state with Tinder/StateMachine, enable R8

Two live-tested bugs this session traced back to the same root cause:
state tracked as scattered, ad hoc booleans (discoveryActive,
connecting, manualDisconnect, isHosting, connectedEndpointId used as a
proxy for "connected") that could drift out of sync with each other —
e.g. MainActivity showing a stale "reconnecting…" message because
nothing reset it once the underlying peer had actually gone idle.

Replaces that bookkeeping with com.github.Tinder:StateMachine:0.3.0
(resolved via JitPack — not on Maven Central despite what some
mirrors list; see settings.gradle.kts) in the three places with a
genuine multi-step lifecycle:
- NearbyPeer: connection lifecycle (idle/discovering/connecting/
  connected/active/reconnecting/given-up) — discovery gets its own
  small machine rather than being folded into the connection states,
  since a device can legitimately be discovering AND connecting to a
  different host at the same time.
- NearbyHost: advertising/retry-attempt state.
- MainActivity: screen mode (idle/hosting/discovering/connecting),
  replacing the isHosting boolean and an untracked "connecting" text
  mutation with an actual ConnectingToHost state.

Deliberately NOT applied to HostForegroundService — its "state" already
is the Android Service lifecycle enforced by the OS itself.

Side effects (the actual Nearby Connections/view calls) stay exactly
where they were; only the state bookkeeping moved into the machines,
verified against the pre-refactor behavior end to end on two physical
devices (host + Nearby guest): full game round, playlist import, and
notification-triggered stop-hosting mid-game, all producing identical
outcomes to before the refactor.

Also enables R8 minification for the release build type
(isMinifyEnabled = true, previously off), with proguard-rules.pro
keeping the WebView JS bridge (@JavascriptInterface methods) and
NodeRuntime's external JNI method — both resolved by name at runtime,
both silently broken by naive minification otherwise. Verified on
device: the JS bridge (getControlToken via the playlist-management
screen) and JNI (embedded Node actually starting) both still work
correctly under the minified build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>