Fix issue with same local/federated timelines.

This commit is contained in:
Marcin Czachursk 2023-03-15 15:11:12 +01:00
parent 95c2ef07f0
commit c51debeedb
6 changed files with 14 additions and 19 deletions

View File

@ -22,8 +22,8 @@ public extension PixelfedClientAuthenticated {
return try await downloadJson([Status].self, request: request)
}
func getPublicTimeline(local: Bool = false,
remote: Bool = false,
func getPublicTimeline(local: Bool? = nil,
remote: Bool? = nil,
onlyMedia: Bool = true,
maxId: EntityId? = nil,
sinceId: EntityId? = nil,
@ -41,8 +41,8 @@ public extension PixelfedClientAuthenticated {
}
func getTagTimeline(tag: String,
local: Bool = false,
remote: Bool = false,
local: Bool? = nil,
remote: Bool? = nil,
onlyMedia: Bool = true,
maxId: EntityId? = nil,
sinceId: EntityId? = nil,

View File

@ -9,8 +9,8 @@ import Foundation
extension Pixelfed {
public enum Timelines {
case home(MaxId?, SinceId?, MinId?, Limit?)
case pub(Bool, Bool, Bool, MaxId?, SinceId?, MinId?, Limit?)
case tag(String, Bool, Bool, Bool, MaxId?, SinceId?, MinId?, Limit?)
case pub(Bool?, Bool?, Bool?, MaxId?, SinceId?, MinId?, Limit?)
case tag(String, Bool?, Bool?, Bool?, MaxId?, SinceId?, MinId?, Limit?)
}
}

View File

@ -1261,7 +1261,7 @@
CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 72;
CURRENT_PROJECT_VERSION = 73;
DEVELOPMENT_TEAM = B2U9FEKYP8;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VernissageWidget/Info.plist;
@ -1289,7 +1289,7 @@
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 72;
CURRENT_PROJECT_VERSION = 73;
DEVELOPMENT_TEAM = B2U9FEKYP8;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VernissageWidget/Info.plist;
@ -1435,7 +1435,7 @@
CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 72;
CURRENT_PROJECT_VERSION = 73;
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
DEVELOPMENT_TEAM = B2U9FEKYP8;
ENABLE_PREVIEWS = YES;
@ -1473,7 +1473,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 72;
CURRENT_PROJECT_VERSION = 73;
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
DEVELOPMENT_TEAM = B2U9FEKYP8;
ENABLE_PREVIEWS = YES;

View File

@ -10,8 +10,8 @@ import PixelfedKit
/// Pixelfed 'Timeline'.
extension Client {
public class PublicTimeline: BaseClient {
public func getStatuses(local: Bool,
remote: Bool,
public func getStatuses(local: Bool? = nil,
remote: Bool? = nil,
maxId: String? = nil,
sinceId: String? = nil,
minId: String? = nil,
@ -26,8 +26,8 @@ extension Client {
}
public func getTagStatuses(tag: String,
local: Bool,
remote: Bool,
local: Bool? = nil,
remote: Bool? = nil,
maxId: String? = nil,
sinceId: String? = nil,
minId: String? = nil,

View File

@ -169,14 +169,12 @@ struct StatusesView: View {
case .local:
return try await self.client.publicTimeline?.getStatuses(
local: true,
remote: false,
maxId: maxId,
sinceId: sinceId,
minId: minId,
limit: self.defaultLimit) ?? []
case .federated:
return try await self.client.publicTimeline?.getStatuses(
local: false,
remote: true,
maxId: maxId,
sinceId: sinceId,
@ -205,8 +203,6 @@ struct StatusesView: View {
return try await self.client.publicTimeline?.getTagStatuses(
tag: tag,
local: false,
remote: true,
maxId: maxId,
sinceId: sinceId,
minId: minId,

View File

@ -113,7 +113,6 @@ struct ImagesGrid: View {
return try await self.client.publicTimeline?.getTagStatuses(
tag: name,
local: true,
remote: false,
limit: 10) ?? []
case .account(let accountId, _, _):
return try await self.client.accounts?.statuses(createdBy: accountId, onlyMedia: true, limit: 10) ?? []