Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
home/ios: "+" offers only apps whose release can be made right now (#596)
nyblnet0a0658627e3c
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.mdindex ac91a880..56ec0fa2 100644--- a/docs/DECISIONS.md+++ b/docs/DECISIONS.md@@ -14,6 +14,42 @@ Decision. Why. Pointers.---+## 2026-10-04 — "+" offers only apps that can be made now, on every host++**Decision.** A host's "New document" offers an app only when that app's+release channel serves a release that **verifies** — signature, app identity+and rollback floor, the same checks used to create the document — or when a+verified shell for it is already cached. Read at runtime, each time "+" opens.+This **supersedes** one line of "2026-08-16 — Creating a document: every host+VERIFIES the release it downloads": *"the app list is aspirational on every+host. All three say '<App> has not been released yet'."*++**Why.** The aspirational list offered every app and refused the unreleased+ones after they were chosen. On 2026-10-04 that meant Spaces and Dash in the+iOS menu with both channels answering 404 — two options in front of App Review+that do nothing, which is guideline 2.1's placeholder case. The list existed to+keep "adding an app to the list is the whole integration" true; reading the+channels at runtime keeps that and adds that an app now appears by itself the+day its channel goes live, with no host release.++**Two details that matter.**++- **Verified, not merely reachable.** An HTTP 200 with a bad signature does not+ put an app in the menu. Offering something the create path would then refuse+ is the failure being replaced, so the two must apply the same checks.+- **The cache keeps offline "New" working.** A shell in the host's own cache+ was verified when it was written, so an app used before stays on offer with+ no connection. With no live channel and nothing cached, "+" says so, rather+ than showing an empty menu.++It is still only the release channel, and still only when creating a+document. Probes run concurrently, so "+" waits for the slowest channel rather+than the sum of them, capped at 8 s.++**Status.** iOS implements it first (`home/ios/Releases.swift`+`available()`). Android and the extension still show the aspirational list and+follow once this is accepted — until then the hosts differ on this one point,+recorded here rather than left to be found.## 2026-10-04 — iOS: "Save a copy…" reports what the picker actually did**Decision.** iOS follows the same rules as Android's 2026-10-04 entry ondiff --git a/home/ios/DocumentBrowserViewController.swift b/home/ios/DocumentBrowserViewController.swiftindex 0090ff81..47e309ee 100644--- a/home/ios/DocumentBrowserViewController.swift+++ b/home/ios/DocumentBrowserViewController.swift@@ -71,22 +71,45 @@ final class DocumentBrowserViewController: UIDocumentBrowserViewController,}}- /// Which Bento. The list is aspirational on purpose — only slides has a- /// published channel today, and an unreleased one says so plainly rather- /// than being hidden, because adding an app to `Releases.apps` is meant to- /// be the whole integration.+ /// Which Bento — only the ones that can actually be made right now.+ ///+ /// `Releases.available()` asks each channel and keeps the apps whose release+ /// verifies, plus any with a verified shell already cached for offline use.+ /// So an app appears here on its own the day its channel goes live, and an+ /// unreleased one is simply absent rather than offered and then refused.private func chooseApp(_ done: @escaping (Releases.App?) -> Void) {- let sheet = UIAlertController(title: "New document", message: nil, preferredStyle: .actionSheet)- for app in Releases.apps {- sheet.addAction(UIAlertAction(title: "\(app.label) — \(app.blurb)", style: .default) { _ in- done(app)- })+ let checking = UIAlertController(title: nil, message: "Checking what's available…",+ preferredStyle: .alert)+ present(checking, animated: true)++ Task { @MainActor in+ let offered = await Releases.available()++ // Fully dismissed before anything else is presented — presenting into+ // an alert's dismissal animation silently does nothing (see create).+ await withCheckedContinuation { finished in+ checking.dismiss(animated: true) { finished.resume() }+ }++ guard !offered.isEmpty else {+ done(nil)+ self.report("Starting a new document needs a connection the first time, "+ + "and bento/home couldn't reach bento.page.")+ return+ }++ let sheet = UIAlertController(title: "New document", message: nil, preferredStyle: .actionSheet)+ for app in offered {+ sheet.addAction(UIAlertAction(title: "\(app.label) — \(app.blurb)", style: .default) { _ in+ done(app)+ })+ }+ sheet.addAction(UIAlertAction(title: "Cancel", style: .cancel) { _ in done(nil) })+ sheet.popoverPresentationController?.sourceView = self.view+ sheet.popoverPresentationController?.sourceRect =+ CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0)+ self.present(sheet, animated: true)}- sheet.addAction(UIAlertAction(title: "Cancel", style: .cancel) { _ in done(nil) })- sheet.popoverPresentationController?.sourceView = view- sheet.popoverPresentationController?.sourceRect =- CGRect(x: view.bounds.midX, y: view.bounds.midY, width: 0, height: 0)- present(sheet, animated: true)}private func create(_ app: Releases.App,diff --git a/home/ios/Releases.swift b/home/ios/Releases.swiftindex 46175798..b611e45a 100644--- a/home/ios/Releases.swift+++ b/home/ios/Releases.swift@@ -150,14 +150,59 @@ enum Releases {UserDefaults.standard.set(version, forKey: "bento.tray.release-floor.\(app.id)")}+ // MARK: - What "+" can offer++ /// How long "+" waits on a channel before treating it as unreachable.+ /// Shorter than a download's, because the user is watching a spinner, and+ /// for this question a slow channel is the same answer as an absent one.+ private static let probeTimeout: TimeInterval = 8++ /// The apps a new document can be made from right now, in `apps` order.+ ///+ /// An app is offered when its channel serves a release that VERIFIES — the+ /// same signature, app-identity and rollback-floor checks `seed` makes — or+ /// when a verified shell for it is already cached, so "New" keeps working+ /// offline for an app used before. A 404, a bad signature and a timeout all+ /// mean "not offered". Offering something `seed` would then refuse is the+ /// failure this replaces.+ ///+ /// It replaces an aspirational list that offered every app and answered+ /// "has not been released yet" for the unreleased ones — which put options+ /// in front of the user, and of App Review, that did nothing. Reading the+ /// channels at runtime keeps what that list was for: adding an app to `apps`+ /// is still the whole integration, and an app now appears on its own the+ /// day its channel goes live. See docs/DECISIONS.md.+ ///+ /// Probes run concurrently, so "+" waits for the slowest channel, not the+ /// sum of them. This is still only the release channel and still only when+ /// creating a document — the one thing this host fetches.+ static func available() async -> [App] {+ await withTaskGroup(of: (Int, Bool).self) { group in+ for (i, app) in apps.enumerated() {+ group.addTask { (i, await isAvailable(app)) }+ }+ var offered = [Bool](repeating: false, count: apps.count)+ for await (i, yes) in group { offered[i] = yes }+ return apps.enumerated().filter { offered[$0.offset] }.map(\.element)+ }+ }++ private static func isAvailable(_ app: App) async -> Bool {+ if let raw = try? await fetch(app.manifest, timeout: probeTimeout),+ (try? release(from: String(decoding: raw, as: UTF8.self),+ for: app, notBefore: floor(for: app))) != nil {+ return true+ }+ return anyCached(app) != nil+ }+// MARK: - The seed/// The current signed shell for `app`, from cache when we already have it.static func seed(for app: App) async throws -> Data {- // Only slides has a published channel today; spaces and dash 404. Say so- // rather than surfacing an HTTP code — the app list is aspirational on- // purpose (adding an app here is the whole integration), so an unreleased- // one is an expected answer, not a fault.+ // "+" only offers apps whose channel verified a moment ago (`available`),+ // so a 404 here means a channel went away in between. Say so plainly+ // rather than surfacing an HTTP code.let envelope: Datado {envelope = try await fetch(app.manifest)@@ -248,12 +293,12 @@ enum Releases {// MARK: - Net- private static func fetch(_ url: String) async throws -> Data {+ private static func fetch(_ url: String, timeout limit: TimeInterval = timeout) async throws -> Data {guard url.hasPrefix("https://"), let u = URL(string: url) else {throw Failed(message: "the release server offered a non-HTTPS build")}var req = URLRequest(url: u, cachePolicy: .reloadIgnoringLocalAndRemoteCacheData,- timeoutInterval: timeout)+ timeoutInterval: limit)// ASK FOR BYTES, NOT A PAGE — and this header is LOAD-BEARING, not// belt-and-braces. Measured against the live server 2026-08-17://