Fix faving/reblogging statuses by tapping buttons
This commit is contained in:
parent
51a03553a9
commit
44cfd44651
|
@ -149,9 +149,10 @@ class ConversationMainStatusTableViewCell: UITableViewCell, PreferencesAdaptive
|
|||
|
||||
let request = (favorited ? Status.favourite : Status.unfavourite)(realStatus)
|
||||
MastodonController.client.run(request) { response in
|
||||
self.favorited = realStatus.favourited ?? false
|
||||
DispatchQueue.main.async {
|
||||
if case .success = response {
|
||||
if case let .success(newStatus, _) = response {
|
||||
self.favorited = newStatus.favourited ?? false
|
||||
MastodonCache.add(status: newStatus)
|
||||
UIImpactFeedbackGenerator(style: .light).impactOccurred()
|
||||
} else {
|
||||
print("Couldn't favorite status \(realStatus.id)")
|
||||
|
@ -172,9 +173,10 @@ class ConversationMainStatusTableViewCell: UITableViewCell, PreferencesAdaptive
|
|||
|
||||
let request = (reblogged ? Status.reblog : Status.unreblog)(realStatus)
|
||||
MastodonController.client.run(request) { response in
|
||||
self.reblogged = realStatus.reblogged ?? false
|
||||
DispatchQueue.main.async {
|
||||
if case .success = response {
|
||||
if case let .success(newStatus, _) = response {
|
||||
self.reblogged = newStatus.reblogged ?? false
|
||||
MastodonCache.add(status: newStatus)
|
||||
UIImpactFeedbackGenerator(style: .light).impactOccurred()
|
||||
} else {
|
||||
print("Couldn't reblog status \(realStatus.id)")
|
||||
|
|
|
@ -175,9 +175,9 @@ class StatusTableViewCell: UITableViewCell, PreferencesAdaptive {
|
|||
let request = (favorited ? Status.favourite : Status.unfavourite)(realStatus)
|
||||
MastodonController.client.run(request) { response in
|
||||
DispatchQueue.main.async {
|
||||
self.favorited = realStatus.favourited ?? false
|
||||
if case .success = response {
|
||||
self.favorited = realStatus.favourited ?? false
|
||||
if case let .success(newStatus, _) = response {
|
||||
self.favorited = newStatus.favourited ?? false
|
||||
MastodonCache.add(status: newStatus)
|
||||
UIImpactFeedbackGenerator(style: .light).impactOccurred()
|
||||
} else {
|
||||
self.favorited = oldValue
|
||||
|
@ -199,10 +199,10 @@ class StatusTableViewCell: UITableViewCell, PreferencesAdaptive {
|
|||
let realStatus: Status = status.reblog ?? status
|
||||
let request = (reblogged ? Status.reblog : Status.unreblog)(realStatus)
|
||||
MastodonController.client.run(request) { response in
|
||||
self.reblogged = realStatus.reblogged ?? false
|
||||
DispatchQueue.main.async {
|
||||
if case .success = response {
|
||||
self.reblogged = realStatus.reblogged ?? false
|
||||
if case let .success(newStatus, _) = response {
|
||||
self.reblogged = newStatus.reblogged ?? false
|
||||
MastodonCache.add(status: newStatus)
|
||||
UIImpactFeedbackGenerator(style: .light).impactOccurred()
|
||||
} else {
|
||||
self.reblogged = oldValue
|
||||
|
|
Loading…
Reference in New Issue