mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-11 11:01:07 +00:00
Refactoring
This commit is contained in:
1 parent
c1defe9eee
commit
5f9104d4da
12 files changed
+112
-46
No files matched your search
@@ -0,0 +1,126 @@
|
||||
//
|
||||
// TutorialView.swift
|
||||
// QuickDrop
|
||||
//
|
||||
// Created by Leon Böttger on 05.03.25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import NearbyShare
|
||||
|
||||
struct TutorialView: View {
|
||||
|
||||
let title: String
|
||||
let text: String
|
||||
let showsLicense: Bool
|
||||
var showsBetaJoinButton: Bool = false
|
||||
|
||||
let openPlus: () -> Void
|
||||
|
||||
@State private var licenseWindow: NSWindow?
|
||||
@State var taps = 0
|
||||
@AppStorage(UserDefaultsKeys.plusVersion.rawValue) var isPlusVersion = false
|
||||
|
||||
var body: some View {
|
||||
|
||||
LargeAppIconView(title: title) {
|
||||
VStack {
|
||||
Text(text.localized())
|
||||
.multilineTextAlignment(.leading)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.padding()
|
||||
.frame(width: 550)
|
||||
|
||||
|
||||
if showsBetaJoinButton {
|
||||
Button {
|
||||
|
||||
let betaTextBottom = "BetaEmailBottom".localized()
|
||||
|
||||
if let url = URL(string: "mailto:quickdrop-beta@leonboettger.com?subject=QuickDrop for Android Beta&body=\(betaTextBottom)") {
|
||||
NSWorkspace.shared.open(url)
|
||||
}
|
||||
} label: {
|
||||
Text("JoinBeta")
|
||||
}
|
||||
.keyboardShortcut(.defaultAction)
|
||||
.padding(.top)
|
||||
}
|
||||
|
||||
if showsLicense {
|
||||
HStack(spacing: 30) {
|
||||
|
||||
Button {
|
||||
licenseWindow = openLicenseWindow()
|
||||
} label: {
|
||||
Text("Acknowledgements")
|
||||
.underline()
|
||||
.font(.footnote)
|
||||
.opacity(0.5)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
|
||||
if !isPlusVersion {
|
||||
Button {
|
||||
openPlus()
|
||||
} label: {
|
||||
Text("SupportQuickDrop")
|
||||
.underline()
|
||||
.font(.footnote)
|
||||
.opacity(0.5)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
Button {
|
||||
for key in UserDefaultsKeys.allCases {
|
||||
UserDefaults.standard.removeObject(forKey: key.rawValue)
|
||||
}
|
||||
} label: {
|
||||
Text("Reset UD")
|
||||
.underline()
|
||||
.font(.footnote)
|
||||
.opacity(0.5)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
#endif
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct LargeAppIconView<Content: View>: View {
|
||||
|
||||
let title: String
|
||||
let bottomView: () -> Content
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
|
||||
VStack {
|
||||
Image("AppIconHighRes")
|
||||
.resizable()
|
||||
.frame(width: 150, height: 150)
|
||||
.padding(.top, 50)
|
||||
|
||||
Text(title.localized())
|
||||
.font(.largeTitle)
|
||||
.padding()
|
||||
|
||||
bottomView()
|
||||
}
|
||||
.frame(maxWidth: 500)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#Preview {
|
||||
WelcomeScreen(openPlusScreen: {}, openAppAdvertisementView: {}, openCableTransmissionView: {}, checkForNetworkIssues: {})
|
||||
}
|
||||
Reference in new issue
Block a user