Fix warnings

This commit is contained in:
Nathan Mattes 2023-09-21 13:10:17 +02:00
parent fbde2a5833
commit 778b44ecf4
22 changed files with 9 additions and 110 deletions

View File

@ -20,13 +20,6 @@ extension DiscoveryPostsViewModel {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)

View File

@ -24,13 +24,6 @@ extension HashtagTimelineViewModel {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)

View File

@ -29,7 +29,6 @@ extension HomeTimelineViewModel {
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let previousState = previousState as? HomeTimelineViewModel.LoadLatestState
viewModel?.loadLatestStateMachinePublisher.send(self)
}
@ -90,12 +89,10 @@ extension HomeTimelineViewModel.LoadLatestState {
managedObjectContext.parent = parentManagedObjectContext
Task {
let start = CACurrentMediaTime()
let latestStatusIDs: [Status.ID] = latestFeedRecords.compactMap { record in
guard let feed = record.object(in: managedObjectContext) else { return nil }
return feed.status?.id
}
let end = CACurrentMediaTime()
do {
let response = try await viewModel.context.apiService.homeTimeline(

View File

@ -20,13 +20,6 @@ extension HomeTimelineViewModel {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
}
@MainActor
func enter(state: LoadOldestState.Type) {
stateMachine?.enter(state)

View File

@ -21,13 +21,6 @@ extension NotificationTimelineViewModel {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
}
@MainActor
func enter(state: LoadOldestState.Type) {
stateMachine?.enter(state)

View File

@ -103,7 +103,7 @@ extension MastodonConfirmEmailViewController {
.receive(on: DispatchQueue.main)
.sink { completion in
switch completion {
case .failure(let error):
case .failure(_):
break
case .finished:
// upload avatar and set display name in the background
@ -118,7 +118,7 @@ extension MastodonConfirmEmailViewController {
.retry(3)
.sink { completion in
switch completion {
case .failure(let error):
case .failure(_):
break
case .finished:
break

View File

@ -228,15 +228,10 @@ class MastodonLoginViewController: UIViewController, NeedsDependency {
@objc func keyboardWillShowNotification(_ notification: Notification) {
guard let userInfo = notification.userInfo,
let keyboardFrameValue = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue,
let duration = userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber
else { return }
// inspired by https://stackoverflow.com/a/30245044
let keyboardFrame = keyboardFrameValue.cgRectValue
let keyboardOrigin = view.convert(keyboardFrame.origin, from: nil)
UIView.animate(withDuration: duration.doubleValue, delay: 0, options: .curveEaseInOut) {
self.view.layoutIfNeeded()
}

View File

@ -21,13 +21,6 @@ extension BookmarkViewModel {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)

View File

@ -20,14 +20,7 @@ extension FavoriteViewModel {
init(viewModel: FavoriteViewModel) {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)

View File

@ -26,13 +26,6 @@ extension FollowerListViewModel {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)

View File

@ -20,13 +20,6 @@ extension FollowingListViewModel {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)

View File

@ -30,7 +30,7 @@ final class RemoteProfileViewModel: ProfileViewModel {
.receive(on: DispatchQueue.main)
.sink { completion in
switch completion {
case .failure(let error):
case .failure(_):
// TODO: handle error
break
case .finished:
@ -106,7 +106,7 @@ final class RemoteProfileViewModel: ProfileViewModel {
.receive(on: DispatchQueue.main)
.sink { completion in
switch completion {
case .failure(let error):
case .failure(_):
// TODO: handle error
break
case .finished:

View File

@ -20,13 +20,6 @@ extension UserTimelineViewModel {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)

View File

@ -20,13 +20,6 @@ extension UserListViewModel {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)

View File

@ -22,13 +22,6 @@ extension ThreadViewModel {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
}
@MainActor
func enter(state: LoadThreadState.Type) {
stateMachine?.enter(state)

View File

@ -82,8 +82,6 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
return
}
let notificationID = String(pushNotification.notificationID)
let accessToken = pushNotification.accessToken
UserDefaults.shared.increaseNotificationCount(accessToken: accessToken)
appContext.notificationService.applicationIconBadgeNeedsUpdate.send()
@ -112,7 +110,6 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
return
}
let notificationID = String(pushNotification.notificationID)
appContext.notificationService.handle(pushNotification: pushNotification)
appContext.notificationService.requestRevealNotificationPublisher.send(pushNotification)
completionHandler()

View File

@ -37,7 +37,7 @@ extension AuthContext {
.sink { [weak self] completion in
guard let self = self else { return }
switch completion {
case .failure(let error):
case .failure(_):
break
case .finished:
break

View File

@ -45,8 +45,6 @@ extension APIService {
networkDate: response.networkDate
)
)
let flag = result.isNewInsertion ? "+" : "-"
}
return response
@ -79,7 +77,6 @@ extension APIService {
networkDate: response.networkDate
)
)
let flag = result.isNewInsertion ? "+" : "-"
}
.setFailureType(to: Error.self)
.tryMap { result -> Mastodon.Response.Content<Mastodon.Entity.Account> in
@ -118,9 +115,6 @@ extension APIService {
networkDate: response.networkDate
)
)
let flag = result.isNewInsertion ? "+" : "-"
let userID = response.value.id
let username = response.value.username
}
return response

View File

@ -62,7 +62,7 @@ extension InstanceService {
.sink { [weak self] completion in
guard let self = self else { return }
switch completion {
case .failure(let error):
case .failure(_):
break
case .finished:
break

View File

@ -75,7 +75,7 @@ public final class StatusFilterService {
switch result {
case .success(let response):
self.activeFilters = response.value
case .failure(let error):
case .failure(_):
break
}
}

View File

@ -21,13 +21,6 @@ extension AutoCompleteViewModel {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)

View File

@ -782,7 +782,7 @@ extension ComposeContentViewModel: AttachmentViewModelDelegate {
@MainActor
func uploadMediaInQueue() async throws {
for (i, attachmentViewModel) in attachmentViewModels.enumerated() {
for (_, attachmentViewModel) in attachmentViewModels.enumerated() {
switch attachmentViewModel.uploadState {
case .none:
return