Indicate that edit history may be incomplete for remote posts
Closes #385
This commit is contained in:
parent
3a3b7aaee4
commit
41665b1060
|
@ -48,6 +48,10 @@ class StatusEditHistoryViewController: UIViewController, CollectionViewControlle
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
if let status = mastodonController.persistentContainer.status(for: statusID),
|
||||||
|
status.url?.host != mastodonController.instanceURL.host {
|
||||||
|
config.footerMode = .supplementary
|
||||||
|
}
|
||||||
let layout = UICollectionViewCompositionalLayout { sectionIndex, environment in
|
let layout = UICollectionViewCompositionalLayout { sectionIndex, environment in
|
||||||
let section = NSCollectionLayoutSection.list(using: config, layoutEnvironment: environment)
|
let section = NSCollectionLayoutSection.list(using: config, layoutEnvironment: environment)
|
||||||
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
|
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
|
||||||
|
@ -77,7 +81,7 @@ class StatusEditHistoryViewController: UIViewController, CollectionViewControlle
|
||||||
let loadingCell = UICollectionView.CellRegistration<LoadingCollectionViewCell, Void> { cell, indexPath, itemIdentifier in
|
let loadingCell = UICollectionView.CellRegistration<LoadingCollectionViewCell, Void> { cell, indexPath, itemIdentifier in
|
||||||
cell.indicator.startAnimating()
|
cell.indicator.startAnimating()
|
||||||
}
|
}
|
||||||
return UICollectionViewDiffableDataSource(collectionView: collectionView) { collectionView, indexPath, itemIdentifier in
|
let dataSource = UICollectionViewDiffableDataSource<Section, Item>(collectionView: collectionView) { collectionView, indexPath, itemIdentifier in
|
||||||
switch itemIdentifier {
|
switch itemIdentifier {
|
||||||
case .edit(let edit, let state, index: let index):
|
case .edit(let edit, let state, index: let index):
|
||||||
return collectionView.dequeueConfiguredReusableCell(using: editCell, for: indexPath, item: (edit, state, index))
|
return collectionView.dequeueConfiguredReusableCell(using: editCell, for: indexPath, item: (edit, state, index))
|
||||||
|
@ -85,6 +89,15 @@ class StatusEditHistoryViewController: UIViewController, CollectionViewControlle
|
||||||
return collectionView.dequeueConfiguredReusableCell(using: loadingCell, for: indexPath, item: ())
|
return collectionView.dequeueConfiguredReusableCell(using: loadingCell, for: indexPath, item: ())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let footerCell = UICollectionView.SupplementaryRegistration<UICollectionViewListCell>(elementKind: UICollectionView.elementKindSectionFooter) { supplementaryView, elementKind, indexPath in
|
||||||
|
var config = supplementaryView.defaultContentConfiguration()
|
||||||
|
config.text = "Edit history for posts originating from instances other than your own may not be complete."
|
||||||
|
supplementaryView.contentConfiguration = config
|
||||||
|
}
|
||||||
|
dataSource.supplementaryViewProvider = { collectionView, elementKind, indexPath in
|
||||||
|
return collectionView.dequeueConfiguredReusableSupplementary(using: footerCell, for: indexPath)
|
||||||
|
}
|
||||||
|
return dataSource
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
|
|
Loading…
Reference in New Issue