Add menu-entry for show/hide reblogs (#365)
translations are still missing, as well as viewModel/networking-stuff.
This commit is contained in:
parent
98d2a8da52
commit
ff65f50689
@ -205,6 +205,9 @@ extension DataSourceFacade {
|
||||
menuContext: MenuContext
|
||||
) async throws {
|
||||
switch action {
|
||||
case .hideReblogs(_):
|
||||
//TODO: Implement. Alert. Toggle on Server.
|
||||
return
|
||||
case .muteUser(let actionContext):
|
||||
let alertController = UIAlertController(
|
||||
title: actionContext.isMuting ? L10n.Scene.Profile.RelationshipActionAlert.ConfirmUnmuteUser.title : L10n.Scene.Profile.RelationshipActionAlert.ConfirmMuteUser.title,
|
||||
|
@ -378,6 +378,7 @@ extension ProfileViewController {
|
||||
let _ = ManagedObjectRecord<MastodonUser>(objectID: user.objectID)
|
||||
let menu = MastodonMenu.setupMenu(
|
||||
actions: [
|
||||
.hideReblogs(.init(showReblogs: self.viewModel.relationshipViewModel.showReblogs)),
|
||||
.muteUser(.init(name: name, isMuting: self.viewModel.relationshipViewModel.isMuting)),
|
||||
.blockUser(.init(name: name, isBlocking: self.viewModel.relationshipViewModel.isBlocking)),
|
||||
.reportUser(.init(name: name)),
|
||||
|
@ -198,6 +198,8 @@ public enum L10n {
|
||||
public static let follow = L10n.tr("Localizable", "Common.Controls.Friendship.Follow")
|
||||
/// Following
|
||||
public static let following = L10n.tr("Localizable", "Common.Controls.Friendship.Following")
|
||||
/// Hide Reblogs
|
||||
public static let hideReblogs = L10n.tr("Localizable", "Common.Controls.Friendship.HideReblogs")
|
||||
/// Mute
|
||||
public static let mute = L10n.tr("Localizable", "Common.Controls.Friendship.Mute")
|
||||
/// Muted
|
||||
@ -210,6 +212,8 @@ public enum L10n {
|
||||
public static let pending = L10n.tr("Localizable", "Common.Controls.Friendship.Pending")
|
||||
/// Request
|
||||
public static let request = L10n.tr("Localizable", "Common.Controls.Friendship.Request")
|
||||
/// Show Reblogs
|
||||
public static let showReblogs = L10n.tr("Localizable", "Common.Controls.Friendship.ShowReblogs")
|
||||
/// Unblock
|
||||
public static let unblock = L10n.tr("Localizable", "Common.Controls.Friendship.Unblock")
|
||||
/// Unblock %@
|
||||
|
@ -77,6 +77,8 @@ Please check your internet connection.";
|
||||
"Common.Controls.Friendship.UnblockUser" = "Unblock %@";
|
||||
"Common.Controls.Friendship.Unmute" = "Unmute";
|
||||
"Common.Controls.Friendship.UnmuteUser" = "Unmute %@";
|
||||
"Common.Controls.Friendship.HideReblogs" = "Hide Reblogs";
|
||||
"Common.Controls.Friendship.ShowReblogs" = "Show Reblogs";
|
||||
"Common.Controls.Keyboard.Common.ComposeNewPost" = "Compose New Post";
|
||||
"Common.Controls.Keyboard.Common.OpenSettings" = "Open Settings";
|
||||
"Common.Controls.Keyboard.Common.ShowFavorites" = "Show Favorites";
|
||||
|
@ -45,11 +45,23 @@ extension MastodonMenu {
|
||||
case reportUser(ReportUserActionContext)
|
||||
case shareUser(ShareUserActionContext)
|
||||
case bookmarkStatus(BookmarkStatusActionContext)
|
||||
case hideReblogs(HideReblogsActionContext)
|
||||
case shareStatus
|
||||
case deleteStatus
|
||||
|
||||
func build(delegate: MastodonMenuDelegate) -> BuiltAction {
|
||||
switch self {
|
||||
case .hideReblogs(let context):
|
||||
let title = context.showReblogs ? L10n.Common.Controls.Friendship.hideReblogs : L10n.Common.Controls.Friendship.hideReblogs
|
||||
let reblogAction = BuiltAction(
|
||||
title: title,
|
||||
image: UIImage(systemName: "arrow.2.squarepath")
|
||||
) { [weak delegate] in
|
||||
guard let delegate = delegate else { return }
|
||||
delegate.menuAction(self)
|
||||
}
|
||||
|
||||
return reblogAction
|
||||
case .muteUser(let context):
|
||||
let muteAction = BuiltAction(
|
||||
title: context.isMuting ? L10n.Common.Controls.Friendship.unmuteUser(context.name) : L10n.Common.Controls.Friendship.muteUser(context.name),
|
||||
@ -205,5 +217,12 @@ extension MastodonMenu {
|
||||
self.name = name
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public struct HideReblogsActionContext {
|
||||
public let showReblogs: Bool
|
||||
|
||||
public init(showReblogs: Bool) {
|
||||
self.showReblogs = showReblogs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,6 +114,7 @@ public final class RelationshipViewModel {
|
||||
@Published public var isFollowing = false
|
||||
@Published public var isFollowingBy = false
|
||||
@Published public var isMuting = false
|
||||
@Published public var showReblogs = false
|
||||
@Published public var isBlocking = false
|
||||
@Published public var isBlockingBy = false
|
||||
@Published public var isSuspended = false
|
||||
|
Loading…
x
Reference in New Issue
Block a user