iOS app asks ipx in protobuf, not JSON (#469)

The badge's and CarPlay's reads (/api/feeds, the entry lists) and the
player's writes (position, flags) now go as application/x-protobuf, the
messages generated from crates/wire/proto by ios/scripts/proto.sh into
Sources/Wire, committed so the build needs no protoc. SwiftProtobuf is
pinned to the generator's version, 1.41.0, whose code refuses another.

A read whose answer is not protobuf counts as no answer: a server from
before #465 answers JSON whatever it is asked, and JSON can decode as a
message of nothing, which would have set the badge to zero.

The outbox keeps its stored key, `json`, for the body, and marks the
new writes protobuf, so places saved offline by an older build are
still sent, as JSON.

Built for the simulator with Xcode 27.2; not run against a server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ray Slakinski
2026-11-16 19:00:10 -05:00
parent a96be2f14c
commit baa6661622
13 changed files with 6118 additions and 51 deletions

12
ios/scripts/proto.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
# The app's protobuf messages (#469), generated from the .proto files ipx serves them by
# (crates/wire/proto) into Sources/Wire, which is committed: XcodeGen and Xcode build it as it is,
# with no protoc in the build. Run again after a change to those files. Needs protoc and
# protoc-gen-swift (`brew install protobuf swift-protobuf`), the generator at the version of the
# SwiftProtobuf package in project.yml, which refuses code from another.
set -eu
cd "$(dirname "$0")/.."
proto=../crates/wire/proto
rm -f Sources/Wire/*.pb.swift
protoc -I "$proto" --swift_out=Sources/Wire --swift_opt=Visibility=Internal "$proto/ipx.proto" "$proto/directory.proto"
protoc-gen-swift --version