From 08ce50573e6cce7ef007f997f9e8e2f0c5e952eb Mon Sep 17 00:00:00 2001 From: Marcin Czachursk Date: Sun, 15 Jan 2023 13:31:37 +0100 Subject: [PATCH] Refactor --- Vernissage/Services/TimelineService.swift | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Vernissage/Services/TimelineService.swift b/Vernissage/Services/TimelineService.swift index e0dee95..11797c7 100644 --- a/Vernissage/Services/TimelineService.swift +++ b/Vernissage/Services/TimelineService.swift @@ -43,16 +43,8 @@ public class TimelineService { public func getComments(for statusId: String, and accountData: AccountData) async throws -> [CommentViewModel] { var commentViewModels: [CommentViewModel] = [] - // Get first level of comments. let client = MastodonClient(baseURL: accountData.serverUrl).getAuthenticated(token: accountData.accessToken ?? String.empty()) - let context = try await client.getContext(for: statusId) - - // Iterate throught first level of comments and download descendants/ - let descendants = context.descendants.toStatusViewModel() - for status in descendants { - commentViewModels.append(CommentViewModel(status: status, showDivider: true)) - try await self.getCommentDescendants(for: status.id, client: client, to: &commentViewModels) - } + try await self.getCommentDescendants(for: statusId, client: client, to: &commentViewModels) return commentViewModels }