2020-06-27 18:22:01 +02:00
|
|
|
//
|
2020-06-29 04:05:49 +02:00
|
|
|
// MainApp.swift
|
2020-06-27 18:22:01 +02:00
|
|
|
// Shared
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 6/27/20.
|
|
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
@main
|
2020-06-29 04:05:49 +02:00
|
|
|
struct MainApp: App {
|
2020-06-28 10:05:01 +02:00
|
|
|
|
|
|
|
#if os(macOS)
|
|
|
|
@NSApplicationDelegateAdaptor(AppDelegate.self) private var delegate
|
|
|
|
#endif
|
|
|
|
#if os(iOS)
|
|
|
|
@UIApplicationDelegateAdaptor(AppDelegate.self) private var delegate
|
|
|
|
#endif
|
|
|
|
|
2020-06-28 21:21:43 +02:00
|
|
|
@StateObject private var sceneModel = SceneModel()
|
2020-07-02 03:57:36 +02:00
|
|
|
@StateObject private var defaults = AppDefaults.shared
|
2020-07-03 14:31:48 +02:00
|
|
|
@State private var showSheet = false
|
2020-06-28 21:21:43 +02:00
|
|
|
|
2020-06-29 14:36:54 +02:00
|
|
|
@SceneBuilder var body: some Scene {
|
|
|
|
#if os(macOS)
|
|
|
|
WindowGroup {
|
2020-06-28 21:21:43 +02:00
|
|
|
SceneNavigationView()
|
|
|
|
.frame(minWidth: 600, idealWidth: 1000, maxWidth: .infinity, minHeight: 600, idealHeight: 700, maxHeight: .infinity)
|
|
|
|
.environmentObject(sceneModel)
|
2020-07-02 12:46:56 +02:00
|
|
|
.environmentObject(defaults)
|
2020-07-06 02:49:07 +02:00
|
|
|
.onAppear {
|
|
|
|
sceneModel.startup()
|
|
|
|
}
|
2020-07-03 14:31:48 +02:00
|
|
|
.sheet(isPresented: $showSheet, onDismiss: { showSheet = false }) {
|
2020-07-03 17:43:20 +02:00
|
|
|
AddWebFeedView()
|
2020-07-03 14:31:48 +02:00
|
|
|
}
|
2020-06-29 15:19:51 +02:00
|
|
|
.toolbar {
|
|
|
|
|
2020-07-04 02:19:40 +02:00
|
|
|
ToolbarItem() {
|
2020-07-04 02:29:25 +02:00
|
|
|
Menu {
|
|
|
|
Button("Add Web Feed", action: { showSheet = true })
|
|
|
|
Button("Add Reddit Feed", action: { })
|
|
|
|
Button("Add Twitter Feed", action: { })
|
|
|
|
Button("Add Folder", action: { })
|
|
|
|
} label : {
|
2020-07-04 02:19:40 +02:00
|
|
|
AppAssets.addMenuImage
|
2020-07-04 02:29:25 +02:00
|
|
|
}
|
2020-06-29 15:19:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ToolbarItem {
|
|
|
|
Button(action: {}, label: {
|
2020-07-04 02:19:40 +02:00
|
|
|
AppAssets.refreshImage
|
2020-06-29 15:19:51 +02:00
|
|
|
}).help("Refresh").padding(.trailing, 40)
|
|
|
|
}
|
2020-07-04 02:19:40 +02:00
|
|
|
|
2020-06-29 15:19:51 +02:00
|
|
|
ToolbarItem {
|
|
|
|
Button(action: {}, label: {
|
2020-07-04 02:19:40 +02:00
|
|
|
AppAssets.markAllAsReadImagePDF
|
|
|
|
.resizable()
|
|
|
|
.scaledToFit()
|
|
|
|
.frame(width: 20, height: 20, alignment: .center)
|
2020-06-29 15:19:51 +02:00
|
|
|
}).help("Mark All as Read")
|
|
|
|
}
|
|
|
|
|
2020-07-04 02:19:40 +02:00
|
|
|
ToolbarItem {
|
|
|
|
MacSearchField()
|
|
|
|
.frame(width: 200)
|
|
|
|
}
|
|
|
|
|
2020-06-29 15:19:51 +02:00
|
|
|
ToolbarItem {
|
|
|
|
Button(action: {}, label: {
|
2020-07-04 02:19:40 +02:00
|
|
|
AppAssets.nextUnreadArticleImage
|
|
|
|
}).help("Go to Next Unread").padding(.trailing, 40)
|
2020-06-29 15:19:51 +02:00
|
|
|
}
|
2020-07-04 02:19:40 +02:00
|
|
|
|
2020-06-29 15:19:51 +02:00
|
|
|
ToolbarItem {
|
|
|
|
Button(action: {}, label: {
|
2020-07-06 01:53:18 +02:00
|
|
|
AppAssets.starOpenImage
|
2020-06-29 15:19:51 +02:00
|
|
|
}).help("Mark as Starred")
|
|
|
|
}
|
|
|
|
ToolbarItem {
|
|
|
|
Button(action: {}, label: {
|
2020-07-06 01:53:18 +02:00
|
|
|
AppAssets.readClosedImage
|
2020-06-29 15:19:51 +02:00
|
|
|
}).help("Mark as Unread")
|
|
|
|
}
|
|
|
|
ToolbarItem {
|
|
|
|
Button(action: {}, label: {
|
2020-07-04 02:19:40 +02:00
|
|
|
AppAssets.openInBrowserImage
|
2020-06-29 15:19:51 +02:00
|
|
|
}).help("Open in Browser")
|
|
|
|
}
|
|
|
|
ToolbarItem {
|
|
|
|
Button(action: {}, label: {
|
2020-07-04 02:19:40 +02:00
|
|
|
AppAssets.shareImage
|
2020-06-29 15:19:51 +02:00
|
|
|
}).help("Share")
|
|
|
|
}
|
|
|
|
|
2020-07-04 02:19:40 +02:00
|
|
|
|
2020-06-29 15:19:51 +02:00
|
|
|
}
|
2020-06-29 14:36:54 +02:00
|
|
|
}
|
|
|
|
.commands {
|
|
|
|
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])
|
|
|
|
})
|
|
|
|
}
|
|
|
|
.windowToolbarStyle(UnifiedWindowToolbarStyle())
|
2020-06-29 15:04:50 +02:00
|
|
|
|
|
|
|
// Mac Preferences
|
|
|
|
Settings {
|
|
|
|
MacPreferencesView()
|
|
|
|
.padding()
|
|
|
|
.frame(width: 500)
|
|
|
|
.navigationTitle("Preferences")
|
2020-07-02 03:57:36 +02:00
|
|
|
.environmentObject(defaults)
|
2020-06-29 15:04:50 +02:00
|
|
|
}
|
|
|
|
.windowToolbarStyle(UnifiedWindowToolbarStyle())
|
|
|
|
|
2020-06-29 14:36:54 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if os(iOS)
|
|
|
|
WindowGroup {
|
2020-06-28 21:21:43 +02:00
|
|
|
SceneNavigationView()
|
|
|
|
.environmentObject(sceneModel)
|
2020-07-02 12:46:56 +02:00
|
|
|
.environmentObject(defaults)
|
2020-07-03 09:05:12 +02:00
|
|
|
.modifier(PreferredColorSchemeModifier(preferredColorScheme: defaults.userInterfaceColorPalette))
|
2020-07-06 02:49:07 +02:00
|
|
|
.onAppear {
|
|
|
|
sceneModel.startup()
|
|
|
|
}
|
2020-07-03 09:05:12 +02:00
|
|
|
}
|
|
|
|
.commands {
|
2020-06-29 14:36:54 +02: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")
|
|
|
|
})
|
|
|
|
CommandGroup(before: .sidebar, addition: {
|
|
|
|
Button("Show Sidebar", action: {})
|
|
|
|
.keyboardShortcut("S", modifiers: [.control, .command])
|
|
|
|
})
|
|
|
|
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])
|
|
|
|
})
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2020-06-27 18:22:01 +02:00
|
|
|
}
|