2020-06-27 11:22:01 -05:00
|
|
|
//
|
2020-06-28 21:05:49 -05:00
|
|
|
// MainApp.swift
|
2020-06-27 11:22:01 -05:00
|
|
|
// Shared
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 6/27/20.
|
|
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
@main
|
2020-06-28 21:05:49 -05:00
|
|
|
struct MainApp: App {
|
2020-06-28 03:05:01 -05:00
|
|
|
|
|
|
|
#if os(macOS)
|
|
|
|
@NSApplicationDelegateAdaptor(AppDelegate.self) private var delegate
|
2020-08-05 20:06:44 +08:00
|
|
|
@State private var selectedPane: MacPreferencePane = .general
|
2020-06-28 03:05:01 -05:00
|
|
|
#endif
|
|
|
|
#if os(iOS)
|
|
|
|
@UIApplicationDelegateAdaptor(AppDelegate.self) private var delegate
|
|
|
|
#endif
|
|
|
|
|
2020-07-15 12:56:19 -05:00
|
|
|
@StateObject private var refreshProgress = RefreshProgressModel()
|
2020-07-02 09:57:36 +08:00
|
|
|
@StateObject private var defaults = AppDefaults.shared
|
2020-08-05 20:06:44 +08:00
|
|
|
|
2020-06-29 20:36:54 +08:00
|
|
|
@SceneBuilder var body: some Scene {
|
|
|
|
#if os(macOS)
|
|
|
|
WindowGroup {
|
2020-06-28 14:21:43 -05:00
|
|
|
SceneNavigationView()
|
|
|
|
.frame(minWidth: 600, idealWidth: 1000, maxWidth: .infinity, minHeight: 600, idealHeight: 700, maxHeight: .infinity)
|
2020-07-15 15:32:04 -05:00
|
|
|
.onAppear { refreshProgress.startup() }
|
2020-07-15 12:56:19 -05:00
|
|
|
.environmentObject(refreshProgress)
|
2020-07-15 15:32:04 -05:00
|
|
|
.environmentObject(defaults)
|
2020-07-14 14:57:55 +08:00
|
|
|
.preferredColorScheme(AppDefaults.userInterfaceColorScheme)
|
2020-06-29 20:36:54 +08:00
|
|
|
}
|
2020-07-07 16:05:26 -05:00
|
|
|
.windowToolbarStyle(UnifiedWindowToolbarStyle())
|
2020-06-29 20:36:54 +08:00
|
|
|
.commands {
|
2020-08-04 21:11:06 -05:00
|
|
|
SidebarCommands()
|
2020-06-29 20:36:54 +08:00
|
|
|
CommandGroup(after: .newItem, addition: {
|
|
|
|
Button("New Feed", action: {})
|
|
|
|
.keyboardShortcut("N")
|
|
|
|
Button("New Folder", action: {})
|
|
|
|
.keyboardShortcut("N", modifiers: [.shift, .command])
|
|
|
|
Button("Refresh", action: {})
|
|
|
|
.keyboardShortcut("R")
|
|
|
|
})
|
|
|
|
CommandMenu("Subscriptions", content: {
|
|
|
|
Button("Import Subscriptions", action: {})
|
|
|
|
.keyboardShortcut("I", modifiers: [.shift, .command])
|
|
|
|
Button("Import NNW 3 Subscriptions", action: {})
|
|
|
|
.keyboardShortcut("O", modifiers: [.shift, .command])
|
|
|
|
Button("Export Subscriptions", action: {})
|
|
|
|
.keyboardShortcut("E", modifiers: [.shift, .command])
|
|
|
|
})
|
|
|
|
CommandMenu("Go", content: {
|
|
|
|
Button("Next Unread", action: {})
|
|
|
|
.keyboardShortcut("/", modifiers: [.command])
|
|
|
|
Button("Today", action: {})
|
|
|
|
.keyboardShortcut("1", modifiers: [.command])
|
|
|
|
Button("All Unread", action: {})
|
|
|
|
.keyboardShortcut("2", modifiers: [.command])
|
|
|
|
Button("Starred", action: {})
|
|
|
|
.keyboardShortcut("3", modifiers: [.command])
|
|
|
|
})
|
|
|
|
CommandMenu("Article", content: {
|
|
|
|
Button("Mark as Read", action: {})
|
|
|
|
.keyboardShortcut("U", modifiers: [.shift, .command])
|
|
|
|
Button("Mark All as Read", action: {})
|
|
|
|
.keyboardShortcut("K", modifiers: [.command])
|
|
|
|
Button("Mark Older as Read", action: {})
|
|
|
|
.keyboardShortcut("K", modifiers: [.shift, .command])
|
|
|
|
Button("Mark as Starred", action: {})
|
|
|
|
.keyboardShortcut("L", modifiers: [.shift, .command])
|
|
|
|
Button("Open in Browser", action: {})
|
|
|
|
.keyboardShortcut(.rightArrow, modifiers: [.command])
|
|
|
|
})
|
2020-08-13 08:24:54 +08:00
|
|
|
CommandGroup(after: .help, addition: {
|
|
|
|
Button("Release Notes", action: {
|
2020-08-15 15:08:07 +08:00
|
|
|
NSWorkspace.shared.open(URL.releaseNotes)
|
2020-08-13 08:24:54 +08:00
|
|
|
})
|
|
|
|
.keyboardShortcut("V", modifiers: [.shift, .command])
|
|
|
|
})
|
2020-06-29 20:36:54 +08:00
|
|
|
}
|
2020-06-29 21:04:50 +08:00
|
|
|
|
|
|
|
// Mac Preferences
|
|
|
|
Settings {
|
2020-08-05 20:06:44 +08:00
|
|
|
TabView(selection: $selectedPane) {
|
|
|
|
GeneralPreferencesView()
|
|
|
|
.tabItem {
|
|
|
|
Image(systemName: "gearshape")
|
|
|
|
.font(.title2)
|
|
|
|
Text("General")
|
|
|
|
}
|
|
|
|
.tag(MacPreferencePane.general)
|
|
|
|
|
|
|
|
AccountsPreferencesView()
|
|
|
|
.tabItem {
|
|
|
|
Image(systemName: "at")
|
|
|
|
.font(.title2)
|
|
|
|
Text("Accounts")
|
|
|
|
}
|
|
|
|
.tag(MacPreferencePane.accounts)
|
|
|
|
|
|
|
|
LayoutPreferencesView()
|
|
|
|
.tabItem {
|
|
|
|
Image(systemName: "eyeglasses")
|
|
|
|
.font(.title2)
|
|
|
|
Text("Viewing")
|
|
|
|
}
|
|
|
|
.tag(MacPreferencePane.viewing)
|
|
|
|
|
|
|
|
AdvancedPreferencesView()
|
|
|
|
.tabItem {
|
|
|
|
Image(systemName: "scale.3d")
|
|
|
|
.font(.title2)
|
|
|
|
Text("Advanced")
|
|
|
|
}
|
|
|
|
.tag(MacPreferencePane.advanced)
|
|
|
|
}
|
2020-08-10 08:50:46 +08:00
|
|
|
.preferredColorScheme(AppDefaults.userInterfaceColorScheme)
|
2020-06-29 21:04:50 +08:00
|
|
|
.frame(width: 500)
|
2020-08-05 20:06:44 +08:00
|
|
|
.padding()
|
2020-06-29 21:04:50 +08:00
|
|
|
}
|
2020-06-29 20:36:54 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if os(iOS)
|
|
|
|
WindowGroup {
|
2020-06-28 14:21:43 -05:00
|
|
|
SceneNavigationView()
|
2020-07-15 15:32:04 -05:00
|
|
|
.onAppear { refreshProgress.startup() }
|
2020-07-15 12:56:19 -05:00
|
|
|
.environmentObject(refreshProgress)
|
2020-07-15 15:32:04 -05:00
|
|
|
.environmentObject(defaults)
|
2020-07-17 22:18:10 +08:00
|
|
|
.preferredColorScheme(AppDefaults.userInterfaceColorScheme)
|
2020-07-03 12:35:12 +05:30
|
|
|
}
|
2020-06-29 20:36:54 +08:00
|
|
|
#endif
|
|
|
|
}
|
2020-06-27 11:22:01 -05:00
|
|
|
}
|