From 0d3bdeef8cc84f5a8f3b90d33ee4e90a9eca9dd6 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Fri, 11 Mar 2022 12:08:47 -0800 Subject: [PATCH] store grid/list layout preference in ios user deafults --- apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift | 2 +- apple/OmnivoreKit/Sources/Utils/UserDefaultKeys.swift | 1 + apple/OmnivoreKit/Sources/Views/FeedItem/GridCard.swift | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index a5b8c67ce..764ab3461 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -9,7 +9,7 @@ import Views #if os(iOS) struct HomeFeedContainerView: View { @EnvironmentObject var dataService: DataService - @State private var prefersListLayout = UIDevice.isIPhone + @AppStorage(UserDefaultKey.homeFeedlayoutPreference.rawValue) var prefersListLayout = UIDevice.isIPhone @State private var searchQuery = "" @State private var snoozePresented = false @State private var itemToSnooze: FeedItem? diff --git a/apple/OmnivoreKit/Sources/Utils/UserDefaultKeys.swift b/apple/OmnivoreKit/Sources/Utils/UserDefaultKeys.swift index 94a5dd04a..369dc232c 100644 --- a/apple/OmnivoreKit/Sources/Utils/UserDefaultKeys.swift +++ b/apple/OmnivoreKit/Sources/Utils/UserDefaultKeys.swift @@ -4,4 +4,5 @@ public enum UserDefaultKey: String { case preferredWebFontSize case userHasDeniedPushPrimer case firebasePushToken + case homeFeedlayoutPreference } diff --git a/apple/OmnivoreKit/Sources/Views/FeedItem/GridCard.swift b/apple/OmnivoreKit/Sources/Views/FeedItem/GridCard.swift index 4fcb7bfea..9dfef40a4 100644 --- a/apple/OmnivoreKit/Sources/Views/FeedItem/GridCard.swift +++ b/apple/OmnivoreKit/Sources/Views/FeedItem/GridCard.swift @@ -92,7 +92,7 @@ public struct GridCard: View { Menu( content: { contextMenuView }, - label: { Image.dotsThree } + label: { Image.dotsThree.padding().background(Color.clear) } ) .frame(width: 16, height: 16, alignment: .center) .onTapGesture { isContextMenuOpen = true }