mirror of
https://github.com/yattee/yattee.git
synced 2024-12-13 22:00:31 +05:30
Don't perform feed operations if not signed in
This commit is contained in:
parent
14b894a2e9
commit
2a7c51abda
@ -107,7 +107,7 @@ final class FeedModel: ObservableObject, CacheModel {
|
||||
}
|
||||
|
||||
func calculateUnwatchedFeed() {
|
||||
guard let account = accounts.current else { return }
|
||||
guard let account = accounts.current, accounts.signedIn else { return }
|
||||
let feed = cacheModel.retrieveFeed(account: account)
|
||||
guard !feed.isEmpty else { return }
|
||||
backgroundContext.perform { [weak self] in
|
||||
@ -130,7 +130,7 @@ final class FeedModel: ObservableObject, CacheModel {
|
||||
}
|
||||
|
||||
func markAllFeedAsWatched() {
|
||||
guard let account = accounts.current else { return }
|
||||
guard let account = accounts.current, accounts.signedIn else { return }
|
||||
|
||||
let mark = { [weak self] in
|
||||
self?.backgroundContext.perform { [weak self] in
|
||||
@ -149,7 +149,7 @@ final class FeedModel: ObservableObject, CacheModel {
|
||||
}
|
||||
|
||||
var canMarkAllFeedAsWatched: Bool {
|
||||
guard let account = accounts.current else { return false }
|
||||
guard let account = accounts.current, accounts.signedIn else { return false }
|
||||
return (unwatched[account] ?? 0) > 0
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ final class FeedModel: ObservableObject, CacheModel {
|
||||
}
|
||||
|
||||
func playUnwatchedFeed() {
|
||||
guard let account = accounts.current else { return }
|
||||
guard let account = accounts.current, accounts.signedIn else { return }
|
||||
let videos = cacheModel.retrieveFeed(account: account)
|
||||
guard !videos.isEmpty else { return }
|
||||
|
||||
@ -208,7 +208,7 @@ final class FeedModel: ObservableObject, CacheModel {
|
||||
}
|
||||
|
||||
var canPlayUnwatchedFeed: Bool {
|
||||
guard let account = accounts.current else { return false }
|
||||
guard let account = accounts.current, accounts.signedIn else { return false }
|
||||
return (unwatched[account] ?? 0) > 0
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ final class FeedModel: ObservableObject, CacheModel {
|
||||
}
|
||||
|
||||
private func loadCachedFeed(_ onCompletion: @escaping () -> Void = {}) {
|
||||
guard let account = accounts.current else { return }
|
||||
guard let account = accounts.current, accounts.signedIn else { return }
|
||||
let cache = cacheModel.retrieveFeed(account: account)
|
||||
if !cache.isEmpty {
|
||||
DispatchQueue.main.async(qos: .userInteractive) { [weak self] in
|
||||
|
Loading…
Reference in New Issue
Block a user