From 92cf938e99e34fa73627723b5e0831f3dfff655d Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 24 Nov 2022 12:30:56 -0500 Subject: [PATCH] Fix cells not being deselected in account list and status action account list --- .../Screens/Account List/AccountListViewController.swift | 9 ++++++++- .../StatusActionAccountListViewController.swift | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Tusker/Screens/Account List/AccountListViewController.swift b/Tusker/Screens/Account List/AccountListViewController.swift index 8f89e064..053c7b0d 100644 --- a/Tusker/Screens/Account List/AccountListViewController.swift +++ b/Tusker/Screens/Account List/AccountListViewController.swift @@ -57,7 +57,14 @@ class AccountListViewController: UIViewController { snapshot.appendItems(accountIDs) dataSource.apply(snapshot, animatingDifferences: false) } - + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + collectionView.indexPathsForSelectedItems?.forEach { + collectionView.deselectItem(at: $0, animated: true) + } + } } extension AccountListViewController { diff --git a/Tusker/Screens/Status Action Account List/StatusActionAccountListViewController.swift b/Tusker/Screens/Status Action Account List/StatusActionAccountListViewController.swift index bce7dc9c..60e2d432 100644 --- a/Tusker/Screens/Status Action Account List/StatusActionAccountListViewController.swift +++ b/Tusker/Screens/Status Action Account List/StatusActionAccountListViewController.swift @@ -120,6 +120,10 @@ class StatusActionAccountListViewController: UIViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + collectionView.indexPathsForSelectedItems?.forEach { + collectionView.deselectItem(at: $0, animated: true) + } + if accountIDs == nil { Task { await loadAccounts()