fix
This commit is contained in:
parent
c0a60a2f3f
commit
c123af8a47
@ -20,6 +20,7 @@ enum NetworkShowMode: String, CaseIterable {
|
|||||||
// MARK: - 主网络视图
|
// MARK: - 主网络视图
|
||||||
struct NetworkView: View {
|
struct NetworkView: View {
|
||||||
@Environment(AppContext.self) var appContext: AppContext
|
@Environment(AppContext.self) var appContext: AppContext
|
||||||
|
@Environment(\.openWindow) var openWindow
|
||||||
|
|
||||||
@State private var showMode: NetworkShowMode = .resource
|
@State private var showMode: NetworkShowMode = .resource
|
||||||
@State private var connectState: ConnectState = .disconnected
|
@State private var connectState: ConnectState = .disconnected
|
||||||
@ -68,7 +69,9 @@ struct NetworkView: View {
|
|||||||
.frame(width: 160)
|
.frame(width: 160)
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsLink {
|
Button {
|
||||||
|
openWindow(id: "settings")
|
||||||
|
} label: {
|
||||||
Image(systemName: "slider.horizontal.3")
|
Image(systemName: "slider.horizontal.3")
|
||||||
.font(.system(size: 14))
|
.font(.system(size: 14))
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|||||||
@ -100,6 +100,7 @@ extension SettingsAccountView {
|
|||||||
struct AccountCreditView: View {
|
struct AccountCreditView: View {
|
||||||
@Environment(AppContext.self) var appContext: AppContext
|
@Environment(AppContext.self) var appContext: AppContext
|
||||||
@Environment(\.openWindow) var openWindow
|
@Environment(\.openWindow) var openWindow
|
||||||
|
@Environment(\.dismissWindow) var dismissWindow
|
||||||
|
|
||||||
let username: String
|
let username: String
|
||||||
|
|
||||||
@ -116,6 +117,7 @@ extension SettingsAccountView {
|
|||||||
try await appContext.logout()
|
try await appContext.logout()
|
||||||
}
|
}
|
||||||
self.appContext.appScene = .login(username: username)
|
self.appContext.appScene = .login(username: username)
|
||||||
|
self.dismissWindow(id: "settings")
|
||||||
self.openWindow(id: "main")
|
self.openWindow(id: "main")
|
||||||
}
|
}
|
||||||
.buttonStyle(.bordered)
|
.buttonStyle(.bordered)
|
||||||
@ -129,6 +131,7 @@ extension SettingsAccountView {
|
|||||||
struct TokenCreditView: View {
|
struct TokenCreditView: View {
|
||||||
@Environment(AppContext.self) var appContext: AppContext
|
@Environment(AppContext.self) var appContext: AppContext
|
||||||
@Environment(\.openWindow) var openWindow
|
@Environment(\.openWindow) var openWindow
|
||||||
|
@Environment(\.dismissWindow) var dismissWindow
|
||||||
|
|
||||||
let token: String
|
let token: String
|
||||||
|
|
||||||
@ -139,8 +142,8 @@ extension SettingsAccountView {
|
|||||||
try await appContext.logout()
|
try await appContext.logout()
|
||||||
}
|
}
|
||||||
self.appContext.appScene = .login(username: nil)
|
self.appContext.appScene = .login(username: nil)
|
||||||
|
self.dismissWindow(id: "settings")
|
||||||
self.openWindow(id: "main")
|
self.openWindow(id: "main")
|
||||||
// 执行关闭当前窗口的操作
|
|
||||||
}
|
}
|
||||||
.buttonStyle(.bordered)
|
.buttonStyle(.bordered)
|
||||||
.foregroundColor(.red)
|
.foregroundColor(.red)
|
||||||
|
|||||||
@ -67,7 +67,7 @@ struct punchnetApp: App {
|
|||||||
.defaultPosition(.center)
|
.defaultPosition(.center)
|
||||||
.windowStyle(.hiddenTitleBar)
|
.windowStyle(.hiddenTitleBar)
|
||||||
|
|
||||||
Settings {
|
Window("settings", id: "settings") {
|
||||||
SettingsView()
|
SettingsView()
|
||||||
.environment(self.appContext)
|
.environment(self.appContext)
|
||||||
.frame(width: 750, height: 450)
|
.frame(width: 750, height: 450)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user