Improve edit list account removal animation

This commit is contained in:
Shadowfacts 2024-04-01 11:02:33 -04:00
parent f79c2feea6
commit 1a2fa10708
1 changed files with 9 additions and 1 deletions

View File

@ -298,7 +298,15 @@ class EditListAccountsViewController: UIViewController, CollectionViewController
do { do {
let request = List.remove(list.id, accounts: [id]) let request = List.remove(list.id, accounts: [id])
_ = try await mastodonController.run(request) _ = try await mastodonController.run(request)
await self.loadAccounts()
var snapshot = dataSource.snapshot()
if snapshot.itemIdentifiers.contains(.account(id: id)) {
snapshot.deleteItems([.account(id: id)])
await MainActor.run {
dataSource.apply(snapshot)
}
}
} catch { } catch {
let config = ToastConfiguration(from: error, with: "Error Removing Account", in: self) { [unowned self] toast in let config = ToastConfiguration(from: error, with: "Error Removing Account", in: self) { [unowned self] toast in
toast.dismissToast(animated: true) toast.dismissToast(animated: true)