mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-27 04:54:55 +01:00
SwiftFormat .
This commit is contained in:
parent
9a6b2129b2
commit
df55028836
@ -364,7 +364,6 @@ struct AccountDetailHeaderView: View {
|
||||
|
||||
/// A ``ViewModifier`` that creates a attaches an accessibility action if the field value is a valid link
|
||||
private struct ConditionalUserDefinedFieldAccessibilityActionModifier: ViewModifier {
|
||||
|
||||
let field: Account.Field
|
||||
let routerPath: RouterPath
|
||||
|
||||
|
@ -363,7 +363,7 @@ public struct AccountDetailView: View {
|
||||
.accessibilityInputLabels([
|
||||
LocalizedStringKey("accessibility.tabs.profile.options.label"),
|
||||
LocalizedStringKey("accessibility.tabs.profile.options.inputLabel1"),
|
||||
LocalizedStringKey("accessibility.tabs.profile.options.inputLabel2")
|
||||
LocalizedStringKey("accessibility.tabs.profile.options.inputLabel2"),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
@ -39,13 +39,13 @@ class AccountDetailViewModel: ObservableObject, StatusesFetcher {
|
||||
|
||||
var accessibilityLabel: LocalizedStringKey {
|
||||
switch self {
|
||||
case .statuses: return "accessibility.tabs.profile.picker.statuses"
|
||||
case .favorites: return "accessibility.tabs.profile.picker.favorites"
|
||||
case .bookmarks: return "accessibility.tabs.profile.picker.bookmarks"
|
||||
case .followedTags: return "accessibility.tabs.profile.picker.followed-tags"
|
||||
case .postsAndReplies: return "accessibility.tabs.profile.picker.posts-and-replies"
|
||||
case .media: return "accessibility.tabs.profile.picker.media"
|
||||
case .lists: return "accessibility.tabs.profile.picker.lists"
|
||||
case .statuses: return "accessibility.tabs.profile.picker.statuses"
|
||||
case .favorites: return "accessibility.tabs.profile.picker.favorites"
|
||||
case .bookmarks: return "accessibility.tabs.profile.picker.bookmarks"
|
||||
case .followedTags: return "accessibility.tabs.profile.picker.followed-tags"
|
||||
case .postsAndReplies: return "accessibility.tabs.profile.picker.posts-and-replies"
|
||||
case .media: return "accessibility.tabs.profile.picker.media"
|
||||
case .lists: return "accessibility.tabs.profile.picker.lists"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Foundation
|
||||
import KeychainSwift
|
||||
import SwiftUI
|
||||
import Models
|
||||
import SwiftUI
|
||||
|
||||
@MainActor
|
||||
public enum DeepLUserAPIHandler {
|
||||
|
@ -111,10 +111,12 @@ class StatusDetailViewModel: ObservableObject {
|
||||
func handleEvent(event: any StreamEvent, currentAccount: Account?) {
|
||||
Task {
|
||||
if let event = event as? StreamEventUpdate,
|
||||
event.status.account.id == currentAccount?.id {
|
||||
event.status.account.id == currentAccount?.id
|
||||
{
|
||||
await fetchStatusDetail(animate: true)
|
||||
} else if let event = event as? StreamEventStatusUpdate,
|
||||
event.status.account.id == currentAccount?.id {
|
||||
event.status.account.id == currentAccount?.id
|
||||
{
|
||||
await fetchStatusDetail(animate: true)
|
||||
} else if event is StreamEventDelete {
|
||||
await fetchStatusDetail(animate: true)
|
||||
|
@ -204,7 +204,6 @@ public struct StatusRowView: View {
|
||||
|
||||
/// A ``ViewModifier`` that creates a suitable combined accessibility label for a `StatusRowView` that is not focused.
|
||||
private struct ConditionalAccessibilityLabelModifier: ViewModifier {
|
||||
|
||||
@ObservedObject var viewModel: StatusRowViewModel
|
||||
let setLabel: Bool
|
||||
|
||||
@ -245,29 +244,29 @@ private struct ConditionalAccessibilityLabelModifier: ViewModifier {
|
||||
|
||||
func combinedAccessibilityLabel() -> Text {
|
||||
userNamePreamble() +
|
||||
Text(hasSpoiler
|
||||
? viewModel.finalStatus.spoilerText.asRawText
|
||||
: viewModel.finalStatus.content.asRawText
|
||||
) + Text(", ") +
|
||||
Text(hasSpoiler
|
||||
? "status.editor.spoiler"
|
||||
: ""
|
||||
) + Text(", ") +
|
||||
imageAltText() + Text(", ") +
|
||||
Text(viewModel.finalStatus.createdAt.relativeFormatted) + Text(", ") +
|
||||
Text("status.summary.n-replies \(viewModel.finalStatus.repliesCount)") + Text(", ") +
|
||||
Text("status.summary.n-boosts \(viewModel.finalStatus.reblogsCount)") + Text(", ") +
|
||||
Text("status.summary.n-favorites \(viewModel.finalStatus.favouritesCount)")
|
||||
Text(hasSpoiler
|
||||
? viewModel.finalStatus.spoilerText.asRawText
|
||||
: viewModel.finalStatus.content.asRawText
|
||||
) + Text(", ") +
|
||||
Text(hasSpoiler
|
||||
? "status.editor.spoiler"
|
||||
: ""
|
||||
) + Text(", ") +
|
||||
imageAltText() + Text(", ") +
|
||||
Text(viewModel.finalStatus.createdAt.relativeFormatted) + Text(", ") +
|
||||
Text("status.summary.n-replies \(viewModel.finalStatus.repliesCount)") + Text(", ") +
|
||||
Text("status.summary.n-boosts \(viewModel.finalStatus.reblogsCount)") + Text(", ") +
|
||||
Text("status.summary.n-favorites \(viewModel.finalStatus.favouritesCount)")
|
||||
}
|
||||
|
||||
func userNamePreamble() -> Text {
|
||||
switch (isReply, isBoost) {
|
||||
case (true, false):
|
||||
return Text("accessibility.status.a-replied-to-\(finalUserDisplayName())") + Text(" ")
|
||||
case (_, true):
|
||||
return Text("accessibility.status.a-boosted-b-\(userDisplayName())-\(finalUserDisplayName())") + Text(", ")
|
||||
default:
|
||||
return Text(userDisplayName()) + Text(", ")
|
||||
case (true, false):
|
||||
return Text("accessibility.status.a-replied-to-\(finalUserDisplayName())") + Text(" ")
|
||||
case (_, true):
|
||||
return Text("accessibility.status.a-boosted-b-\(userDisplayName())-\(finalUserDisplayName())") + Text(", ")
|
||||
default:
|
||||
return Text(userDisplayName()) + Text(", ")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ public class StatusRowViewModel: ObservableObject {
|
||||
do {
|
||||
// We first use instance translation API if available.
|
||||
let translation: Translation = try await client.post(endpoint: Statuses.translate(id: finalStatus.id,
|
||||
lang: userLang))
|
||||
lang: userLang))
|
||||
withAnimation {
|
||||
self.translation = translation
|
||||
isLoadingTranslation = false
|
||||
|
@ -53,24 +53,24 @@ struct StatusRowActionsView: View {
|
||||
func accessibilityLabel(dataController: StatusDataController, privateBoost: Bool = false) -> LocalizedStringKey {
|
||||
switch self {
|
||||
case .respond:
|
||||
return "status.action.reply"
|
||||
return "status.action.reply"
|
||||
case .boost:
|
||||
if dataController.isReblogged {
|
||||
return "status.action.unboost"
|
||||
}
|
||||
return privateBoost
|
||||
? "status.action.boost-to-followers"
|
||||
: "status.action.boost"
|
||||
if dataController.isReblogged {
|
||||
return "status.action.unboost"
|
||||
}
|
||||
return privateBoost
|
||||
? "status.action.boost-to-followers"
|
||||
: "status.action.boost"
|
||||
case .favorite:
|
||||
return dataController.isFavorited
|
||||
? "status.action.unfavorite"
|
||||
: "status.action.favorite"
|
||||
return dataController.isFavorited
|
||||
? "status.action.unfavorite"
|
||||
: "status.action.favorite"
|
||||
case .bookmark:
|
||||
return dataController.isBookmarked
|
||||
? "status.action.unbookmark"
|
||||
: "status.action.bookmark"
|
||||
return dataController.isBookmarked
|
||||
? "status.action.unbookmark"
|
||||
: "status.action.bookmark"
|
||||
case .share:
|
||||
return "status.action.share"
|
||||
return "status.action.share"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ struct StatusRowContextMenu: View {
|
||||
} label: {
|
||||
Label("status.action.translate", systemImage: "captions.bubble")
|
||||
}
|
||||
|
||||
|
||||
if !viewModel.alwaysTranslateWithDeepl {
|
||||
Button {
|
||||
Task {
|
||||
|
@ -337,7 +337,6 @@ public struct StatusRowMediaPreviewView: View {
|
||||
|
||||
/// A ``ViewModifier`` that creates a suitable accessibility label for an image that may or may not have alt text
|
||||
private struct ConditionalAccessibilityLabelAltTextModifier: ViewModifier {
|
||||
|
||||
let attachment: MediaAttachment
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
@ -349,4 +348,3 @@ private struct ConditionalAccessibilityLabelAltTextModifier: ViewModifier {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,8 @@ struct StatusRowReplyView: View {
|
||||
.accessibilityElement(children: .combine)
|
||||
.accessibilityLabel(
|
||||
Text("status.row.was-reply")
|
||||
+ Text(" ")
|
||||
+ Text(mention.username)
|
||||
+ Text(" ")
|
||||
+ Text(mention.username)
|
||||
)
|
||||
.font(.scaledFootnote)
|
||||
.foregroundColor(.gray)
|
||||
|
Loading…
x
Reference in New Issue
Block a user