From 5a8862b1e2140a596a44390d19d31ce9c96ce71c Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Tue, 13 Aug 2024 10:17:05 +0200 Subject: [PATCH] Remove unecessary workaround --- IceCubesApp/App/Report/ReportView.swift | 1 - .../Account/Sources/Account/AccountDetailContextMenu.swift | 7 ------- Packages/Account/Sources/Account/AccountDetailView.swift | 1 - .../Account/Sources/Account/Filters/FiltersListView.swift | 1 - .../Account/MediaGrid/AccountDetailMediaGridView.swift | 1 - .../Conversations/Detail/ConversationMessageView.swift | 3 --- .../StatusKit/Sources/StatusKit/Row/StatusRowView.swift | 1 - 7 files changed, 15 deletions(-) diff --git a/IceCubesApp/App/Report/ReportView.swift b/IceCubesApp/App/Report/ReportView.swift index 46cf82bc..dcb37d9a 100644 --- a/IceCubesApp/App/Report/ReportView.swift +++ b/IceCubesApp/App/Report/ReportView.swift @@ -44,7 +44,6 @@ public struct ReportView: View { ToolbarItem(placement: .navigationBarTrailing) { Button { isSendingReport = true - let client = client Task { do { let _: ReportSent = diff --git a/Packages/Account/Sources/Account/AccountDetailContextMenu.swift b/Packages/Account/Sources/Account/AccountDetailContextMenu.swift index ace8460c..9d193278 100644 --- a/Packages/Account/Sources/Account/AccountDetailContextMenu.swift +++ b/Packages/Account/Sources/Account/AccountDetailContextMenu.swift @@ -35,7 +35,6 @@ public struct AccountDetailContextMenu: View { if viewModel.relationship?.blocking == true { Button { - let client = client Task { do { viewModel.relationship = try await client.post(endpoint: Accounts.unblock(id: account.id)) @@ -54,7 +53,6 @@ public struct AccountDetailContextMenu: View { if viewModel.relationship?.muting == true { Button { - let client = client Task { do { viewModel.relationship = try await client.post(endpoint: Accounts.unmute(id: account.id)) @@ -67,7 +65,6 @@ public struct AccountDetailContextMenu: View { Menu { ForEach(Duration.mutingDurations(), id: \.rawValue) { duration in Button(duration.description) { - let client = client Task { do { viewModel.relationship = try await client.post(endpoint: Accounts.mute(id: account.id, json: MuteData(duration: duration.rawValue))) @@ -85,7 +82,6 @@ public struct AccountDetailContextMenu: View { { if relationship.notifying { Button { - let client = client Task { do { viewModel.relationship = try await client.post(endpoint: Accounts.follow(id: account.id, @@ -98,7 +94,6 @@ public struct AccountDetailContextMenu: View { } } else { Button { - let client = client Task { do { viewModel.relationship = try await client.post(endpoint: Accounts.follow(id: account.id, @@ -112,7 +107,6 @@ public struct AccountDetailContextMenu: View { } if relationship.showingReblogs { Button { - let client = client Task { do { viewModel.relationship = try await client.post(endpoint: Accounts.follow(id: account.id, @@ -125,7 +119,6 @@ public struct AccountDetailContextMenu: View { } } else { Button { - let client = client Task { do { viewModel.relationship = try await client.post(endpoint: Accounts.follow(id: account.id, diff --git a/Packages/Account/Sources/Account/AccountDetailView.swift b/Packages/Account/Sources/Account/AccountDetailView.swift index b62da6bb..e7876467 100644 --- a/Packages/Account/Sources/Account/AccountDetailView.swift +++ b/Packages/Account/Sources/Account/AccountDetailView.swift @@ -380,7 +380,6 @@ public struct AccountDetailView: View { .confirmationDialog("Block User", isPresented: $showBlockConfirmation) { if let account = viewModel.account { Button("account.action.block-user-\(account.username)", role: .destructive) { - let client = client Task { do { viewModel.relationship = try await client.post(endpoint: Accounts.block(id: account.id)) diff --git a/Packages/Account/Sources/Account/Filters/FiltersListView.swift b/Packages/Account/Sources/Account/Filters/FiltersListView.swift index a54d21d2..33b1d296 100644 --- a/Packages/Account/Sources/Account/Filters/FiltersListView.swift +++ b/Packages/Account/Sources/Account/Filters/FiltersListView.swift @@ -78,7 +78,6 @@ public struct FiltersListView: View { .background(theme.secondaryBackgroundColor) #endif .task { - let client = client do { isLoading = true filters = try await client.get(endpoint: ServerFilters.filters, forceVersion: .v2) diff --git a/Packages/Account/Sources/Account/MediaGrid/AccountDetailMediaGridView.swift b/Packages/Account/Sources/Account/MediaGrid/AccountDetailMediaGridView.swift index 3fe520c6..443d3ef2 100644 --- a/Packages/Account/Sources/Account/MediaGrid/AccountDetailMediaGridView.swift +++ b/Packages/Account/Sources/Account/MediaGrid/AccountDetailMediaGridView.swift @@ -103,7 +103,6 @@ public struct AccountDetailMediaGridView: View { } private func fetchNextPage() async throws { - let client = client let newStatuses: [Status] = try await client.get(endpoint: Accounts.statuses(id: account.id, sinceId: mediaStatuses.last?.id, diff --git a/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift b/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift index 83b8c275..61ae9387 100644 --- a/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift +++ b/Packages/Conversations/Sources/Conversations/Detail/ConversationMessageView.swift @@ -108,7 +108,6 @@ struct ConversationMessageView: View { Label("status.action.copy-text", systemImage: "doc.on.doc") } Button { - let client = client Task { do { let status: Status @@ -127,7 +126,6 @@ struct ConversationMessageView: View { systemImage: isLiked ? "star.fill" : "star") } Button { - let client = client Task { do { let status: Status @@ -147,7 +145,6 @@ struct ConversationMessageView: View { Divider() if message.account.id == currentAccount.account?.id { Button("status.action.delete", role: .destructive) { - let client = client Task { _ = try await client.delete(endpoint: Statuses.status(id: message.id)) } diff --git a/Packages/StatusKit/Sources/StatusKit/Row/StatusRowView.swift b/Packages/StatusKit/Sources/StatusKit/Row/StatusRowView.swift index fe802d85..0d2d2359 100644 --- a/Packages/StatusKit/Sources/StatusKit/Row/StatusRowView.swift +++ b/Packages/StatusKit/Sources/StatusKit/Row/StatusRowView.swift @@ -200,7 +200,6 @@ public struct StatusRowView: View { isPresented: $isBlockConfirmationPresented) { Button("account.action.block", role: .destructive) { - let client = client Task { do { let operationAccount = viewModel.status.reblog?.account ?? viewModel.status.account