From cc176134ea5effa4756afd28305f0f0e70ca6870 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Thu, 17 Jun 2021 19:23:41 -0500 Subject: [PATCH] Put in a slight delay to prevent the screen from flashing. Fixes #3038 --- iOS/MasterFeed/MasterFeedViewController.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 0e9a327b0..d374e0798 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -1232,8 +1232,11 @@ private extension MasterFeedViewController { let title = NSString.localizedStringWithFormat(localizedMenuText as NSString, account.nameForDisplay) as String let action = UIAction(title: title, image: AppAssets.markAllAsReadImage) { [weak self] action in MarkAsReadAlertController.confirm(self, coordinator: self?.coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in - if let articles = try? account.fetchArticles(.unread()) { - self?.coordinator.markAllAsRead(Array(articles)) + // If you don't have this delay the screen flashes when it executes this code + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + if let articles = try? account.fetchArticles(.unread()) { + self?.coordinator.markAllAsRead(Array(articles)) + } } } }