From 075b8a739a321e107eb419886cb8225e63fe5718 Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Mon, 21 Aug 2023 11:32:00 +0200 Subject: [PATCH] Fix some warnings --- .../Community/DiscoveryCommunityViewModel+State.swift | 3 --- .../Scene/Onboarding/Login/MastodonLoginViewController.swift | 1 - Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift | 2 +- Mastodon/Scene/Thread/ThreadViewModel+LoadThreadState.swift | 2 +- .../Scene/ComposeContent/ComposeContentViewModel.swift | 2 -- .../ComposeContent/Publisher/MastodonStatusEditPublisher.swift | 3 +-- 6 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel+State.swift b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel+State.swift index 6f1e5d5ec..14910f791 100644 --- a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel+State.swift +++ b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel+State.swift @@ -22,9 +22,6 @@ extension DiscoveryCommunityViewModel { override func didEnter(from previousState: GKState?) { super.didEnter(from: previousState) - - let from = previousState.flatMap { String(describing: $0) } ?? "nil" - let to = String(describing: self) } @MainActor diff --git a/Mastodon/Scene/Onboarding/Login/MastodonLoginViewController.swift b/Mastodon/Scene/Onboarding/Login/MastodonLoginViewController.swift index 8f1cbecf2..839750145 100644 --- a/Mastodon/Scene/Onboarding/Login/MastodonLoginViewController.swift +++ b/Mastodon/Scene/Onboarding/Login/MastodonLoginViewController.swift @@ -236,7 +236,6 @@ class MastodonLoginViewController: UIViewController, NeedsDependency { let keyboardFrame = keyboardFrameValue.cgRectValue let keyboardOrigin = view.convert(keyboardFrame.origin, from: nil) - let intersectionY = CGRectGetMaxY(view.frame) - keyboardOrigin.y; UIView.animate(withDuration: duration.doubleValue, delay: 0, options: .curveEaseInOut) { self.view.layoutIfNeeded() diff --git a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift index 506487504..da97a7888 100644 --- a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift +++ b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift @@ -333,7 +333,7 @@ extension WelcomeViewController { self.authenticationViewModel.isAuthenticating.send(false) switch completion { - case .failure(let error ): + case .failure(_): guard let randomServer = self.viewModel.pickRandomDefaultServer() else { return } self.viewModel.randomDefaultServer = randomServer diff --git a/Mastodon/Scene/Thread/ThreadViewModel+LoadThreadState.swift b/Mastodon/Scene/Thread/ThreadViewModel+LoadThreadState.swift index c11da082c..6d26b9fa4 100644 --- a/Mastodon/Scene/Thread/ThreadViewModel+LoadThreadState.swift +++ b/Mastodon/Scene/Thread/ThreadViewModel+LoadThreadState.swift @@ -85,7 +85,7 @@ extension ThreadViewModel.LoadThreadState { // assert(!Thread.isMainThread) // await Task.sleep(1_000_000_000) // 1s delay to prevent UI render issue - let statusHistory = try await viewModel.context.apiService.getHistory(forStatusID: threadContext.statusID, + _ = try await viewModel.context.apiService.getHistory(forStatusID: threadContext.statusID, authenticationBox: viewModel.authContext.mastodonAuthenticationBox) viewModel.mastodonStatusThreadViewModel.appendAncestor( diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel.swift index c2e13fb40..835740b21 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel.swift @@ -480,8 +480,6 @@ extension ComposeContentViewModel { ) .receive(on: DispatchQueue.main) .map { contentWarning, content, hasPoll, attachments in - let canDiscardContentWarning = contentWarning.isEmpty - let trimmedContent = content.trimmingCharacters(in: .whitespacesAndNewlines) let initialContent = self.initialContent.trimmingCharacters(in: .whitespacesAndNewlines) let canDiscardContent = trimmedContent.isEmpty || trimmedContent == initialContent diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Publisher/MastodonStatusEditPublisher.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Publisher/MastodonStatusEditPublisher.swift index 76ad758bc..893fb1a28 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Publisher/MastodonStatusEditPublisher.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Publisher/MastodonStatusEditPublisher.swift @@ -5,6 +5,7 @@ import CoreData import CoreDataStack import MastodonCore import MastodonSDK +import Combine public final class MastodonEditStatusPublisher: NSObject, ProgressReporting { @@ -77,8 +78,6 @@ extension MastodonEditStatusPublisher: StatusPublisher { api: APIService, authContext: AuthContext ) async throws -> StatusPublishResult { - let idempotencyKey = UUID().uuidString - let publishStatusTaskStartDelayWeight: Int64 = 20 let publishStatusTaskStartDelayCount: Int64 = publishStatusTaskStartDelayWeight