Share sheet errored "Got an unexpected response from the server" (a client-side decode failure) on every open. OutlineShare only declared 5 fields against the real response's ~20, with url non-optional — something in a real payload came back null and blew up the strict decode, same class of bug as OutlinePin's history: self-hosted responses keep diverging from what the hosted-app docs imply is non-nullable. - Rewrote OutlineShare to match the full documented shares.* response shape. Only id/published are trusted non-optional; everything else (documentTitle, sourceTitle, urlId, domain, title, iconUrl, includeChildDocuments, allowSubscriptions, allowIndexing, showLastUpdated, showTOC, views, createdBy, createdAt, updatedAt, lastAccessedAt) is optional so an unexpectedly-null field can't crash the decode again. - shares.list and shares.revoke were never wrapped at all — added both. - UpdateShareRequest was missing the documented title/iconUrl overrides. - DocumentShareSheet: handles share.url being optional, adds a public-page title override field, adds a Revoke Link button (confirmation dialog, resets back to "Create Share Link" after). - Removed dead DocumentReaderViewModel.share/loadShare()/ createOrLoadShare() — never called by anything; DocumentShareSheet manages its own share state independently. - Added a decode test using the exact payload from Outline's official shares.info docs, plus tests for shares.list and shares.revoke. Branched fresh off main (post home-page merge) rather than continuing on feature/home-page, to keep this its own PR.
19 lines
628 B
Swift
19 lines
628 B
Swift
import Foundation
|
|
|
|
public struct UpdateShareRequest: Encodable, Sendable {
|
|
public let id: String
|
|
public let published: Bool
|
|
/// Overrides the title displayed on the publicly shared page. `nil`
|
|
/// leaves it unset in the payload (server keeps whatever it already
|
|
/// has) rather than clearing it — send an empty string to clear.
|
|
public let title: String?
|
|
public let iconUrl: String?
|
|
|
|
public init(id: String, published: Bool, title: String? = nil, iconUrl: String? = nil) {
|
|
self.id = id
|
|
self.published = published
|
|
self.title = title
|
|
self.iconUrl = iconUrl
|
|
}
|
|
}
|