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 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 @MainActor
func enter(state: State.Type) { func enter(state: State.Type) {
stateMachine?.enter(state) stateMachine?.enter(state)

View File

@ -24,13 +24,6 @@ extension HashtagTimelineViewModel {
self.viewModel = viewModel 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 @MainActor
func enter(state: State.Type) { func enter(state: State.Type) {
stateMachine?.enter(state) stateMachine?.enter(state)

View File

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

View File

@ -20,13 +20,6 @@ extension HomeTimelineViewModel {
self.viewModel = viewModel 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 @MainActor
func enter(state: LoadOldestState.Type) { func enter(state: LoadOldestState.Type) {
stateMachine?.enter(state) stateMachine?.enter(state)

View File

@ -21,13 +21,6 @@ extension NotificationTimelineViewModel {
self.viewModel = viewModel 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 @MainActor
func enter(state: LoadOldestState.Type) { func enter(state: LoadOldestState.Type) {
stateMachine?.enter(state) stateMachine?.enter(state)

View File

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

View File

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

View File

@ -21,13 +21,6 @@ extension BookmarkViewModel {
self.viewModel = viewModel 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 @MainActor
func enter(state: State.Type) { func enter(state: State.Type) {
stateMachine?.enter(state) stateMachine?.enter(state)

View File

@ -21,13 +21,6 @@ extension FavoriteViewModel {
self.viewModel = viewModel 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 @MainActor
func enter(state: State.Type) { func enter(state: State.Type) {
stateMachine?.enter(state) stateMachine?.enter(state)

View File

@ -26,13 +26,6 @@ extension FollowerListViewModel {
self.viewModel = viewModel 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 @MainActor
func enter(state: State.Type) { func enter(state: State.Type) {
stateMachine?.enter(state) stateMachine?.enter(state)

View File

@ -20,13 +20,6 @@ extension FollowingListViewModel {
self.viewModel = viewModel 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 @MainActor
func enter(state: State.Type) { func enter(state: State.Type) {
stateMachine?.enter(state) stateMachine?.enter(state)

View File

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

View File

@ -20,13 +20,6 @@ extension UserTimelineViewModel {
self.viewModel = viewModel 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 @MainActor
func enter(state: State.Type) { func enter(state: State.Type) {
stateMachine?.enter(state) stateMachine?.enter(state)

View File

@ -20,13 +20,6 @@ extension UserListViewModel {
self.viewModel = viewModel 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 @MainActor
func enter(state: State.Type) { func enter(state: State.Type) {
stateMachine?.enter(state) stateMachine?.enter(state)

View File

@ -22,13 +22,6 @@ extension ThreadViewModel {
self.viewModel = viewModel 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 @MainActor
func enter(state: LoadThreadState.Type) { func enter(state: LoadThreadState.Type) {
stateMachine?.enter(state) stateMachine?.enter(state)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,13 +21,6 @@ extension AutoCompleteViewModel {
self.viewModel = viewModel 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 @MainActor
func enter(state: State.Type) { func enter(state: State.Type) {
stateMachine?.enter(state) stateMachine?.enter(state)

View File

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