mirror of
https://github.com/yattee/yattee.git
synced 2025-11-13 21:58:48 +00:00
Resolves 130+ violations including deployment target checks, code style issues, and formatting inconsistencies. Adds SwiftLint disable comments for compiler-required availability checks while maintaining deployment target compliance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
35 lines
874 B
Swift
35 lines
874 B
Swift
import Foundation
|
|
import SwiftUI
|
|
|
|
final class UnwatchedFeedCountModel: ObservableObject {
|
|
static let shared = UnwatchedFeedCountModel()
|
|
|
|
@Published var unwatched = [Account: Int]()
|
|
@Published var unwatchedByChannel = [Account: [Channel.ID: Int]]()
|
|
|
|
private var accounts = AccountsModel.shared
|
|
|
|
var unwatchedText: Text? {
|
|
if let account = accounts.current,
|
|
!account.anonymous,
|
|
let count = unwatched[account],
|
|
count > 0
|
|
{
|
|
return Text(String(count))
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func unwatchedByChannelText(_ channel: Channel) -> Text? {
|
|
if let account = accounts.current,
|
|
!account.anonymous,
|
|
let count = unwatchedByChannel[account]?[channel.id],
|
|
count > 0
|
|
{
|
|
return Text(String(count))
|
|
}
|
|
return nil
|
|
}
|
|
}
|