The Apps section folds, remembered per account on this device
Task 11 of the native slice 2 part 1 plan (spec 7.5, P5). - SidebarFolds keeps Apps folded or open in UserDefaults on base.fold.apps.<accountKey>. AccountKey is the first 16 bytes of SHA-256 over the origin, a newline and the session's Oficina ID, in hex: no address or origin in clear, and known before /api/v1/me answers, and offline. It starts open and is never synced. BaseSession makes it at begin() and drops it at end(). P9's cache will use the same key. - FoldHeading, shared by the Mac sidebar and the iPhone's apps sheet: a button with a chevron, and the app count while folded. Space toggles it; on the Mac, left folds and right unfolds. VoiceOver says "Apps, expanded" or "Apps, collapsed" (DRAFT strings). With Reduce Motion the chevron jumps. Tests (SidebarFoldsTests): starts open; the same account remembers; another account or Base has its own; the key is the hash with nothing in clear; the session has its folds before me loads. Snapshots: base-mac window-apps-folded (new), and the open window, Store and People windows re-recorded (the heading's chevron); base-phone apps-folded (new, also AX3) and apps re-recorded. Gate: swift test -j 4 --filter BaseKitTests.SidebarFoldsTests: 5 passed; build-iphone.sh simulator succeeded; snapshots record (reviewed), then compare mac and compare iphone: passed. check-strings.py: ok. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Task 11: the Apps section folds
25 files changed,
+227
−14
native/apple/Sources/BaseKit/Home/SidebarFolds.swift+78 −0native/apple/Sources/BaseKit/Mac/MacMainView.swift+20 −6native/apple/Sources/BaseKit/Phone/PhoneAskScreen.swift+23 −6native/apple/Sources/BaseKit/Resources/Localizable.xcstrings+24 −0native/apple/Sources/BaseKit/Session/BaseSession.swift+4 −0native/apple/Sources/BaseMac/BaseMacApp.swift+1 −1native/apple/Sources/BasePhone/BasePhoneApp.swift+1 −1native/apple/Tests/BaseKitTests/SidebarFoldsTests.swift+59 −0native/apple/Tests/BaseSnapshots/MacSnapshots.swift+17 −0native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-apps-folded-dark-default.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-apps-folded-light-default.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-dark-default.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-light-default.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-people-dark-default.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-people-light-default.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-store-dark-default.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-store-light-default.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-dark-ax3.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-dark-default.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-dark-ax3.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-dark-default.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-light-ax3.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-light-default.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-light-ax3.pngbinarynative/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-light-default.pngbinary
diff --git a/native/apple/Sources/BaseKit/Home/SidebarFolds.swift b/native/apple/Sources/BaseKit/Home/SidebarFolds.swift| new file mode 100644 |
| index 0000000..549c725 |
| --- /dev/null |
| +++ b/native/apple/Sources/BaseKit/Home/SidebarFolds.swift |
| @@ -0,0 +1,78 @@ |
| +import CryptoKit |
| +import Foundation |
| +import Observation |
| +import SwiftUI |
| + |
| +/// An account on this device, as a name for what's kept per account (the |
| +/// sidebar's folds, P5; the files cache, P9): the first 16 bytes of |
| +/// SHA-256 over the Base's origin, a newline, and the Oficina ID the |
| +/// session holds, in hex. Neither the address nor the origin is in clear, |
| +/// and it is known before `/api/v1/me` answers, and offline. |
| +public enum AccountKey { |
| + public static func make(origin: URL, identity: String) -> String { |
| + SHA256.hash(data: Data((origin.absoluteString + "\n" + identity).utf8)).prefix(16).map { String(format: "%02x", $0) }.joined() |
| + } |
| +} |
| + |
| +/// Which sidebar sections are folded (spec 7.5): only Apps in part 1. Kept |
| +/// on this device for this account; it starts open, and is never synced. |
| +@MainActor @Observable public final class SidebarFolds { |
| + @ObservationIgnored let defaults: UserDefaults |
| + @ObservationIgnored let appsKey: String |
| + |
| + public var appsFolded: Bool { |
| + didSet { defaults.set(appsFolded, forKey: appsKey) } |
| + } |
| + |
| + public init(defaults: UserDefaults = .standard, origin: URL, identity: String) { |
| + self.defaults = defaults |
| + appsKey = "base.fold.apps." + AccountKey.make(origin: origin, identity: identity) |
| + appsFolded = defaults.bool(forKey: appsKey) |
| + } |
| +} |
| + |
| +/// A section heading that folds its section (spec 7.5: a button, not a |
| +/// disclosure group): a chevron, the title, and the section's count while |
| +/// folded. Space, Return or a click toggles it; on the Mac ← folds and → |
| +/// unfolds. VoiceOver hears "Apps, expanded" or "Apps, collapsed". With |
| +/// Reduce Motion the chevron jumps. |
| +public struct FoldHeading: View { |
| + let title: String |
| + let label: (expanded: String, collapsed: String) |
| + let count: Int |
| + @Binding var folded: Bool |
| + var font: Font = BaseFont.body(11.5, .semibold, relativeTo: .caption) |
| + @Environment(\.colorScheme) private var scheme |
| + @Environment(\.accessibilityReduceMotion) private var reduceMotion |
| + |
| + public init(title: String, label: (expanded: String, collapsed: String), count: Int, folded: Binding<Bool>, |
| + font: Font = BaseFont.body(11.5, .semibold, relativeTo: .caption)) { |
| + self.title = title; self.label = label; self.count = count; _folded = folded; self.font = font |
| + } |
| + |
| + public var body: some View { |
| + let p = Palette(scheme) |
| + Button { set(!folded) } label: { |
| + HStack(spacing: 5) { |
| + Image(systemName: "chevron.down").font(.system(size: 9, weight: .bold)) |
| + .rotationEffect(.degrees(folded ? -90 : 0)) |
| + Text(verbatim: title).font(font) |
| + Spacer(minLength: 4) |
| + if folded { Text(verbatim: "\(count)").font(font) } |
| + } |
| + .foregroundStyle(p[.haze]) |
| + .contentShape(Rectangle()) |
| + } |
| + .buttonStyle(.plain) |
| + .accessibilityLabel(Text(verbatim: folded ? label.collapsed : label.expanded)) |
| + .accessibilityAddTraits(.isHeader) |
| + #if os(macOS) |
| + .onKeyPress(.leftArrow) { set(true); return .handled } |
| + .onKeyPress(.rightArrow) { set(false); return .handled } |
| + #endif |
| + } |
| + |
| + private func set(_ fold: Bool) { |
| + if reduceMotion { folded = fold } else { withAnimation(.easeOut(duration: 0.18)) { folded = fold } } |
| + } |
| +} |
diff --git a/native/apple/Sources/BaseKit/Mac/MacMainView.swift b/native/apple/Sources/BaseKit/Mac/MacMainView.swift| index 4e59231..ca24b8b 100644 |
| --- a/native/apple/Sources/BaseKit/Mac/MacMainView.swift |
| +++ b/native/apple/Sources/BaseKit/Mac/MacMainView.swift |
| @@ -11,15 +11,16 @@ public struct MacMainView: View { |
| let home: HomeData? |
| let ask: AskModel? |
| let team: TeamModels? |
| + let folds: SidebarFolds? |
| let transport: NativeTransport? |
| let actions: BaseActions |
| @Binding var sidebarShown: Bool |
| @State private var pane: MacPane |
| @Environment(\.colorScheme) private var scheme |
| - public init(me: Me?, home: HomeData?, ask: AskModel?, team: TeamModels? = nil, transport: NativeTransport?, actions: BaseActions, |
| - sidebarShown: Binding<Bool>, pane: MacPane = .ask) { |
| - self.me = me; self.home = home; self.ask = ask; self.team = team; self.transport = transport; self.actions = actions |
| + public init(me: Me?, home: HomeData?, ask: AskModel?, team: TeamModels? = nil, folds: SidebarFolds? = nil, transport: NativeTransport?, |
| + actions: BaseActions, sidebarShown: Binding<Bool>, pane: MacPane = .ask) { |
| + self.me = me; self.home = home; self.ask = ask; self.team = team; self.folds = folds; self.transport = transport; self.actions = actions |
| _sidebarShown = sidebarShown |
| _pane = State(initialValue: pane) |
| } |
| @@ -29,7 +30,7 @@ public struct MacMainView: View { |
| Sky() |
| HStack(spacing: 10) { |
| if sidebarShown { |
| - MacSidebar(me: me, home: home, waiting: ask?.waitingJobs ?? 0, team: team, pane: $pane, transport: transport, actions: actions) |
| + MacSidebar(me: me, home: home, waiting: ask?.waitingJobs ?? 0, team: team, folds: folds, pane: $pane, transport: transport, actions: actions) |
| .frame(width: 236) |
| .transition(.move(edge: .leading).combined(with: .opacity)) |
| } |
| @@ -113,8 +114,11 @@ struct MacSidebar: View { |
| let home: HomeData? |
| let waiting: Int |
| let team: TeamModels? |
| + let folds: SidebarFolds? |
| @Binding var pane: MacPane |
| let transport: NativeTransport? |
| + /// Without the session's folds (previews), folding lasts the view. |
| + @State private var localFold = false |
| let actions: BaseActions |
| @State private var switching = false |
| @State private var confirmingSignOut = false |
| @@ -129,8 +133,13 @@ struct MacSidebar: View { |
| askRow(p) |
| if let home, home.stepsOpen { steps(home, p) } |
| if let home, !home.launchable.isEmpty { |
| - heading(BaseText.text("native.sidebar.apps"), p) |
| - ForEach(home.launchable) { app in appRow(app, p) } |
| + FoldHeading(title: BaseText.text("native.sidebar.apps"), |
| + label: (BaseText.text("native.sidebar.apps.expanded_a11y"), BaseText.text("native.sidebar.apps.collapsed_a11y")), |
| + count: home.launchable.count, folded: appsFolded) |
| + .padding(.top, 14).padding(.bottom, 4).padding(.horizontal, 10) |
| + if !appsFolded.wrappedValue { |
| + ForEach(home.launchable) { app in appRow(app, p) } |
| + } |
| } |
| if let home, !home.own.isEmpty { |
| heading(BaseText.format("native.sidebar.team", ["team": me?.base.name ?? ""]), p) |
| @@ -149,6 +158,11 @@ struct MacSidebar: View { |
| .task { if let people = team?.people, people.people == nil { people.appear() } } |
| } |
| + private var appsFolded: Binding<Bool> { |
| + if let folds { return Binding(get: { folds.appsFolded }, set: { folds.appsFolded = $0 }) } |
| + return $localFold |
| + } |
| + |
| private func askRow(_ p: Palette) -> some View { |
| Button { pane = .ask } label: { askLabel(p) } |
| .buttonStyle(.plain) |
diff --git a/native/apple/Sources/BaseKit/Phone/PhoneAskScreen.swift b/native/apple/Sources/BaseKit/Phone/PhoneAskScreen.swift| index 8c59822..89d8ff0 100644 |
| --- a/native/apple/Sources/BaseKit/Phone/PhoneAskScreen.swift |
| +++ b/native/apple/Sources/BaseKit/Phone/PhoneAskScreen.swift |
| @@ -11,6 +11,7 @@ public struct PhoneAskScreen: View { |
| let home: HomeData? |
| let ask: AskModel? |
| let team: TeamModels? |
| + let folds: SidebarFolds? |
| let transport: NativeTransport? |
| let actions: BaseActions |
| @State private var appsShown: Bool |
| @@ -18,8 +19,9 @@ public struct PhoneAskScreen: View { |
| @State private var confirmingSignOut = false |
| @Environment(\.colorScheme) private var scheme |
| - public init(me: Me?, home: HomeData?, ask: AskModel?, team: TeamModels? = nil, transport: NativeTransport?, actions: BaseActions, appsShown: Bool = false) { |
| - self.me = me; self.home = home; self.ask = ask; self.team = team; self.transport = transport; self.actions = actions |
| + public init(me: Me?, home: HomeData?, ask: AskModel?, team: TeamModels? = nil, folds: SidebarFolds? = nil, transport: NativeTransport?, |
| + actions: BaseActions, appsShown: Bool = false) { |
| + self.me = me; self.home = home; self.ask = ask; self.team = team; self.folds = folds; self.transport = transport; self.actions = actions |
| _appsShown = State(initialValue: appsShown) |
| } |
| @@ -48,7 +50,7 @@ public struct PhoneAskScreen: View { |
| .foregroundStyle(p[.frost]) |
| .scrollDismissesKeyboard(.interactively) |
| .sheet(isPresented: $appsShown) { |
| - AppsSheet(me: me, home: home, team: team, transport: transport, actions: actions) { appsShown = false } |
| + AppsSheet(me: me, home: home, team: team, folds: folds, transport: transport, actions: actions) { appsShown = false } |
| .presentationDetents([.medium, .large]) |
| .presentationDragIndicator(.visible) |
| .presentationBackground { Palette(scheme)[.menuBase] } |
| @@ -111,16 +113,19 @@ public struct AppsSheet: View { |
| let me: Me? |
| let home: HomeData? |
| let team: TeamModels? |
| + let folds: SidebarFolds? |
| let transport: NativeTransport? |
| let actions: BaseActions |
| let close: () -> Void |
| @State private var path: [MacPane] |
| + /// Without the session's folds (previews), folding lasts the sheet. |
| + @State private var localFold = false |
| @Environment(\.colorScheme) private var scheme |
| @Environment(\.dynamicTypeSize) private var typeSize |
| - public init(me: Me?, home: HomeData?, team: TeamModels? = nil, transport: NativeTransport?, actions: BaseActions, |
| + public init(me: Me?, home: HomeData?, team: TeamModels? = nil, folds: SidebarFolds? = nil, transport: NativeTransport?, actions: BaseActions, |
| path: [MacPane] = [], close: @escaping () -> Void) { |
| - self.me = me; self.home = home; self.team = team; self.transport = transport; self.actions = actions; self.close = close |
| + self.me = me; self.home = home; self.team = team; self.folds = folds; self.transport = transport; self.actions = actions; self.close = close |
| _path = State(initialValue: path) |
| } |
| @@ -193,7 +198,14 @@ public struct AppsSheet: View { |
| } |
| } |
| if let home { |
| - grid(home.launchable) |
| + if !home.launchable.isEmpty { |
| + FoldHeading(title: BaseText.text("native.sidebar.apps"), |
| + label: (BaseText.text("native.sidebar.apps.expanded_a11y"), BaseText.text("native.sidebar.apps.collapsed_a11y")), |
| + count: home.launchable.count, folded: appsFolded, |
| + font: BaseFont.body(13, .semibold, relativeTo: .footnote)) |
| + .frame(minHeight: 32) |
| + if !appsFolded.wrappedValue { grid(home.launchable) } |
| + } |
| yourTeam(TeamChoice.yourTeam(home), p) |
| } |
| } |
| @@ -203,6 +215,11 @@ public struct AppsSheet: View { |
| .background(p[.menuBase]) |
| } |
| + private var appsFolded: Binding<Bool> { |
| + if let folds { return Binding(get: { folds.appsFolded }, set: { folds.appsFolded = $0 }) } |
| + return $localFold |
| + } |
| + |
| /// "Your team": a row each for Store, People and Settings. |
| @ViewBuilder private func yourTeam(_ apps: [HomeData.App], _ p: Palette) -> some View { |
| if !apps.isEmpty { |
diff --git a/native/apple/Sources/BaseKit/Resources/Localizable.xcstrings b/native/apple/Sources/BaseKit/Resources/Localizable.xcstrings| index 79de746..2c990cc 100644 |
| --- a/native/apple/Sources/BaseKit/Resources/Localizable.xcstrings |
| +++ b/native/apple/Sources/BaseKit/Resources/Localizable.xcstrings |
| @@ -1321,6 +1321,30 @@ |
| } |
| } |
| }, |
| + "native.sidebar.apps.collapsed_a11y": { |
| + "comment": "DRAFT 2026-11-28 (slice 2 part 1, for Luna). VoiceOver: the Apps heading while its apps are folded away. A button: it shows them.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Apps, collapsed" |
| + } |
| + } |
| + } |
| + }, |
| + "native.sidebar.apps.expanded_a11y": { |
| + "comment": "DRAFT 2026-11-28 (slice 2 part 1, for Luna). VoiceOver: the sidebar's (and the iPhone apps sheet's) Apps heading while its apps show. A button: it folds them.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Apps, expanded" |
| + } |
| + } |
| + } |
| + }, |
| "native.sidebar.ask": { |
| "comment": "The first row of the sidebar, selected by default: the conversation with the Assistant. A small badge beside it counts jobs that are waiting on the person.", |
| "extractionState": "manual", |
diff --git a/native/apple/Sources/BaseKit/Session/BaseSession.swift b/native/apple/Sources/BaseKit/Session/BaseSession.swift| index cecdb95..ded01a0 100644 |
| --- a/native/apple/Sources/BaseKit/Session/BaseSession.swift |
| +++ b/native/apple/Sources/BaseKit/Session/BaseSession.swift |
| @@ -34,6 +34,8 @@ import RastrilloApple |
| public private(set) var home: HomeData? |
| /// Store and People, natively (slice 2). |
| public private(set) var team: TeamModels? |
| + /// The sidebar's folds, for this account on this device (P5). |
| + public private(set) var folds: SidebarFolds? |
| @ObservationIgnored public private(set) var askSetup: AskSetup? |
| @ObservationIgnored private var transport: SwappableTransport? |
| @@ -146,6 +148,7 @@ import RastrilloApple |
| self.ask = ask |
| askSetup = setup |
| team = TeamModels(store: StoreModel(client: client, baseName: ""), people: PeopleModel(client: client)) |
| + folds = SidebarFolds(defaults: defaults, origin: origin, identity: identity) |
| refreshing = Task { await self.refresh() } |
| } |
| @@ -160,6 +163,7 @@ import RastrilloApple |
| ask?.dispose() |
| team?.end() |
| team = nil |
| + folds = nil |
| ask = nil; askSetup = nil; client = nil; transport = nil; account = nil |
| signedIn = nil; me = nil; home = nil |
| } |
diff --git a/native/apple/Sources/BaseMac/BaseMacApp.swift b/native/apple/Sources/BaseMac/BaseMacApp.swift| index 8dfb2f1..3a766ce 100644 |
| --- a/native/apple/Sources/BaseMac/BaseMacApp.swift |
| +++ b/native/apple/Sources/BaseMac/BaseMacApp.swift |
| @@ -139,7 +139,7 @@ struct MacRoot: View { |
| var body: some View { |
| Group { |
| if let state = session.signedIn { |
| - MacMainView(me: session.me, home: session.home, ask: session.ask, team: session.team, transport: session.iconTransport, |
| + MacMainView(me: session.me, home: session.home, ask: session.ask, team: session.team, folds: session.folds, transport: session.iconTransport, |
| actions: actions, sidebarShown: $sidebarShown) |
| .overlay(alignment: .top) { |
| NativeOfflineBanner(origin: state.origin, message: BaseText.text("native.offline")).padding(.top, 8) |
diff --git a/native/apple/Sources/BasePhone/BasePhoneApp.swift b/native/apple/Sources/BasePhone/BasePhoneApp.swift| index 7fdac07..c908d2c 100644 |
| --- a/native/apple/Sources/BasePhone/BasePhoneApp.swift |
| +++ b/native/apple/Sources/BasePhone/BasePhoneApp.swift |
| @@ -37,7 +37,7 @@ struct PhoneRoot: View { |
| let actions = PhoneActions.make(session: session) |
| Group { |
| if let state = session.signedIn { |
| - PhoneAskScreen(me: session.me, home: session.home, ask: session.ask, team: session.team, transport: session.iconTransport, actions: actions) |
| + PhoneAskScreen(me: session.me, home: session.home, ask: session.ask, team: session.team, folds: session.folds, transport: session.iconTransport, actions: actions) |
| .safeAreaInset(edge: .top, spacing: 0) { |
| NativeOfflineBanner(origin: state.origin, message: BaseText.text("native.offline")) |
| } |
diff --git a/native/apple/Tests/BaseKitTests/SidebarFoldsTests.swift b/native/apple/Tests/BaseKitTests/SidebarFoldsTests.swift| new file mode 100644 |
| index 0000000..adbe6ed |
| --- /dev/null |
| +++ b/native/apple/Tests/BaseKitTests/SidebarFoldsTests.swift |
| @@ -0,0 +1,59 @@ |
| +@testable import BaseKit |
| +import CryptoKit |
| +import Foundation |
| +import XCTest |
| + |
| +/// Task 11 (plan P5): the Apps section folds, remembered per account on |
| +/// this device, never synced. |
| +@MainActor final class SidebarFoldsTests: XCTestCase { |
| + let fennel = URL(string: "https://fennel.base.example")! |
| + let rye = URL(string: "https://rye.base.example")! |
| + |
| + func testItStartsOpen() { |
| + let folds = SidebarFolds(defaults: freshDefaults(), origin: fennel, identity: "id-paul") |
| + XCTAssertFalse(folds.appsFolded) |
| + } |
| + |
| + func testTheSameAccountRemembers() { |
| + let defaults = freshDefaults() |
| + SidebarFolds(defaults: defaults, origin: fennel, identity: "id-paul").appsFolded = true |
| + XCTAssertTrue(SidebarFolds(defaults: defaults, origin: fennel, identity: "id-paul").appsFolded) |
| + } |
| + |
| + func testAnotherAccountOrBaseHasItsOwn() { |
| + let defaults = freshDefaults() |
| + SidebarFolds(defaults: defaults, origin: fennel, identity: "id-paul").appsFolded = true |
| + XCTAssertFalse(SidebarFolds(defaults: defaults, origin: fennel, identity: "id-ana").appsFolded) |
| + XCTAssertFalse(SidebarFolds(defaults: defaults, origin: rye, identity: "id-paul").appsFolded) |
| + } |
| + |
| + func testTheKeyIsTheHashedAccountWithNothingInClear() throws { |
| + let defaults = freshDefaults() |
| + SidebarFolds(defaults: defaults, origin: fennel, identity: "id-paul").appsFolded = true |
| + let digest = SHA256.hash(data: Data((fennel.absoluteString + "\n" + "id-paul").utf8)) |
| + let hex = digest.prefix(16).map { String(format: "%02x", $0) }.joined() |
| + XCTAssertEqual(AccountKey.make(origin: fennel, identity: "id-paul"), hex) |
| + XCTAssertEqual(hex.count, 32) |
| + let keys = defaults.dictionaryRepresentation().keys.filter { $0.hasPrefix("base.fold.") } |
| + XCTAssertEqual(keys, ["base.fold.apps.\(hex)"]) |
| + for key in keys { |
| + XCTAssertFalse(key.contains("fennel") || key.contains("id-paul") || key.contains("@"), key) |
| + } |
| + } |
| + |
| + /// The session's account (from the kit), not /api/v1/me: right before |
| + /// Base answers, and offline. |
| + func testTheSessionHasItsFoldsBeforeMeLoads() { |
| + let defaults = freshDefaults() |
| + let session = BaseSession(oficina: memoryOficina(), defaults: defaults) |
| + session.begin(identity: "id-paul", origin: fennel, transport: GatedTransport()) |
| + XCTAssertNil(session.me) |
| + let folds = try! XCTUnwrap(session.folds) |
| + folds.appsFolded = true |
| + session.end() |
| + XCTAssertNil(session.folds) |
| + session.begin(identity: "id-paul", origin: fennel, transport: GatedTransport()) |
| + XCTAssertTrue(session.folds?.appsFolded ?? false) |
| + session.end() |
| + } |
| +} |
diff --git a/native/apple/Tests/BaseSnapshots/MacSnapshots.swift b/native/apple/Tests/BaseSnapshots/MacSnapshots.swift| index 9475dd5..5d44021 100644 |
| --- a/native/apple/Tests/BaseSnapshots/MacSnapshots.swift |
| +++ b/native/apple/Tests/BaseSnapshots/MacSnapshots.swift |
| @@ -32,6 +32,11 @@ final class MacSnapshots: XCTestCase { |
| MacMainView(me: HomeFixtures.me, home: HomeFixtures.home, ask: AskFixtures.thread(), team: TeamFixtures.team(), transport: nil, |
| actions: .none, sidebarShown: .constant(true), pane: .people).skyFrozen() |
| }, |
| + // Task 11: the Apps section folded, with its count. |
| + SnapshotScreen("window-apps-folded", mac: .fixed(width: 1280, height: 800), iphone: nil) { |
| + MacMainView(me: HomeFixtures.me, home: HomeFixtures.home, ask: AskFixtures.thread(), team: TeamFixtures.team(), |
| + folds: HomeFixtures.folded(), transport: nil, actions: .none, sidebarShown: .constant(true)).skyFrozen() |
| + }, |
| SnapshotScreen("menubar", mac: .fixed(width: 410, height: 560), iphone: nil) { |
| MenuPanel(me: HomeFixtures.me, ask: AskFixtures.thread(), shortcut: "⌃Space", openBase: {}, actions: .none).skyFrozen() |
| }, |
| @@ -59,6 +64,14 @@ final class MacSnapshots: XCTestCase { |
| /// Home and the member as the mockups show them: Fennel & Rye's Base. |
| @MainActor enum HomeFixtures { |
| + /// The sidebar's folds with Apps folded, kept nowhere that lasts. |
| + static func folded() -> SidebarFolds { |
| + let folds = SidebarFolds(defaults: UserDefaults(suiteName: "BaseSnapshots.\(UUID().uuidString)")!, |
| + origin: URL(string: "https://fennel.base.example")!, identity: "id-paul") |
| + folds.appsFolded = true |
| + return folds |
| + } |
| + |
| static let me = Me(member: .init(id: "mb1", name: "Paul Campbell", email: "paul@fennel.example", initials: "PC", owner: true), |
| base: .init(name: "Fennel & Rye", slug: "fennel", origin: URL(string: "https://fennel.base.example"), timezone: "Europe/Dublin")) |
| @@ -106,6 +119,10 @@ final class PhoneSnapshots: XCTestCase { |
| SnapshotScreen("apps", mac: nil, iphone: .fixed(width: 402, height: 820)) { |
| AppsSheet(me: HomeFixtures.me, home: HomeFixtures.home, team: TeamFixtures.team(), transport: nil, actions: .none) {}.skyFrozen() |
| }, |
| + SnapshotScreen("apps-folded", mac: nil, iphone: .fixed(width: 402, height: 820)) { |
| + AppsSheet(me: HomeFixtures.me, home: HomeFixtures.home, team: TeamFixtures.team(), folds: HomeFixtures.folded(), |
| + transport: nil, actions: .none) {}.skyFrozen() |
| + }, |
| SnapshotScreen("job", mac: nil, iphone: .fixed(width: 402, height: 437)) { |
| JobView(job: AskFixtures.job, timeZone: AskFixtures.zone, close: {}, now: SnapshotSettings.now) |
| }, |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-apps-folded-dark-default.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-apps-folded-dark-default.png| new file mode 100644 |
| index 0000000..226cbc8 |
| Binary files /dev/null and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-apps-folded-dark-default.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-apps-folded-light-default.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-apps-folded-light-default.png| new file mode 100644 |
| index 0000000..2094d28 |
| Binary files /dev/null and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-apps-folded-light-default.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-dark-default.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-dark-default.png| index cdb124f..2f35474 100644 |
| Binary files a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-dark-default.png and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-dark-default.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-light-default.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-light-default.png| index 9dcdadf..2c54aca 100644 |
| Binary files a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-light-default.png and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-light-default.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-people-dark-default.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-people-dark-default.png| index 7f27e14..4a8a4f3 100644 |
| Binary files a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-people-dark-default.png and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-people-dark-default.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-people-light-default.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-people-light-default.png| index 130c50a..affdff7 100644 |
| Binary files a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-people-light-default.png and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-people-light-default.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-store-dark-default.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-store-dark-default.png| index f832f0b..97f7edf 100644 |
| Binary files a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-store-dark-default.png and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-store-dark-default.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-store-light-default.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-store-light-default.png| index 0d5823d..da92efa 100644 |
| Binary files a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-store-light-default.png and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-mac/mac/window-store-light-default.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-dark-ax3.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-dark-ax3.png| index 5feb2d0..00489d3 100644 |
| Binary files a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-dark-ax3.png and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-dark-ax3.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-dark-default.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-dark-default.png| index 109fbd4..c5fb557 100644 |
| Binary files a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-dark-default.png and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-dark-default.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-dark-ax3.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-dark-ax3.png| new file mode 100644 |
| index 0000000..6f896c2 |
| Binary files /dev/null and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-dark-ax3.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-dark-default.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-dark-default.png| new file mode 100644 |
| index 0000000..59eb844 |
| Binary files /dev/null and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-dark-default.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-light-ax3.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-light-ax3.png| new file mode 100644 |
| index 0000000..1acbecd |
| Binary files /dev/null and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-light-ax3.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-light-default.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-light-default.png| new file mode 100644 |
| index 0000000..156ff0d |
| Binary files /dev/null and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-folded-light-default.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-light-ax3.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-light-ax3.png| index c622605..ec5ee87 100644 |
| Binary files a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-light-ax3.png and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-light-ax3.png differ |
diff --git a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-light-default.png b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-light-default.png| index 6ebfff9..e57f9ef 100644 |
| Binary files a/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-light-default.png and b/native/apple/Tests/BaseSnapshots/__Snapshots__/base-phone/iphone/apps-light-default.png differ |