mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-21 05:46:03 +00:00
Improve user manual
This commit is contained in:
1 parent
28e0ede409
commit
b5de24d926
5 files changed
+1361
-105
No files matched your search
@@ -27,6 +27,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
private var errorAlertHandler = ErrorAlertHandler.shared
|
private var errorAlertHandler = ErrorAlertHandler.shared
|
||||||
|
|
||||||
private var receiveModel: ReceiveModel?
|
private var receiveModel: ReceiveModel?
|
||||||
|
private let welcomeNavigationState = WelcomeScreenNavigationState()
|
||||||
|
|
||||||
var showsFirewallAlert = false
|
var showsFirewallAlert = false
|
||||||
var visibleItem: NSMenuItem? = nil
|
var visibleItem: NSMenuItem? = nil
|
||||||
@@ -233,7 +234,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
|
|
||||||
// MARK: - Button Actions
|
// MARK: - Button Actions
|
||||||
|
|
||||||
@objc private func visibleMenuItemSelected() {}
|
@objc private func visibleMenuItemSelected() {
|
||||||
|
showMainWindow(selectedTab: .settings)
|
||||||
|
}
|
||||||
|
|
||||||
@objc func sendClipboard() {
|
@objc func sendClipboard() {
|
||||||
|
|
||||||
@@ -252,6 +255,15 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
|
|
||||||
|
|
||||||
@objc func openMainWindow() {
|
@objc func openMainWindow() {
|
||||||
|
showMainWindow()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private func showMainWindow(selectedTab: Tab? = nil) {
|
||||||
|
if let selectedTab {
|
||||||
|
welcomeNavigationState.select(selectedTab)
|
||||||
|
}
|
||||||
|
|
||||||
defer {
|
defer {
|
||||||
if let welcomeWindow, !Settings.sharedInstance.appLaunchedBefore {
|
if let welcomeWindow, !Settings.sharedInstance.appLaunchedBefore {
|
||||||
runAfter(seconds: 0.2) {
|
runAfter(seconds: 0.2) {
|
||||||
@@ -278,7 +290,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
openPlusScreen: openPlusScreen,
|
openPlusScreen: openPlusScreen,
|
||||||
openAppAdvertisementView: { self.openSheetView(type: .downloadAndroidApp) },
|
openAppAdvertisementView: { self.openSheetView(type: .downloadAndroidApp) },
|
||||||
openCableTransmissionView: { self.openSheetView(type: .downloadCableConnectionApp) },
|
openCableTransmissionView: { self.openSheetView(type: .downloadCableConnectionApp) },
|
||||||
checkForNetworkIssues: performDeviceToDeviceCheck
|
checkForNetworkIssues: performDeviceToDeviceCheck,
|
||||||
|
navigationState: welcomeNavigationState
|
||||||
)
|
)
|
||||||
|
|
||||||
welcomeWindow = NSWindow(
|
welcomeWindow = NSWindow(
|
||||||
|
|||||||
+1204
-39
File diff suppressed because it is too large.
Load diff
@@ -11,10 +11,14 @@ import LUI
|
|||||||
|
|
||||||
struct SettingsView: View {
|
struct SettingsView: View {
|
||||||
|
|
||||||
|
let openPlus: () -> Void
|
||||||
|
|
||||||
@ObservedObject var settings = Settings.sharedInstance
|
@ObservedObject var settings = Settings.sharedInstance
|
||||||
@ObservedObject var connectionManager = NearbyConnectionManager.shared
|
@ObservedObject var connectionManager = NearbyConnectionManager.shared
|
||||||
|
@ObservedObject var iapManager = IAPManager.sharedInstance
|
||||||
|
|
||||||
@State private var isChangeDeviceNameAlertPresented = false
|
@State private var isChangeDeviceNameAlertPresented = false
|
||||||
|
@State private var licenseWindow: NSWindow?
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
|
||||||
@@ -68,17 +72,33 @@ struct SettingsView: View {
|
|||||||
Divider()
|
Divider()
|
||||||
.padding(.vertical, 10)
|
.padding(.vertical, 10)
|
||||||
|
|
||||||
Button {
|
HStack(spacing: 30) {
|
||||||
openTrustedDevicesWindow()
|
SettingsFooterButton("ManageTrustedDevices") {
|
||||||
} label: {
|
openTrustedDevicesWindow()
|
||||||
Text("ManageTrustedDevices")
|
}
|
||||||
.underline()
|
|
||||||
.font(.subheadline)
|
SettingsFooterButton("Acknowledgements") {
|
||||||
.opacity(0.5)
|
licenseWindow = openLicenseWindow()
|
||||||
.frame(maxWidth: .infinity)
|
}
|
||||||
.padding(.vertical, 15)
|
|
||||||
|
#if !GITHUB
|
||||||
|
if !iapManager.plusVersionState {
|
||||||
|
SettingsFooterButton("SupportQuickDrop") {
|
||||||
|
openPlus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
SettingsFooterButton("ResetAllSettings") {
|
||||||
|
IAPManager.sharedInstance.plusVersionState = false
|
||||||
|
Settings.sharedInstance.deleteAllUserDefaults()
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
.buttonStyle(PlainButtonStyle())
|
.minimumScaleFactor(0.7)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.padding(.vertical, 15)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -194,7 +214,31 @@ struct SettingsView: View {
|
|||||||
|
|
||||||
struct SettingsView_Previews: PreviewProvider {
|
struct SettingsView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
SettingsView()
|
SettingsView(openPlus: {})
|
||||||
.frame(width: 800, height: 500)
|
.frame(width: 800, height: 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private struct SettingsFooterButton: View {
|
||||||
|
let title: String
|
||||||
|
let action: () -> Void
|
||||||
|
|
||||||
|
init(_ title: String, action: @escaping () -> Void) {
|
||||||
|
self.title = title
|
||||||
|
self.action = action
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Button {
|
||||||
|
action()
|
||||||
|
} label: {
|
||||||
|
Text(title.localized())
|
||||||
|
.underline()
|
||||||
|
.font(.subheadline)
|
||||||
|
.lineLimit(1)
|
||||||
|
.opacity(0.5)
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,12 +12,8 @@ import SwiftUI
|
|||||||
struct TutorialView: View {
|
struct TutorialView: View {
|
||||||
|
|
||||||
let tab: Tab
|
let tab: Tab
|
||||||
let openPlus: () -> Void
|
|
||||||
let openAppAdvertisementView: () -> Void
|
let openAppAdvertisementView: () -> Void
|
||||||
|
|
||||||
@State private var licenseWindow: NSWindow?
|
|
||||||
@ObservedObject var iapManager = IAPManager.sharedInstance
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
|
||||||
LargeAppIconView(title: tab.title) {
|
LargeAppIconView(title: tab.title) {
|
||||||
@@ -35,7 +31,7 @@ struct TutorialView: View {
|
|||||||
.padding(.top)
|
.padding(.top)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Text(tab.text.localized())
|
Text(tab.text)
|
||||||
.multilineTextAlignment(.leading)
|
.multilineTextAlignment(.leading)
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
.padding()
|
.padding()
|
||||||
@@ -44,51 +40,22 @@ struct TutorialView: View {
|
|||||||
.frame(width: 550)
|
.frame(width: 550)
|
||||||
|
|
||||||
if tab == .receive {
|
if tab == .receive {
|
||||||
HStack(spacing: 30) {
|
Button {
|
||||||
|
showSamsungOneUI85Alert()
|
||||||
Button {
|
} label: {
|
||||||
licenseWindow = openLicenseWindow()
|
Text("SamsungOneUI85HelpLink".localized())
|
||||||
} label: {
|
.underline()
|
||||||
Text("Acknowledgements")
|
.font(.footnote)
|
||||||
.underline()
|
.multilineTextAlignment(.center)
|
||||||
.font(.footnote)
|
.opacity(0.7)
|
||||||
.opacity(0.5)
|
|
||||||
}
|
|
||||||
.buttonStyle(.plain)
|
|
||||||
|
|
||||||
#if !GITHUB
|
|
||||||
if !iapManager.plusVersionState {
|
|
||||||
Button {
|
|
||||||
openPlus()
|
|
||||||
} label: {
|
|
||||||
Text("SupportQuickDrop")
|
|
||||||
.underline()
|
|
||||||
.font(.footnote)
|
|
||||||
.opacity(0.5)
|
|
||||||
}
|
|
||||||
.buttonStyle(.plain)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
Button {
|
|
||||||
IAPManager.sharedInstance.plusVersionState = false
|
|
||||||
Settings.sharedInstance.deleteAllUserDefaults()
|
|
||||||
} label: {
|
|
||||||
Text("ResetAllSettings")
|
|
||||||
.underline()
|
|
||||||
.font(.footnote)
|
|
||||||
.opacity(0.5)
|
|
||||||
}
|
|
||||||
.buttonStyle(.plain)
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
else if tab == .send {
|
else if tab == .send {
|
||||||
EnableExtensionView()
|
EnableExtensionView()
|
||||||
}
|
}
|
||||||
else if tab == .notificationSync {
|
else if tab == .notificationSync || tab == .clipboardSync {
|
||||||
Button {
|
Button {
|
||||||
openAppAdvertisementView()
|
openAppAdvertisementView()
|
||||||
} label: {
|
} label: {
|
||||||
@@ -100,6 +67,21 @@ struct TutorialView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func showSamsungOneUI85Alert() {
|
||||||
|
let alert = NSAlert()
|
||||||
|
alert.alertStyle = .informational
|
||||||
|
alert.messageText = "SamsungOneUI85AlertTitle".localized()
|
||||||
|
alert.informativeText = "SamsungOneUI85AlertMessage".localized()
|
||||||
|
alert.addButton(withTitle: "CloseAlert".localized())
|
||||||
|
|
||||||
|
if let window = NSApp.mainWindow ?? NSApp.keyWindow {
|
||||||
|
alert.beginSheetModal(for: window) { _ in }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
alert.runModal()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -198,5 +180,5 @@ private struct SharingPickerPresenter: NSViewRepresentable {
|
|||||||
|
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
WelcomeScreen(openPlusScreen: {}, openAppAdvertisementView: {}, openCableTransmissionView: {}, checkForNetworkIssues: {})
|
WelcomeScreen(openPlusScreen: {}, openAppAdvertisementView: {}, openCableTransmissionView: {}, checkForNetworkIssues: {}, navigationState: WelcomeScreenNavigationState())
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,25 @@ import SwiftUI
|
|||||||
import UniformTypeIdentifiers
|
import UniformTypeIdentifiers
|
||||||
import LUI
|
import LUI
|
||||||
|
|
||||||
|
struct WelcomeScreenNavigationRequest {
|
||||||
|
let tab: Tab
|
||||||
|
let id = UUID()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
final class WelcomeScreenNavigationState: ObservableObject {
|
||||||
|
@Published private(set) var request: WelcomeScreenNavigationRequest
|
||||||
|
|
||||||
|
init(selection: Tab = .receive) {
|
||||||
|
self.request = WelcomeScreenNavigationRequest(tab: selection)
|
||||||
|
}
|
||||||
|
|
||||||
|
func select(_ tab: Tab) {
|
||||||
|
request = WelcomeScreenNavigationRequest(tab: tab)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct WelcomeScreen: View {
|
struct WelcomeScreen: View {
|
||||||
|
|
||||||
static let width: CGFloat = 1000
|
static let width: CGFloat = 1000
|
||||||
@@ -21,7 +40,23 @@ struct WelcomeScreen: View {
|
|||||||
let openCableTransmissionView: () -> Void
|
let openCableTransmissionView: () -> Void
|
||||||
let checkForNetworkIssues: () -> Void
|
let checkForNetworkIssues: () -> Void
|
||||||
|
|
||||||
@State private var selection: Tab = Tab.receive
|
@ObservedObject var navigationState: WelcomeScreenNavigationState
|
||||||
|
@State private var selection: Tab
|
||||||
|
|
||||||
|
init(
|
||||||
|
openPlusScreen: @escaping () -> Void,
|
||||||
|
openAppAdvertisementView: @escaping () -> Void,
|
||||||
|
openCableTransmissionView: @escaping () -> Void,
|
||||||
|
checkForNetworkIssues: @escaping () -> Void,
|
||||||
|
navigationState: WelcomeScreenNavigationState
|
||||||
|
) {
|
||||||
|
self.openPlusScreen = openPlusScreen
|
||||||
|
self.openAppAdvertisementView = openAppAdvertisementView
|
||||||
|
self.openCableTransmissionView = openCableTransmissionView
|
||||||
|
self.checkForNetworkIssues = checkForNetworkIssues
|
||||||
|
self.navigationState = navigationState
|
||||||
|
_selection = State(initialValue: navigationState.request.tab)
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
|
||||||
@@ -35,7 +70,7 @@ struct WelcomeScreen: View {
|
|||||||
)
|
)
|
||||||
|
|
||||||
List(selection: listBinding) {
|
List(selection: listBinding) {
|
||||||
ForEach(Tab.allCases.filter({$0 != .settings }), id: \.self) { tab in
|
ForEach([Tab.receive, .send, .notificationSync, .clipboardSync], id: \.self) { tab in
|
||||||
Label(tab.sidebarTitle, systemImage: tab.systemImage)
|
Label(tab.sidebarTitle, systemImage: tab.systemImage)
|
||||||
.tag(tab)
|
.tag(tab)
|
||||||
.frame(height: 30)
|
.frame(height: 30)
|
||||||
@@ -43,6 +78,12 @@ struct WelcomeScreen: View {
|
|||||||
|
|
||||||
Divider()
|
Divider()
|
||||||
|
|
||||||
|
Label(Tab.troubleshooting.sidebarTitle, systemImage: Tab.troubleshooting.systemImage)
|
||||||
|
.tag(Tab.troubleshooting)
|
||||||
|
.frame(height: 30)
|
||||||
|
|
||||||
|
Divider()
|
||||||
|
|
||||||
ExternalLinkLabel(label: "GetSupport", icon: "questionmark.circle") {
|
ExternalLinkLabel(label: "GetSupport", icon: "questionmark.circle") {
|
||||||
LogExportPresenter.showUploadLogsAlert(openSupportMailWhenNotUploading: true)
|
LogExportPresenter.showUploadLogsAlert(openSupportMailWhenNotUploading: true)
|
||||||
}
|
}
|
||||||
@@ -76,12 +117,11 @@ struct WelcomeScreen: View {
|
|||||||
Color.defaultBackground.edgesIgnoringSafeArea(.vertical)
|
Color.defaultBackground.edgesIgnoringSafeArea(.vertical)
|
||||||
|
|
||||||
if selection == .settings {
|
if selection == .settings {
|
||||||
SettingsView()
|
SettingsView(openPlus: openPlusScreen)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TutorialView(
|
TutorialView(
|
||||||
tab: selection,
|
tab: selection,
|
||||||
openPlus: openPlusScreen,
|
|
||||||
openAppAdvertisementView: openAppAdvertisementView
|
openAppAdvertisementView: openAppAdvertisementView
|
||||||
)
|
)
|
||||||
.onAppear {
|
.onAppear {
|
||||||
@@ -92,6 +132,11 @@ struct WelcomeScreen: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.onReceive(navigationState.$request) { request in
|
||||||
|
if selection != request.tab {
|
||||||
|
selection = request.tab
|
||||||
|
}
|
||||||
|
}
|
||||||
.onDrop(of: [.fileURL], isTargeted: nil) { providers in
|
.onDrop(of: [.fileURL], isTargeted: nil) { providers in
|
||||||
handleDrop(providers: providers)
|
handleDrop(providers: providers)
|
||||||
return true
|
return true
|
||||||
@@ -182,6 +227,7 @@ enum Tab: CaseIterable {
|
|||||||
case receive
|
case receive
|
||||||
case send
|
case send
|
||||||
case notificationSync
|
case notificationSync
|
||||||
|
case clipboardSync
|
||||||
case troubleshooting
|
case troubleshooting
|
||||||
case settings
|
case settings
|
||||||
|
|
||||||
@@ -193,6 +239,8 @@ enum Tab: CaseIterable {
|
|||||||
return "SendFiles".localized()
|
return "SendFiles".localized()
|
||||||
case .notificationSync:
|
case .notificationSync:
|
||||||
return "NotificationSyncSidebar".localized()
|
return "NotificationSyncSidebar".localized()
|
||||||
|
case .clipboardSync:
|
||||||
|
return "ClipboardSyncSidebar".localized()
|
||||||
case .troubleshooting:
|
case .troubleshooting:
|
||||||
return "TroubleshootingAndFaq".localized()
|
return "TroubleshootingAndFaq".localized()
|
||||||
case .settings:
|
case .settings:
|
||||||
@@ -210,11 +258,13 @@ enum Tab: CaseIterable {
|
|||||||
var text: String {
|
var text: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .receive:
|
case .receive:
|
||||||
"UserManualDescription"
|
"UserManualDescription".localized()
|
||||||
case .send:
|
case .send:
|
||||||
"SendFilesDescription"
|
"SendFilesDescription".localized()
|
||||||
case .notificationSync:
|
case .notificationSync:
|
||||||
"NotificationSyncManualDescription"
|
"NotificationSyncManualDescription".localized()
|
||||||
|
case .clipboardSync:
|
||||||
|
"ClipboardSyncManualDescription".localized()
|
||||||
default:
|
default:
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
@@ -228,6 +278,8 @@ enum Tab: CaseIterable {
|
|||||||
return "tray.and.arrow.up"
|
return "tray.and.arrow.up"
|
||||||
case .notificationSync:
|
case .notificationSync:
|
||||||
return "bell"
|
return "bell"
|
||||||
|
case .clipboardSync:
|
||||||
|
return "clipboard"
|
||||||
case .troubleshooting:
|
case .troubleshooting:
|
||||||
return "exclamationmark.triangle"
|
return "exclamationmark.triangle"
|
||||||
case .settings:
|
case .settings:
|
||||||
@@ -238,5 +290,5 @@ enum Tab: CaseIterable {
|
|||||||
|
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
WelcomeScreen(openPlusScreen: {}, openAppAdvertisementView: {}, openCableTransmissionView: {}, checkForNetworkIssues: {})
|
WelcomeScreen(openPlusScreen: {}, openAppAdvertisementView: {}, openCableTransmissionView: {}, checkForNetworkIssues: {}, navigationState: WelcomeScreenNavigationState())
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user