forked from shadowfacts/Tusker
Fix crash when ownInstanceLoaded callback is called multiple times
This commit is contained in:
parent
41a31c23b7
commit
434d975767
|
@ -154,7 +154,8 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate {
|
|||
|
||||
private func ownInstanceLoaded(_ instance: Instance) {
|
||||
var snapshot = self.dataSource.snapshot()
|
||||
if mastodonController.instanceFeatures.instanceType.isMastodon {
|
||||
if mastodonController.instanceFeatures.instanceType.isMastodon,
|
||||
!snapshot.sectionIdentifiers.contains(.discover) {
|
||||
snapshot.insertSections([.discover], afterSection: .bookmarks)
|
||||
snapshot.appendItems([.trendingTags, .profileDirectory], toSection: .discover)
|
||||
}
|
||||
|
|
|
@ -161,7 +161,8 @@ class MainSidebarViewController: UIViewController {
|
|||
|
||||
private func ownInstanceLoaded(_ instance: Instance) {
|
||||
var snapshot = self.dataSource.snapshot()
|
||||
if mastodonController.instanceFeatures.instanceType.isMastodon {
|
||||
if mastodonController.instanceFeatures.instanceType.isMastodon,
|
||||
!snapshot.sectionIdentifiers.contains(.discover) {
|
||||
snapshot.insertSections([.discover], afterSection: .compose)
|
||||
snapshot.appendItems([
|
||||
.trendingTags,
|
||||
|
|
Loading…
Reference in New Issue