mirror of
https://github.com/yattee/yattee.git
synced 2025-01-09 06:17:10 +00:00
parent
b9ad5bc633
commit
f8d79bb08c
@ -115,7 +115,7 @@ final class FeedModel: ObservableObject, CacheModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func calculateUnwatchedFeed() {
|
func calculateUnwatchedFeed() {
|
||||||
guard let account = accounts.current, accounts.signedIn else { return }
|
guard let account = accounts.current, accounts.signedIn, Defaults[.showUnwatchedFeedBadges] else { return }
|
||||||
let feed = cacheModel.retrieveFeed(account: account)
|
let feed = cacheModel.retrieveFeed(account: account)
|
||||||
backgroundContext.perform { [weak self] in
|
backgroundContext.perform { [weak self] in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
|
@ -51,6 +51,7 @@ extension Defaults.Keys {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
static let lockPortraitWhenBrowsing = Key<Bool>("lockPortraitWhenBrowsing", default: UIDevice.current.userInterfaceIdiom == .phone)
|
static let lockPortraitWhenBrowsing = Key<Bool>("lockPortraitWhenBrowsing", default: UIDevice.current.userInterfaceIdiom == .phone)
|
||||||
#endif
|
#endif
|
||||||
|
static let showUnwatchedFeedBadges = Key<Bool>("showUnwatchedFeedBadges", default: false)
|
||||||
static let expandChannelDescription = Key<Bool>("expandChannelDescription", default: false)
|
static let expandChannelDescription = Key<Bool>("expandChannelDescription", default: false)
|
||||||
static let channelOnThumbnail = Key<Bool>("channelOnThumbnail", default: false)
|
static let channelOnThumbnail = Key<Bool>("channelOnThumbnail", default: false)
|
||||||
static let timeOnThumbnail = Key<Bool>("timeOnThumbnail", default: true)
|
static let timeOnThumbnail = Key<Bool>("timeOnThumbnail", default: true)
|
||||||
|
@ -8,6 +8,8 @@ struct AppSidebarSubscriptions: View {
|
|||||||
@ObservedObject private var subscriptions = SubscribedChannelsModel.shared
|
@ObservedObject private var subscriptions = SubscribedChannelsModel.shared
|
||||||
@ObservedObject private var accounts = AccountsModel.shared
|
@ObservedObject private var accounts = AccountsModel.shared
|
||||||
|
|
||||||
|
@Default(.showUnwatchedFeedBadges) private var showUnwatchedFeedBadges
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Section(header: Text("Subscriptions")) {
|
Section(header: Text("Subscriptions")) {
|
||||||
ForEach(subscriptions.all) { channel in
|
ForEach(subscriptions.all) { channel in
|
||||||
@ -26,7 +28,7 @@ struct AppSidebarSubscriptions: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
.backport
|
.backport
|
||||||
.badge(feedCount.unwatchedByChannelText(channel))
|
.badge(showUnwatchedFeedBadges ? feedCount.unwatchedByChannelText(channel) : nil)
|
||||||
}
|
}
|
||||||
.contextMenu {
|
.contextMenu {
|
||||||
if subscriptions.isSubscribing(channel.id) {
|
if subscriptions.isSubscribing(channel.id) {
|
||||||
|
@ -13,6 +13,7 @@ struct AppTabNavigation: View {
|
|||||||
@Default(.showDocuments) private var showDocuments
|
@Default(.showDocuments) private var showDocuments
|
||||||
@Default(.showOpenActionsToolbarItem) private var showOpenActionsToolbarItem
|
@Default(.showOpenActionsToolbarItem) private var showOpenActionsToolbarItem
|
||||||
@Default(.visibleSections) private var visibleSections
|
@Default(.visibleSections) private var visibleSections
|
||||||
|
@Default(.showUnwatchedFeedBadges) private var showUnwatchedFeedBadges
|
||||||
|
|
||||||
let persistenceController = PersistenceController.shared
|
let persistenceController = PersistenceController.shared
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ struct AppTabNavigation: View {
|
|||||||
}
|
}
|
||||||
.tag(TabSelection.subscriptions)
|
.tag(TabSelection.subscriptions)
|
||||||
.backport
|
.backport
|
||||||
.badge(feedCount.unwatchedText)
|
.badge(showUnwatchedFeedBadges ? feedCount.unwatchedText : nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var subscriptionsVisible: Bool {
|
private var subscriptionsVisible: Bool {
|
||||||
|
@ -12,6 +12,7 @@ struct Sidebar: View {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
@Default(.showDocuments) private var showDocuments
|
@Default(.showDocuments) private var showDocuments
|
||||||
#endif
|
#endif
|
||||||
|
@Default(.showUnwatchedFeedBadges) private var showUnwatchedFeedBadges
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollViewReader { scrollView in
|
ScrollViewReader { scrollView in
|
||||||
@ -79,7 +80,7 @@ struct Sidebar: View {
|
|||||||
.accessibility(label: Text("Subscriptions"))
|
.accessibility(label: Text("Subscriptions"))
|
||||||
}
|
}
|
||||||
.backport
|
.backport
|
||||||
.badge(feedCount.unwatchedText)
|
.badge(showUnwatchedFeedBadges ? feedCount.unwatchedText : nil)
|
||||||
.contextMenu {
|
.contextMenu {
|
||||||
playUnwatchedButton
|
playUnwatchedButton
|
||||||
toggleWatchedButton
|
toggleWatchedButton
|
||||||
|
@ -7,6 +7,7 @@ struct BrowsingSettings: View {
|
|||||||
@Default(.roundedThumbnails) private var roundedThumbnails
|
@Default(.roundedThumbnails) private var roundedThumbnails
|
||||||
#endif
|
#endif
|
||||||
@Default(.accountPickerDisplaysAnonymousAccounts) private var accountPickerDisplaysAnonymousAccounts
|
@Default(.accountPickerDisplaysAnonymousAccounts) private var accountPickerDisplaysAnonymousAccounts
|
||||||
|
@Default(.showUnwatchedFeedBadges) private var showUnwatchedFeedBadges
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
@Default(.homeRecentDocumentsItems) private var homeRecentDocumentsItems
|
@Default(.homeRecentDocumentsItems) private var homeRecentDocumentsItems
|
||||||
@Default(.lockPortraitWhenBrowsing) private var lockPortraitWhenBrowsing
|
@Default(.lockPortraitWhenBrowsing) private var lockPortraitWhenBrowsing
|
||||||
@ -223,6 +224,12 @@ struct BrowsingSettings: View {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Toggle("Show anonymous accounts", isOn: $accountPickerDisplaysAnonymousAccounts)
|
Toggle("Show anonymous accounts", isOn: $accountPickerDisplaysAnonymousAccounts)
|
||||||
|
Toggle("Show unwatched feed badges", isOn: $showUnwatchedFeedBadges)
|
||||||
|
.onChange(of: showUnwatchedFeedBadges) { newValue in
|
||||||
|
if newValue {
|
||||||
|
FeedModel.shared.calculateUnwatchedFeed()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Toggle("Open channels with description expanded", isOn: $expandChannelDescription)
|
Toggle("Open channels with description expanded", isOn: $expandChannelDescription)
|
||||||
|
@ -243,7 +243,7 @@ struct SettingsView: View {
|
|||||||
private var windowHeight: Double {
|
private var windowHeight: Double {
|
||||||
switch selection {
|
switch selection {
|
||||||
case .browsing:
|
case .browsing:
|
||||||
return 820
|
return 840
|
||||||
case .player:
|
case .player:
|
||||||
return 450
|
return 450
|
||||||
case .controls:
|
case .controls:
|
||||||
|
@ -9,6 +9,7 @@ struct ChannelsView: View {
|
|||||||
@ObservedObject private var feedCount = UnwatchedFeedCountModel.shared
|
@ObservedObject private var feedCount = UnwatchedFeedCountModel.shared
|
||||||
|
|
||||||
@Default(.showCacheStatus) private var showCacheStatus
|
@Default(.showCacheStatus) private var showCacheStatus
|
||||||
|
@Default(.showUnwatchedFeedBadges) private var showUnwatchedFeedBadges
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List {
|
List {
|
||||||
@ -26,7 +27,7 @@ struct ChannelsView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.backport
|
.backport
|
||||||
.badge(feedCount.unwatchedByChannelText(channel))
|
.badge(showUnwatchedFeedBadges ? feedCount.unwatchedByChannelText(channel) : nil)
|
||||||
}
|
}
|
||||||
.contextMenu {
|
.contextMenu {
|
||||||
if subscriptions.isSubscribing(channel.id) {
|
if subscriptions.isSubscribing(channel.id) {
|
||||||
|
Loading…
Reference in New Issue
Block a user