|
|
|
@ -32,6 +32,7 @@ class StatusTableViewCell: UITableViewCell, PreferencesAdaptive {
|
|
|
|
|
|
|
|
|
|
var statusID: String!
|
|
|
|
|
var accountID: String!
|
|
|
|
|
var reblogStatusID: String?
|
|
|
|
|
var rebloggerID: String?
|
|
|
|
|
|
|
|
|
|
var favorited: Bool = false {
|
|
|
|
@ -74,21 +75,22 @@ class StatusTableViewCell: UITableViewCell, PreferencesAdaptive {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func updateUI(for statusID: String) {
|
|
|
|
|
self.statusID = statusID
|
|
|
|
|
guard let status = MastodonCache.status(for: statusID) else { fatalError("Missing cached status \(statusID)") }
|
|
|
|
|
guard var status = MastodonCache.status(for: statusID) else { fatalError("Missing cached status \(statusID)") }
|
|
|
|
|
|
|
|
|
|
let account: Account
|
|
|
|
|
if let reblog = status.reblog {
|
|
|
|
|
account = reblog.account
|
|
|
|
|
if let reblogID = status.reblog?.id,
|
|
|
|
|
let reblog = MastodonCache.status(for: reblogID) {
|
|
|
|
|
reblogStatusID = statusID
|
|
|
|
|
rebloggerID = status.account.id
|
|
|
|
|
status = reblog
|
|
|
|
|
reblogLabel.isHidden = false
|
|
|
|
|
} else {
|
|
|
|
|
account = status.account
|
|
|
|
|
reblogLabel.isHidden = true
|
|
|
|
|
reblogStatusID = nil
|
|
|
|
|
rebloggerID = nil
|
|
|
|
|
reblogLabel.isHidden = true
|
|
|
|
|
}
|
|
|
|
|
let account = status.account
|
|
|
|
|
self.accountID = account.id
|
|
|
|
|
|
|
|
|
|
self.statusID = status.id
|
|
|
|
|
|
|
|
|
|
updateUIForPreferences()
|
|
|
|
|
|
|
|
|
@ -292,7 +294,7 @@ extension StatusTableViewCell: TableViewSwipeActionProvider {
|
|
|
|
|
}
|
|
|
|
|
completion(true)
|
|
|
|
|
MastodonCache.add(status: status)
|
|
|
|
|
self.updateUI(for: self.statusID)
|
|
|
|
|
self.updateUI(for: self.reblogStatusID ?? self.statusID)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
@ -320,7 +322,7 @@ extension StatusTableViewCell: TableViewSwipeActionProvider {
|
|
|
|
|
}
|
|
|
|
|
completion(true)
|
|
|
|
|
MastodonCache.add(status: status)
|
|
|
|
|
self.updateUI(for: self.statusID)
|
|
|
|
|
self.updateUI(for: self.reblogStatusID ?? self.statusID)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|