Published spaces: publish from Space info (Android)
Stacked on #166 (stack #163: #158 ← #160 ← #162 ← #166 ← this). Phase 4, part 1 of 2; iOS follows in its own PR.
Android's Space info gets a Published section: turn publishing on and off, and change the address. Custom CSS stays in the web app, as agreed.
What
- Registry:
publishedgets a section, with the samecanTurnOnas sharing (canExpose): never the default space, and only its owner once shared. - Off (owner): one line saying what publishing does, and Publish.
- It sends the address the app reaches the server by, from
ApiClient.origin(scheme, host and port; IPv6 in brackets). - A space with locked notes is refused with their count, read on this phone first, as sharing does.
- It sends the address the app reaches the server by, from
- On (owner):
- The address in mono (
host/@handle), with Open (browser), Share (the system's share sheet) and Change address. - Change address opens a field; Save asks first ("Links to the current address will stop working"). A taken or invalid handle says so.
- Stop publishing… sits in its own card, with an inline confirm.
- The address in mono (
- Members see the trait's summary. A trait's problem ("Publishing failed") shows in the section.
Publishing(next toSharing): the calls run on the app's scope and sync afterwards, so the trait, its glyph and the lock rules arrive with the space list. Errors use the web's wording.- Shared engine:
ApiClient.publishSettings,publish(handle?, origin?),unpublish,origin, and aPublishSettingsmodel. - Docs: the guide says Android publishes too, with custom CSS on the web; architecture §7.10's Apps bullet.
Noticed, not changed
The engine's ApiClient builds paths with url("…/${seg(id)}/…"). seg percent-encodes, and then addPathSegments encodes the % again. Any id with a reserved character would arrive double-encoded. Space ids are UUIDs or default, so nothing hits this today, and it predates this PR (invites, members and owner use the same pattern). The new calls follow the existing pattern; a separate fix would cover them all.
Tests
PublishingFlowTest(Robolectric, againstFakeNotesd, which gains the publish endpoints and thepublishedtrait):- publish from this phone's server address;
- the locked-notes refusal;
- the default space isn't offered;
- change address, including a taken handle;
- stop, keeping the handle;
- a member's view.
ApiClientTest: the publish request bodies (only what changes), the codes that come back,unpublish, andoriginfor a port, the default port and IPv6.- Screenshot test: Space info published, light and dark, checked by eye.
mise run lint,typecheck,test,lint:androidandtest:android: all green (Android 295 tests).
Summary by cubic
Adds a Published section to Android's Space info so a space's owner can publish it, change its address, and stop publishing from the phone; custom CSS stays in the web app.
What changed
- The section appears for any space but the default, and for a shared space only for its owner; a member just sees where the site is.
- Publishing sends the address the app reaches the server by, and refuses a space with locked notes, saying how many; a locked note on this phone stops it before the server's asked.
- Changing the address asks first — links to the old address stop working — and says when the handle is taken or invalid; cancelling keeps the handle as typed.
- Each call syncs afterwards, so the trait and its lock rules arrive with the space list.
ApiClientgainspublishSettings,publish,unpublish,origin, and aPublishSettingsmodel.