mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-04-27 02:14:45 +00:00
Fix timeline filtering + looping
This commit is contained in:
parent
6f1896caf3
commit
1e7c25993a
3 changed files with 23 additions and 12 deletions
|
@ -35,6 +35,7 @@ public protocol AnyStatus {
|
||||||
var filtered: [Filtered]? { get }
|
var filtered: [Filtered]? { get }
|
||||||
var sensitive: Bool { get }
|
var sensitive: Bool { get }
|
||||||
var language: String? { get }
|
var language: String? { get }
|
||||||
|
var isHidden: Bool { get }
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct StatusViewId: Hashable {
|
public struct StatusViewId: Hashable {
|
||||||
|
@ -84,6 +85,10 @@ public final class Status: AnyStatus, Codable, Identifiable, Equatable, Hashable
|
||||||
public let filtered: [Filtered]?
|
public let filtered: [Filtered]?
|
||||||
public let sensitive: Bool
|
public let sensitive: Bool
|
||||||
public let language: String?
|
public let language: String?
|
||||||
|
|
||||||
|
public var isHidden: Bool {
|
||||||
|
filtered?.first?.filter.filterAction == .hide
|
||||||
|
}
|
||||||
|
|
||||||
public init(id: String, content: HTMLString, account: Account, createdAt: ServerDate, editedAt: ServerDate?, reblog: ReblogStatus?, mediaAttachments: [MediaAttachment], mentions: [Mention], repliesCount: Int, reblogsCount: Int, favouritesCount: Int, card: Card?, favourited: Bool?, reblogged: Bool?, pinned: Bool?, bookmarked: Bool?, emojis: [Emoji], url: String?, application: Application?, inReplyToId: String?, inReplyToAccountId: String?, visibility: Visibility, poll: Poll?, spoilerText: HTMLString, filtered: [Filtered]?, sensitive: Bool, language: String?) {
|
public init(id: String, content: HTMLString, account: Account, createdAt: ServerDate, editedAt: ServerDate?, reblog: ReblogStatus?, mediaAttachments: [MediaAttachment], mentions: [Mention], repliesCount: Int, reblogsCount: Int, favouritesCount: Int, card: Card?, favourited: Bool?, reblogged: Bool?, pinned: Bool?, bookmarked: Bool?, emojis: [Emoji], url: String?, application: Application?, inReplyToId: String?, inReplyToAccountId: String?, visibility: Visibility, poll: Poll?, spoilerText: HTMLString, filtered: [Filtered]?, sensitive: Bool, language: String?) {
|
||||||
self.id = id
|
self.id = id
|
||||||
|
@ -221,6 +226,10 @@ public final class ReblogStatus: AnyStatus, Codable, Identifiable, Equatable, Ha
|
||||||
public let filtered: [Filtered]?
|
public let filtered: [Filtered]?
|
||||||
public let sensitive: Bool
|
public let sensitive: Bool
|
||||||
public let language: String?
|
public let language: String?
|
||||||
|
|
||||||
|
public var isHidden: Bool {
|
||||||
|
filtered?.first?.filter.filterAction == .hide
|
||||||
|
}
|
||||||
|
|
||||||
public init(id: String, content: HTMLString, account: Account, createdAt: ServerDate, editedAt: ServerDate?, mediaAttachments: [MediaAttachment], mentions: [Mention], repliesCount: Int, reblogsCount: Int, favouritesCount: Int, card: Card?, favourited: Bool?, reblogged: Bool?, pinned: Bool?, bookmarked: Bool?, emojis: [Emoji], url: String?, application: Application? = nil, inReplyToId: String?, inReplyToAccountId: String?, visibility: Visibility, poll: Poll?, spoilerText: HTMLString, filtered: [Filtered]?, sensitive: Bool, language: String?) {
|
public init(id: String, content: HTMLString, account: Account, createdAt: ServerDate, editedAt: ServerDate?, mediaAttachments: [MediaAttachment], mentions: [Mention], repliesCount: Int, reblogsCount: Int, favouritesCount: Int, card: Card?, favourited: Bool?, reblogged: Bool?, pinned: Bool?, bookmarked: Bool?, emojis: [Emoji], url: String?, application: Application? = nil, inReplyToId: String?, inReplyToAccountId: String?, visibility: Visibility, poll: Poll?, spoilerText: HTMLString, filtered: [Filtered]?, sensitive: Bool, language: String?) {
|
||||||
self.id = id
|
self.id = id
|
||||||
|
|
|
@ -48,17 +48,19 @@ public struct StatusesListView<Fetcher>: View where Fetcher: StatusesFetcher {
|
||||||
|
|
||||||
case let .display(statuses, nextPageState):
|
case let .display(statuses, nextPageState):
|
||||||
ForEach(statuses, id: \.viewId) { status in
|
ForEach(statuses, id: \.viewId) { status in
|
||||||
StatusRowView(viewModel: StatusRowViewModel(status: status,
|
if !status.isHidden {
|
||||||
client: client,
|
StatusRowView(viewModel: StatusRowViewModel(status: status,
|
||||||
routerPath: routerPath,
|
client: client,
|
||||||
isRemote: isRemote))
|
routerPath: routerPath,
|
||||||
.id(status.id)
|
isRemote: isRemote))
|
||||||
.onAppear {
|
.id(status.id)
|
||||||
fetcher.statusDidAppear(status: status)
|
.onAppear {
|
||||||
}
|
fetcher.statusDidAppear(status: status)
|
||||||
.onDisappear {
|
}
|
||||||
fetcher.statusDidDisappear(status: status)
|
.onDisappear {
|
||||||
}
|
fetcher.statusDidDisappear(status: status)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
switch nextPageState {
|
switch nextPageState {
|
||||||
case .hasNextPage:
|
case .hasNextPage:
|
||||||
|
|
|
@ -9,7 +9,7 @@ actor TimelineDatasource {
|
||||||
}
|
}
|
||||||
|
|
||||||
func get() -> [Status] {
|
func get() -> [Status] {
|
||||||
statuses.filter { $0.filtered?.first?.filter.filterAction != .hide }
|
statuses
|
||||||
}
|
}
|
||||||
|
|
||||||
func count() -> Int {
|
func count() -> Int {
|
||||||
|
|
Loading…
Reference in a new issue