Don't reload list timeline if edit screen is closed without making changes
This commit is contained in:
parent
d4b9f71fd3
commit
23e4541eb7
|
@ -12,12 +12,12 @@ import Combine
|
|||
|
||||
class EditListAccountsViewController: EnhancedTableViewController {
|
||||
|
||||
private var list: List
|
||||
let mastodonController: MastodonController
|
||||
|
||||
private var list: List
|
||||
var changedAccounts = false
|
||||
|
||||
var dataSource: DataSource!
|
||||
|
||||
var nextRange: RequestRange?
|
||||
|
||||
var searchResultsController: SearchResultsViewController!
|
||||
|
@ -122,6 +122,7 @@ class EditListAccountsViewController: EnhancedTableViewController {
|
|||
}
|
||||
|
||||
private func addAccount(id: String) async {
|
||||
changedAccounts = true
|
||||
do {
|
||||
let req = List.add(list, accounts: [id])
|
||||
_ = try await mastodonController.run(req)
|
||||
|
@ -137,6 +138,7 @@ class EditListAccountsViewController: EnhancedTableViewController {
|
|||
}
|
||||
|
||||
private func removeAccount(id: String) async {
|
||||
changedAccounts = true
|
||||
do {
|
||||
let request = List.remove(list, accounts: [id])
|
||||
_ = try await mastodonController.run(request)
|
||||
|
|
|
@ -71,12 +71,15 @@ class ListTimelineViewController: TimelineViewController {
|
|||
}
|
||||
|
||||
@objc func editListDoneButtonPressed() {
|
||||
let presented = (presentedViewController as? UINavigationController)?.viewControllers.first as? EditListAccountsViewController
|
||||
|
||||
dismiss(animated: true)
|
||||
|
||||
// TODO: only reload if there were changes
|
||||
Task {
|
||||
applyInitialSnapshot()
|
||||
await controller.loadInitial()
|
||||
if presented?.changedAccounts == true {
|
||||
Task {
|
||||
applyInitialSnapshot()
|
||||
await controller.loadInitial()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue