From 9858cc84135a232db6fd76f6e1f46374f02de1d9 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Fri, 20 May 2022 08:49:47 -0700 Subject: [PATCH 1/2] remove guard for loadItems call --- .../OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index 8fb2c0702..bf3f2a1d8 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -94,10 +94,7 @@ private let enableGrid = UIDevice.isIPad || FeatureFlag.enableGridCardsOnPhone .navigationTitle("Home") .navigationBarTitleDisplayMode(.inline) .onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in - // Don't refresh the list if the user is currently reading an article - if viewModel.selectedLinkItem == nil || viewModel.linkRequest == nil { - loadItems(isRefresh: true) - } + loadItems(isRefresh: true) } .onReceive(NotificationCenter.default.publisher(for: Notification.Name("PushJSONArticle"))) { notification in guard let jsonArticle = notification.userInfo?["article"] as? JSONArticle else { return } From 12c2f8ab62b0d359a6cebefc82a3cfb7f354873f Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Fri, 20 May 2022 08:54:16 -0700 Subject: [PATCH 2/2] use task rather than onAppear for loading initial items --- apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index bf3f2a1d8..ee531e593 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -128,7 +128,7 @@ private let enableGrid = UIDevice.isIPad || FeatureFlag.enableGridCardsOnPhone } } } - .onAppear { // TODO: use task instead + .task { if viewModel.items.isEmpty { loadItems(isRefresh: true) }