Preserve isSensitiveToggled state when interacting with posts (IOS-176)

This commit is contained in:
Marcus Kida 2023-12-01 09:52:41 +01:00
parent 112dce06f5
commit 38423a14ca
No known key found for this signature in database
GPG Key ID: 19FF64E08013CA40
3 changed files with 14 additions and 5 deletions

View File

@ -24,6 +24,9 @@ extension DataSourceFacade {
authenticationBox: provider.authContext.mastodonAuthenticationBox
).value
provider.update(status: .fromEntity(updatedStatus))
let newStatus: MastodonStatus = .fromEntity(updatedStatus)
newStatus.isSensitiveToggled = status.isSensitiveToggled
provider.update(status: newStatus)
}
}

View File

@ -18,11 +18,14 @@ extension DataSourceFacade {
let selectionFeedbackGenerator = await UISelectionFeedbackGenerator()
await selectionFeedbackGenerator.selectionChanged()
let newStatus = try await provider.context.apiService.favorite(
let updatedStatus = try await provider.context.apiService.favorite(
status: status,
authenticationBox: provider.authContext.mastodonAuthenticationBox
).value
provider.update(status: .fromEntity(newStatus))
let newStatus: MastodonStatus = .fromEntity(updatedStatus)
newStatus.isSensitiveToggled = status.isSensitiveToggled
provider.update(status: newStatus)
}
}

View File

@ -18,11 +18,14 @@ extension DataSourceFacade {
let selectionFeedbackGenerator = await UISelectionFeedbackGenerator()
await selectionFeedbackGenerator.selectionChanged()
let newStatus = try await provider.context.apiService.reblog(
let updatedStatus = try await provider.context.apiService.reblog(
status: status,
authenticationBox: provider.authContext.mastodonAuthenticationBox
).value
provider.update(status: .fromEntity(newStatus))
let newStatus: MastodonStatus = .fromEntity(updatedStatus)
newStatus.isSensitiveToggled = status.isSensitiveToggled
provider.update(status: newStatus)
}
}