mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-03 12:58:50 +00:00
Run SwiftFormat
This commit is contained in:
parent
5991641d32
commit
a79c5691e0
49 changed files with 234 additions and 237 deletions
|
@ -220,7 +220,6 @@ class AppDelegate: NSObject, UIApplicationDelegate {
|
|||
}
|
||||
|
||||
func application(_: UIApplication, didFailToRegisterForRemoteNotificationsWithError _: Error) {}
|
||||
|
||||
}
|
||||
|
||||
class ThemeObserverViewController: UIViewController {
|
||||
|
|
|
@ -84,7 +84,7 @@ struct SideBarView<Content: View>: View {
|
|||
.frame(width: .sidebarWidth, height: 50)
|
||||
.padding(.vertical, 8)
|
||||
.background(selectedTab == .profile && account.id == appAccounts.currentAccount.id ?
|
||||
theme.secondaryBackgroundColor : .clear)
|
||||
theme.secondaryBackgroundColor : .clear)
|
||||
}
|
||||
|
||||
private var tabsView: some View {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import AppAccount
|
||||
import Env
|
||||
import Models
|
||||
import Network
|
||||
import Notifications
|
||||
import SwiftUI
|
||||
import Timeline
|
||||
import Models
|
||||
|
||||
struct NotificationsTab: View {
|
||||
@EnvironmentObject private var client: Client
|
||||
|
|
|
@ -5,9 +5,9 @@ import Env
|
|||
import Models
|
||||
import Network
|
||||
import NukeUI
|
||||
import SafariServices
|
||||
import Shimmer
|
||||
import SwiftUI
|
||||
import SafariServices
|
||||
|
||||
struct AddAccountView: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
@ -81,7 +81,7 @@ struct AddAccountView: View {
|
|||
instanceNamePublisher.send(newValue)
|
||||
}
|
||||
.onReceive(instanceNamePublisher.debounce(for: .milliseconds(500), scheduler: DispatchQueue.main)) { newValue in
|
||||
let newValue = newValue
|
||||
let newValue = newValue
|
||||
.replacingOccurrences(of: "http://", with: "")
|
||||
.replacingOccurrences(of: "https://", with: "")
|
||||
let client = Client(server: newValue)
|
||||
|
@ -171,8 +171,8 @@ struct AddAccountView: View {
|
|||
(Text("instance.list.users-\(instance.users)")
|
||||
+ Text(" ⸱ ")
|
||||
+ Text("instance.list.posts-\(instance.statuses)"))
|
||||
.font(.scaledFootnote)
|
||||
.foregroundColor(.gray)
|
||||
.font(.scaledFootnote)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
|
@ -235,11 +235,9 @@ struct AddAccountView: View {
|
|||
struct SafariView: UIViewControllerRepresentable {
|
||||
let url: URL
|
||||
|
||||
func makeUIViewController(context: UIViewControllerRepresentableContext<SafariView>) -> SFSafariViewController {
|
||||
func makeUIViewController(context _: UIViewControllerRepresentableContext<SafariView>) -> SFSafariViewController {
|
||||
SFSafariViewController(url: url)
|
||||
}
|
||||
|
||||
func updateUIViewController(_ uiViewController: SFSafariViewController, context: UIViewControllerRepresentableContext<SafariView>) {
|
||||
|
||||
}
|
||||
func updateUIViewController(_: SFSafariViewController, context _: UIViewControllerRepresentableContext<SafariView>) {}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import DesignSystem
|
||||
import Env
|
||||
import Models
|
||||
import Status
|
||||
import SwiftUI
|
||||
import Env
|
||||
|
||||
struct DisplaySettingsView: View {
|
||||
@EnvironmentObject private var theme: Theme
|
||||
|
@ -16,15 +16,15 @@ struct DisplaySettingsView: View {
|
|||
Toggle("settings.display.theme.systemColor", isOn: $theme.followSystemColorScheme)
|
||||
themeSelectorButton
|
||||
ColorPicker("settings.display.theme.tint", selection: $theme.tintColor)
|
||||
.onChange(of: theme.tintColor) { newValue in
|
||||
.onChange(of: theme.tintColor) { _ in
|
||||
theme.followSystemColorScheme = false
|
||||
}
|
||||
ColorPicker("settings.display.theme.background", selection: $theme.primaryBackgroundColor)
|
||||
.onChange(of: theme.primaryBackgroundColor) { newValue in
|
||||
.onChange(of: theme.primaryBackgroundColor) { _ in
|
||||
theme.followSystemColorScheme = false
|
||||
}
|
||||
ColorPicker("settings.display.theme.secondary-background", selection: $theme.secondaryBackgroundColor)
|
||||
.onChange(of: theme.primaryBackgroundColor) { newValue in
|
||||
.onChange(of: theme.primaryBackgroundColor) { _ in
|
||||
theme.followSystemColorScheme = false
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ struct DisplaySettingsView: View {
|
|||
}
|
||||
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||
VStack {
|
||||
Slider(value: $userPreferences.fontSizeScale, in: 0.5...1.5, step: 0.1)
|
||||
Slider(value: $userPreferences.fontSizeScale, in: 0.5 ... 1.5, step: 0.1)
|
||||
Text("Font scaling: \(String(format: "%.1f", userPreferences.fontSizeScale))")
|
||||
.font(.scaledBody)
|
||||
}
|
||||
|
|
|
@ -142,11 +142,11 @@ struct SettingsTabs: View {
|
|||
.tint(theme.labelColor)
|
||||
}
|
||||
} header: {
|
||||
Text("settings.section.app")
|
||||
Text("settings.section.app")
|
||||
} footer: {
|
||||
if let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
|
||||
Text("App Version: \(appVersion)").frame(maxWidth: .infinity, alignment: .center)
|
||||
}
|
||||
if let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
|
||||
Text("App Version: \(appVersion)").frame(maxWidth: .infinity, alignment: .center)
|
||||
}
|
||||
}
|
||||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
}
|
||||
|
|
|
@ -98,8 +98,8 @@ struct AddRemoteTimelineView: View {
|
|||
(Text("instance.list.users-\(instance.users)")
|
||||
+ Text(" ⸱ ")
|
||||
+ Text("instance.list.posts-\(instance.statuses)"))
|
||||
.font(.scaledFootnote)
|
||||
.foregroundColor(.gray)
|
||||
.font(.scaledFootnote)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
|
|
|
@ -119,8 +119,8 @@ struct AccountDetailHeaderView: View {
|
|||
relationship: relationship,
|
||||
shouldDisplayNotify: true,
|
||||
relationshipUpdated: { relationship in
|
||||
viewModel.relationship = relationship
|
||||
}))
|
||||
viewModel.relationship = relationship
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -377,7 +377,7 @@ public struct AccountDetailView: View {
|
|||
if !viewModel.isCurrentUser {
|
||||
Button {
|
||||
routerPath.presentedSheet = .mentionStatusEditor(account: account,
|
||||
visibility: preferences.serverPreferences?.postVisibility ?? .pub)
|
||||
visibility: preferences.serverPreferences?.postVisibility ?? .pub)
|
||||
} label: {
|
||||
Label("account.action.mention", systemImage: "at")
|
||||
}
|
||||
|
|
|
@ -9,14 +9,15 @@ public class FollowButtonViewModel: ObservableObject {
|
|||
|
||||
public let accountId: String
|
||||
public let shouldDisplayNotify: Bool
|
||||
public let relationshipUpdated: ((Relationship) -> Void)
|
||||
public let relationshipUpdated: (Relationship) -> Void
|
||||
@Published public private(set) var relationship: Relationship
|
||||
@Published public private(set) var isUpdating: Bool = false
|
||||
|
||||
public init(accountId: String,
|
||||
relationship: Relationship,
|
||||
shouldDisplayNotify: Bool,
|
||||
relationshipUpdated: @escaping ((Relationship) -> Void)) {
|
||||
relationshipUpdated: @escaping ((Relationship) -> Void))
|
||||
{
|
||||
self.accountId = accountId
|
||||
self.relationship = relationship
|
||||
self.shouldDisplayNotify = shouldDisplayNotify
|
||||
|
|
|
@ -20,7 +20,7 @@ struct ConversationsListRow: View {
|
|||
VStack(alignment: .leading, spacing: 4) {
|
||||
HStack {
|
||||
EmojiTextApp(.init(stringValue: conversation.accounts.map { $0.safeDisplayName }.joined(separator: ", ")),
|
||||
emojis: conversation.accounts.flatMap{ $0.emojis })
|
||||
emojis: conversation.accounts.flatMap { $0.emojis })
|
||||
.font(.scaledSubheadline)
|
||||
.fontWeight(.semibold)
|
||||
.foregroundColor(theme.labelColor)
|
||||
|
|
|
@ -43,8 +43,7 @@ class ConversationsListViewModel: ObservableObject {
|
|||
nextPage = nil
|
||||
}
|
||||
isLoadingNextPage = false
|
||||
} catch {
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import SwiftUI
|
||||
|
||||
public let availableColorsSets: [ColorSetCouple] =
|
||||
[.init(light: IceCubeLight(), dark: IceCubeDark()),
|
||||
.init(light: IceCubeNeonLight(), dark: IceCubeNeonDark()),
|
||||
.init(light: DesertLight(), dark: DesertDark()),
|
||||
.init(light: NemesisLight(), dark: NemesisDark()),
|
||||
.init(light: MediumLight(), dark: MediumDark())]
|
||||
[.init(light: IceCubeLight(), dark: IceCubeDark()),
|
||||
.init(light: IceCubeNeonLight(), dark: IceCubeNeonDark()),
|
||||
.init(light: DesertLight(), dark: DesertDark()),
|
||||
.init(light: NemesisLight(), dark: NemesisDark()),
|
||||
.init(light: MediumLight(), dark: MediumDark())]
|
||||
|
||||
public protocol ColorSet {
|
||||
var name: ColorSetName { get }
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import SwiftUI
|
||||
import Env
|
||||
import SwiftUI
|
||||
|
||||
@MainActor
|
||||
extension Font {
|
||||
|
||||
public static func userScaledFontSize(baseSize: CGFloat) -> CGFloat {
|
||||
public extension Font {
|
||||
static func userScaledFontSize(baseSize: CGFloat) -> CGFloat {
|
||||
UIFontMetrics.default.scaledValue(for: baseSize * UserPreferences.shared.fontSizeScale)
|
||||
}
|
||||
|
||||
public static var scaledTitle: Font {
|
||||
static var scaledTitle: Font {
|
||||
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||
return .system(size: userScaledFontSize(baseSize: 28))
|
||||
} else {
|
||||
|
@ -16,7 +15,7 @@ extension Font {
|
|||
}
|
||||
}
|
||||
|
||||
public static var scaledHeadline: Font {
|
||||
static var scaledHeadline: Font {
|
||||
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||
return .system(size: userScaledFontSize(baseSize: 20), weight: .semibold)
|
||||
} else {
|
||||
|
@ -24,7 +23,7 @@ extension Font {
|
|||
}
|
||||
}
|
||||
|
||||
public static var scaledBody: Font {
|
||||
static var scaledBody: Font {
|
||||
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||
return .system(size: userScaledFontSize(baseSize: 19))
|
||||
} else {
|
||||
|
@ -32,7 +31,7 @@ extension Font {
|
|||
}
|
||||
}
|
||||
|
||||
public static var scaledBodyUIFont: UIFont {
|
||||
static var scaledBodyUIFont: UIFont {
|
||||
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||
return UIFont.systemFont(ofSize: userScaledFontSize(baseSize: 19))
|
||||
} else {
|
||||
|
@ -40,7 +39,7 @@ extension Font {
|
|||
}
|
||||
}
|
||||
|
||||
public static var scaledCallout: Font {
|
||||
static var scaledCallout: Font {
|
||||
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||
return .system(size: userScaledFontSize(baseSize: 17))
|
||||
} else {
|
||||
|
@ -48,7 +47,7 @@ extension Font {
|
|||
}
|
||||
}
|
||||
|
||||
public static var scaledSubheadline: Font {
|
||||
static var scaledSubheadline: Font {
|
||||
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||
return .system(size: userScaledFontSize(baseSize: 16))
|
||||
} else {
|
||||
|
@ -56,8 +55,7 @@ extension Font {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static var scaledFootnote: Font {
|
||||
static var scaledFootnote: Font {
|
||||
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||
return .system(size: userScaledFontSize(baseSize: 15))
|
||||
} else {
|
||||
|
@ -65,7 +63,7 @@ extension Font {
|
|||
}
|
||||
}
|
||||
|
||||
public static var scaledCaption: Font {
|
||||
static var scaledCaption: Font {
|
||||
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||
return .system(size: userScaledFontSize(baseSize: 14))
|
||||
} else {
|
||||
|
|
|
@ -29,12 +29,13 @@ struct ThemeApplier: ViewModifier {
|
|||
.onAppear {
|
||||
// If theme is never set before set the default store. This should only execute once after install.
|
||||
if !theme.isThemePreviouslySet {
|
||||
theme.selectedSet = colorScheme == .dark ? .iceCubeDark : .iceCubeLight
|
||||
theme.selectedSet = colorScheme == .dark ? .iceCubeDark : .iceCubeLight
|
||||
theme.isThemePreviouslySet = true
|
||||
} else if theme.followSystemColorScheme && theme.isThemePreviouslySet,
|
||||
} else if theme.followSystemColorScheme, theme.isThemePreviouslySet,
|
||||
let sets = availableColorsSets
|
||||
.first(where: { $0.light.name == theme.selectedSet || $0.dark.name == theme.selectedSet }) {
|
||||
theme.selectedSet = colorScheme == .dark ? sets.dark.name : sets.light.name
|
||||
.first(where: { $0.light.name == theme.selectedSet || $0.dark.name == theme.selectedSet })
|
||||
{
|
||||
theme.selectedSet = colorScheme == .dark ? sets.dark.name : sets.light.name
|
||||
}
|
||||
setWindowTint(theme.tintColor)
|
||||
setBarsColor(theme.primaryBackgroundColor)
|
||||
|
@ -48,7 +49,8 @@ struct ThemeApplier: ViewModifier {
|
|||
.onChange(of: colorScheme) { newColorScheme in
|
||||
if theme.followSystemColorScheme,
|
||||
let sets = availableColorsSets
|
||||
.first(where: { $0.light.name == theme.selectedSet || $0.dark.name == theme.selectedSet }) {
|
||||
.first(where: { $0.light.name == theme.selectedSet || $0.dark.name == theme.selectedSet })
|
||||
{
|
||||
theme.selectedSet = newColorScheme == .dark ? sets.dark.name : sets.light.name
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ public struct ExploreView: View {
|
|||
loadingView
|
||||
} else if !viewModel.searchQuery.isEmpty {
|
||||
if viewModel.isSearching {
|
||||
HStack { }
|
||||
.listRowBackground(theme.secondaryBackgroundColor)
|
||||
.listRowSeparator(.hidden)
|
||||
HStack {}
|
||||
.listRowBackground(theme.secondaryBackgroundColor)
|
||||
.listRowSeparator(.hidden)
|
||||
} else if let results = viewModel.results[viewModel.searchQuery], !results.isEmpty {
|
||||
makeSearchResultsView(results: results)
|
||||
} else {
|
||||
|
|
|
@ -27,6 +27,7 @@ class ExploreViewModel: ObservableObject {
|
|||
isSearching = true
|
||||
}
|
||||
}
|
||||
|
||||
@Published var results: [String: SearchResults] = [:]
|
||||
@Published var isLoaded = false
|
||||
@Published var isSearching = false
|
||||
|
|
|
@ -20,6 +20,7 @@ public struct DeepLClient {
|
|||
public let detectedSourceLanguage: String
|
||||
public let text: String
|
||||
}
|
||||
|
||||
public let translations: [Translation]
|
||||
}
|
||||
|
||||
|
@ -31,7 +32,7 @@ public struct DeepLClient {
|
|||
|
||||
public init() {}
|
||||
|
||||
public func request(target: String, source: String?, text: String) async throws -> String {
|
||||
public func request(target: String, source _: String?, text: String) async throws -> String {
|
||||
do {
|
||||
var components = URLComponents(string: endpoint)!
|
||||
var queryItems: [URLQueryItem] = []
|
||||
|
|
|
@ -22,7 +22,7 @@ public struct NotificationsListView: View {
|
|||
ScrollView {
|
||||
LazyVStack {
|
||||
notificationsView
|
||||
.frame(maxWidth: .maxColumnWidth)
|
||||
.frame(maxWidth: .maxColumnWidth)
|
||||
}
|
||||
.padding(.top, .layoutPadding + 16)
|
||||
.background(theme.primaryBackgroundColor)
|
||||
|
|
|
@ -43,8 +43,8 @@ class NotificationsViewModel: ObservableObject {
|
|||
private var queryTypes: [String]? {
|
||||
if let selectedType {
|
||||
var excludedTypes = Models.Notification.NotificationType.allCases
|
||||
excludedTypes.removeAll(where: { $0 == selectedType})
|
||||
return excludedTypes.map{ $0.rawValue }
|
||||
excludedTypes.removeAll(where: { $0 == selectedType })
|
||||
return excludedTypes.map { $0.rawValue }
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ class NotificationsViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func handleEvent(event: any StreamEvent) {
|
||||
if let event = event as? StreamEventNotification,
|
||||
if let event = event as? StreamEventNotification,
|
||||
!notifications.contains(where: { $0.id == event.notification.id })
|
||||
{
|
||||
if let selectedType, event.notification.type == selectedType.rawValue {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import DesignSystem
|
||||
import Env
|
||||
import Models
|
||||
import NukeUI
|
||||
import PhotosUI
|
||||
import SwiftUI
|
||||
import NukeUI
|
||||
|
||||
struct StatusEditorAccessoryView: View {
|
||||
@EnvironmentObject private var preferences: UserPreferences
|
||||
|
|
|
@ -11,7 +11,7 @@ enum StatusEditorUTTypeSupported: String, CaseIterable {
|
|||
case jpeg = "public.jpeg"
|
||||
case png = "public.png"
|
||||
|
||||
static func types() -> [UTType] {
|
||||
static func types() -> [UTType] {
|
||||
[.url, .text, .plainText, .image, .jpeg, .png]
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,6 @@ public class StatusEditorViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Status Text manipulations
|
||||
|
||||
func insertStatusText(text: String) {
|
||||
|
@ -245,7 +244,7 @@ public class StatusEditorViewModel: ObservableObject {
|
|||
range: NSRange(location: range.location, length: range.length))
|
||||
}
|
||||
|
||||
var mediaAdded: Bool = false
|
||||
var mediaAdded = false
|
||||
statusText.enumerateAttribute(.attachment, in: range) { attachment, range, _ in
|
||||
if let attachment = attachment as? NSTextAttachment, let image = attachment.image {
|
||||
mediasImages.append(.init(image: image, mediaAttachment: nil, error: nil))
|
||||
|
@ -262,6 +261,7 @@ public class StatusEditorViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
// MARK: - Shar sheet / Item provider
|
||||
|
||||
private func processItemsProvider(items: [NSItemProvider]) {
|
||||
Task {
|
||||
var initialText: String = ""
|
||||
|
@ -302,7 +302,6 @@ public class StatusEditorViewModel: ObservableObject {
|
|||
return options.isEmpty ? nil : options
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Embeds
|
||||
|
||||
private func checkEmbed() {
|
||||
|
@ -447,7 +446,7 @@ public class StatusEditorViewModel: ObservableObject {
|
|||
if let index = indexOf(container: container) {
|
||||
do {
|
||||
let media: MediaAttachment = try await client.put(endpoint: Media.media(id: attachment.id,
|
||||
description: description))
|
||||
description: description))
|
||||
mediasImages[index] = .init(image: nil, mediaAttachment: media, error: nil)
|
||||
} catch {}
|
||||
}
|
||||
|
@ -464,11 +463,12 @@ public class StatusEditorViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
// MARK: - Custom emojis
|
||||
|
||||
func fetchCustomEmojis() async {
|
||||
guard let client else { return }
|
||||
do {
|
||||
customEmojis = try await client.get(endpoint: CustomEmojis.customEmojis) ?? []
|
||||
} catch { }
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import SwiftUI
|
||||
import DesignSystem
|
||||
import Models
|
||||
import Network
|
||||
import DesignSystem
|
||||
import SwiftUI
|
||||
|
||||
public struct StatusEditHistoryView: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
@ -23,13 +23,13 @@ public struct StatusEditHistoryView: View {
|
|||
Section {
|
||||
if let history {
|
||||
ForEach(history) { edit in
|
||||
VStack(alignment: .leading, spacing: 8){
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
EmojiTextApp(edit.content, emojis: edit.emojis)
|
||||
.font(.scaledBody)
|
||||
Group {
|
||||
Text(edit.createdAt.asDate, style: .date) +
|
||||
Text("status.summary.at-time") +
|
||||
Text(edit.createdAt.asDate, style: .time)
|
||||
Text("status.summary.at-time") +
|
||||
Text(edit.createdAt.asDate, style: .time)
|
||||
}
|
||||
.font(.footnote)
|
||||
.foregroundColor(.gray)
|
||||
|
|
|
@ -101,9 +101,9 @@ struct StatusActionsView: View {
|
|||
Divider()
|
||||
HStack {
|
||||
Text(viewModel.status.createdAt.asDate, style: .date) +
|
||||
Text("status.summary.at-time") +
|
||||
Text(viewModel.status.createdAt.asDate, style: .time) +
|
||||
Text(" ·")
|
||||
Text("status.summary.at-time") +
|
||||
Text(viewModel.status.createdAt.asDate, style: .time) +
|
||||
Text(" ·")
|
||||
Image(systemName: viewModel.status.visibility.iconName)
|
||||
Spacer()
|
||||
Text(viewModel.status.application?.name ?? "")
|
||||
|
@ -121,9 +121,9 @@ struct StatusActionsView: View {
|
|||
Divider()
|
||||
HStack {
|
||||
Text("status.summary.edited-time") +
|
||||
Text(editedAt.asDate, style: .date) +
|
||||
Text("status.summary.at-time") +
|
||||
Text(editedAt.asDate, style: .time)
|
||||
Text(editedAt.asDate, style: .date) +
|
||||
Text("status.summary.at-time") +
|
||||
Text(editedAt.asDate, style: .time)
|
||||
Spacer()
|
||||
}
|
||||
.onTapGesture {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import DesignSystem
|
||||
import Env
|
||||
import Models
|
||||
import Nuke
|
||||
import NukeUI
|
||||
import Shimmer
|
||||
import SwiftUI
|
||||
import Nuke
|
||||
|
||||
public struct StatusMediaPreviewView: View {
|
||||
@Environment(\.openURL) private var openURL
|
||||
|
@ -175,7 +175,6 @@ public struct StatusMediaPreviewView: View {
|
|||
.fill(Color.gray)
|
||||
.frame(maxHeight: isNotifications || theme.statusDisplayStyle == .compact ? imageMaxHeight : nil)
|
||||
.shimmering()
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@ -197,7 +196,6 @@ public struct StatusMediaPreviewView: View {
|
|||
isAltAlertDisplayed = true
|
||||
} label: {
|
||||
Text("ALT")
|
||||
|
||||
}
|
||||
.padding(8)
|
||||
.background(.thinMaterial)
|
||||
|
@ -298,7 +296,6 @@ public struct StatusMediaPreviewView: View {
|
|||
Label("status.media.sensitive.show", systemImage: "eye")
|
||||
} else {
|
||||
Label("status.media.content.show", systemImage: "eye")
|
||||
|
||||
}
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
|
@ -307,14 +304,14 @@ public struct StatusMediaPreviewView: View {
|
|||
}
|
||||
|
||||
private var cornerSensitiveButton: some View {
|
||||
HStack{
|
||||
HStack {
|
||||
Button {
|
||||
withAnimation {
|
||||
isHidingMedia = true
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: "eye.slash")
|
||||
.frame(minHeight:21) // Match the alt button in case it is also present
|
||||
.frame(minHeight: 21) // Match the alt button in case it is also present
|
||||
}
|
||||
.padding(10)
|
||||
.buttonStyle(.borderedProminent)
|
||||
|
@ -337,7 +334,7 @@ public struct StatusMediaPreviewView: View {
|
|||
do {
|
||||
let image = try await ImagePipeline.shared.image(for: url).image
|
||||
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
|
||||
} catch { }
|
||||
} catch {}
|
||||
}
|
||||
} label: {
|
||||
Label("status.media.contextmenu.save", systemImage: "square.and.arrow.down")
|
||||
|
@ -347,7 +344,7 @@ public struct StatusMediaPreviewView: View {
|
|||
do {
|
||||
let image = try await ImagePipeline.shared.image(for: url).image
|
||||
UIPasteboard.general.image = image
|
||||
} catch { }
|
||||
} catch {}
|
||||
}
|
||||
} label: {
|
||||
Label("status.media.contextmenu.copy", systemImage: "doc.on.doc")
|
||||
|
|
|
@ -67,31 +67,31 @@ public struct StatusRowView: View {
|
|||
viewModel.displaySpoiler = false
|
||||
}
|
||||
}
|
||||
.contextMenu {
|
||||
StatusRowContextMenu(viewModel: viewModel)
|
||||
}
|
||||
.accessibilityElement(children: viewModel.isFocused ? .contain : .combine)
|
||||
.accessibilityActions {
|
||||
// Add the individual mentions as accessibility actions
|
||||
ForEach(viewModel.status.mentions, id: \.id) { mention in
|
||||
Button("@\(mention.username)") {
|
||||
routerPath.navigate(to: .accountDetail(id: mention.id))
|
||||
}
|
||||
}
|
||||
.contextMenu {
|
||||
StatusRowContextMenu(viewModel: viewModel)
|
||||
}
|
||||
.accessibilityElement(children: viewModel.isFocused ? .contain : .combine)
|
||||
.accessibilityActions {
|
||||
// Add the individual mentions as accessibility actions
|
||||
ForEach(viewModel.status.mentions, id: \.id) { mention in
|
||||
Button("@\(mention.username)") {
|
||||
routerPath.navigate(to: .accountDetail(id: mention.id))
|
||||
}
|
||||
}
|
||||
|
||||
Button(viewModel.displaySpoiler ? "status.show-more" : "status.show-less") {
|
||||
withAnimation {
|
||||
viewModel.displaySpoiler.toggle()
|
||||
}
|
||||
}
|
||||
Button(viewModel.displaySpoiler ? "status.show-more" : "status.show-less") {
|
||||
withAnimation {
|
||||
viewModel.displaySpoiler.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
Button("@\(viewModel.status.account.username)") {
|
||||
routerPath.navigate(to: .accountDetail(id: viewModel.status.account.id))
|
||||
}
|
||||
Button("@\(viewModel.status.account.username)") {
|
||||
routerPath.navigate(to: .accountDetail(id: viewModel.status.account.id))
|
||||
}
|
||||
|
||||
StatusRowContextMenu(viewModel: viewModel)
|
||||
}
|
||||
.background {
|
||||
StatusRowContextMenu(viewModel: viewModel)
|
||||
}
|
||||
.background {
|
||||
Color.clear
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
|
@ -125,15 +125,15 @@ public struct StatusRowView: View {
|
|||
Text("status.row.was-boosted")
|
||||
} else {
|
||||
Text("status.row.you-boosted")
|
||||
}
|
||||
}
|
||||
.accessibilityElement()
|
||||
.accessibilityLabel(
|
||||
Text("\(viewModel.status.account.safeDisplayName)")
|
||||
+ Text(" ")
|
||||
+ Text(viewModel.status.account.username != account.account?.username ? "status.row.was-boosted" : "status.row.you-boosted")
|
||||
)
|
||||
.font(.scaledFootnote)
|
||||
}
|
||||
}
|
||||
.accessibilityElement()
|
||||
.accessibilityLabel(
|
||||
Text("\(viewModel.status.account.safeDisplayName)")
|
||||
+ Text(" ")
|
||||
+ Text(viewModel.status.account.username != account.account?.username ? "status.row.was-boosted" : "status.row.you-boosted")
|
||||
)
|
||||
.font(.scaledFootnote)
|
||||
.foregroundColor(.gray)
|
||||
.fontWeight(.semibold)
|
||||
.onTapGesture {
|
||||
|
@ -192,22 +192,22 @@ public struct StatusRowView: View {
|
|||
.buttonStyle(.plain)
|
||||
Spacer()
|
||||
menuButton
|
||||
.accessibilityHidden(true)
|
||||
.accessibilityHidden(true)
|
||||
}
|
||||
.accessibilityElement()
|
||||
.accessibilityLabel(Text("\(status.account.displayName), \(status.createdAt.formatted)"))
|
||||
.accessibilityLabel(Text("\(status.account.displayName), \(status.createdAt.formatted)"))
|
||||
}
|
||||
makeStatusContentView(status: status)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
viewModel.navigateToDetail(routerPath: routerPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
.accessibilityElement(children: viewModel.isFocused ? .contain : .combine)
|
||||
.accessibilityAction {
|
||||
viewModel.navigateToDetail(routerPath: routerPath)
|
||||
}
|
||||
viewModel.navigateToDetail(routerPath: routerPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
.accessibilityElement(children: viewModel.isFocused ? .contain : .combine)
|
||||
.accessibilityAction {
|
||||
viewModel.navigateToDetail(routerPath: routerPath)
|
||||
}
|
||||
}
|
||||
|
||||
private func makeStatusContentView(status: AnyStatus) -> some View {
|
||||
|
@ -243,7 +243,7 @@ public struct StatusRowView: View {
|
|||
}
|
||||
|
||||
makeMediasView(status: status)
|
||||
.accessibilityHidden(!viewModel.isFocused)
|
||||
.accessibilityHidden(!viewModel.isFocused)
|
||||
makeCardView(status: status)
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +289,8 @@ public struct StatusRowView: View {
|
|||
status.language != nil,
|
||||
userLang != status.language,
|
||||
!status.content.asRawText.isEmpty,
|
||||
viewModel.translation == nil {
|
||||
viewModel.translation == nil
|
||||
{
|
||||
Button {
|
||||
Task {
|
||||
await viewModel.translate(userLang: userLang)
|
||||
|
|
Loading…
Reference in a new issue