forked from shadowfacts/Tusker
Rename Hide Discover Section pref to Hide Trends
This commit is contained in:
parent
14c456df22
commit
b2096f22c3
|
@ -80,7 +80,7 @@ class Preferences: Codable, ObservableObject {
|
|||
self.defaultNotificationsMode = try container.decode(NotificationsMode.self, forKey: .defaultNotificationsType)
|
||||
self.grayscaleImages = try container.decodeIfPresent(Bool.self, forKey: .grayscaleImages) ?? false
|
||||
self.disableInfiniteScrolling = try container.decodeIfPresent(Bool.self, forKey: .disableInfiniteScrolling) ?? false
|
||||
self.hideDiscover = try container.decodeIfPresent(Bool.self, forKey: .hideDiscover) ?? false
|
||||
self.hideTrends = try container.decodeIfPresent(Bool.self, forKey: .hideTrends) ?? false
|
||||
|
||||
self.statusContentType = try container.decode(StatusContentType.self, forKey: .statusContentType)
|
||||
|
||||
|
@ -130,7 +130,7 @@ class Preferences: Codable, ObservableObject {
|
|||
try container.encode(defaultNotificationsMode, forKey: .defaultNotificationsType)
|
||||
try container.encode(grayscaleImages, forKey: .grayscaleImages)
|
||||
try container.encode(disableInfiniteScrolling, forKey: .disableInfiniteScrolling)
|
||||
try container.encode(hideDiscover, forKey: .hideDiscover)
|
||||
try container.encode(hideTrends, forKey: .hideTrends)
|
||||
|
||||
try container.encode(statusContentType, forKey: .statusContentType)
|
||||
|
||||
|
@ -190,7 +190,7 @@ class Preferences: Codable, ObservableObject {
|
|||
@Published var defaultNotificationsMode = NotificationsMode.allNotifications
|
||||
@Published var grayscaleImages = false
|
||||
@Published var disableInfiniteScrolling = false
|
||||
@Published var hideDiscover = false
|
||||
@Published var hideTrends = false
|
||||
|
||||
// MARK: Advanced
|
||||
@Published var statusContentType: StatusContentType = .plain
|
||||
|
@ -241,7 +241,7 @@ class Preferences: Codable, ObservableObject {
|
|||
case defaultNotificationsType
|
||||
case grayscaleImages
|
||||
case disableInfiniteScrolling
|
||||
case hideDiscover
|
||||
case hideTrends = "hideDiscover"
|
||||
|
||||
case statusContentType
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate, Collect
|
|||
snapshot.appendSections(Section.allCases.filter { $0 != .discover })
|
||||
snapshot.appendItems([.bookmarks, .favorites], toSection: .bookmarks)
|
||||
if mastodonController.instanceFeatures.trends,
|
||||
!Preferences.shared.hideDiscover {
|
||||
!Preferences.shared.hideTrends {
|
||||
addDiscoverSection(to: &snapshot)
|
||||
}
|
||||
snapshot.appendItems([.addList], toSection: .lists)
|
||||
|
@ -248,7 +248,7 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate, Collect
|
|||
@objc private func preferencesChanged() {
|
||||
var snapshot = dataSource.snapshot()
|
||||
let hasSection = snapshot.sectionIdentifiers.contains(.discover)
|
||||
let hide = Preferences.shared.hideDiscover
|
||||
let hide = Preferences.shared.hideTrends
|
||||
if hasSection && hide {
|
||||
snapshot.deleteSections([.discover])
|
||||
} else if !hasSection && !hide {
|
||||
|
|
|
@ -21,7 +21,7 @@ class TrendsViewController: UIViewController, CollectionViewController {
|
|||
|
||||
private var isShowingTrends = false
|
||||
private var shouldShowTrends: Bool {
|
||||
mastodonController.instanceFeatures.trends && !Preferences.shared.hideDiscover
|
||||
mastodonController.instanceFeatures.trends && !Preferences.shared.hideTrends
|
||||
}
|
||||
|
||||
init(mastodonController: MastodonController) {
|
||||
|
|
|
@ -17,7 +17,7 @@ struct WellnessPrefsView: View {
|
|||
notificationsMode
|
||||
grayscaleImages
|
||||
disableInfiniteScrolling
|
||||
hideDiscover
|
||||
hideTrends
|
||||
}
|
||||
.listStyle(InsetGroupedListStyle())
|
||||
.navigationBarTitle(Text("Digital Wellness"))
|
||||
|
@ -57,10 +57,10 @@ struct WellnessPrefsView: View {
|
|||
}
|
||||
}
|
||||
|
||||
private var hideDiscover: some View {
|
||||
Section(footer: Text("Do not show the Discover section (Trends, Profile Directory) of the Explore screen or sidebar.")) {
|
||||
Toggle(isOn: $preferences.hideDiscover) {
|
||||
Text("Hide Discover Section")
|
||||
private var hideTrends: some View {
|
||||
Section(footer: Text("Do not show Trends (hashtags, links, posts, suggested accounts) on the Explore screen.")) {
|
||||
Toggle(isOn: $preferences.hideTrends) {
|
||||
Text("Hide Trends")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue