Fix favorite action (IOS-176)

This commit is contained in:
Marcus Kida 2023-11-22 21:16:48 +01:00
parent 36d4f6ea15
commit 9809e69751
No known key found for this signature in database
GPG Key ID: 19FF64E08013CA40
2 changed files with 7 additions and 8 deletions

View File

@ -99,7 +99,6 @@ extension DataSourceFacade {
action: ActionToolbarContainer.Action,
sender: UIButton
) async throws {
let managedObjectContext = provider.context.managedObjectContext
let _status = status.reblog ?? status
switch action {
@ -111,7 +110,7 @@ extension DataSourceFacade {
context: provider.context,
authContext: provider.authContext,
composeContext: .composeStatus,
destination: .reply(parent: status)
destination: .reply(parent: _status)
)
_ = provider.coordinator.present(
scene: .compose(viewModel: composeViewModel),
@ -121,17 +120,17 @@ extension DataSourceFacade {
case .reblog:
try await DataSourceFacade.responseToStatusReblogAction(
provider: provider,
status: status
status: _status
)
case .like:
try await DataSourceFacade.responseToStatusFavoriteAction(
provider: provider,
status: status
status: _status
)
case .share:
try await DataSourceFacade.responseToStatusShareAction(
provider: provider,
status: status,
status: _status,
button: sender
)
} // end switch

View File

@ -37,11 +37,11 @@ extension APIService {
}
let _status = status.reblog ?? status
let isFavorited = status.entity.favourited == true
let favoritedCount = Int64(status.entity.favouritesCount)
let isFavorited = _status.entity.favourited == true
let favoritedCount = Int64(_status.entity.favouritesCount)
let context = MastodonFavoriteContext(
statusID: status.id,
statusID: _status.id,
isFavorited: isFavorited,
favoritedCount: favoritedCount
)