From 2ebec7801c82ee85c8e4032570c03c4b101c1030 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Sun, 12 Jul 2020 15:03:43 -0500 Subject: [PATCH] Fix read filter accessibility labels (help) --- .../Shared/Sidebar/SidebarToolbarModifier.swift | 2 +- Multiplatform/Shared/Sidebar/SidebarView.swift | 1 + .../Timeline/TimelineToolbarModifier.swift | 16 ++++++++++++---- Multiplatform/Shared/Timeline/TimelineView.swift | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Multiplatform/Shared/Sidebar/SidebarToolbarModifier.swift b/Multiplatform/Shared/Sidebar/SidebarToolbarModifier.swift index 4eb1f3fd0..6ca5f83d7 100644 --- a/Multiplatform/Shared/Sidebar/SidebarToolbarModifier.swift +++ b/Multiplatform/Shared/Sidebar/SidebarToolbarModifier.swift @@ -30,7 +30,7 @@ struct SidebarToolbarModifier: ViewModifier { } else { AppAssets.filterInactiveImage.font(.title3) } - }).help("Filter Read Feeds") + }).help(sidebarModel.isReadFiltered ? "Show Read Feeds" : "Filter Read Feeds") } ToolbarItem(placement: .automatic) { diff --git a/Multiplatform/Shared/Sidebar/SidebarView.swift b/Multiplatform/Shared/Sidebar/SidebarView.swift index 69d533210..80f70c395 100644 --- a/Multiplatform/Shared/Sidebar/SidebarView.swift +++ b/Multiplatform/Shared/Sidebar/SidebarView.swift @@ -35,6 +35,7 @@ struct SidebarView: View { }) .padding(.top, 8).padding(.trailing) .buttonStyle(PlainButtonStyle()) + .help(sidebarModel.isReadFiltered ? "Show Read Feeds" : "Filter Read Feeds") } ZStack { NavigationLink(destination: TimelineContainerView(feeds: sidebarModel.selectedFeeds), isActive: $navigate) { diff --git a/Multiplatform/Shared/Timeline/TimelineToolbarModifier.swift b/Multiplatform/Shared/Timeline/TimelineToolbarModifier.swift index a10271655..741480379 100644 --- a/Multiplatform/Shared/Timeline/TimelineToolbarModifier.swift +++ b/Multiplatform/Shared/Timeline/TimelineToolbarModifier.swift @@ -10,16 +10,24 @@ import SwiftUI struct TimelineToolbarModifier: ViewModifier { + @EnvironmentObject private var timelineModel: TimelineModel + func body(content: Content) -> some View { content .toolbar { #if os(iOS) ToolbarItem(placement: .navigation) { - Button(action: { + Button (action: { + withAnimation { + timelineModel.isReadFiltered.toggle() + } }, label: { - AppAssets.filterInactiveImage - .font(.title3) - }).help("Filter Read Articles") + if timelineModel.isReadFiltered { + AppAssets.filterActiveImage.font(.title3) + } else { + AppAssets.filterInactiveImage.font(.title3) + } + }).help(timelineModel.isReadFiltered ? "Show Read Articles" : "Filter Read Articles") } ToolbarItem { diff --git a/Multiplatform/Shared/Timeline/TimelineView.swift b/Multiplatform/Shared/Timeline/TimelineView.swift index 22abe3b71..d08de5580 100644 --- a/Multiplatform/Shared/Timeline/TimelineView.swift +++ b/Multiplatform/Shared/Timeline/TimelineView.swift @@ -31,6 +31,7 @@ struct TimelineView: View { }) .padding(.top, 8).padding(.trailing) .buttonStyle(PlainButtonStyle()) + .help(timelineModel.isReadFiltered ? "Show Read Articles" : "Filter Read Articles") } ZStack { NavigationLink(destination: ArticleContainerView(articles: timelineModel.selectedArticles), isActive: $navigate) {