Compare commits
No commits in common. "1d9efc7fb5b971de778f93b62808312cfa312586" and "cc401fce8c96b29e49fddc2fb536c484c6e0c444" have entirely different histories.
1d9efc7fb5
...
cc401fce8c
|
@ -85,7 +85,7 @@ public class Client {
|
||||||
}
|
}
|
||||||
guard response.statusCode == 200 else {
|
guard response.statusCode == 200 else {
|
||||||
let mastodonError = try? Client.decoder.decode(MastodonError.self, from: data)
|
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)))
|
completion(.failure(Error(request: request, type: type)))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -462,8 +462,8 @@ extension Client {
|
||||||
return "Invalid Response"
|
return "Invalid Response"
|
||||||
case .invalidModel(_):
|
case .invalidModel(_):
|
||||||
return "Invalid Model"
|
return "Invalid Model"
|
||||||
case .mastodonError(let code, let error):
|
case .mastodonError(let error):
|
||||||
return "Server Error (\(code)): \(error)"
|
return "Server Error: \(error)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -473,6 +473,6 @@ extension Client {
|
||||||
case invalidRequest
|
case invalidRequest
|
||||||
case invalidResponse
|
case invalidResponse
|
||||||
case invalidModel(Swift.Error)
|
case invalidModel(Swift.Error)
|
||||||
case mastodonError(Int, String)
|
case mastodonError(String)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,4 @@ class AccountActivityItemSource: NSObject, UIActivityItemSource {
|
||||||
return metadata
|
return metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivity.ActivityType?) -> String {
|
|
||||||
return "\(account.displayName) (@\(account.acct)"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,4 @@ class StatusActivityItemSource: NSObject, UIActivityItemSource {
|
||||||
return metadata
|
return metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivity.ActivityType?) -> String {
|
|
||||||
return "Post by @\(status.account.acct)"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -621,12 +621,9 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
snapshot.insertItems(presentItems.map { .status(id: $0, collapseState: .unknown, filterState: .unknown) }, beforeItem: .gap)
|
snapshot.insertItems(presentItems.map { .status(id: $0, collapseState: .unknown, filterState: .unknown) }, beforeItem: .gap)
|
||||||
|
|
||||||
if applySnapshotBeforeScrolling {
|
if applySnapshotBeforeScrolling {
|
||||||
if let firstVisibleIndexPath = collectionView.indexPathsForVisibleItems.min() {
|
let firstVisibleIndexPath = collectionView.indexPathsForVisibleItems.min()!
|
||||||
let firstVisibleItem = dataSource.itemIdentifier(for: firstVisibleIndexPath)!
|
let firstVisibleItem = dataSource.itemIdentifier(for: firstVisibleIndexPath)!
|
||||||
applySnapshot(snapshot, maintainingBottomRelativeScrollPositionOf: firstVisibleItem)
|
applySnapshot(snapshot, maintainingBottomRelativeScrollPositionOf: firstVisibleItem)
|
||||||
} else {
|
|
||||||
dataSource.apply(snapshot, animatingDifferences: false)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = ToastConfiguration(title: "Jump to Present")
|
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
|
// TODO: this is a bizarre place to do this, but code path covers basically all errors
|
||||||
switch error.type {
|
switch error.type {
|
||||||
case .invalidRequest, .invalidResponse, .invalidModel(_), .mastodonError(_, _):
|
case .invalidRequest, .invalidResponse, .invalidModel(_), .mastodonError(_):
|
||||||
let event = Event(error: error)
|
let event = Event(error: error)
|
||||||
event.message = SentryMessage(formatted: "\(title): \(error)")
|
event.message = SentryMessage(formatted: "\(title): \(error)")
|
||||||
event.tags = [
|
event.tags = [
|
||||||
|
@ -72,9 +72,8 @@ extension ToastConfiguration {
|
||||||
case .invalidModel(let error):
|
case .invalidModel(let error):
|
||||||
event.tags!["error_type"] = "invalid_model"
|
event.tags!["error_type"] = "invalid_model"
|
||||||
event.tags!["underlying_error"] = String(describing: error)
|
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!["error_type"] = "mastodon_error"
|
||||||
event.tags!["response_code"] = "\(code)"
|
|
||||||
event.tags!["underlying_error"] = error
|
event.tags!["underlying_error"] = error
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue