Compare commits

..

No commits in common. "1d9efc7fb5b971de778f93b62808312cfa312586" and "cc401fce8c96b29e49fddc2fb536c484c6e0c444" have entirely different histories.

5 changed files with 9 additions and 21 deletions

View File

@ -85,7 +85,7 @@ public class Client {
}
guard response.statusCode == 200 else {
let mastodonError = try? Client.decoder.decode(MastodonError.self, from: data)
let type: ErrorType = mastodonError.flatMap { .mastodonError(response.statusCode, $0.description) } ?? .unexpectedStatus(response.statusCode)
let type: ErrorType = mastodonError.flatMap { .mastodonError($0.description) } ?? .unexpectedStatus(response.statusCode)
completion(.failure(Error(request: request, type: type)))
return
}
@ -462,8 +462,8 @@ extension Client {
return "Invalid Response"
case .invalidModel(_):
return "Invalid Model"
case .mastodonError(let code, let error):
return "Server Error (\(code)): \(error)"
case .mastodonError(let error):
return "Server Error: \(error)"
}
}
}
@ -473,6 +473,6 @@ extension Client {
case invalidRequest
case invalidResponse
case invalidModel(Swift.Error)
case mastodonError(Int, String)
case mastodonError(String)
}
}

View File

@ -37,8 +37,4 @@ class AccountActivityItemSource: NSObject, UIActivityItemSource {
return metadata
}
func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivity.ActivityType?) -> String {
return "\(account.displayName) (@\(account.acct)"
}
}

View File

@ -40,8 +40,4 @@ class StatusActivityItemSource: NSObject, UIActivityItemSource {
return metadata
}
func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivity.ActivityType?) -> String {
return "Post by @\(status.account.acct)"
}
}

View File

@ -621,12 +621,9 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
snapshot.insertItems(presentItems.map { .status(id: $0, collapseState: .unknown, filterState: .unknown) }, beforeItem: .gap)
if applySnapshotBeforeScrolling {
if let firstVisibleIndexPath = collectionView.indexPathsForVisibleItems.min() {
let firstVisibleIndexPath = collectionView.indexPathsForVisibleItems.min()!
let firstVisibleItem = dataSource.itemIdentifier(for: firstVisibleIndexPath)!
applySnapshot(snapshot, maintainingBottomRelativeScrollPositionOf: firstVisibleItem)
} else {
dataSource.apply(snapshot, animatingDifferences: false)
}
}
var config = ToastConfiguration(title: "Jump to Present")

View File

@ -57,7 +57,7 @@ extension ToastConfiguration {
}
// TODO: this is a bizarre place to do this, but code path covers basically all errors
switch error.type {
case .invalidRequest, .invalidResponse, .invalidModel(_), .mastodonError(_, _):
case .invalidRequest, .invalidResponse, .invalidModel(_), .mastodonError(_):
let event = Event(error: error)
event.message = SentryMessage(formatted: "\(title): \(error)")
event.tags = [
@ -72,9 +72,8 @@ extension ToastConfiguration {
case .invalidModel(let error):
event.tags!["error_type"] = "invalid_model"
event.tags!["underlying_error"] = String(describing: error)
case .mastodonError(let code, let error):
case .mastodonError(let error):
event.tags!["error_type"] = "mastodon_error"
event.tags!["response_code"] = "\(code)"
event.tags!["underlying_error"] = error
default:
break