Fixes for macOS

This commit is contained in:
Thomas Ricouard 2023-10-24 18:34:45 +02:00
parent 07bfd8cd0e
commit 434247f3ea
5 changed files with 77 additions and 29 deletions

View File

@ -16,6 +16,7 @@ struct IceCubesApp: App {
@UIApplicationDelegateAdaptor private var appDelegate: AppDelegate @UIApplicationDelegateAdaptor private var appDelegate: AppDelegate
@Environment(\.scenePhase) private var scenePhase @Environment(\.scenePhase) private var scenePhase
@Environment(\.openWindow) private var openWindow
@State private var appAccountsManager = AppAccountsManager.shared @State private var appAccountsManager = AppAccountsManager.shared
@State private var currentInstance = CurrentInstance.shared @State private var currentInstance = CurrentInstance.shared
@ -42,7 +43,7 @@ struct IceCubesApp: App {
} }
private var appScene: some Scene { private var appScene: some Scene {
WindowGroup { WindowGroup(id: "MainWindow") {
appView appView
.applyTheme(theme) .applyTheme(theme)
.onAppear { .onAppear {
@ -98,7 +99,6 @@ struct IceCubesApp: App {
watcher.watch(streams: [.user, .direct]) watcher.watch(streams: [.user, .direct])
} }
} }
} }
@ViewBuilder @ViewBuilder
@ -273,9 +273,18 @@ struct IceCubesApp: App {
@CommandsBuilder @CommandsBuilder
private var appMenu: some Commands { private var appMenu: some Commands {
CommandGroup(replacing: .newItem) { CommandGroup(replacing: .newItem) {
Button("menu.new-post") { Button("menu.new-window") {
sidebarRouterPath.presentedSheet = .newStatusEditor(visibility: userPreferences.postVisibility) openWindow(id: "MainWindow")
} }
.keyboardShortcut("n", modifiers: .shift)
Button("menu.new-post") {
if ProcessInfo.processInfo.isMacCatalystApp {
openWindow(value: WindowDestination.newStatusEditor(visibility: userPreferences.postVisibility))
} else {
sidebarRouterPath.presentedSheet = .newStatusEditor(visibility: userPreferences.postVisibility)
}
}
.keyboardShortcut("n", modifiers: .command)
} }
CommandGroup(replacing: .textFormatting) { CommandGroup(replacing: .textFormatting) {
Menu("menu.font") { Menu("menu.font") {

View File

@ -69,7 +69,6 @@ struct SideBarView<Content: View>: View {
.frame(width: 20, height: 30) .frame(width: 20, height: 30)
} }
.buttonStyle(.borderedProminent) .buttonStyle(.borderedProminent)
.keyboardShortcut("n", modifiers: .command)
} }
private func makeAccountButton(account: AppAccount, showBadge: Bool) -> some View { private func makeAccountButton(account: AppAccount, showBadge: Bool) -> some View {

View File

@ -29932,120 +29932,142 @@
"localizations" : { "localizations" : {
"be" : { "be" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "Новы допіс" "value" : "Новы допіс"
} }
}, },
"ca" : { "ca" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "Publicació nova" "value" : "Publicació nova"
} }
}, },
"de" : { "de" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "Neuer Beitrag" "value" : "Neuer Beitrag"
} }
}, },
"en" : { "en" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "New post" "value" : "New Post"
} }
}, },
"en-GB" : { "en-GB" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "New post" "value" : "New Post"
} }
}, },
"es" : { "es" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "Publicación nueva" "value" : "Publicación nueva"
} }
}, },
"eu" : { "eu" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "Bidalketa berria" "value" : "Bidalketa berria"
} }
}, },
"fr" : { "fr" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "Nouvelle publication" "value" : "Nouvelle publication"
} }
}, },
"it" : { "it" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "Nuovo post" "value" : "Nuovo post"
} }
}, },
"ja" : { "ja" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "新しい投稿" "value" : "新しい投稿"
} }
}, },
"ko" : { "ko" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "새 글" "value" : "새 글"
} }
}, },
"nb" : { "nb" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "Nytt innlegg" "value" : "Nytt innlegg"
} }
}, },
"nl" : { "nl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "Nieuwe post" "value" : "Nieuwe post"
} }
}, },
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "Nowy post" "value" : "Nowy post"
} }
}, },
"pt-BR" : { "pt-BR" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "Nova postagem" "value" : "Nova postagem"
} }
}, },
"tr" : { "tr" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "New post" "value" : "New post"
} }
}, },
"uk" : { "uk" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "Новий допис" "value" : "Новий допис"
} }
}, },
"zh-Hans" : { "zh-Hans" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "新嘟文" "value" : "新嘟文"
} }
}, },
"zh-Hant" : { "zh-Hant" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "needs_review",
"value" : "新嘟文" "value" : "新嘟文"
} }
} }
} }
}, },
"menu.new-window" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "New Window"
}
},
"en-GB" : {
"stringUnit" : {
"state" : "translated",
"value" : "New Window"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Nouvelle fenêtre"
}
}
}
},
"notifications-others-count %lld" : { "notifications-others-count %lld" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@ -68353,4 +68375,4 @@
} }
}, },
"version" : "1.0" "version" : "1.0"
} }

View File

@ -12,6 +12,7 @@ struct AccountDetailHeaderView: View {
static let headerHeight: CGFloat = 200 static let headerHeight: CGFloat = 200
} }
@Environment(\.openWindow) private var openWindow
@Environment(Theme.self) private var theme @Environment(Theme.self) private var theme
@Environment(QuickLook.self) private var quickLook @Environment(QuickLook.self) private var quickLook
@Environment(RouterPath.self) private var routerPath @Environment(RouterPath.self) private var routerPath
@ -80,7 +81,13 @@ struct AccountDetailHeaderView: View {
return return
} }
let attachement = MediaAttachment.imageWith(url: account.header) let attachement = MediaAttachment.imageWith(url: account.header)
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement])
if ProcessInfo.processInfo.isMacCatalystApp {
openWindow(value: WindowDestination.mediaViewer(attachments: [attachement],
selectedAttachment: attachement))
} else {
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement])
}
} }
.accessibilityElement(children: .combine) .accessibilityElement(children: .combine)
.accessibilityAddTraits([.isImage, .isButton]) .accessibilityAddTraits([.isImage, .isButton])
@ -110,7 +117,12 @@ struct AccountDetailHeaderView: View {
return return
} }
let attachement = MediaAttachment.imageWith(url: account.avatar) let attachement = MediaAttachment.imageWith(url: account.avatar)
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement]) if ProcessInfo.processInfo.isMacCatalystApp {
openWindow(value: WindowDestination.mediaViewer(attachments: [attachement],
selectedAttachment: attachement))
} else {
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement])
}
} }
.accessibilityElement(children: .combine) .accessibilityElement(children: .combine)
.accessibilityAddTraits([.isImage, .isButton]) .accessibilityAddTraits([.isImage, .isButton])

View File

@ -7,6 +7,7 @@ import SwiftUI
@MainActor @MainActor
struct ConversationMessageView: View { struct ConversationMessageView: View {
@Environment(\.openWindow) private var openWindow
@Environment(QuickLook.self) private var quickLook @Environment(QuickLook.self) private var quickLook
@Environment(RouterPath.self) private var routerPath @Environment(RouterPath.self) private var routerPath
@Environment(CurrentAccount.self) private var currentAccount @Environment(CurrentAccount.self) private var currentAccount
@ -200,7 +201,12 @@ struct ConversationMessageView: View {
.frame(height: 200) .frame(height: 200)
.contentShape(Rectangle()) .contentShape(Rectangle())
.onTapGesture { .onTapGesture {
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement]) if ProcessInfo.processInfo.isMacCatalystApp {
openWindow(value: WindowDestination.mediaViewer(attachments: [attachement],
selectedAttachment: attachement))
} else {
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement])
}
} }
} }