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:
@@ -148,7 +148,10 @@ running the command and kills the session (exit 144), which has happened more th
|
|||||||
see [ios/README.md](ios/README.md). It builds only on a Mac with Xcode, from `ios/project.yml`
|
see [ios/README.md](ios/README.md). It builds only on a Mac with Xcode, from `ios/project.yml`
|
||||||
through XcodeGen: nothing here compiles or checks the Swift, so say so when handing over a change
|
through XcodeGen: nothing here compiles or checks the Swift, so say so when handing over a change
|
||||||
to it. A change to the bridge's messages is a change to `native.ts`, `tests/native-bridge.ts` and
|
to it. A change to the bridge's messages is a change to `native.ts`, `tests/native-bridge.ts` and
|
||||||
`ios/Sources/Bridge.swift` together, and the page deploys first.
|
`ios/Sources/Bridge.swift` together, and the page deploys first. The app's own calls to ipx (the
|
||||||
|
player, the badge, CarPlay) are protobuf, from `ios/Sources/Wire`, generated from
|
||||||
|
`crates/wire/proto` by `sh ios/scripts/proto.sh`: run it after changing a `.proto`, and deploy ipx
|
||||||
|
before shipping an app that needs a new field.
|
||||||
|
|
||||||
## Before you touch the page
|
## Before you touch the page
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,8 @@ not know: `ipx_wire::negotiate`, a layer on each service's routes, converts the
|
|||||||
by its table of each route's messages (`WIRE` in `web.rs`, `api.rs` and play's `lib.rs`). A route
|
by its table of each route's messages (`WIRE` in `web.rs`, `api.rs` and play's `lib.rs`). A route
|
||||||
added to a router goes in its table. Debug builds convert every JSON answer strictly, so the cargo
|
added to a router goes in its table. Debug builds convert every JSON answer strictly, so the cargo
|
||||||
tests and the browser suite answer `500` for a field missing from the `.proto` or a route missing
|
tests and the browser suite answer `500` for a field missing from the `.proto` or a route missing
|
||||||
from the table. Errors stay JSON.
|
from the table. Errors stay JSON. The iOS app's own calls go in protobuf (#469), from Swift
|
||||||
|
generated off the same files: a change to them is `sh ios/scripts/proto.sh` too.
|
||||||
|
|
||||||
Show notes are feed-supplied HTML from an untrusted source, sanitized with `ammonia` server-side
|
Show notes are feed-supplied HTML from an untrusted source, sanitized with `ammonia` server-side
|
||||||
before they reach the page.
|
before they reach the page.
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ The iOS app, `ios/`. Format: [Keep a Changelog](https://keepachangelog.com/en/1.
|
|||||||
- The icon's count stays right with the app closed: ipx sends it to the phone when it changes, once its `[push]` is set up, in place of waiting for iOS's background refresh (#433).
|
- The icon's count stays right with the app closed: ipx sends it to the phone when it changes, once its `[push]` is set up, in place of waiting for iOS's background refresh (#433).
|
||||||
- Presses are felt: a light tap on play, pause, flag and pull to refresh, a success on marking read, a warning with an error (#430).
|
- Presses are felt: a light tap on play, pause, flag and pull to refresh, a success on marking read, a warning with an error (#430).
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- The player, the badge and CarPlay talk to ipx in protobuf rather than JSON, which is smaller and quicker to read; they need an ipx with protobuf (#465), and a place saved offline by an older build is still sent (#469).
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- A question the page asks before going ahead (deleting a file, sharing an address that carries your access) is shown with Cancel and OK, rather than answered Cancel at once with nothing shown (#453).
|
- A question the page asks before going ahead (deleting a file, sharing an address that carries your access) is shown with Cancel and OK, rather than answered Cancel at once with nothing shown (#453).
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ on the `sdf1.net` zone) blocks every request to it except a bearer-token one for
|
|||||||
| `Sources/CookieBridge.swift` | the web view's cookies into `HTTPCookieStorage.shared`, for the player |
|
| `Sources/CookieBridge.swift` | the web view's cookies into `HTTPCookieStorage.shared`, for the player |
|
||||||
| `Sources/Server.swift` | which server |
|
| `Sources/Server.swift` | which server |
|
||||||
| `Sources/Intents.swift`, `Shared/PlayPauseIntent.swift` | Siri and Shortcuts (#427) |
|
| `Sources/Intents.swift`, `Shared/PlayPauseIntent.swift` | Siri and Shortcuts (#427) |
|
||||||
|
| `Sources/API.swift`, `Sources/Wire` | ipx's API without the page, in protobuf (#469): `Wire` is generated from `crates/wire/proto` by `scripts/proto.sh`, and committed |
|
||||||
| `Sources/LastPlayed.swift` | the last episode and its place, so Resume works with the app closed |
|
| `Sources/LastPlayed.swift` | the last episode and its place, so Resume works with the app closed |
|
||||||
| `Widgets/`, `Shared/Snapshot.swift`, `Sources/WidgetFeed.swift` | the widget (#428), and what the app writes for it |
|
| `Widgets/`, `Shared/Snapshot.swift`, `Sources/WidgetFeed.swift` | the widget (#428), and what the app writes for it |
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
import SwiftProtobuf
|
||||||
|
|
||||||
/// Reading ipx without the page: the badge and CarPlay (#420), which has no web view. Signed in
|
/// Reading ipx without the page: the badge and CarPlay (#420), which has no web view. Signed in
|
||||||
/// as the player is, by the credentials or else the cookies the web view left (CookieBridge).
|
/// as the player is, by the credentials or else the cookies the web view left (CookieBridge).
|
||||||
enum API {
|
enum API {
|
||||||
|
/// What ipx answers and reads in protobuf rather than JSON (#465, #469). The messages are
|
||||||
|
/// `Sources/Wire`, generated from ipx's own `.proto` files by `scripts/proto.sh`.
|
||||||
|
static let protobuf = "application/x-protobuf"
|
||||||
|
|
||||||
private static let session: URLSession = {
|
private static let session: URLSession = {
|
||||||
let cfg = URLSessionConfiguration.default
|
let cfg = URLSessionConfiguration.default
|
||||||
cfg.httpCookieStorage = .shared
|
cfg.httpCookieStorage = .shared
|
||||||
@@ -11,13 +16,25 @@ enum API {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
/// The body of a 200, or nil: not signed in, no server, no connection.
|
/// The body of a 200, or nil: not signed in, no server, no connection.
|
||||||
static func get(_ path: String) async -> Data? {
|
static func get(_ path: String, accept: String? = nil) async -> Data? {
|
||||||
guard let url = Server.resolveForPlayer(path) else { return nil }
|
guard let (data, resp) = await fetch(path, accept: accept), resp.statusCode == 200 else { return nil }
|
||||||
var req = URLRequest(url: url)
|
|
||||||
req.setValue("application/json", forHTTPHeaderField: "Accept")
|
|
||||||
Credentials.headers.forEach { req.setValue($1, forHTTPHeaderField: $0) }
|
|
||||||
guard let (data, resp) = try? await session.data(for: req),
|
|
||||||
(resp as? HTTPURLResponse)?.statusCode == 200 else { return nil }
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A 200's body as message `M`, or nil. Nil too for an answer not in protobuf: a server from
|
||||||
|
/// before #465 answers JSON whatever it is asked, and JSON can read as a message of nothing.
|
||||||
|
static func get<M: SwiftProtobuf.Message>(_ type: M.Type, _ path: String) async -> M? {
|
||||||
|
guard let (data, resp) = await fetch(path, accept: protobuf), resp.statusCode == 200,
|
||||||
|
resp.value(forHTTPHeaderField: "Content-Type")?.hasPrefix(protobuf) == true else { return nil }
|
||||||
|
return try? M(serializedBytes: data)
|
||||||
|
}
|
||||||
|
|
||||||
|
private static func fetch(_ path: String, accept: String?) async -> (Data, HTTPURLResponse)? {
|
||||||
|
guard let url = Server.resolveForPlayer(path) else { return nil }
|
||||||
|
var req = URLRequest(url: url)
|
||||||
|
if let accept { req.setValue(accept, forHTTPHeaderField: "Accept") }
|
||||||
|
Credentials.headers.forEach { req.setValue($1, forHTTPHeaderField: $0) }
|
||||||
|
guard let (data, resp) = try? await session.data(for: req), let http = resp as? HTTPURLResponse else { return nil }
|
||||||
|
return (data, http)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,22 +11,13 @@ import UserNotifications
|
|||||||
enum Badge {
|
enum Badge {
|
||||||
static let taskId = "net.sdf1.ipx.refresh"
|
static let taskId = "net.sdf1.ipx.refresh"
|
||||||
|
|
||||||
private struct Row: Decodable {
|
|
||||||
let id: String
|
|
||||||
let group: String?
|
|
||||||
let unread: Int?
|
|
||||||
let hide_from_all: Bool?
|
|
||||||
}
|
|
||||||
|
|
||||||
/// web/src/feeds.ts `unreadInAll`: a feed counts unless it, or the OPML it came from, is
|
/// web/src/feeds.ts `unreadInAll`: a feed counts unless it, or the OPML it came from, is
|
||||||
/// hidden from All Subscriptions. Nil when the body is not a feed list, so an error page
|
/// hidden from All Subscriptions.
|
||||||
/// does not turn the badge to zero.
|
static func unread(inAll rows: [Ipx_FeedRow]) -> Int {
|
||||||
static func unread(inAll body: Data) -> Int? {
|
let hidden = Set(rows.filter(\.hideFromAll).map(\.id))
|
||||||
guard let rows = try? JSONDecoder().decode([Row].self, from: body) else { return nil }
|
|
||||||
let hidden = Set(rows.filter { $0.hide_from_all == true }.map(\.id))
|
|
||||||
return rows.reduce(0) { n, f in
|
return rows.reduce(0) { n, f in
|
||||||
if f.hide_from_all == true || f.group.map(hidden.contains) == true { return n }
|
if f.hideFromAll || (f.hasGroup && hidden.contains(f.group)) { return n }
|
||||||
return n + max(0, f.unread ?? 0)
|
return n + max(0, Int(f.unread))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,10 +60,11 @@ enum Badge {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All Subscriptions' unread count from ipx, or nil when it cannot be had.
|
/// All Subscriptions' unread count from ipx, or nil when it cannot be had: an answer that is
|
||||||
|
/// not a feed list leaves the badge as it was rather than turning it to zero.
|
||||||
static func fetch() async -> Int? {
|
static func fetch() async -> Int? {
|
||||||
guard let data = await API.get("/api/feeds") else { return nil }
|
guard let feeds = await API.get(Ipx_FeedRows.self, "/api/feeds") else { return nil }
|
||||||
return unread(inAll: data)
|
return unread(inAll: feeds.items)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - while the app is closed
|
// MARK: - while the app is closed
|
||||||
|
|||||||
@@ -7,14 +7,22 @@ import UIKit
|
|||||||
// does. Now Playing is the system's, fed by Playback's now-playing info and remote commands.
|
// does. Now Playing is the system's, fed by Playback's now-playing info and remote commands.
|
||||||
|
|
||||||
/// An item as a car's list needs it: db.rs EntryRow, the fields used.
|
/// An item as a car's list needs it: db.rs EntryRow, the fields used.
|
||||||
struct CarEpisode: Decodable {
|
struct CarEpisode {
|
||||||
struct Enclosure: Decodable {
|
struct Enclosure {
|
||||||
let id: Int
|
let id: Int
|
||||||
let url: String
|
let url: String
|
||||||
let mime: String?
|
let mime: String?
|
||||||
let deadair: Double?
|
let deadair: Double?
|
||||||
/// Set once ipx has the file; `/media/{id}` answers 404 before that.
|
/// Set once ipx has the file; `/media/{id}` answers 404 before that.
|
||||||
let path: String?
|
let path: String?
|
||||||
|
|
||||||
|
init(_ e: Ipx_EncRow) {
|
||||||
|
id = Int(e.id)
|
||||||
|
url = e.url
|
||||||
|
mime = e.hasMime ? e.mime : nil
|
||||||
|
deadair = e.hasDeadair ? Double(e.deadair) : nil
|
||||||
|
path = e.hasPath ? e.path : nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let guid: String
|
let guid: String
|
||||||
@@ -25,6 +33,16 @@ struct CarEpisode: Decodable {
|
|||||||
let position: Double
|
let position: Double
|
||||||
let enclosures: [Enclosure]
|
let enclosures: [Enclosure]
|
||||||
|
|
||||||
|
init(_ e: Ipx_EntryRow) {
|
||||||
|
guid = e.guid
|
||||||
|
feed_id = e.feedID
|
||||||
|
title = e.hasTitle ? e.title : nil
|
||||||
|
image = e.hasImage ? e.image : nil
|
||||||
|
duration = e.hasDuration ? Double(e.duration) : nil
|
||||||
|
position = Double(e.position)
|
||||||
|
enclosures = e.enclosures.map(Enclosure.init)
|
||||||
|
}
|
||||||
|
|
||||||
/// The file to play: the first downloaded one that is sound (items.ts isPlayable, less video,
|
/// The file to play: the first downloaded one that is sound (items.ts isPlayable, less video,
|
||||||
/// which a car would play the sound of with nothing to say so). An item with none is not listed
|
/// which a car would play the sound of with nothing to say so). An item with none is not listed
|
||||||
/// (#443): a post's picture or a file still to come is nothing a car can play.
|
/// (#443): a post's picture or a file still to come is nothing a car can play.
|
||||||
@@ -69,7 +87,7 @@ struct CarEpisode: Decodable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A subscription, from `/api/feeds`.
|
/// A subscription, from `/api/feeds`.
|
||||||
struct CarFeed: Decodable {
|
struct CarFeed {
|
||||||
let id: String
|
let id: String
|
||||||
let title: String?
|
let title: String?
|
||||||
let image: String?
|
let image: String?
|
||||||
@@ -80,10 +98,16 @@ struct CarFeed: Decodable {
|
|||||||
let group: String?
|
let group: String?
|
||||||
|
|
||||||
var name: String { title ?? id }
|
var name: String { title ?? id }
|
||||||
}
|
|
||||||
|
|
||||||
private struct CarPage: Decodable {
|
init(_ f: Ipx_FeedRow) {
|
||||||
let entries: [CarEpisode]
|
id = f.id
|
||||||
|
title = f.hasTitle ? f.title : nil
|
||||||
|
image = f.hasImage ? f.image : nil
|
||||||
|
unread = Int(f.unread)
|
||||||
|
entries = Int(f.entries)
|
||||||
|
downloaded = Int(f.downloaded)
|
||||||
|
group = f.hasGroup ? f.group : nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class CarPlaySceneDelegate: UIResponder, CPTemplateApplicationSceneDelegate {
|
final class CarPlaySceneDelegate: UIResponder, CPTemplateApplicationSceneDelegate {
|
||||||
@@ -143,19 +167,18 @@ final class CarScreen: NSObject, CPTabBarTemplateDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func loadFeeds() async {
|
private func loadFeeds() async {
|
||||||
guard let data = await API.get("/api/feeds"),
|
guard let rows = await API.get(Ipx_FeedRows.self, "/api/feeds")?.items.map(CarFeed.init) else { return }
|
||||||
let rows = try? JSONDecoder().decode([CarFeed].self, from: data) else { return }
|
|
||||||
feeds = Dictionary(rows.map { ($0.id, $0) }, uniquingKeysWith: { a, _ in a })
|
feeds = Dictionary(rows.map { ($0.id, $0) }, uniquingKeysWith: { a, _ in a })
|
||||||
}
|
}
|
||||||
|
|
||||||
private func episodes(in list: CPListTemplate, from path: String, empty: String, oneFeed: Bool = false) async {
|
private func episodes(in list: CPListTemplate, from path: String, empty: String, oneFeed: Bool = false) async {
|
||||||
guard let data = await API.get(path), let page = try? JSONDecoder().decode(CarPage.self, from: data) else {
|
guard let page = await API.get(Ipx_EntryPage.self, path) else {
|
||||||
unreachable(list)
|
unreachable(list)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let kept = Set(Offline.shared.store.paths)
|
let kept = Set(Offline.shared.store.paths)
|
||||||
let playing = Playback.shared.current
|
let playing = Playback.shared.current
|
||||||
let rows: [CPListItem] = page.entries.compactMap { e in
|
let rows: [CPListItem] = page.entries.map(CarEpisode.init).compactMap { e in
|
||||||
let feed = feeds[e.feed_id]
|
let feed = feeds[e.feed_id]
|
||||||
guard let item = e.item(feedTitle: feed?.name ?? e.feed_id, feedImage: feed?.image, kept: kept) else {
|
guard let item = e.item(feedTitle: feed?.name ?? e.feed_id, feedImage: feed?.image, kept: kept) else {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import Network
|
import Network
|
||||||
|
import SwiftProtobuf
|
||||||
|
|
||||||
/// Writes the player made with no connection, sent when there is one (#425): where you got to in
|
/// Writes the player made with no connection, sent when there is one (#425): where you got to in
|
||||||
/// an episode, and that you finished it. In a browser the page's service worker holds these; the
|
/// an episode, and that you finished it. In a browser the page's service worker holds these; the
|
||||||
@@ -10,7 +11,13 @@ import Network
|
|||||||
enum Outbox {
|
enum Outbox {
|
||||||
struct Write: Codable, Equatable {
|
struct Write: Codable, Equatable {
|
||||||
var path: String
|
var path: String
|
||||||
var json: Data
|
var body: Data
|
||||||
|
/// The body is protobuf (#469). Nil in a write queued by a build before it, whose body is
|
||||||
|
/// JSON, and is sent as JSON.
|
||||||
|
var protobuf: Bool?
|
||||||
|
|
||||||
|
// `json` was the body's name when it could only be JSON; kept, so those writes still read.
|
||||||
|
enum CodingKeys: String, CodingKey { case path, body = "json", protobuf }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static let key = "ipx.outbox"
|
private static let key = "ipx.outbox"
|
||||||
@@ -24,11 +31,11 @@ enum Outbox {
|
|||||||
|
|
||||||
/// A write that never arrived. Only the player's own two kinds are kept: anything else, such
|
/// A write that never arrived. Only the player's own two kinds are kept: anything else, such
|
||||||
/// as adding a feed, fails offline as it always has.
|
/// as adding a feed, fails offline as it always has.
|
||||||
static func add(path: String, json: [String: Any]) {
|
static func add(path: String, _ body: any SwiftProtobuf.Message) {
|
||||||
guard path.hasSuffix("/position") || path.hasSuffix("/flags"),
|
guard path.hasSuffix("/position") || path.hasSuffix("/flags"),
|
||||||
let data = try? JSONSerialization.data(withJSONObject: json, options: [.sortedKeys]) else { return }
|
let data = try? body.serializedData() else { return }
|
||||||
var all = pending.filter { $0.path != path }
|
var all = pending.filter { $0.path != path }
|
||||||
all.append(Write(path: path, json: data))
|
all.append(Write(path: path, body: data, protobuf: true))
|
||||||
pending = all
|
pending = all
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,9 +53,9 @@ enum Outbox {
|
|||||||
guard let url = Server.resolveForPlayer(w.path) else { return }
|
guard let url = Server.resolveForPlayer(w.path) else { return }
|
||||||
var req = URLRequest(url: url)
|
var req = URLRequest(url: url)
|
||||||
req.httpMethod = "POST"
|
req.httpMethod = "POST"
|
||||||
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
req.setValue(w.protobuf == true ? API.protobuf : "application/json", forHTTPHeaderField: "Content-Type")
|
||||||
Credentials.headers.forEach { req.setValue($1, forHTTPHeaderField: $0) }
|
Credentials.headers.forEach { req.setValue($1, forHTTPHeaderField: $0) }
|
||||||
req.httpBody = w.json
|
req.httpBody = w.body
|
||||||
guard (try? await session.data(for: req)) != nil else { return }
|
guard (try? await session.data(for: req)) != nil else { return }
|
||||||
// Removed by what it is, not where it was: a newer write may have replaced it while
|
// Removed by what it is, not where it was: a newer write may have replaced it while
|
||||||
// this one was on its way.
|
// this one was on its way.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import AVFoundation
|
import AVFoundation
|
||||||
import MediaPlayer
|
import MediaPlayer
|
||||||
|
import SwiftProtobuf
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
/// The phone's player: the one that plays on with the screen locked, and the one the lock screen
|
/// The phone's player: the one that plays on with the screen locked, and the one the lock screen
|
||||||
@@ -269,14 +270,15 @@ final class Playback: NSObject {
|
|||||||
s.position = Double(secs)
|
s.position = Double(secs)
|
||||||
if let d = duration { s.duration = d }
|
if let d = duration { s.duration = d }
|
||||||
}
|
}
|
||||||
var body: [String: Any] = ["secs": secs]
|
var body = Ipx_Position()
|
||||||
if let d = duration { body["duration"] = Int(d.rounded()) }
|
body.secs = Int64(secs)
|
||||||
|
if let d = duration { body.duration = Int64(d.rounded()) }
|
||||||
// DeadAir's copy runs on a shorter clock; the server has to know which one this is.
|
// DeadAir's copy runs on a shorter clock; the server has to know which one this is.
|
||||||
if item.url.path.contains("/deadair") { body["deadair"] = item.enc }
|
if item.url.path.contains("/deadair") { body.deadair = Int64(item.enc) }
|
||||||
let path = entryPath(item, "position")
|
let path = entryPath(item, "position")
|
||||||
// Not arrived, kept for when the connection is back: offline, the ten-second retry would
|
// Not arrived, kept for when the connection is back: offline, the ten-second retry would
|
||||||
// only fail again, and the place reached on the last pause would be lost.
|
// only fail again, and the place reached on the last pause would be lost.
|
||||||
Task { if await request("POST", path, body) == nil { Outbox.add(path: path, json: body) } }
|
Task { if await request("POST", path, body) == nil { Outbox.add(path: path, body) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - as it plays
|
// MARK: - as it plays
|
||||||
@@ -314,7 +316,9 @@ final class Playback: NSObject {
|
|||||||
markedRead = true
|
markedRead = true
|
||||||
let path = entryPath(item, "flags")
|
let path = entryPath(item, "flags")
|
||||||
Task {
|
Task {
|
||||||
if await request("POST", path, ["read": true]) == nil { Outbox.add(path: path, json: ["read": true]) }
|
var read = Ipx_Flags()
|
||||||
|
read.read = true
|
||||||
|
if await request("POST", path, read) == nil { Outbox.add(path: path, read) }
|
||||||
await Badge.refresh()
|
await Badge.refresh()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -406,14 +410,14 @@ final class Playback: NSObject {
|
|||||||
/// One call to ipx, signed in by the credentials or else the web view's cookies; its status, or nil if it never
|
/// One call to ipx, signed in by the credentials or else the web view's cookies; its status, or nil if it never
|
||||||
/// arrived. A position that does not save is saved again ten seconds on.
|
/// arrived. A position that does not save is saved again ten seconds on.
|
||||||
@discardableResult
|
@discardableResult
|
||||||
private func request(_ method: String, _ path: String, _ json: [String: Any]? = nil) async -> Int? {
|
private func request(_ method: String, _ path: String, _ body: (any SwiftProtobuf.Message)? = nil) async -> Int? {
|
||||||
guard let url = Server.resolveForPlayer(path) else { return nil }
|
guard let url = Server.resolveForPlayer(path) else { return nil }
|
||||||
var req = URLRequest(url: url)
|
var req = URLRequest(url: url)
|
||||||
req.httpMethod = method
|
req.httpMethod = method
|
||||||
Credentials.headers.forEach { req.setValue($1, forHTTPHeaderField: $0) }
|
Credentials.headers.forEach { req.setValue($1, forHTTPHeaderField: $0) }
|
||||||
if let json {
|
if let body {
|
||||||
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
req.setValue(API.protobuf, forHTTPHeaderField: "Content-Type")
|
||||||
req.httpBody = try? JSONSerialization.data(withJSONObject: json)
|
req.httpBody = try? body.serializedData()
|
||||||
}
|
}
|
||||||
guard let (_, resp) = try? await session.data(for: req) else { return nil }
|
guard let (_, resp) = try? await session.data(for: req) else { return nil }
|
||||||
return (resp as? HTTPURLResponse)?.statusCode
|
return (resp as? HTTPURLResponse)?.statusCode
|
||||||
|
|||||||
941
ios/Sources/Wire/directory.pb.swift
Normal file
941
ios/Sources/Wire/directory.pb.swift
Normal file
@@ -0,0 +1,941 @@
|
|||||||
|
// DO NOT EDIT.
|
||||||
|
// swift-format-ignore-file
|
||||||
|
// swiftlint:disable all
|
||||||
|
//
|
||||||
|
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||||
|
// Source: directory.proto
|
||||||
|
//
|
||||||
|
// For information on using the generated types, please see the documentation:
|
||||||
|
// https://github.com/apple/swift-protobuf/
|
||||||
|
|
||||||
|
/// ipx-directory's API under /v1 (crates/directory/src/wire.rs), each message named after the Rust
|
||||||
|
/// struct it mirrors. A field added there goes here too; debug builds refuse an answer with a field
|
||||||
|
/// missing here. A message whose only field is `repeated items` is a JSON array.
|
||||||
|
|
||||||
|
import SwiftProtobuf
|
||||||
|
|
||||||
|
// If the compiler emits an error on this type, it is because this file
|
||||||
|
// was generated by a version of the `protoc` Swift plug-in that is
|
||||||
|
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||||
|
// Please ensure that you are building against the same version of the API
|
||||||
|
// that was used to generate this file.
|
||||||
|
fileprivate nonisolated struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||||
|
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||||
|
typealias Version = _2
|
||||||
|
}
|
||||||
|
|
||||||
|
/// GET /v1/me.
|
||||||
|
nonisolated struct Directory_Me: Sendable {
|
||||||
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||||
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||||
|
// methods supported on all messages.
|
||||||
|
|
||||||
|
var name: String = String()
|
||||||
|
|
||||||
|
/// "ro", "rw" or "rwa".
|
||||||
|
var access: String = String()
|
||||||
|
|
||||||
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||||
|
|
||||||
|
init() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated struct Directory_Listing: Sendable {
|
||||||
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||||
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||||
|
// methods supported on all messages.
|
||||||
|
|
||||||
|
var id: String = String()
|
||||||
|
|
||||||
|
var url: String = String()
|
||||||
|
|
||||||
|
var title: String {
|
||||||
|
get {_title ?? String()}
|
||||||
|
set {_title = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `title` has been explicitly set.
|
||||||
|
var hasTitle: Bool {self._title != nil}
|
||||||
|
/// Clears the value of `title`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearTitle() {self._title = nil}
|
||||||
|
|
||||||
|
var image: String {
|
||||||
|
get {_image ?? String()}
|
||||||
|
set {_image = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `image` has been explicitly set.
|
||||||
|
var hasImage: Bool {self._image != nil}
|
||||||
|
/// Clears the value of `image`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearImage() {self._image = nil}
|
||||||
|
|
||||||
|
var category: String {
|
||||||
|
get {_category ?? String()}
|
||||||
|
set {_category = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `category` has been explicitly set.
|
||||||
|
var hasCategory: Bool {self._category != nil}
|
||||||
|
/// Clears the value of `category`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearCategory() {self._category = nil}
|
||||||
|
|
||||||
|
var subcategory: String {
|
||||||
|
get {_subcategory ?? String()}
|
||||||
|
set {_subcategory = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `subcategory` has been explicitly set.
|
||||||
|
var hasSubcategory: Bool {self._subcategory != nil}
|
||||||
|
/// Clears the value of `subcategory`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearSubcategory() {self._subcategory = nil}
|
||||||
|
|
||||||
|
var podcast: Bool = false
|
||||||
|
|
||||||
|
var subscribers: Int64 = 0
|
||||||
|
|
||||||
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||||
|
|
||||||
|
init() {}
|
||||||
|
|
||||||
|
fileprivate var _title: String? = nil
|
||||||
|
fileprivate var _image: String? = nil
|
||||||
|
fileprivate var _category: String? = nil
|
||||||
|
fileprivate var _subcategory: String? = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// GET /v1/feeds, GET /v1/popular.
|
||||||
|
nonisolated struct Directory_Listings: Sendable {
|
||||||
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||||
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||||
|
// methods supported on all messages.
|
||||||
|
|
||||||
|
var items: [Directory_Listing] = []
|
||||||
|
|
||||||
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||||
|
|
||||||
|
init() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated struct Directory_Item: Sendable {
|
||||||
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||||
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||||
|
// methods supported on all messages.
|
||||||
|
|
||||||
|
var guid: String = String()
|
||||||
|
|
||||||
|
var title: String {
|
||||||
|
get {_title ?? String()}
|
||||||
|
set {_title = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `title` has been explicitly set.
|
||||||
|
var hasTitle: Bool {self._title != nil}
|
||||||
|
/// Clears the value of `title`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearTitle() {self._title = nil}
|
||||||
|
|
||||||
|
var link: String {
|
||||||
|
get {_link ?? String()}
|
||||||
|
set {_link = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `link` has been explicitly set.
|
||||||
|
var hasLink: Bool {self._link != nil}
|
||||||
|
/// Clears the value of `link`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearLink() {self._link = nil}
|
||||||
|
|
||||||
|
var published: Int64 {
|
||||||
|
get {_published ?? 0}
|
||||||
|
set {_published = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `published` has been explicitly set.
|
||||||
|
var hasPublished: Bool {self._published != nil}
|
||||||
|
/// Clears the value of `published`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearPublished() {self._published = nil}
|
||||||
|
|
||||||
|
var duration: Int64 {
|
||||||
|
get {_duration ?? 0}
|
||||||
|
set {_duration = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `duration` has been explicitly set.
|
||||||
|
var hasDuration: Bool {self._duration != nil}
|
||||||
|
/// Clears the value of `duration`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearDuration() {self._duration = nil}
|
||||||
|
|
||||||
|
var description_p: String {
|
||||||
|
get {_description_p ?? String()}
|
||||||
|
set {_description_p = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `description_p` has been explicitly set.
|
||||||
|
var hasDescription_p: Bool {self._description_p != nil}
|
||||||
|
/// Clears the value of `description_p`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearDescription_p() {self._description_p = nil}
|
||||||
|
|
||||||
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||||
|
|
||||||
|
init() {}
|
||||||
|
|
||||||
|
fileprivate var _title: String? = nil
|
||||||
|
fileprivate var _link: String? = nil
|
||||||
|
fileprivate var _published: Int64? = nil
|
||||||
|
fileprivate var _duration: Int64? = nil
|
||||||
|
fileprivate var _description_p: String? = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// GET /v1/feeds/{id}, POST /v1/feeds/{id}/refresh: a Listing's fields and these.
|
||||||
|
nonisolated struct Directory_FeedPage: Sendable {
|
||||||
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||||
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||||
|
// methods supported on all messages.
|
||||||
|
|
||||||
|
var id: String = String()
|
||||||
|
|
||||||
|
var url: String = String()
|
||||||
|
|
||||||
|
var title: String {
|
||||||
|
get {_title ?? String()}
|
||||||
|
set {_title = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `title` has been explicitly set.
|
||||||
|
var hasTitle: Bool {self._title != nil}
|
||||||
|
/// Clears the value of `title`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearTitle() {self._title = nil}
|
||||||
|
|
||||||
|
var image: String {
|
||||||
|
get {_image ?? String()}
|
||||||
|
set {_image = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `image` has been explicitly set.
|
||||||
|
var hasImage: Bool {self._image != nil}
|
||||||
|
/// Clears the value of `image`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearImage() {self._image = nil}
|
||||||
|
|
||||||
|
var category: String {
|
||||||
|
get {_category ?? String()}
|
||||||
|
set {_category = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `category` has been explicitly set.
|
||||||
|
var hasCategory: Bool {self._category != nil}
|
||||||
|
/// Clears the value of `category`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearCategory() {self._category = nil}
|
||||||
|
|
||||||
|
var subcategory: String {
|
||||||
|
get {_subcategory ?? String()}
|
||||||
|
set {_subcategory = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `subcategory` has been explicitly set.
|
||||||
|
var hasSubcategory: Bool {self._subcategory != nil}
|
||||||
|
/// Clears the value of `subcategory`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearSubcategory() {self._subcategory = nil}
|
||||||
|
|
||||||
|
var podcast: Bool = false
|
||||||
|
|
||||||
|
var subscribers: Int64 = 0
|
||||||
|
|
||||||
|
var description_p: String {
|
||||||
|
get {_description_p ?? String()}
|
||||||
|
set {_description_p = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `description_p` has been explicitly set.
|
||||||
|
var hasDescription_p: Bool {self._description_p != nil}
|
||||||
|
/// Clears the value of `description_p`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearDescription_p() {self._description_p = nil}
|
||||||
|
|
||||||
|
var failing: String {
|
||||||
|
get {_failing ?? String()}
|
||||||
|
set {_failing = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `failing` has been explicitly set.
|
||||||
|
var hasFailing: Bool {self._failing != nil}
|
||||||
|
/// Clears the value of `failing`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearFailing() {self._failing = nil}
|
||||||
|
|
||||||
|
var items: [Directory_Item] = []
|
||||||
|
|
||||||
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||||
|
|
||||||
|
init() {}
|
||||||
|
|
||||||
|
fileprivate var _title: String? = nil
|
||||||
|
fileprivate var _image: String? = nil
|
||||||
|
fileprivate var _category: String? = nil
|
||||||
|
fileprivate var _subcategory: String? = nil
|
||||||
|
fileprivate var _description_p: String? = nil
|
||||||
|
fileprivate var _failing: String? = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated struct Directory_SnapshotEntry: Sendable {
|
||||||
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||||
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||||
|
// methods supported on all messages.
|
||||||
|
|
||||||
|
var url: String = String()
|
||||||
|
|
||||||
|
var subscribers: Int64 = 0
|
||||||
|
|
||||||
|
var category: String {
|
||||||
|
get {_category ?? String()}
|
||||||
|
set {_category = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `category` has been explicitly set.
|
||||||
|
var hasCategory: Bool {self._category != nil}
|
||||||
|
/// Clears the value of `category`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearCategory() {self._category = nil}
|
||||||
|
|
||||||
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||||
|
|
||||||
|
init() {}
|
||||||
|
|
||||||
|
fileprivate var _category: String? = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// POST /v1/snapshot, the body.
|
||||||
|
nonisolated struct Directory_Snapshot: Sendable {
|
||||||
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||||
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||||
|
// methods supported on all messages.
|
||||||
|
|
||||||
|
var items: [Directory_SnapshotEntry] = []
|
||||||
|
|
||||||
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||||
|
|
||||||
|
init() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// POST /v1/snapshot, the answer.
|
||||||
|
nonisolated struct Directory_SnapshotResult: Sendable {
|
||||||
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||||
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||||
|
// methods supported on all messages.
|
||||||
|
|
||||||
|
var accepted: UInt64 = 0
|
||||||
|
|
||||||
|
var refusedPrivate: UInt64 = 0
|
||||||
|
|
||||||
|
var refusedBlocked: UInt64 = 0
|
||||||
|
|
||||||
|
var refusedInvalid: UInt64 = 0
|
||||||
|
|
||||||
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||||
|
|
||||||
|
init() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated struct Directory_Instance: Sendable {
|
||||||
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||||
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||||
|
// methods supported on all messages.
|
||||||
|
|
||||||
|
var name: String = String()
|
||||||
|
|
||||||
|
var feeds: Int64 = 0
|
||||||
|
|
||||||
|
var subscribers: Int64 = 0
|
||||||
|
|
||||||
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||||
|
|
||||||
|
init() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// GET /v1/instances.
|
||||||
|
nonisolated struct Directory_Instances: Sendable {
|
||||||
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||||
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||||
|
// methods supported on all messages.
|
||||||
|
|
||||||
|
var items: [Directory_Instance] = []
|
||||||
|
|
||||||
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||||
|
|
||||||
|
init() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated struct Directory_Blocked: Sendable {
|
||||||
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||||
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||||
|
// methods supported on all messages.
|
||||||
|
|
||||||
|
var id: String = String()
|
||||||
|
|
||||||
|
var url: String {
|
||||||
|
get {_url ?? String()}
|
||||||
|
set {_url = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `url` has been explicitly set.
|
||||||
|
var hasURL: Bool {self._url != nil}
|
||||||
|
/// Clears the value of `url`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearURL() {self._url = nil}
|
||||||
|
|
||||||
|
var title: String {
|
||||||
|
get {_title ?? String()}
|
||||||
|
set {_title = newValue}
|
||||||
|
}
|
||||||
|
/// Returns true if `title` has been explicitly set.
|
||||||
|
var hasTitle: Bool {self._title != nil}
|
||||||
|
/// Clears the value of `title`. Subsequent reads from it will return its default value.
|
||||||
|
mutating func clearTitle() {self._title = nil}
|
||||||
|
|
||||||
|
var at: Int64 = 0
|
||||||
|
|
||||||
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||||
|
|
||||||
|
init() {}
|
||||||
|
|
||||||
|
fileprivate var _url: String? = nil
|
||||||
|
fileprivate var _title: String? = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/// GET /v1/blocked.
|
||||||
|
nonisolated struct Directory_BlockedList: Sendable {
|
||||||
|
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||||
|
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||||
|
// methods supported on all messages.
|
||||||
|
|
||||||
|
var items: [Directory_Blocked] = []
|
||||||
|
|
||||||
|
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||||
|
|
||||||
|
init() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||||
|
|
||||||
|
fileprivate nonisolated let _protobuf_package = "directory"
|
||||||
|
|
||||||
|
nonisolated extension Directory_Me: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||||
|
static let protoMessageName: String = _protobuf_package + ".Me"
|
||||||
|
static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}name\0\u{1}access\0")
|
||||||
|
|
||||||
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||||
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every case branch when no optimizations are
|
||||||
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||||
|
switch fieldNumber {
|
||||||
|
case 1: try { try decoder.decodeSingularStringField(value: &self.name) }()
|
||||||
|
case 2: try { try decoder.decodeSingularStringField(value: &self.access) }()
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||||
|
if !self.name.isEmpty {
|
||||||
|
try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
|
||||||
|
}
|
||||||
|
if !self.access.isEmpty {
|
||||||
|
try visitor.visitSingularStringField(value: self.access, fieldNumber: 2)
|
||||||
|
}
|
||||||
|
try unknownFields.traverse(visitor: &visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func ==(lhs: Directory_Me, rhs: Directory_Me) -> Bool {
|
||||||
|
if lhs.name != rhs.name {return false}
|
||||||
|
if lhs.access != rhs.access {return false}
|
||||||
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated extension Directory_Listing: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||||
|
static let protoMessageName: String = _protobuf_package + ".Listing"
|
||||||
|
static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}id\0\u{1}url\0\u{1}title\0\u{1}image\0\u{1}category\0\u{1}subcategory\0\u{1}podcast\0\u{1}subscribers\0")
|
||||||
|
|
||||||
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||||
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every case branch when no optimizations are
|
||||||
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||||
|
switch fieldNumber {
|
||||||
|
case 1: try { try decoder.decodeSingularStringField(value: &self.id) }()
|
||||||
|
case 2: try { try decoder.decodeSingularStringField(value: &self.url) }()
|
||||||
|
case 3: try { try decoder.decodeSingularStringField(value: &self._title) }()
|
||||||
|
case 4: try { try decoder.decodeSingularStringField(value: &self._image) }()
|
||||||
|
case 5: try { try decoder.decodeSingularStringField(value: &self._category) }()
|
||||||
|
case 6: try { try decoder.decodeSingularStringField(value: &self._subcategory) }()
|
||||||
|
case 7: try { try decoder.decodeSingularBoolField(value: &self.podcast) }()
|
||||||
|
case 8: try { try decoder.decodeSingularInt64Field(value: &self.subscribers) }()
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every if/case branch local when no optimizations
|
||||||
|
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||||
|
// https://github.com/apple/swift-protobuf/issues/1182
|
||||||
|
if !self.id.isEmpty {
|
||||||
|
try visitor.visitSingularStringField(value: self.id, fieldNumber: 1)
|
||||||
|
}
|
||||||
|
if !self.url.isEmpty {
|
||||||
|
try visitor.visitSingularStringField(value: self.url, fieldNumber: 2)
|
||||||
|
}
|
||||||
|
try { if let v = self._title {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 3)
|
||||||
|
} }()
|
||||||
|
try { if let v = self._image {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 4)
|
||||||
|
} }()
|
||||||
|
try { if let v = self._category {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 5)
|
||||||
|
} }()
|
||||||
|
try { if let v = self._subcategory {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 6)
|
||||||
|
} }()
|
||||||
|
if self.podcast != false {
|
||||||
|
try visitor.visitSingularBoolField(value: self.podcast, fieldNumber: 7)
|
||||||
|
}
|
||||||
|
if self.subscribers != 0 {
|
||||||
|
try visitor.visitSingularInt64Field(value: self.subscribers, fieldNumber: 8)
|
||||||
|
}
|
||||||
|
try unknownFields.traverse(visitor: &visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func ==(lhs: Directory_Listing, rhs: Directory_Listing) -> Bool {
|
||||||
|
if lhs.id != rhs.id {return false}
|
||||||
|
if lhs.url != rhs.url {return false}
|
||||||
|
if lhs._title != rhs._title {return false}
|
||||||
|
if lhs._image != rhs._image {return false}
|
||||||
|
if lhs._category != rhs._category {return false}
|
||||||
|
if lhs._subcategory != rhs._subcategory {return false}
|
||||||
|
if lhs.podcast != rhs.podcast {return false}
|
||||||
|
if lhs.subscribers != rhs.subscribers {return false}
|
||||||
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated extension Directory_Listings: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||||
|
static let protoMessageName: String = _protobuf_package + ".Listings"
|
||||||
|
static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}items\0")
|
||||||
|
|
||||||
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||||
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every case branch when no optimizations are
|
||||||
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||||
|
switch fieldNumber {
|
||||||
|
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.items) }()
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||||
|
if !self.items.isEmpty {
|
||||||
|
try visitor.visitRepeatedMessageField(value: self.items, fieldNumber: 1)
|
||||||
|
}
|
||||||
|
try unknownFields.traverse(visitor: &visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func ==(lhs: Directory_Listings, rhs: Directory_Listings) -> Bool {
|
||||||
|
if lhs.items != rhs.items {return false}
|
||||||
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated extension Directory_Item: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||||
|
static let protoMessageName: String = _protobuf_package + ".Item"
|
||||||
|
static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}guid\0\u{1}title\0\u{1}link\0\u{1}published\0\u{1}duration\0\u{1}description\0")
|
||||||
|
|
||||||
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||||
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every case branch when no optimizations are
|
||||||
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||||
|
switch fieldNumber {
|
||||||
|
case 1: try { try decoder.decodeSingularStringField(value: &self.guid) }()
|
||||||
|
case 2: try { try decoder.decodeSingularStringField(value: &self._title) }()
|
||||||
|
case 3: try { try decoder.decodeSingularStringField(value: &self._link) }()
|
||||||
|
case 4: try { try decoder.decodeSingularInt64Field(value: &self._published) }()
|
||||||
|
case 5: try { try decoder.decodeSingularInt64Field(value: &self._duration) }()
|
||||||
|
case 6: try { try decoder.decodeSingularStringField(value: &self._description_p) }()
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every if/case branch local when no optimizations
|
||||||
|
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||||
|
// https://github.com/apple/swift-protobuf/issues/1182
|
||||||
|
if !self.guid.isEmpty {
|
||||||
|
try visitor.visitSingularStringField(value: self.guid, fieldNumber: 1)
|
||||||
|
}
|
||||||
|
try { if let v = self._title {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 2)
|
||||||
|
} }()
|
||||||
|
try { if let v = self._link {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 3)
|
||||||
|
} }()
|
||||||
|
try { if let v = self._published {
|
||||||
|
try visitor.visitSingularInt64Field(value: v, fieldNumber: 4)
|
||||||
|
} }()
|
||||||
|
try { if let v = self._duration {
|
||||||
|
try visitor.visitSingularInt64Field(value: v, fieldNumber: 5)
|
||||||
|
} }()
|
||||||
|
try { if let v = self._description_p {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 6)
|
||||||
|
} }()
|
||||||
|
try unknownFields.traverse(visitor: &visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func ==(lhs: Directory_Item, rhs: Directory_Item) -> Bool {
|
||||||
|
if lhs.guid != rhs.guid {return false}
|
||||||
|
if lhs._title != rhs._title {return false}
|
||||||
|
if lhs._link != rhs._link {return false}
|
||||||
|
if lhs._published != rhs._published {return false}
|
||||||
|
if lhs._duration != rhs._duration {return false}
|
||||||
|
if lhs._description_p != rhs._description_p {return false}
|
||||||
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated extension Directory_FeedPage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||||
|
static let protoMessageName: String = _protobuf_package + ".FeedPage"
|
||||||
|
static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}id\0\u{1}url\0\u{1}title\0\u{1}image\0\u{1}category\0\u{1}subcategory\0\u{1}podcast\0\u{1}subscribers\0\u{1}description\0\u{1}failing\0\u{1}items\0")
|
||||||
|
|
||||||
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||||
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every case branch when no optimizations are
|
||||||
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||||
|
switch fieldNumber {
|
||||||
|
case 1: try { try decoder.decodeSingularStringField(value: &self.id) }()
|
||||||
|
case 2: try { try decoder.decodeSingularStringField(value: &self.url) }()
|
||||||
|
case 3: try { try decoder.decodeSingularStringField(value: &self._title) }()
|
||||||
|
case 4: try { try decoder.decodeSingularStringField(value: &self._image) }()
|
||||||
|
case 5: try { try decoder.decodeSingularStringField(value: &self._category) }()
|
||||||
|
case 6: try { try decoder.decodeSingularStringField(value: &self._subcategory) }()
|
||||||
|
case 7: try { try decoder.decodeSingularBoolField(value: &self.podcast) }()
|
||||||
|
case 8: try { try decoder.decodeSingularInt64Field(value: &self.subscribers) }()
|
||||||
|
case 9: try { try decoder.decodeSingularStringField(value: &self._description_p) }()
|
||||||
|
case 10: try { try decoder.decodeSingularStringField(value: &self._failing) }()
|
||||||
|
case 11: try { try decoder.decodeRepeatedMessageField(value: &self.items) }()
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every if/case branch local when no optimizations
|
||||||
|
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||||
|
// https://github.com/apple/swift-protobuf/issues/1182
|
||||||
|
if !self.id.isEmpty {
|
||||||
|
try visitor.visitSingularStringField(value: self.id, fieldNumber: 1)
|
||||||
|
}
|
||||||
|
if !self.url.isEmpty {
|
||||||
|
try visitor.visitSingularStringField(value: self.url, fieldNumber: 2)
|
||||||
|
}
|
||||||
|
try { if let v = self._title {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 3)
|
||||||
|
} }()
|
||||||
|
try { if let v = self._image {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 4)
|
||||||
|
} }()
|
||||||
|
try { if let v = self._category {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 5)
|
||||||
|
} }()
|
||||||
|
try { if let v = self._subcategory {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 6)
|
||||||
|
} }()
|
||||||
|
if self.podcast != false {
|
||||||
|
try visitor.visitSingularBoolField(value: self.podcast, fieldNumber: 7)
|
||||||
|
}
|
||||||
|
if self.subscribers != 0 {
|
||||||
|
try visitor.visitSingularInt64Field(value: self.subscribers, fieldNumber: 8)
|
||||||
|
}
|
||||||
|
try { if let v = self._description_p {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 9)
|
||||||
|
} }()
|
||||||
|
try { if let v = self._failing {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 10)
|
||||||
|
} }()
|
||||||
|
if !self.items.isEmpty {
|
||||||
|
try visitor.visitRepeatedMessageField(value: self.items, fieldNumber: 11)
|
||||||
|
}
|
||||||
|
try unknownFields.traverse(visitor: &visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func ==(lhs: Directory_FeedPage, rhs: Directory_FeedPage) -> Bool {
|
||||||
|
if lhs.id != rhs.id {return false}
|
||||||
|
if lhs.url != rhs.url {return false}
|
||||||
|
if lhs._title != rhs._title {return false}
|
||||||
|
if lhs._image != rhs._image {return false}
|
||||||
|
if lhs._category != rhs._category {return false}
|
||||||
|
if lhs._subcategory != rhs._subcategory {return false}
|
||||||
|
if lhs.podcast != rhs.podcast {return false}
|
||||||
|
if lhs.subscribers != rhs.subscribers {return false}
|
||||||
|
if lhs._description_p != rhs._description_p {return false}
|
||||||
|
if lhs._failing != rhs._failing {return false}
|
||||||
|
if lhs.items != rhs.items {return false}
|
||||||
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated extension Directory_SnapshotEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||||
|
static let protoMessageName: String = _protobuf_package + ".SnapshotEntry"
|
||||||
|
static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}url\0\u{1}subscribers\0\u{1}category\0")
|
||||||
|
|
||||||
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||||
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every case branch when no optimizations are
|
||||||
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||||
|
switch fieldNumber {
|
||||||
|
case 1: try { try decoder.decodeSingularStringField(value: &self.url) }()
|
||||||
|
case 2: try { try decoder.decodeSingularInt64Field(value: &self.subscribers) }()
|
||||||
|
case 3: try { try decoder.decodeSingularStringField(value: &self._category) }()
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every if/case branch local when no optimizations
|
||||||
|
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||||
|
// https://github.com/apple/swift-protobuf/issues/1182
|
||||||
|
if !self.url.isEmpty {
|
||||||
|
try visitor.visitSingularStringField(value: self.url, fieldNumber: 1)
|
||||||
|
}
|
||||||
|
if self.subscribers != 0 {
|
||||||
|
try visitor.visitSingularInt64Field(value: self.subscribers, fieldNumber: 2)
|
||||||
|
}
|
||||||
|
try { if let v = self._category {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 3)
|
||||||
|
} }()
|
||||||
|
try unknownFields.traverse(visitor: &visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func ==(lhs: Directory_SnapshotEntry, rhs: Directory_SnapshotEntry) -> Bool {
|
||||||
|
if lhs.url != rhs.url {return false}
|
||||||
|
if lhs.subscribers != rhs.subscribers {return false}
|
||||||
|
if lhs._category != rhs._category {return false}
|
||||||
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated extension Directory_Snapshot: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||||
|
static let protoMessageName: String = _protobuf_package + ".Snapshot"
|
||||||
|
static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}items\0")
|
||||||
|
|
||||||
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||||
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every case branch when no optimizations are
|
||||||
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||||
|
switch fieldNumber {
|
||||||
|
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.items) }()
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||||
|
if !self.items.isEmpty {
|
||||||
|
try visitor.visitRepeatedMessageField(value: self.items, fieldNumber: 1)
|
||||||
|
}
|
||||||
|
try unknownFields.traverse(visitor: &visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func ==(lhs: Directory_Snapshot, rhs: Directory_Snapshot) -> Bool {
|
||||||
|
if lhs.items != rhs.items {return false}
|
||||||
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated extension Directory_SnapshotResult: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||||
|
static let protoMessageName: String = _protobuf_package + ".SnapshotResult"
|
||||||
|
static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}accepted\0\u{3}refused_private\0\u{3}refused_blocked\0\u{3}refused_invalid\0")
|
||||||
|
|
||||||
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||||
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every case branch when no optimizations are
|
||||||
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||||
|
switch fieldNumber {
|
||||||
|
case 1: try { try decoder.decodeSingularUInt64Field(value: &self.accepted) }()
|
||||||
|
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.refusedPrivate) }()
|
||||||
|
case 3: try { try decoder.decodeSingularUInt64Field(value: &self.refusedBlocked) }()
|
||||||
|
case 4: try { try decoder.decodeSingularUInt64Field(value: &self.refusedInvalid) }()
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||||
|
if self.accepted != 0 {
|
||||||
|
try visitor.visitSingularUInt64Field(value: self.accepted, fieldNumber: 1)
|
||||||
|
}
|
||||||
|
if self.refusedPrivate != 0 {
|
||||||
|
try visitor.visitSingularUInt64Field(value: self.refusedPrivate, fieldNumber: 2)
|
||||||
|
}
|
||||||
|
if self.refusedBlocked != 0 {
|
||||||
|
try visitor.visitSingularUInt64Field(value: self.refusedBlocked, fieldNumber: 3)
|
||||||
|
}
|
||||||
|
if self.refusedInvalid != 0 {
|
||||||
|
try visitor.visitSingularUInt64Field(value: self.refusedInvalid, fieldNumber: 4)
|
||||||
|
}
|
||||||
|
try unknownFields.traverse(visitor: &visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func ==(lhs: Directory_SnapshotResult, rhs: Directory_SnapshotResult) -> Bool {
|
||||||
|
if lhs.accepted != rhs.accepted {return false}
|
||||||
|
if lhs.refusedPrivate != rhs.refusedPrivate {return false}
|
||||||
|
if lhs.refusedBlocked != rhs.refusedBlocked {return false}
|
||||||
|
if lhs.refusedInvalid != rhs.refusedInvalid {return false}
|
||||||
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated extension Directory_Instance: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||||
|
static let protoMessageName: String = _protobuf_package + ".Instance"
|
||||||
|
static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}name\0\u{1}feeds\0\u{1}subscribers\0")
|
||||||
|
|
||||||
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||||
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every case branch when no optimizations are
|
||||||
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||||
|
switch fieldNumber {
|
||||||
|
case 1: try { try decoder.decodeSingularStringField(value: &self.name) }()
|
||||||
|
case 2: try { try decoder.decodeSingularInt64Field(value: &self.feeds) }()
|
||||||
|
case 3: try { try decoder.decodeSingularInt64Field(value: &self.subscribers) }()
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||||
|
if !self.name.isEmpty {
|
||||||
|
try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
|
||||||
|
}
|
||||||
|
if self.feeds != 0 {
|
||||||
|
try visitor.visitSingularInt64Field(value: self.feeds, fieldNumber: 2)
|
||||||
|
}
|
||||||
|
if self.subscribers != 0 {
|
||||||
|
try visitor.visitSingularInt64Field(value: self.subscribers, fieldNumber: 3)
|
||||||
|
}
|
||||||
|
try unknownFields.traverse(visitor: &visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func ==(lhs: Directory_Instance, rhs: Directory_Instance) -> Bool {
|
||||||
|
if lhs.name != rhs.name {return false}
|
||||||
|
if lhs.feeds != rhs.feeds {return false}
|
||||||
|
if lhs.subscribers != rhs.subscribers {return false}
|
||||||
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated extension Directory_Instances: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||||
|
static let protoMessageName: String = _protobuf_package + ".Instances"
|
||||||
|
static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}items\0")
|
||||||
|
|
||||||
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||||
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every case branch when no optimizations are
|
||||||
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||||
|
switch fieldNumber {
|
||||||
|
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.items) }()
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||||
|
if !self.items.isEmpty {
|
||||||
|
try visitor.visitRepeatedMessageField(value: self.items, fieldNumber: 1)
|
||||||
|
}
|
||||||
|
try unknownFields.traverse(visitor: &visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func ==(lhs: Directory_Instances, rhs: Directory_Instances) -> Bool {
|
||||||
|
if lhs.items != rhs.items {return false}
|
||||||
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated extension Directory_Blocked: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||||
|
static let protoMessageName: String = _protobuf_package + ".Blocked"
|
||||||
|
static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}id\0\u{1}url\0\u{1}title\0\u{1}at\0")
|
||||||
|
|
||||||
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||||
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every case branch when no optimizations are
|
||||||
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||||
|
switch fieldNumber {
|
||||||
|
case 1: try { try decoder.decodeSingularStringField(value: &self.id) }()
|
||||||
|
case 2: try { try decoder.decodeSingularStringField(value: &self._url) }()
|
||||||
|
case 3: try { try decoder.decodeSingularStringField(value: &self._title) }()
|
||||||
|
case 4: try { try decoder.decodeSingularInt64Field(value: &self.at) }()
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every if/case branch local when no optimizations
|
||||||
|
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
||||||
|
// https://github.com/apple/swift-protobuf/issues/1182
|
||||||
|
if !self.id.isEmpty {
|
||||||
|
try visitor.visitSingularStringField(value: self.id, fieldNumber: 1)
|
||||||
|
}
|
||||||
|
try { if let v = self._url {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 2)
|
||||||
|
} }()
|
||||||
|
try { if let v = self._title {
|
||||||
|
try visitor.visitSingularStringField(value: v, fieldNumber: 3)
|
||||||
|
} }()
|
||||||
|
if self.at != 0 {
|
||||||
|
try visitor.visitSingularInt64Field(value: self.at, fieldNumber: 4)
|
||||||
|
}
|
||||||
|
try unknownFields.traverse(visitor: &visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func ==(lhs: Directory_Blocked, rhs: Directory_Blocked) -> Bool {
|
||||||
|
if lhs.id != rhs.id {return false}
|
||||||
|
if lhs._url != rhs._url {return false}
|
||||||
|
if lhs._title != rhs._title {return false}
|
||||||
|
if lhs.at != rhs.at {return false}
|
||||||
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nonisolated extension Directory_BlockedList: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||||
|
static let protoMessageName: String = _protobuf_package + ".BlockedList"
|
||||||
|
static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}items\0")
|
||||||
|
|
||||||
|
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||||
|
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||||
|
// The use of inline closures is to circumvent an issue where the compiler
|
||||||
|
// allocates stack space for every case branch when no optimizations are
|
||||||
|
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||||
|
switch fieldNumber {
|
||||||
|
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.items) }()
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||||
|
if !self.items.isEmpty {
|
||||||
|
try visitor.visitRepeatedMessageField(value: self.items, fieldNumber: 1)
|
||||||
|
}
|
||||||
|
try unknownFields.traverse(visitor: &visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
static func ==(lhs: Directory_BlockedList, rhs: Directory_BlockedList) -> Bool {
|
||||||
|
if lhs.items != rhs.items {return false}
|
||||||
|
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
5055
ios/Sources/Wire/ipx.pb.swift
Normal file
5055
ios/Sources/Wire/ipx.pb.swift
Normal file
File diff suppressed because it is too large
Load Diff
@@ -13,6 +13,12 @@ settings:
|
|||||||
SWIFT_VERSION: "5.9"
|
SWIFT_VERSION: "5.9"
|
||||||
TARGETED_DEVICE_FAMILY: "1,2"
|
TARGETED_DEVICE_FAMILY: "1,2"
|
||||||
CODE_SIGN_STYLE: Automatic
|
CODE_SIGN_STYLE: Automatic
|
||||||
|
packages:
|
||||||
|
# The app's half of ipx's protobuf (#469). The same version as the protoc-gen-swift that made
|
||||||
|
# Sources/Wire (scripts/proto.sh), whose code refuses another.
|
||||||
|
SwiftProtobuf:
|
||||||
|
url: https://github.com/apple/swift-protobuf
|
||||||
|
exactVersion: 1.41.0
|
||||||
targets:
|
targets:
|
||||||
iPX:
|
iPX:
|
||||||
type: application
|
type: application
|
||||||
@@ -23,6 +29,7 @@ targets:
|
|||||||
- Resources/Assets.xcassets
|
- Resources/Assets.xcassets
|
||||||
dependencies:
|
dependencies:
|
||||||
- target: iPXWidgets
|
- target: iPXWidgets
|
||||||
|
- package: SwiftProtobuf
|
||||||
info:
|
info:
|
||||||
path: Resources/Info.plist
|
path: Resources/Info.plist
|
||||||
properties:
|
properties:
|
||||||
|
|||||||
12
ios/scripts/proto.sh
Executable file
12
ios/scripts/proto.sh
Executable 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
|
||||||
Reference in New Issue
Block a user