diff --git a/Mastodon/Scene/Notification/Cell/NotificationTableViewCell+ViewModel.swift b/Mastodon/Scene/Notification/Cell/NotificationTableViewCell+ViewModel.swift index b11b4bf3c..1d2b40ebc 100644 --- a/Mastodon/Scene/Notification/Cell/NotificationTableViewCell+ViewModel.swift +++ b/Mastodon/Scene/Notification/Cell/NotificationTableViewCell+ViewModel.swift @@ -51,9 +51,8 @@ extension NotificationTableViewCell { ) .dropFirst() .receive(on: DispatchQueue.main) - .sink { [weak tableView, weak self] _, _ in + .sink { [weak tableView] _, _ in guard let tableView = tableView else { return } - guard let self = self else { return } UIView.performWithoutAnimation { tableView.beginUpdates() diff --git a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+State.swift b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+State.swift index 07a5e222c..d4fb507b2 100644 --- a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+State.swift +++ b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+State.swift @@ -26,11 +26,6 @@ extension ReportStatusViewModel { self.viewModel = viewModel } - override func didEnter(from previousState: GKState?) { - super.didEnter(from: previousState) - let previousState = previousState as? ReportStatusViewModel.State - } - @MainActor func enter(state: State.Type) { stateMachine?.enter(state) diff --git a/MastodonSDK/Sources/MastodonCore/AuthContext.swift b/MastodonSDK/Sources/MastodonCore/AuthContext.swift index 6dce8f758..ad8e7578d 100644 --- a/MastodonSDK/Sources/MastodonCore/AuthContext.swift +++ b/MastodonSDK/Sources/MastodonCore/AuthContext.swift @@ -34,14 +34,7 @@ extension AuthContext { ManagedObjectObserver.observe(object: authentication) .receive(on: DispatchQueue.main) - .sink { [weak self] completion in - guard let self = self else { return } - switch completion { - case .failure(_): - break - case .finished: - break - } + .sink { _ in } receiveValue: { [weak self] change in guard let self = self else { return } switch change.changeType { diff --git a/MastodonSDK/Sources/MastodonCore/Extension/NSItemProvider.swift b/MastodonSDK/Sources/MastodonCore/Extension/NSItemProvider.swift index 62e3edbf2..672adb81e 100644 --- a/MastodonSDK/Sources/MastodonCore/Extension/NSItemProvider.swift +++ b/MastodonSDK/Sources/MastodonCore/Extension/NSItemProvider.swift @@ -81,8 +81,6 @@ extension NSItemProvider { CGImageDestinationAddImage(imageDestination, cgImage, destinationProperties) CGImageDestinationFinalize(imageDestination) - let dataSize = ByteCountFormatter.string(fromByteCount: Int64(data.length), countStyle: .memory) - let result = ImageLoadResult( data: data as Data, type: cgImage.utType.flatMap { UTType($0 as String) } diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Account.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Account.swift index d9d6b97b1..5968f7a95 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Account.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Account.swift @@ -36,7 +36,7 @@ extension APIService { let managedObjectContext = self.backgroundManagedObjectContext try await managedObjectContext.performChanges { - let result = Persistence.MastodonUser.createOrMerge( + _ = Persistence.MastodonUser.createOrMerge( in: managedObjectContext, context: Persistence.MastodonUser.PersistContext( domain: domain, @@ -68,7 +68,7 @@ extension APIService { let managedObjectContext = self.backgroundManagedObjectContext return managedObjectContext.performChanges { - let result = Persistence.MastodonUser.createOrMerge( + _ = Persistence.MastodonUser.createOrMerge( in: managedObjectContext, context: Persistence.MastodonUser.PersistContext( domain: domain, @@ -106,7 +106,7 @@ extension APIService { let managedObjectContext = self.backgroundManagedObjectContext try await managedObjectContext.performChanges { - let result = Persistence.MastodonUser.createOrMerge( + _ = Persistence.MastodonUser.createOrMerge( in: managedObjectContext, context: Persistence.MastodonUser.PersistContext( domain: domain, diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Follow.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Follow.swift index 75ed5ba38..2561ee675 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Follow.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Follow.swift @@ -102,7 +102,6 @@ extension APIService { networkDate: response.networkDate ) ) - let following = response.value.following case .failure: // rollback user.update(isFollowing: followContext.isFollowing, by: me) diff --git a/MastodonSDK/Sources/MastodonCore/Service/InstanceService.swift b/MastodonSDK/Sources/MastodonCore/Service/InstanceService.swift index 20c0f793e..8444392a8 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/InstanceService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/InstanceService.swift @@ -59,14 +59,7 @@ extension InstanceService { // .flatMap { [unowned self] response -> AnyPublisher in // return // } - .sink { [weak self] completion in - guard let self = self else { return } - switch completion { - case .failure(_): - break - case .finished: - break - } + .sink { _ in } receiveValue: { [weak self] response in guard let _ = self else { return } // do nothing diff --git a/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift b/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift index ff9e6b979..62bb98041 100644 --- a/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift +++ b/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift @@ -88,8 +88,6 @@ public enum ItemProviderLoader { CGImageDestinationAddImage(imageDestination, cgImage, destinationProperties) CGImageDestinationFinalize(imageDestination) - let dataSize = ByteCountFormatter.string(fromByteCount: Int64(data.length), countStyle: .memory) - let file = Mastodon.Query.MediaAttachment.jpeg(data as Data) promise(.success(file)) } diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Upload.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Upload.swift index 6fe331139..58259d28c 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Upload.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Upload.swift @@ -185,7 +185,7 @@ extension AttachmentViewModel { ).singleOutput() progress.completedUnitCount += checkUploadTaskCount - if let url = attachmentStatusResponse.value.url { + if attachmentStatusResponse.value.url != nil { // escape here progress.completedUnitCount = progress.totalUnitCount return .uploadedMastodonAttachment(attachmentStatusResponse.value) diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+UITextViewDelegate.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+UITextViewDelegate.swift index feabef283..53184cdfc 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+UITextViewDelegate.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+UITextViewDelegate.swift @@ -35,8 +35,6 @@ extension ComposeContentViewModel: UITextViewDelegate { assertionFailure() return } - let backedString = metaText.backedString - // configure auto completion setupAutoComplete(for: textView) diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel.swift index 7a97d3e26..8a1a1363a 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel.swift @@ -789,7 +789,6 @@ extension ComposeContentViewModel: AttachmentViewModelDelegate { case .compressing: return case .ready: - let count = self.attachmentViewModels.count try await attachmentViewModel.upload() return case .uploading: diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift index e43a4ed07..73ef89bfc 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift @@ -393,9 +393,7 @@ extension StatusView.ViewModel { private func bindMedia(statusView: StatusView) { $mediaViewConfigurations - .sink { [weak self] configurations in - guard let self = self else { return } - + .sink { configurations in statusView.mediaGridContainerView.prepareForReuse() let maxSize = CGSize( diff --git a/WidgetExtension/Variants/FollowersCount/FollowersCountHistory.swift b/WidgetExtension/Variants/FollowersCount/FollowersCountHistory.swift index cc38ec180..7a9041578 100644 --- a/WidgetExtension/Variants/FollowersCount/FollowersCountHistory.swift +++ b/WidgetExtension/Variants/FollowersCount/FollowersCountHistory.swift @@ -93,7 +93,6 @@ class FollowersCountHistory { let history = followersHistorySorted(for: account) let relevantDays = elapsedFollowersCountDateStrings() let today = relevantDays.last! - let yesterday = relevantDays[relevantDays.count - 2] let followersToday = history.first(where: { $0.dstring == today })?.count ?? account.followersCount let followersYesterday = history[safe: history.count-2]?.count ?? account.followersCount