forked from shadowfacts/Tusker
Only show fav/reblog inaccurate count warning for remote posts
This commit is contained in:
parent
266868376d
commit
2582907919
|
@ -17,8 +17,7 @@ class StatusActionAccountListCollectionViewController: UIViewController, Collect
|
|||
private let actionType: StatusActionAccountListViewController.ActionType
|
||||
private let mastodonController: MastodonController
|
||||
|
||||
/// If `true`, a warning will be shown below the account list describing that the total favs/reblogs may be innacurate.
|
||||
var showInacurateCountWarning = false
|
||||
private var needsInaccurateCountWarning = false
|
||||
|
||||
var collectionView: UICollectionView! {
|
||||
view as? UICollectionView
|
||||
|
@ -64,7 +63,7 @@ class StatusActionAccountListCollectionViewController: UIViewController, Collect
|
|||
switch dataSource.sectionIdentifier(for: sectionIndex)! {
|
||||
case .status:
|
||||
var config = UICollectionLayoutListConfiguration(appearance: .grouped)
|
||||
config.footerMode = self.showInacurateCountWarning ? .supplementary : .none
|
||||
config.footerMode = self.needsInaccurateCountWarning ? .supplementary : .none
|
||||
config.backgroundColor = .appGroupedBackground
|
||||
config.leadingSwipeActionsConfigurationProvider = { [unowned self] in
|
||||
(collectionView.cellForItem(at: $0) as? TimelineStatusCollectionViewCell)?.leadingSwipeActions()
|
||||
|
@ -149,9 +148,11 @@ class StatusActionAccountListCollectionViewController: UIViewController, Collect
|
|||
}
|
||||
}
|
||||
|
||||
func addStatus(_ status: StatusMO, state: CollapseState) {
|
||||
func addStatus(_ status: StatusMO, state: CollapseState, showInaccurateCountWarning: Bool) {
|
||||
loadViewIfNeeded()
|
||||
|
||||
needsInaccurateCountWarning = showInaccurateCountWarning && status.url?.host != mastodonController.instanceURL.host
|
||||
|
||||
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
|
||||
snapshot.appendSections([.status, .accounts])
|
||||
snapshot.appendItems([.status(status.id, state)], toSection: .status)
|
||||
|
|
|
@ -18,13 +18,7 @@ class StatusActionAccountListViewController: UIViewController {
|
|||
private var accountIDs: [String]?
|
||||
|
||||
/// If `true`, a warning will be shown below the account list describing that the total favs/reblogs may be innacurate.
|
||||
var showInacurateCountWarning = false {
|
||||
didSet {
|
||||
if case .displaying(let vc) = state {
|
||||
vc.showInacurateCountWarning = showInacurateCountWarning
|
||||
}
|
||||
}
|
||||
}
|
||||
var showInaccurateCountWarning = false
|
||||
|
||||
private var state: State = .unloaded {
|
||||
didSet {
|
||||
|
@ -147,8 +141,7 @@ class StatusActionAccountListViewController: UIViewController {
|
|||
|
||||
private func statusLoaded(_ status: StatusMO) async {
|
||||
let vc = StatusActionAccountListCollectionViewController(statusID: statusID, actionType: actionType, mastodonController: mastodonController)
|
||||
vc.addStatus(status, state: statusState)
|
||||
vc.showInacurateCountWarning = showInacurateCountWarning
|
||||
vc.addStatus(status, state: statusState, showInaccurateCountWarning: showInaccurateCountWarning)
|
||||
if let accountIDs {
|
||||
vc.setAccounts(accountIDs, animated: false)
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ extension ActionNotificationGroupTableViewCell: SelectableTableViewCell {
|
|||
fatalError()
|
||||
}
|
||||
let vc = StatusActionAccountListViewController(actionType: action, statusID: statusID, statusState: .unknown, accountIDs: accountIDs, mastodonController: mastodonController)
|
||||
vc.showInacurateCountWarning = false
|
||||
vc.showInaccurateCountWarning = false
|
||||
delegate.show(vc)
|
||||
}
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ extension ActionNotificationGroupTableViewCell: MenuPreviewProvider {
|
|||
fatalError()
|
||||
}
|
||||
let vc = StatusActionAccountListViewController(actionType: action, statusID: self.statusID, statusState: .unknown, accountIDs: accountIDs, mastodonController: self.mastodonController)
|
||||
vc.showInacurateCountWarning = false
|
||||
vc.showInaccurateCountWarning = false
|
||||
return vc
|
||||
}, actions: {
|
||||
return []
|
||||
|
|
|
@ -417,8 +417,7 @@ class ConversationMainStatusCollectionViewCell: UICollectionViewListCell, Status
|
|||
return
|
||||
}
|
||||
let vc = StatusActionAccountListViewController(actionType: .favorite, statusID: statusID, statusState: statusState.copy(), accountIDs: nil, mastodonController: mastodonController)
|
||||
// TODO: only show warning if the instance isn't the logged in one
|
||||
vc.showInacurateCountWarning = true
|
||||
vc.showInaccurateCountWarning = true
|
||||
delegate.show(vc)
|
||||
}
|
||||
|
||||
|
@ -427,7 +426,7 @@ class ConversationMainStatusCollectionViewCell: UICollectionViewListCell, Status
|
|||
return
|
||||
}
|
||||
let vc = StatusActionAccountListViewController(actionType: .reblog, statusID: statusID, statusState: statusState.copy(), accountIDs: nil, mastodonController: mastodonController)
|
||||
vc.showInacurateCountWarning = true
|
||||
vc.showInaccurateCountWarning = true
|
||||
delegate.show(vc)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue