From 8acc78db7b2b0725f46696d3809eab85a12bca16 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 21 Dec 2023 13:44:11 +0800 Subject: [PATCH] Fix ipad toolbar items, resize toasts on ipad --- .../App/Views/Home/HomeFeedViewIOS.swift | 92 ++++++++----------- .../Views/Profile/NewsletterEmailsView.swift | 4 +- .../App/Views/Profile/SubscriptionsView.swift | 2 +- .../Views/WebReader/WebReaderContainer.swift | 2 +- 4 files changed, 44 insertions(+), 56 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index 06192da7b..3610c702b 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -163,59 +163,9 @@ struct AnimatingCellHeight: AnimatableModifier { .navigationBarTitleDisplayMode(.inline) } - var trailingItems: some ToolbarContent { - Group { - ToolbarItem(placement: .barTrailing) { - if prefersListLayout { - Button( - action: { isEditMode = isEditMode == .active ? .inactive : .active }, - label: { - Image.selectMultiple - .foregroundColor(Color.appGrayTextContrast) - } - ) - } - } - ToolbarItem(placement: UIDevice.isIPhone ? .barLeading : .barTrailing) { - if enableGrid { - Button( - action: { prefersListLayout.toggle() }, - label: { - Label("Toggle Feed Layout", systemImage: prefersListLayout ? "square.grid.2x2" : "list.bullet") - } - ) - } - } - ToolbarItem(placement: .barTrailing) { - Button( - action: { - if viewModel.folder == "inbox" { - showAddLinkView = true - } else if viewModel.folder == "following" { - showAddFeedView = true - } - }, - label: { - Image.addLink - .foregroundColor(Color.appGrayTextContrast) - } - ) - } - ToolbarItem(placement: .barTrailing) { - Button( - action: { searchPresented = true }, - label: { - Image.magnifyingGlass - .foregroundColor(Color.appGrayTextContrast) - } - ) - } - } - } - var toolbarItems: some ToolbarContent { Group { - ToolbarItem(placement: .barLeading) { + ToolbarItemGroup(placement: .barLeading) { if UIDevice.isIPhone || horizontalSizeClass != .compact { VStack(alignment: .leading) { let showDate = isListScrolled && !listTitle.isEmpty @@ -233,7 +183,45 @@ struct AnimatingCellHeight: AnimatableModifier { } } - trailingItems + ToolbarItemGroup(placement: .barTrailing) { + if prefersListLayout { + Button( + action: { isEditMode = isEditMode == .active ? .inactive : .active }, + label: { + Image.selectMultiple + .foregroundColor(Color.appGrayTextContrast) + } + ) + } + if enableGrid { + Button( + action: { prefersListLayout.toggle() }, + label: { + Label("Toggle Feed Layout", systemImage: prefersListLayout ? "square.grid.2x2" : "list.bullet") + } + ) + } + Button( + action: { + if viewModel.folder == "inbox" { + showAddLinkView = true + } else if viewModel.folder == "following" { + showAddFeedView = true + } + }, + label: { + Image.addLink + .foregroundColor(Color.appGrayTextContrast) + } + ) + Button( + action: { searchPresented = true }, + label: { + Image.magnifyingGlass + .foregroundColor(Color.appGrayTextContrast) + } + ) + } ToolbarItemGroup(placement: .bottomBar) { if isEditMode == .active { diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/NewsletterEmailsView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/NewsletterEmailsView.swift index 58293ec17..f9abe596f 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/NewsletterEmailsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/NewsletterEmailsView.swift @@ -194,7 +194,7 @@ struct MessageToast: View { } .padding(10) .frame(minHeight: 50) - .frame(maxWidth: .infinity) + .frame(maxWidth: 380) .background(Color(hex: "2A2A2A")) .cornerRadius(4.0) .tint(Color.green) @@ -228,7 +228,7 @@ struct NewsletterOperationToast: View { } .padding(10) .frame(minHeight: 50) - .frame(maxWidth: .infinity) + .frame(maxWidth: 380) .background(Color(hex: "2A2A2A")) .cornerRadius(4.0) .tint(Color.green) diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/SubscriptionsView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/SubscriptionsView.swift index 49158e24d..62267165f 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/SubscriptionsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/SubscriptionsView.swift @@ -175,7 +175,7 @@ struct OperationToast: View { } .padding(10) .frame(minHeight: 50) - .frame(maxWidth: .infinity) + .frame(maxWidth: 380) .background(Color(hex: "2A2A2A")) .cornerRadius(4.0) .tint(Color.green) diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift index 6fa9859c4..5497f094e 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift @@ -721,7 +721,7 @@ struct ReaderOperationToast: View { } .padding(10) .frame(minHeight: 50) - .frame(maxWidth: .infinity) + .frame(maxWidth: 380) .background(Color(hex: "2A2A2A")) .cornerRadius(4.0) .tint(Color.green)