This commit is contained in:
世界
2023-08-05 21:27:52 +08:00
parent b5e682021b
commit ba8cd27b70
6 changed files with 46 additions and 37 deletions
@@ -32,7 +32,6 @@ public struct ActiveDashboardView: View {
} }
.pickerStyle(.segmented) .pickerStyle(.segmented)
#if os(iOS) #if os(iOS)
.padding([.leading, .trailing]) .padding([.leading, .trailing])
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
#endif #endif
@@ -71,16 +71,17 @@ public struct DashboardView: View {
@State private var alert: Alert? @State private var alert: Alert?
var body: some View { var body: some View {
VStack {
ActiveDashboardView() ActiveDashboardView()
.environmentObject(profile) .environmentObject(profile)
EmptyView() }
.alertBinding($alert) .alertBinding($alert)
.onChangeCompat(of: profile.status) { newValue in .onChangeCompat(of: profile.status) { newValue in
if newValue == .disconnecting || newValue == .connected { if newValue == .disconnecting || newValue == .connected {
Task.detached { Task.detached {
if let serviceError = try? String(contentsOf: ExtensionProvider.errorFile) { if let serviceError = try? String(contentsOf: ExtensionProvider.errorFile) {
DispatchQueue.main.async { DispatchQueue.main.async {
alert = Alert(errorMessage: serviceError) alert = Alert(title: Text("Service Error"), message: Text(serviceError))
} }
try? FileManager.default.removeItem(at: ExtensionProvider.errorFile) try? FileManager.default.removeItem(at: ExtensionProvider.errorFile)
} }
@@ -25,6 +25,9 @@ public struct OverviewView: View {
if ApplicationLibrary.inPreview || profile.status.isConnected { if ApplicationLibrary.inPreview || profile.status.isConnected {
ExtensionStatusView() ExtensionStatusView()
} }
if profileList.isEmpty {
Text("Empty profiles")
} else {
FormView { FormView {
#if os(iOS) || os(tvOS) #if os(iOS) || os(tvOS)
StartStopButton() StartStopButton()
@@ -48,6 +51,8 @@ public struct OverviewView: View {
#endif #endif
} }
} }
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
.alertBinding($alert) .alertBinding($alert)
.onChangeCompat(of: selectedProfileID) { .onChangeCompat(of: selectedProfileID) {
reasserting = true reasserting = true
@@ -27,7 +27,7 @@ public struct GroupListView: View {
}.padding() }.padding()
} }
} else { } else {
Text("Empty groups") Text("Empty Groups")
} }
} }
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
@@ -79,7 +79,7 @@ public struct ProfileView: View {
} }
#endif #endif
if profileList.isEmpty { if profileList.isEmpty {
Text("Empty Profiles") Text("Empty profiles")
} else { } else {
List { List {
ForEach(profileList, id: \.mustID) { profile in ForEach(profileList, id: \.mustID) { profile in
@@ -99,7 +99,7 @@ public struct ProfileView: View {
} }
#elseif os(macOS) #elseif os(macOS)
if profileList.isEmpty { if profileList.isEmpty {
Text("Empty Profiles") Text("Empty profiles")
} else { } else {
FormView { FormView {
List { List {
+4
View File
@@ -1,7 +1,11 @@
import Foundation import Foundation
public enum FilePath { public enum FilePath {
#if !NEXT
public static let packageName = "io.nekohasekai.sfa" public static let packageName = "io.nekohasekai.sfa"
#else
public static let packageName = "io.nekohasekai.sfa.next"
#endif
} }
public extension FilePath { public extension FilePath {