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
@Environment(\.scenePhase) private var scenePhase
@Environment(\.openWindow) private var openWindow
@State private var appAccountsManager = AppAccountsManager.shared
@State private var currentInstance = CurrentInstance.shared
@ -42,7 +43,7 @@ struct IceCubesApp: App {
}
private var appScene: some Scene {
WindowGroup {
WindowGroup(id: "MainWindow") {
appView
.applyTheme(theme)
.onAppear {
@ -98,7 +99,6 @@ struct IceCubesApp: App {
watcher.watch(streams: [.user, .direct])
}
}
}
@ViewBuilder
@ -273,9 +273,18 @@ struct IceCubesApp: App {
@CommandsBuilder
private var appMenu: some Commands {
CommandGroup(replacing: .newItem) {
Button("menu.new-post") {
sidebarRouterPath.presentedSheet = .newStatusEditor(visibility: userPreferences.postVisibility)
Button("menu.new-window") {
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) {
Menu("menu.font") {

View File

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

View File

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

View File

@ -12,6 +12,7 @@ struct AccountDetailHeaderView: View {
static let headerHeight: CGFloat = 200
}
@Environment(\.openWindow) private var openWindow
@Environment(Theme.self) private var theme
@Environment(QuickLook.self) private var quickLook
@Environment(RouterPath.self) private var routerPath
@ -80,7 +81,13 @@ struct AccountDetailHeaderView: View {
return
}
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)
.accessibilityAddTraits([.isImage, .isButton])
@ -110,7 +117,12 @@ struct AccountDetailHeaderView: View {
return
}
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)
.accessibilityAddTraits([.isImage, .isButton])

View File

@ -7,6 +7,7 @@ import SwiftUI
@MainActor
struct ConversationMessageView: View {
@Environment(\.openWindow) private var openWindow
@Environment(QuickLook.self) private var quickLook
@Environment(RouterPath.self) private var routerPath
@Environment(CurrentAccount.self) private var currentAccount
@ -200,7 +201,12 @@ struct ConversationMessageView: View {
.frame(height: 200)
.contentShape(Rectangle())
.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])
}
}
}