mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-24 14:02:53 +01:00
Add some macOS menu & shortcuts
This commit is contained in:
parent
5ff0330fb7
commit
1b9d4e0247
@ -56,11 +56,7 @@ struct IceCubesApp: App {
|
||||
})
|
||||
}
|
||||
.commands {
|
||||
CommandGroup(replacing: CommandGroupPlacement.newItem) {
|
||||
Button("New post") {
|
||||
sidebarRouterPath.presentedSheet = .newStatusEditor(visibility: userPreferences.serverPreferences?.postVisibility ?? .pub)
|
||||
}
|
||||
}
|
||||
appMenu
|
||||
}
|
||||
.onChange(of: scenePhase) { scenePhase in
|
||||
handleScenePhase(scenePhase: scenePhase)
|
||||
@ -172,6 +168,29 @@ struct IceCubesApp: App {
|
||||
private func refreshPushSubs() {
|
||||
PushNotificationsService.shared.requestPushNotifications()
|
||||
}
|
||||
|
||||
@CommandsBuilder
|
||||
private var appMenu: some Commands {
|
||||
CommandGroup(replacing: .newItem) {
|
||||
Button("New post") {
|
||||
sidebarRouterPath.presentedSheet = .newStatusEditor(visibility: userPreferences.serverPreferences?.postVisibility ?? .pub)
|
||||
}
|
||||
}
|
||||
CommandGroup(replacing: .textFormatting) {
|
||||
Menu("Font") {
|
||||
Button("Bigger") {
|
||||
if userPreferences.fontSizeScale < 1.5 {
|
||||
userPreferences.fontSizeScale += 0.1
|
||||
}
|
||||
}
|
||||
Button("Smaller") {
|
||||
if userPreferences.fontSizeScale > 0.5 {
|
||||
userPreferences.fontSizeScale -= 0.1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AppDelegate: NSObject, UIApplicationDelegate {
|
||||
|
@ -110,6 +110,7 @@ public struct StatusEditorView: View {
|
||||
}
|
||||
}
|
||||
.disabled(!viewModel.canPost)
|
||||
.keyboardShortcut(.return, modifiers: .command)
|
||||
}
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
Button {
|
||||
@ -123,6 +124,7 @@ public struct StatusEditorView: View {
|
||||
} label: {
|
||||
Text("Cancel")
|
||||
}
|
||||
.keyboardShortcut(.cancelAction)
|
||||
.confirmationDialog("",
|
||||
isPresented: $isDismissAlertPresented,
|
||||
actions: {
|
||||
|
@ -115,6 +115,7 @@ public struct TimelineView: View {
|
||||
} label: {
|
||||
Text(viewModel.pendingStatusesButtonTitle)
|
||||
}
|
||||
.keyboardShortcut("r", modifiers: .command)
|
||||
.buttonStyle(.bordered)
|
||||
.background(.thinMaterial)
|
||||
.cornerRadius(8)
|
||||
|
Loading…
Reference in New Issue
Block a user