mirror of
https://github.com/mastodon/mastodon-ios
synced 2025-04-11 22:58:02 +02:00
Fix CW cannot be hidden (IOS-176)
This commit is contained in:
parent
9fed54db1f
commit
45accb29e6
@ -150,7 +150,7 @@ extension DataSourceFacade {
|
||||
|
||||
@MainActor
|
||||
static func responseToMenuAction(
|
||||
dependency: UIViewController & NeedsDependency & AuthContextProvider,
|
||||
dependency: UIViewController & NeedsDependency & AuthContextProvider & DataSourceProvider,
|
||||
action: MastodonMenu.Action,
|
||||
menuContext: MenuContext
|
||||
) async throws {
|
||||
@ -389,13 +389,15 @@ extension DataSourceFacade {
|
||||
extension DataSourceFacade {
|
||||
|
||||
static func responseToToggleSensitiveAction(
|
||||
dependency: NeedsDependency,
|
||||
dependency: NeedsDependency & DataSourceProvider,
|
||||
status: MastodonStatus
|
||||
) async throws {
|
||||
try await dependency.context.managedObjectContext.perform {
|
||||
let _status = status.reblog ?? status
|
||||
_status.isSensitiveToggled = !_status.isSensitiveToggled
|
||||
}
|
||||
let _status = status.reblog ?? status
|
||||
|
||||
let newStatus: MastodonStatus = .fromEntity(_status.entity)
|
||||
newStatus.isSensitiveToggled = !_status.isSensitiveToggled
|
||||
|
||||
dependency.update(status: newStatus)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import MastodonLocalization
|
||||
import CoreDataStack
|
||||
import TabBarPager
|
||||
import XLPagerTabStrip
|
||||
import MastodonSDK
|
||||
|
||||
protocol ProfileViewModelEditable {
|
||||
var isEdited: Bool { get }
|
||||
@ -940,3 +941,14 @@ private extension ProfileViewController {
|
||||
authContext.mastodonAuthenticationBox.authentication.instance(in: context.managedObjectContext)
|
||||
}
|
||||
}
|
||||
|
||||
extension ProfileViewController: DataSourceProvider {
|
||||
func item(from source: DataSourceItem.Source) async -> DataSourceItem? {
|
||||
assertionFailure("Implement not required in this class")
|
||||
return nil
|
||||
}
|
||||
|
||||
func update(status: MastodonStatus) {
|
||||
assertionFailure("Implement not required in this class")
|
||||
}
|
||||
}
|
||||
|
@ -56,13 +56,15 @@ extension MastodonFeed: Hashable {
|
||||
public static func == (lhs: MastodonFeed, rhs: MastodonFeed) -> Bool {
|
||||
lhs.id == rhs.id &&
|
||||
lhs.status?.entity == rhs.status?.entity &&
|
||||
lhs.status?.reblog?.entity == rhs.status?.reblog?.entity
|
||||
lhs.status?.reblog?.entity == rhs.status?.reblog?.entity &&
|
||||
lhs.status?.isSensitiveToggled == rhs.status?.isSensitiveToggled
|
||||
}
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(id)
|
||||
hasher.combine(status?.entity)
|
||||
hasher.combine(status?.reblog?.entity)
|
||||
hasher.combine(status?.isSensitiveToggled)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,12 +37,14 @@ extension MastodonStatus {
|
||||
extension MastodonStatus: Hashable {
|
||||
public static func == (lhs: MastodonStatus, rhs: MastodonStatus) -> Bool {
|
||||
lhs.entity == rhs.entity &&
|
||||
lhs.reblog?.entity == rhs.reblog?.entity
|
||||
lhs.reblog?.entity == rhs.reblog?.entity &&
|
||||
lhs.isSensitiveToggled == rhs.isSensitiveToggled
|
||||
}
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(entity)
|
||||
hasher.combine(reblog?.entity)
|
||||
hasher.combine(isSensitiveToggled)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user