From d9b166339dfe9a035fb5d6b6b43cb29f19a4fd56 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Tue, 31 Jan 2023 08:16:36 +0100 Subject: [PATCH] Fixes for iPad layout --- .../Sources/Account/AccountDetailView.swift | 1 - .../List/ConversationsListView.swift | 1 - .../Sources/DesignSystem/DesignSystem.swift | 2 +- .../DesignSystem/Views/ErrorView.swift | 42 ++++++++++--------- .../Status/List/StatusesListView.swift | 1 + .../Sources/Timeline/TimelineViewModel.swift | 2 +- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/Packages/Account/Sources/Account/AccountDetailView.swift b/Packages/Account/Sources/Account/AccountDetailView.swift index 041ba398..3ee533c5 100644 --- a/Packages/Account/Sources/Account/AccountDetailView.swift +++ b/Packages/Account/Sources/Account/AccountDetailView.swift @@ -76,7 +76,6 @@ public struct AccountDetailView: View { listsListView } } - .frame(maxWidth: .maxColumnWidth) } .scrollContentBackground(.hidden) .background(theme.primaryBackgroundColor) diff --git a/Packages/Conversations/Sources/Conversations/List/ConversationsListView.swift b/Packages/Conversations/Sources/Conversations/List/ConversationsListView.swift index 7be178d1..34dad745 100644 --- a/Packages/Conversations/Sources/Conversations/List/ConversationsListView.swift +++ b/Packages/Conversations/Sources/Conversations/List/ConversationsListView.swift @@ -67,7 +67,6 @@ public struct ConversationsListView: View { } } } - .frame(maxWidth: .maxColumnWidth) } .padding(.top, .layoutPadding) } diff --git a/Packages/DesignSystem/Sources/DesignSystem/DesignSystem.swift b/Packages/DesignSystem/Sources/DesignSystem/DesignSystem.swift index b1730843..e05dfefd 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/DesignSystem.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/DesignSystem.swift @@ -1,7 +1,7 @@ import Foundation public extension CGFloat { - static let layoutPadding: CGFloat = 20 + static var layoutPadding: CGFloat = 20 static let dividerPadding: CGFloat = 2 static let statusColumnsSpacing: CGFloat = 8 static let maxColumnWidth: CGFloat = 650 diff --git a/Packages/DesignSystem/Sources/DesignSystem/Views/ErrorView.swift b/Packages/DesignSystem/Sources/DesignSystem/Views/ErrorView.swift index dda94c3a..2394a75d 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/Views/ErrorView.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/Views/ErrorView.swift @@ -14,27 +14,31 @@ public struct ErrorView: View { } public var body: some View { - VStack { - Image(systemName: "exclamationmark.triangle.fill") - .resizable() - .aspectRatio(contentMode: .fit) - .frame(maxHeight: 50) - Text(title) - .font(.scaledTitle) + HStack { + Spacer() + VStack { + Image(systemName: "exclamationmark.triangle.fill") + .resizable() + .aspectRatio(contentMode: .fit) + .frame(maxHeight: 50) + Text(title) + .font(.scaledTitle) + .padding(.top, 16) + Text(message) + .font(.scaledSubheadline) + .multilineTextAlignment(.center) + .foregroundColor(.gray) + Button { + onButtonPress() + } label: { + Text(buttonTitle) + } + .buttonStyle(.bordered) .padding(.top, 16) - Text(message) - .font(.scaledSubheadline) - .multilineTextAlignment(.center) - .foregroundColor(.gray) - Button { - onButtonPress() - } label: { - Text(buttonTitle) } - .buttonStyle(.bordered) - .padding(.top, 16) + .padding(.top, 100) + .padding(.layoutPadding) + Spacer() } - .padding(.top, 100) - .padding(.layoutPadding) } } diff --git a/Packages/Status/Sources/Status/List/StatusesListView.swift b/Packages/Status/Sources/Status/List/StatusesListView.swift index cfaa3803..1a228b98 100644 --- a/Packages/Status/Sources/Status/List/StatusesListView.swift +++ b/Packages/Status/Sources/Status/List/StatusesListView.swift @@ -42,6 +42,7 @@ public struct StatusesListView: View where Fetcher: StatusesFetcher { } } .listRowBackground(theme.primaryBackgroundColor) + .listRowSeparator(.hidden) case let .display(statuses, nextPageState): ForEach(statuses, id: \.viewId) { status in diff --git a/Packages/Timeline/Sources/Timeline/TimelineViewModel.swift b/Packages/Timeline/Sources/Timeline/TimelineViewModel.swift index 757ba731..cffa6734 100644 --- a/Packages/Timeline/Sources/Timeline/TimelineViewModel.swift +++ b/Packages/Timeline/Sources/Timeline/TimelineViewModel.swift @@ -61,7 +61,7 @@ class TimelineViewModel: ObservableObject, StatusesFetcher { pendingStatusesObserver?.pendingStatuses = [] statusesState = .loading statuses = try await client.get(endpoint: timeline.endpoint(sinceId: nil, - maxId: nil, + maxId: "109762933377057565", minId: nil, offset: statuses.count)) withAnimation {