From 10481fe1dcf679c9536272b0f64a0de422d80945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 19 Aug 2024 10:42:13 +0800 Subject: [PATCH] Fixes --- .../Connections/ConnectionListView.swift | 2 + .../Views/Dashboard/ActiveDashboardView.swift | 68 ++++--------------- .../Views/Dashboard/DashboardPage.swift | 2 +- sing-box.xcodeproj/project.pbxproj | 8 +-- 4 files changed, 22 insertions(+), 58 deletions(-) diff --git a/ApplicationLibrary/Views/Connections/ConnectionListView.swift b/ApplicationLibrary/Views/Connections/ConnectionListView.swift index 661b12b..b0a33a5 100644 --- a/ApplicationLibrary/Views/Connections/ConnectionListView.swift +++ b/ApplicationLibrary/Views/Connections/ConnectionListView.swift @@ -61,7 +61,9 @@ public struct ConnectionListView: View { } } } + #if os(macOS) .searchable(text: $searchText) + #endif .alertBinding($alert) .onAppear { connect() diff --git a/ApplicationLibrary/Views/Dashboard/ActiveDashboardView.swift b/ApplicationLibrary/Views/Dashboard/ActiveDashboardView.swift index 84c218f..6c93062 100644 --- a/ApplicationLibrary/Views/Dashboard/ActiveDashboardView.swift +++ b/ApplicationLibrary/Views/Dashboard/ActiveDashboardView.swift @@ -50,23 +50,25 @@ public struct ActiveDashboardView: View { VStack { #if os(iOS) || os(tvOS) if ApplicationLibrary.inPreview || profile.status.isConnectedStrict { - viewBuilder { - #if os(iOS) - if #available(iOS 16.0, *) { - content1 - } else { - content0 - } - #else - content0 - #endif + Picker("Page", selection: $selection) { + ForEach(DashboardPage.allCases) { page in + page.label + } } + .pickerStyle(.segmented) #if os(iOS) - .navigationBarTitleDisplayMode(.inline) + .padding([.leading, .trailing]) + .navigationBarTitleDisplayMode(.inline) #endif - .onAppear { - UIScrollView.appearance().isScrollEnabled = false + TabView(selection: $selection) { + ForEach(DashboardPage.enabledCases) { page in + page.contentView($profileList, $selectedProfileID, $systemProxyAvailable, $systemProxyEnabled) + .tag(page) + } } + #if os(iOS) + .navigationBarTitleDisplayMode(.inline) + #endif .tabViewStyle(.page(indexDisplayMode: .never)) } else { OverviewView($profileList, $selectedProfileID, $systemProxyAvailable, $systemProxyEnabled) @@ -91,46 +93,6 @@ public struct ActiveDashboardView: View { .alertBinding($alert) } - @ViewBuilder - private var content0: some View { - Picker("Page", selection: $selection) { - ForEach(DashboardPage.allCases) { page in - page.label - } - } - .pickerStyle(.segmented) - #if os(iOS) - .padding([.leading, .trailing]) - .navigationBarTitleDisplayMode(.inline) - #endif - TabView(selection: $selection) { - ForEach(DashboardPage.enabledCases) { page in - page.contentView($profileList, $selectedProfileID, $systemProxyAvailable, $systemProxyEnabled) - .tag(page) - } - } - } - - @available(iOS 16.0, *) - @ViewBuilder - private var content1: some View { - TabView(selection: $selection) { - ForEach(DashboardPage.enabledCases) { page in - page.contentView($profileList, $selectedProfileID, $systemProxyAvailable, $systemProxyEnabled) - .tag(page) - } - } - .toolbar { - ToolbarTitleMenu { - Picker("Page", selection: $selection) { - ForEach(DashboardPage.allCases) { page in - page.label - } - } - } - } - } - private func doReload() async { defer { isLoading = false diff --git a/ApplicationLibrary/Views/Dashboard/DashboardPage.swift b/ApplicationLibrary/Views/Dashboard/DashboardPage.swift index fc0728c..3e61fcc 100644 --- a/ApplicationLibrary/Views/Dashboard/DashboardPage.swift +++ b/ApplicationLibrary/Views/Dashboard/DashboardPage.swift @@ -13,7 +13,7 @@ public enum DashboardPage: Int, CaseIterable, Identifiable { } public extension DashboardPage { - #if !os(tvOS) + #if !tvOS static var enabledCases: [DashboardPage] = [ .overview, .groups, diff --git a/sing-box.xcodeproj/project.pbxproj b/sing-box.xcodeproj/project.pbxproj index 1f53a26..c23d917 100644 --- a/sing-box.xcodeproj/project.pbxproj +++ b/sing-box.xcodeproj/project.pbxproj @@ -2734,7 +2734,7 @@ "@executable_path/../../../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 1.9.4; + MARKETING_VERSION = "1.10.0-alpha.18"; PRODUCT_BUNDLE_IDENTIFIER = io.nekohasekai.sfavt.system; PRODUCT_NAME = "$(inherited)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2770,7 +2770,7 @@ "@executable_path/../../../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 1.9.4; + MARKETING_VERSION = "1.10.0-alpha.18"; PRODUCT_BUNDLE_IDENTIFIER = io.nekohasekai.sfavt.system; PRODUCT_NAME = "$(inherited)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2812,7 +2812,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 1.9.4; + MARKETING_VERSION = "1.10.0-alpha.18"; PRODUCT_BUNDLE_IDENTIFIER = io.nekohasekai.sfavt.standalone; PRODUCT_NAME = SFM; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2853,7 +2853,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 1.9.4; + MARKETING_VERSION = "1.10.0-alpha.18"; PRODUCT_BUNDLE_IDENTIFIER = io.nekohasekai.sfavt.standalone; PRODUCT_NAME = SFM; PROVISIONING_PROFILE_SPECIFIER = "";