Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

iOS shell: settings on demand, a library-only upright layout

v0lumehi760f8ea0b46b
diff --git a/frontend-ios/README.md b/frontend-ios/README.md
index b0dcef02..ccdb3448 100644
--- a/frontend-ios/README.md
+++ b/frontend-ios/README.md
@@ -49,11 +49,11 @@ Only the available size decides, never the device model, idiom or orientation (`
| Size | Layout |
| --- | --- |
-| Compact, taller than wide (iPhone portrait, a folded foldable, Split View) | One column: the chosen game's banner edge to edge at the top, flowing into its blurred colour where the title sits, a row of wide cards, recently played, Play and settings at the bottom for the thumb. Settings push over the library. |
-| Regular width and height, not wide (iPad portrait, an unfolded foldable held like a book) | Two panes: the same library with a grid of wide cards and Play in the hero, settings inline beside it. |
-| Wider than tall (iPhone and iPad landscape, an unfolded foldable on its side) | Cover Flow over the blurred banner, wide cards in a calm deck. Settings open as a panel on the right (regular) or over the library (compact). |
+| Compact, taller than wide (iPhone portrait, a folded foldable, Split View) | One column: the chosen game's banner edge to edge at the top, flowing into its blurred colour where the title sits, a row of wide cards, recently played, Play and the settings button at the bottom for the thumb. Settings, when asked for, take the whole screen. |
+| Regular width and height, not wide (iPad portrait, an unfolded foldable held like a book) | The library alone: the same hero with Play and the settings button in it, a grid of wide cards, recently played. Settings, when asked for, float in as a panel from the right over the dimmed library. |
+| Wider than tall (iPhone and iPad landscape, an unfolded foldable on its side) | Cover Flow over the blurred banner, wide cards in a calm deck. Settings, when asked for, float in as the same panel (regular) or take the whole screen (compact). |
-The settings pane is one view in one place for every layout, so the selected game, open settings and both scroll positions survive a fold, a rotation or a Stage Manager resize.
+Settings appear only when asked for (the settings button, X on a controller) and close with Back, B or a tap outside. They are one view in one place for every layout, with the game's banner as their header, so the selected game, open settings and both scroll positions survive a fold, a rotation or a Stage Manager resize.
Controller first: the D-pad and stick move a cream focus ring, A activates, B backs out, X opens settings, Y opens controllers. In Cover Flow, left and right move the carousel by one card and the focused card is always the middle one. Keyboard arrows, Return and Escape take the same path. Touch and pointer use ordinary controls.
diff --git a/frontend-ios/Sources/ShellUI/GameDetailView.swift b/frontend-ios/Sources/ShellUI/GameDetailView.swift
index 2fa54bb7..1d7e50bc 100644
--- a/frontend-ios/Sources/ShellUI/GameDetailView.swift
+++ b/frontend-ios/Sources/ShellUI/GameDetailView.swift
@@ -17,7 +17,7 @@ public struct GameDetailView: View {
}
public var body: some View {
VStack(alignment: .leading, spacing: 30) {
- if showsHeader { header }
+ if showsHeader || showsPrimaryAction { header }
ForEach(detail.sections) { section in
group(section.title) {
ForEach(section.rows) { row in
@@ -68,6 +68,7 @@ public struct GameDetailView: View {
private var header: some View {
VStack(alignment: .leading, spacing: 16) {
+ if showsHeader {
HStack(alignment: .center, spacing: 16) {
CoverView(game: detail.game, radius: 8).frame(width: 112, height: 63)
VStack(alignment: .leading, spacing: 6) {
@@ -80,6 +81,7 @@ public struct GameDetailView: View {
}
}
}
+ }
if showsPrimaryAction {
if !detail.game.state.explanation.isEmpty {
Text(detail.game.state.explanation).shellText(14).foregroundStyle(.white.opacity(0.72))
diff --git a/frontend-ios/Sources/ShellUI/LibraryView.swift b/frontend-ios/Sources/ShellUI/LibraryView.swift
index bfc95dbc..6cb5beba 100644
--- a/frontend-ios/Sources/ShellUI/LibraryView.swift
+++ b/frontend-ios/Sources/ShellUI/LibraryView.swift
@@ -3,27 +3,29 @@ import SwiftUI
/// How the library arranges itself. Only the available size decides, never the device model or orientation,
/// so a Stage Manager window, Split View and a foldable opening while the app runs all follow the same rules.
enum ShellLayout: Equatable {
- /// Compact and taller than wide: one column, settings pushed over the library.
+ /// Compact and taller than wide: one column, settings over the whole library when asked for.
case column
- /// Regular width and height, not wide: the library beside the settings pane.
- case split
- /// Wider than tall: Cover Flow. Settings open as a panel on the right (regular) or over the library (compact).
+ /// Regular width and height, not wide: the library alone with a grid of cards, settings as a panel when asked for.
+ case grid
+ /// Wider than tall: Cover Flow. Settings as a panel on the right (regular) or over the whole library (compact).
case coverFlow(regular: Bool)
static func resolve(_ size: CGSize, accessibilityText: Bool) -> ShellLayout {
let regular = size.width >= 600 && size.height >= 500
if size.width > size.height * 1.2 { return .coverFlow(regular: regular) }
- return regular && !accessibilityText ? .split : .column
+ return regular && !accessibilityText ? .grid : .column
}
- /// The settings pane's width: the whole width where it covers the library.
+ /// The settings panel's width: the whole width where it covers the library, else a panel that leaves the
+ /// library in view beside it.
func paneWidth(_ width: CGFloat) -> CGFloat {
switch self {
case .column, .coverFlow(regular: false): width
- case .split: min(460, max(320, width * 0.46))
- case .coverFlow(regular: true): min(520, max(380, width * 0.42))
+ case .grid, .coverFlow(regular: true): min(500, max(380, width * 0.5))
}
}
+ /// Whether the settings float as a panel over a dimmed library, rather than replacing it.
+ var settingsFloat: Bool { self == .grid || self == .coverFlow(regular: true) }
var isCoverFlow: Bool { if case .coverFlow = self { true } else { false } }
}
@@ -68,10 +70,11 @@ public struct LibraryView: View {
let layout = ShellLayout.resolve(whole, accessibilityText: typeSize.isAccessibilitySize)
let width = geometry.size.width
let pane = layout.paneWidth(width)
- let paneShown = layout == .split || settingsOpen
- // Where the pane is as wide as the screen, the library underneath steps out of the way.
- let paneCovers = settingsOpen && pane >= width
- let panelOverLibrary = settingsOpen && layout == .coverFlow(regular: true)
+ // Settings only when asked for. A panel floats over the dimmed library where there is room, otherwise the
+ // settings take the whole screen and the library steps out of the way.
+ let floating = layout.settingsFloat
+ let paneCovers = settingsOpen && !floating
+ let panelOverLibrary = settingsOpen && floating
ZStack(alignment: .topLeading) {
if layout.isCoverFlow, let selected { CoverFlowBackdrop(game: selected.game) } else { ShellPalette.background.ignoresSafeArea() }
if games.isEmpty {
@@ -80,37 +83,41 @@ public struct LibraryView: View {
ControllerChip(count: controllers.count, action: openControllers).padding(.top, 6).padding(.trailing, 16)
}
} else if let selected {
- library(selected, layout: layout,
- size: CGSize(width: layout == .split ? width - pane : width, height: geometry.size.height),
- topInset: insets.top)
- .frame(width: layout == .split ? width - pane : width, height: geometry.size.height)
+ library(selected, layout: layout, size: geometry.size, topInset: insets.top)
+ .frame(width: width, height: geometry.size.height)
.opacity(paneCovers ? 0 : 1)
- .allowsHitTesting(!paneCovers && !panelOverLibrary)
- .accessibilityHidden(paneCovers || panelOverLibrary)
- .transformPreference(FocusTargets.self) { if paneCovers || panelOverLibrary { $0.removeAll() } }
+ .allowsHitTesting(!settingsOpen)
+ .accessibilityHidden(settingsOpen)
+ .transformPreference(FocusTargets.self) { if settingsOpen { $0.removeAll() } }
if panelOverLibrary {
- Color.black.opacity(0.45).ignoresSafeArea()
+ Color.black.opacity(0.5).ignoresSafeArea()
.onTapGesture { closeSettings() }
.accessibilityHidden(true)
.transition(.opacity)
}
- // One settings pane in one place for every layout, so its scroll position and focus survive
+ // One settings view in one place for every layout, so its state, scroll position and focus survive
// a fold, a rotation or a Stage Manager resize.
- settingsPane(selected, layout: layout)
- .frame(width: pane, height: geometry.size.height)
+ settingsPane(selected, floating: floating, width: pane - (floating ? 24 : 0))
+ .frame(width: pane - (floating ? 24 : 0))
+ .frame(maxHeight: .infinity)
.background {
- (paneCovers ? ShellPalette.background : Color(red: 0.075, green: 0.075, blue: 0.082))
- .ignoresSafeArea()
- .overlay(alignment: .leading) {
- if !paneCovers { Rectangle().fill(ShellPalette.hairline).frame(width: 1).ignoresSafeArea() }
- }
+ if floating {
+ RoundedRectangle(cornerRadius: 26).fill(Color(red: 0.075, green: 0.075, blue: 0.082))
+ .overlay(RoundedRectangle(cornerRadius: 26).strokeBorder(.white.opacity(0.10)))
+ } else {
+ ShellPalette.background.ignoresSafeArea()
+ }
}
- .offset(x: paneShown ? 0 : pane + 24)
- .opacity(paneShown ? 1 : 0)
- .frame(maxWidth: .infinity, alignment: .trailing)
- .allowsHitTesting(paneShown)
- .accessibilityHidden(!paneShown)
- .transformPreference(FocusTargets.self) { if !paneShown { $0.removeAll() } }
+ .clipShape(RoundedRectangle(cornerRadius: floating ? 26 : 0))
+ .shadow(color: .black.opacity(floating ? 0.5 : 0), radius: 40, x: -8)
+ .padding(floating ? 12 : 0)
+ .offset(x: settingsOpen ? 0 : pane + 40)
+ .opacity(settingsOpen ? 1 : 0)
+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .trailing)
+ .allowsHitTesting(settingsOpen)
+ .accessibilityHidden(!settingsOpen)
+ .accessibilityAddTraits(settingsOpen ? .isModal : [])
+ .transformPreference(FocusTargets.self) { if !settingsOpen { $0.removeAll() } }
}
if controllersOpen {
Color.black.opacity(0.55).ignoresSafeArea().accessibilityHidden(true)
@@ -159,45 +166,45 @@ public struct LibraryView: View {
select: select, primary: primary, openSettings: openSettings, openControllers: openControllers)
.transition(.opacity)
} else {
- PortraitLibrary(games: games, selected: selected, twoPanes: layout == .split, size: size, topInset: topInset,
+ PortraitLibrary(games: games, selected: selected, wide: layout == .grid, size: size, topInset: topInset,
controllers: controllers.count, select: select, primary: primary,
openSettings: openSettings, openControllers: openControllers, position: $libraryPosition)
.transition(.opacity)
}
}
- private func settingsPane(_ selected: GameDetail, layout: ShellLayout) -> some View {
- let closable = layout != .split
- return VStack(spacing: 0) {
- HStack(spacing: 12) {
- if closable {
- Button(action: closeSettings) {
- if typeSize.isAccessibilitySize { Image(systemName: "chevron.left").frame(minWidth: 24) }
- else { Label(ShellStrings.text("Library"), systemImage: "chevron.left") }
- }
- .buttonStyle(ShellButtonStyle())
- .accessibilityLabel(ShellStrings.text("Library"))
- .accessibilityIdentifier("library.back")
- .shellTarget("set.back", action: closeSettings)
- }
- SectionHeading(title: ShellStrings.text("Game settings"))
- .padding(.leading, closable ? 4 : 0)
- Spacer(minLength: 0)
- }
- .padding(.horizontal, 24).padding(.top, 10).padding(.bottom, 4).frame(minHeight: 56)
- ScrollViewReader { proxy in
- ScrollView {
- GameDetailView(detail: selected, actions: actions, showsPrimaryAction: layout != .split, showsHeader: layout != .split)
- .padding(.horizontal, 24).padding(.top, 12).padding(.bottom, 32)
+ /// The settings for the selected game: its banner as the header, with the title over it and Back on top, then
+ /// the primary action and the setting groups. A panel or the whole screen, the same view.
+ private func settingsPane(_ selected: GameDetail, floating: Bool, width: CGFloat) -> some View {
+ ScrollViewReader { proxy in
+ ScrollView {
+ VStack(alignment: .leading, spacing: 0) {
+ PaneBanner(game: selected.game, width: width).id("set.top")
+ GameDetailView(detail: selected, actions: actions, showsPrimaryAction: true, showsHeader: false)
+ .padding(.horizontal, 24).padding(.top, 18).padding(.bottom, 32)
// A phone on its side: a readable column, not rows stretched across the whole width.
.frame(maxWidth: 640, alignment: .leading)
- .frame(maxWidth: .infinity, alignment: .leading)
}
- .scrollPosition($settingsPosition)
- .scrollIndicators(.hidden)
- .onChange(of: focus.id) { _, id in
- guard let id, id.hasPrefix("set."), id != "set.back" else { return }
- withAnimation(reduceMotion ? nil : .easeOut(duration: 0.18)) { proxy.scrollTo(id, anchor: .center) }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+ .scrollPosition($settingsPosition)
+ .scrollIndicators(.hidden)
+ .ignoresSafeArea(edges: floating ? [] : .top)
+ .overlay(alignment: .topLeading) {
+ Button(action: closeSettings) {
+ if typeSize.isAccessibilitySize { Image(systemName: "chevron.left").frame(minWidth: 24) }
+ else { Label(ShellStrings.text("Library"), systemImage: "chevron.left") }
+ }
+ .buttonStyle(ChipButtonStyle())
+ .accessibilityLabel(ShellStrings.text("Library"))
+ .accessibilityIdentifier("library.back")
+ .shellTarget("set.back", radius: 22, action: closeSettings)
+ .padding(.leading, 16).padding(.top, floating ? 14 : 6)
+ }
+ .onChange(of: focus.id) { _, id in
+ guard let id, id.hasPrefix("set.") else { return }
+ withAnimation(reduceMotion ? nil : .easeOut(duration: 0.18)) {
+ proxy.scrollTo(id == "set.back" ? "set.top" : id, anchor: id == "set.back" ? .top : .center)
}
}
}
@@ -220,11 +227,6 @@ public struct LibraryView: View {
settingsPosition.scrollTo(edge: .top)
}
private func openSettings() {
- if layout == .split {
- // The pane is already there: move into it.
- focus.id = targets.values.first { $0.id.hasPrefix("set.row.") }?.id ?? focus.id
- return
- }
settingsOpen = true
focus.id = "set.back"
}
@@ -235,8 +237,7 @@ public struct LibraryView: View {
private func openControllers() { controllersOpen = true; focus.id = "ctl.close" }
private func back() {
if controllersOpen { controllersOpen = false; focus.id = "lib.controllers" }
- else if settingsOpen && layout != .split { closeSettings() }
- else if let id = focus.id, id.hasPrefix("set.") { focus.id = selected.map { "lib.tile.\($0.id)" } }
+ else if settingsOpen { closeSettings() }
else { actions.onBack() }
}
private func handle(_ action: ShellInput.Action) {
@@ -271,7 +272,41 @@ public struct LibraryView: View {
}
private var defaultFocus: String? {
if controllersOpen { return "ctl.close" }
- if settingsOpen && layout != .split { return "set.back" }
+ if settingsOpen { return "set.back" }
return selected.map { "lib.tile.\($0.id)" } ?? "lib.controllers"
}
}
+
+/// The top of the settings: the game's banner, whole and fading into the panel, then its state and title below it,
+/// so the banner's own logo and the title never overlap. Capped in height for a phone on its side.
+private struct PaneBanner: View {
+ let game: GameTile
+ let width: CGFloat
+ var body: some View {
+ let bannerHeight = min(width * 9 / 16, 220)
+ VStack(alignment: .leading, spacing: 8) {
+ StatusLabel(state: game.state, prominent: true)
+ Text(game.title).shellText(26, .heavy, relativeTo: .title).tracking(-0.7)
+ .fixedSize(horizontal: false, vertical: true)
+ .accessibilityAddTraits(.isHeader).accessibilityIdentifier("detail.title")
+ HStack(spacing: 8) {
+ SectionHeading(title: ShellStrings.text("Game settings"))
+ if !game.subtitle.isEmpty {
+ Text(game.subtitle).shellText(12.5).foregroundStyle(.white.opacity(0.5))
+ }
+ }.padding(.top, 2)
+ }
+ .padding(.horizontal, 24)
+ .padding(.top, bannerHeight - 22)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .background(alignment: .top) {
+ ArtView(game: game, lettering: false)
+ .frame(width: width, height: bannerHeight)
+ .mask {
+ LinearGradient(stops: [.init(color: .black, location: 0), .init(color: .black, location: 0.55),
+ .init(color: .clear, location: 1)], startPoint: .top, endPoint: .bottom)
+ }
+ .accessibilityHidden(true)
+ }
+ }
+}
diff --git a/frontend-ios/Sources/ShellUI/PortraitLibrary.swift b/frontend-ios/Sources/ShellUI/PortraitLibrary.swift
index 655fa8f1..de635bdf 100644
--- a/frontend-ios/Sources/ShellUI/PortraitLibrary.swift
+++ b/frontend-ios/Sources/ShellUI/PortraitLibrary.swift
@@ -1,12 +1,13 @@
import SwiftUI
-/// The library when it is taller than it is wide: the chosen game's art as a full-bleed hero with the title over it,
+/// The library when it is taller than it is wide: the chosen game's banner as the hero with the title under it,
/// then the collection, then recently played. In one column the primary action sits at the bottom for the thumb.
-/// Beside the settings pane (two panes) the collection becomes a grid and Play moves into the hero.
+/// With regular width (an iPad or an unfolded foldable held upright) the collection becomes a grid of wide cards and
+/// Play and the settings button move into the hero. Settings themselves only appear when asked for.
struct PortraitLibrary: View {
let games: [GameDetail]
let selected: GameDetail
- let twoPanes: Bool
+ let wide: Bool
let size: CGSize
let topInset: CGFloat
let controllers: Int
@@ -39,16 +40,18 @@ struct PortraitLibrary: View {
ScrollView {
VStack(alignment: .leading, spacing: 0) {
HeroView(game: selected.game, width: size.width, topInset: topInset,
- titleSize: twoPanes ? 34 : short ? 26 : 32) {
- if twoPanes {
- Button { primary(selected) } label: {
- Label(selected.game.state.actionTitle, systemImage: selected.game.state.actionSymbol)
- }
- .buttonStyle(PrimaryPillStyle())
- .accessibilityLabel(selected.game.state.actionTitle + ", " + selected.game.title)
- .accessibilityIdentifier("state.action")
- .shellTarget("lib.play", radius: 25) { primary(selected) }
- .padding(.top, 8)
+ titleSize: wide ? 34 : short ? 26 : 32) {
+ if wide {
+ HStack(spacing: 12) {
+ Button { primary(selected) } label: {
+ Label(selected.game.state.actionTitle, systemImage: selected.game.state.actionSymbol)
+ }
+ .buttonStyle(PrimaryPillStyle())
+ .accessibilityLabel(selected.game.state.actionTitle + ", " + selected.game.title)
+ .accessibilityIdentifier("state.action")
+ .shellTarget("lib.play", radius: 25) { primary(selected) }
+ settingsButton
+ }.padding(.top, 8)
}
}
collection.padding(.top, short ? 6 : 14)
@@ -58,7 +61,7 @@ struct PortraitLibrary: View {
.scrollPosition($position)
.scrollIndicators(.hidden)
.ignoresSafeArea(edges: .top)
- .safeAreaInset(edge: .bottom, spacing: 0) { if !twoPanes { bottomBar } }
+ .safeAreaInset(edge: .bottom, spacing: 0) { if !wide { bottomBar } }
.overlay(alignment: .topTrailing) {
ControllerChip(count: controllers, action: openControllers).padding(.top, 6).padding(.trailing, 16)
}
@@ -73,8 +76,8 @@ struct PortraitLibrary: View {
private var collection: some View {
VStack(alignment: .leading, spacing: 14) {
SectionHeading(title: ShellStrings.text("Your games"), trailing: "\(games.count)").padding(.horizontal, 24)
- if twoPanes {
- LazyVGrid(columns: [GridItem(.adaptive(minimum: 170, maximum: 260), spacing: 18, alignment: .top)],
+ if wide {
+ LazyVGrid(columns: [GridItem(.adaptive(minimum: 210, maximum: 320), spacing: 22, alignment: .top)],
alignment: .leading, spacing: 24) {
ForEach(games) { tile($0) }
}.padding(.horizontal, 24)
@@ -148,6 +151,14 @@ struct PortraitLibrary: View {
}
}
+ private var settingsButton: some View {
+ Button(action: openSettings) { Image(systemName: "slider.horizontal.3") }
+ .buttonStyle(RoundIconButtonStyle())
+ .accessibilityLabel(ShellStrings.text("Game settings"))
+ .accessibilityIdentifier("settings.open")
+ .shellTarget("lib.settings", radius: 25, action: openSettings)
+ }
+
private var bottomBar: some View {
HStack(spacing: 12) {
Button { primary(selected) } label: {
@@ -157,11 +168,7 @@ struct PortraitLibrary: View {
.accessibilityLabel(selected.game.state.actionTitle + ", " + selected.game.title)
.accessibilityIdentifier("state.action")
.shellTarget("lib.play", radius: 25) { primary(selected) }
- Button(action: openSettings) { Image(systemName: "slider.horizontal.3") }
- .buttonStyle(RoundIconButtonStyle())
- .accessibilityLabel(ShellStrings.text("Game settings"))
- .accessibilityIdentifier("settings.open")
- .shellTarget("lib.settings", radius: 25, action: openSettings)
+ settingsButton
}
.padding(.horizontal, 24).padding(.top, 22).padding(.bottom, 8)
.background {
diff --git a/frontend-ios/Sources/ShellUI/ShellStyle.swift b/frontend-ios/Sources/ShellUI/ShellStyle.swift
index 5740438a..34c722af 100644
--- a/frontend-ios/Sources/ShellUI/ShellStyle.swift
+++ b/frontend-ios/Sources/ShellUI/ShellStyle.swift
@@ -114,7 +114,12 @@ struct ChipButtonStyle: ButtonStyle {
configuration.label.shellText(13, .semibold, relativeTo: .footnote)
.padding(.horizontal, 14).frame(minHeight: 44)
.foregroundStyle(.white)
- .background(.black.opacity(configuration.isPressed ? 0.55 : 0.38), in: Capsule())
+ // Its own quiet backdrop: a blur and a dark tint, so it stays legible on any art.
+ .background {
+ Capsule().fill(.ultraThinMaterial)
+ .overlay(Capsule().fill(.black.opacity(configuration.isPressed ? 0.62 : 0.5)))
+ }
+ .environment(\.colorScheme, .dark)
.overlay(Capsule().strokeBorder(.white.opacity(0.14)))
.contentShape(Capsule())
}
diff --git a/frontend-ios/Tests/ShellUITests/LayoutTests.swift b/frontend-ios/Tests/ShellUITests/LayoutTests.swift
index 93876687..42a27823 100644
--- a/frontend-ios/Tests/ShellUITests/LayoutTests.swift
+++ b/frontend-ios/Tests/ShellUITests/LayoutTests.swift
@@ -10,7 +10,7 @@ final class LayoutTests: XCTestCase {
XCTAssertEqual(layout(874, 402), .coverFlow(regular: false))
}
func testPad() {
- XCTAssertEqual(layout(834, 1194), .split)
+ XCTAssertEqual(layout(834, 1194), .grid)
XCTAssertEqual(layout(1194, 834), .coverFlow(regular: true))
// Split View and narrow Stage Manager windows are compact.
XCTAssertEqual(layout(507, 834), .column)
@@ -21,21 +21,24 @@ final class LayoutTests: XCTestCase {
func testFoldable() {
XCTAssertEqual(layout(375, 525), .column)
XCTAssertEqual(layout(525, 375), .coverFlow(regular: false))
- XCTAssertEqual(layout(626, 890), .split)
+ XCTAssertEqual(layout(626, 890), .grid)
XCTAssertEqual(layout(890, 626), .coverFlow(regular: true))
- XCTAssertEqual(layout(669, 951), .split)
+ XCTAssertEqual(layout(669, 951), .grid)
XCTAssertEqual(layout(951, 669), .coverFlow(regular: true))
}
- /// A nearly square window keeps two panes. Cover Flow needs clearly more width than height.
+ /// A nearly square window keeps the upright library. Cover Flow needs clearly more width than height.
func testSquareWindowKeepsTwoPanes() {
- XCTAssertEqual(layout(800, 760), .split)
+ XCTAssertEqual(layout(800, 760), .grid)
}
func testAccessibilityTextUsesOneColumn() {
XCTAssertEqual(layout(834, 1194, large: true), .column)
}
func testPaneWidths() {
XCTAssertEqual(ShellLayout.column.paneWidth(402), 402)
- XCTAssertEqual(ShellLayout.split.paneWidth(626), 320)
- XCTAssertEqual(ShellLayout.coverFlow(regular: true).paneWidth(1194), 501.48, accuracy: 0.01)
+ XCTAssertEqual(ShellLayout.grid.paneWidth(626), 380)
+ XCTAssertEqual(ShellLayout.grid.paneWidth(834), 417)
+ XCTAssertEqual(ShellLayout.coverFlow(regular: true).paneWidth(1194), 500)
+ XCTAssertTrue(ShellLayout.grid.settingsFloat)
+ XCTAssertFalse(ShellLayout.column.settingsFloat)
}
}
diff --git a/frontend-ios/UITests/ShellAdditionalTests.swift b/frontend-ios/UITests/ShellAdditionalTests.swift
index d9f3c33a..85ad0169 100644
--- a/frontend-ios/UITests/ShellAdditionalTests.swift
+++ b/frontend-ios/UITests/ShellAdditionalTests.swift
@@ -52,19 +52,19 @@ import XCTest
app.buttons["qa.input.settings"].tap()
let toggle = app.switches["setting.DM_SHOW_FPS"]
XCTAssertTrue(toggle.waitForExistence(timeout: 5))
- // Pushed settings start on Back, then Play and the play mode choice. Beside the library they start on the choice.
- let pushed = app.buttons["library.back"].exists
- for _ in 0..<(pushed ? 3 : 1) { app.buttons["qa.input.down"].tap() }
+ // Settings start on Back, then Play and the play mode choice, then the toggle.
+ XCTAssertTrue(app.buttons["library.back"].exists)
+ for _ in 0..<3 { app.buttons["qa.input.down"].tap() }
app.buttons["qa.input.activate"].tap()
XCTAssertEqual(toggle.value as? String, "1")
app.buttons["qa.input.activate"].tap()
XCTAssertEqual(toggle.value as? String, "0")
capture("controller-toggles-setting")
app.buttons["qa.input.back"].tap()
- if pushed { XCTAssertFalse(app.buttons["library.back"].isHittable) }
+ XCTAssertFalse(app.buttons["library.back"].isHittable)
capture("controller-back-restores-library")
// The one-column row: right walks through every cover, also the ones still off screen.
- guard pushed else { return }
+ guard UIDevice.current.userInterfaceIdiom == .phone else { return }
app.terminate()
app.launch()
XCTAssertTrue(app.buttons["qa.input.right"].waitForExistence(timeout: 10))
@@ -102,10 +102,10 @@ import XCTest
app.scrollViews.element(boundBy: app.scrollViews.count - 1).swipeUp()
capture("folded-settings-scrolled")
app.buttons["qa.fold"].tap()
- // Unfolded: two panes, the hero beside the open settings.
- XCTAssertEqual(app.staticTexts["hero.title"].label, "The Quiet Tide")
+ // Unfolded: the settings stay open, now as a panel over the library.
+ XCTAssertEqual(app.staticTexts["detail.title"].label, "The Quiet Tide")
XCTAssertTrue(toggle.exists)
- XCTAssertFalse(app.buttons["library.back"].exists)
+ XCTAssertTrue(app.buttons["library.back"].exists)
capture("unfolded-settings-scrolled")
app.buttons["qa.fold"].tap()
XCTAssertTrue(app.buttons["library.back"].waitForExistence(timeout: 5))