Compare commits

..

No commits in common. "afe47437e4917a1f352d38df06c0809981d0c49c" and "0f2a85b1088cd7d8a27924b37715c465c2a52420" have entirely different histories.

5 changed files with 20 additions and 63 deletions

View File

@ -217,18 +217,6 @@ public final class InstanceFeatures: ObservableObject {
instanceType.isPleroma instanceType.isPleroma
} }
public var muteNotifications: Bool {
!instanceType.isPixelfed
}
public var blockDomains: Bool {
!instanceType.isPixelfed
}
public var hideReblogs: Bool {
!instanceType.isPixelfed
}
public init() { public init() {
} }
@ -350,14 +338,6 @@ extension InstanceFeatures {
return false return false
} }
} }
var isPixelfed: Bool {
if case .pixelfed = self {
return true
} else {
return false
}
}
} }
@_spi(InstanceType) public enum MastodonType { @_spi(InstanceType) public enum MastodonType {

View File

@ -27,13 +27,10 @@ public struct Relationship: RelationshipProtocol, Decodable, Sendable {
self.followedBy = try container.decode(Bool.self, forKey: .followedBy) self.followedBy = try container.decode(Bool.self, forKey: .followedBy)
self.blocking = try container.decode(Bool.self, forKey: .blocking) self.blocking = try container.decode(Bool.self, forKey: .blocking)
self.muting = try container.decode(Bool.self, forKey: .muting) self.muting = try container.decode(Bool.self, forKey: .muting)
// not supported on pixelfed self.mutingNotifications = try container.decode(Bool.self, forKey: .mutingNotifications)
self.mutingNotifications = try container.decodeIfPresent(Bool.self, forKey: .mutingNotifications) ?? false
self.followRequested = try container.decode(Bool.self, forKey: .followRequested) self.followRequested = try container.decode(Bool.self, forKey: .followRequested)
// not supported on pixelfed self.domainBlocking = try container.decode(Bool.self, forKey: .domainBlocking)
self.domainBlocking = try container.decodeIfPresent(Bool.self, forKey: .domainBlocking) ?? false self.showingReblogs = try container.decode(Bool.self, forKey: .showingReblogs)
// not supported on pixelfed
self.showingReblogs = try container.decodeIfPresent(Bool.self, forKey: .showingReblogs) ?? true
self.endorsed = try container.decodeIfPresent(Bool.self, forKey: .endorsed) ?? false self.endorsed = try container.decodeIfPresent(Bool.self, forKey: .endorsed) ?? false
} }

View File

@ -78,7 +78,6 @@ struct MuteAccountView: View {
} }
.accessibilityHidden(true) .accessibilityHidden(true)
if mastodonController.instanceFeatures.muteNotifications {
Section { Section {
Toggle(isOn: $muteNotifications) { Toggle(isOn: $muteNotifications) {
Text("Hide notifications from this person") Text("Hide notifications from this person")
@ -91,7 +90,6 @@ struct MuteAccountView: View {
} }
} }
.appGroupedListRowBackground() .appGroupedListRowBackground()
}
Section { Section {
Picker(selection: $duration) { Picker(selection: $duration) {

View File

@ -9,12 +9,6 @@
import UIKit import UIKit
import Pachyderm import Pachyderm
import Combine import Combine
import OSLog
#if canImport(Sentry)
import Sentry
#endif
private let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "ProfileStatusesViewController")
class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionViewController, CollectionViewController { class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionViewController, CollectionViewController {
@ -256,17 +250,10 @@ class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionVie
state = .setupInitialSnapshot state = .setupInitialSnapshot
Task { Task {
do { if let (all, _) = try? await mastodonController.run(Client.getRelationships(accounts: [accountID])),
let (all, _) = try await mastodonController.run(Client.getRelationships(accounts: [accountID])) let relationship = all.first {
if let relationship = all.first {
self.mastodonController.persistentContainer.addOrUpdate(relationship: relationship) self.mastodonController.persistentContainer.addOrUpdate(relationship: relationship)
} }
} catch {
logger.error("Error fetching relationship: \(String(describing: error))")
#if canImport(Sentry)
SentrySDK.capture(error: error)
#endif
}
} }
await controller.loadInitial() await controller.loadInitial()

View File

@ -557,15 +557,11 @@ extension MenuActionProvider {
return createAction(identifier: "block", title: "Unblock \(displayName)", systemImageName: "circle.slash", handler: handler(false)) return createAction(identifier: "block", title: "Unblock \(displayName)", systemImageName: "circle.slash", handler: handler(false))
} else { } else {
let image = UIImage(systemName: "circle.slash") let image = UIImage(systemName: "circle.slash")
var children = [ return UIMenu(title: "Block", image: image, children: [
UIAction(title: "Cancel", handler: { _ in }), UIAction(title: "Cancel", handler: { _ in }),
UIAction(title: "Block \(displayName)", image: image, attributes: .destructive, handler: handler(true)), UIAction(title: "Block \(displayName)", image: image, attributes: .destructive, handler: handler(true)),
] UIAction(title: "Block \(host)", image: image, attributes: .destructive, handler: domainHandler(true))
if mastodonController.instanceFeatures.blockDomains, ])
host != mastodonController.account?.url.host {
children.append(UIAction(title: "Block \(host)", image: image, attributes: .destructive, handler: domainHandler(true)))
}
return UIMenu(title: "Block", image: image, children: children)
} }
} }
@ -596,8 +592,7 @@ extension MenuActionProvider {
@MainActor @MainActor
private func hideReblogsAction(for relationship: RelationshipMO, mastodonController: MastodonController) -> UIMenuElement? { private func hideReblogsAction(for relationship: RelationshipMO, mastodonController: MastodonController) -> UIMenuElement? {
// don't show action for people that the user isn't following and isn't already hiding reblogs for // don't show action for people that the user isn't following and isn't already hiding reblogs for
guard relationship.following || relationship.showingReblogs, guard relationship.following || relationship.showingReblogs else {
mastodonController.instanceFeatures.hideReblogs else {
return nil return nil
} }
let title = relationship.showingReblogs ? "Hide Reblogs" : "Show Reblogs" let title = relationship.showingReblogs ? "Hide Reblogs" : "Show Reblogs"