Compare commits
3 Commits
cc401fce8c
...
1d9efc7fb5
Author | SHA1 | Date |
---|---|---|
Shadowfacts | 1d9efc7fb5 | |
Shadowfacts | b17b7b7a24 | |
Shadowfacts | 18d7917756 |
|
@ -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($0.description) } ?? .unexpectedStatus(response.statusCode)
|
||||
let type: ErrorType = mastodonError.flatMap { .mastodonError(response.statusCode, $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 error):
|
||||
return "Server Error: \(error)"
|
||||
case .mastodonError(let code, let error):
|
||||
return "Server Error (\(code)): \(error)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -473,6 +473,6 @@ extension Client {
|
|||
case invalidRequest
|
||||
case invalidResponse
|
||||
case invalidModel(Swift.Error)
|
||||
case mastodonError(String)
|
||||
case mastodonError(Int, String)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,4 +37,8 @@ class AccountActivityItemSource: NSObject, UIActivityItemSource {
|
|||
return metadata
|
||||
}
|
||||
|
||||
func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivity.ActivityType?) -> String {
|
||||
return "\(account.displayName) (@\(account.acct)"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,4 +40,8 @@ class StatusActivityItemSource: NSObject, UIActivityItemSource {
|
|||
return metadata
|
||||
}
|
||||
|
||||
func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivity.ActivityType?) -> String {
|
||||
return "Post by @\(status.account.acct)"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -621,9 +621,12 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
|||
snapshot.insertItems(presentItems.map { .status(id: $0, collapseState: .unknown, filterState: .unknown) }, beforeItem: .gap)
|
||||
|
||||
if applySnapshotBeforeScrolling {
|
||||
let firstVisibleIndexPath = collectionView.indexPathsForVisibleItems.min()!
|
||||
let firstVisibleItem = dataSource.itemIdentifier(for: firstVisibleIndexPath)!
|
||||
applySnapshot(snapshot, maintainingBottomRelativeScrollPositionOf: firstVisibleItem)
|
||||
if 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")
|
||||
|
|
|
@ -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,8 +72,9 @@ extension ToastConfiguration {
|
|||
case .invalidModel(let error):
|
||||
event.tags!["error_type"] = "invalid_model"
|
||||
event.tags!["underlying_error"] = String(describing: error)
|
||||
case .mastodonError(let error):
|
||||
case .mastodonError(let code, let error):
|
||||
event.tags!["error_type"] = "mastodon_error"
|
||||
event.tags!["response_code"] = "\(code)"
|
||||
event.tags!["underlying_error"] = error
|
||||
default:
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue