Move diagnostics to settings

This commit is contained in:
Davide De Rosa 2022-09-11 16:43:42 +02:00
parent 940e0cf8c9
commit 38bdbc3697
5 changed files with 19 additions and 81 deletions

View File

@ -101,7 +101,6 @@
0E90DFE627BACC1500EF5078 /* AddHostViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E90DFE527BACC1500EF5078 /* AddHostViewModel.swift */; }; 0E90DFE627BACC1500EF5078 /* AddHostViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E90DFE527BACC1500EF5078 /* AddHostViewModel.swift */; };
0E92D7C627F103300033CB7B /* ProfileView+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E92D7C527F103300033CB7B /* ProfileView+Configuration.swift */; }; 0E92D7C627F103300033CB7B /* ProfileView+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E92D7C527F103300033CB7B /* ProfileView+Configuration.swift */; };
0E92D7C927F1042A0033CB7B /* ProfileView+Extra.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E92D7C827F1042A0033CB7B /* ProfileView+Extra.swift */; }; 0E92D7C927F1042A0033CB7B /* ProfileView+Extra.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E92D7C827F1042A0033CB7B /* ProfileView+Extra.swift */; };
0E92D7F427F104B80033CB7B /* ProfileView+Diagnostics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E92D7F327F104B80033CB7B /* ProfileView+Diagnostics.swift */; };
0E96D2DE28704C3B005EFBCF /* TextItem+ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E96D2DD28704C3B005EFBCF /* TextItem+ViewModel.swift */; }; 0E96D2DE28704C3B005EFBCF /* TextItem+ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E96D2DD28704C3B005EFBCF /* TextItem+ViewModel.swift */; };
0E96D2E028718E44005EFBCF /* VPNItemGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E96D2DF28718E44005EFBCF /* VPNItemGroup.swift */; }; 0E96D2E028718E44005EFBCF /* VPNItemGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E96D2DF28718E44005EFBCF /* VPNItemGroup.swift */; };
0E96D2E228718E78005EFBCF /* VPNItemGroup+ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E96D2E128718E78005EFBCF /* VPNItemGroup+ViewModel.swift */; }; 0E96D2E228718E78005EFBCF /* VPNItemGroup+ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E96D2E128718E78005EFBCF /* VPNItemGroup+ViewModel.swift */; };
@ -373,7 +372,6 @@
0E90DFE527BACC1500EF5078 /* AddHostViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddHostViewModel.swift; sourceTree = "<group>"; }; 0E90DFE527BACC1500EF5078 /* AddHostViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddHostViewModel.swift; sourceTree = "<group>"; };
0E92D7C527F103300033CB7B /* ProfileView+Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProfileView+Configuration.swift"; sourceTree = "<group>"; }; 0E92D7C527F103300033CB7B /* ProfileView+Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProfileView+Configuration.swift"; sourceTree = "<group>"; };
0E92D7C827F1042A0033CB7B /* ProfileView+Extra.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProfileView+Extra.swift"; sourceTree = "<group>"; }; 0E92D7C827F1042A0033CB7B /* ProfileView+Extra.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProfileView+Extra.swift"; sourceTree = "<group>"; };
0E92D7F327F104B80033CB7B /* ProfileView+Diagnostics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProfileView+Diagnostics.swift"; sourceTree = "<group>"; };
0E96D2DD28704C3B005EFBCF /* TextItem+ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TextItem+ViewModel.swift"; sourceTree = "<group>"; }; 0E96D2DD28704C3B005EFBCF /* TextItem+ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TextItem+ViewModel.swift"; sourceTree = "<group>"; };
0E96D2DF28718E44005EFBCF /* VPNItemGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNItemGroup.swift; sourceTree = "<group>"; }; 0E96D2DF28718E44005EFBCF /* VPNItemGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNItemGroup.swift; sourceTree = "<group>"; };
0E96D2E128718E78005EFBCF /* VPNItemGroup+ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "VPNItemGroup+ViewModel.swift"; sourceTree = "<group>"; }; 0E96D2E128718E78005EFBCF /* VPNItemGroup+ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "VPNItemGroup+ViewModel.swift"; sourceTree = "<group>"; };
@ -633,7 +631,6 @@
0EBE880E281B18DE0090D9E6 /* ProfileRow.swift */, 0EBE880E281B18DE0090D9E6 /* ProfileRow.swift */,
0E44689527B051C300A14CE4 /* ProfileView.swift */, 0E44689527B051C300A14CE4 /* ProfileView.swift */,
0E92D7C527F103300033CB7B /* ProfileView+Configuration.swift */, 0E92D7C527F103300033CB7B /* ProfileView+Configuration.swift */,
0E92D7F327F104B80033CB7B /* ProfileView+Diagnostics.swift */,
0E92D7C827F1042A0033CB7B /* ProfileView+Extra.swift */, 0E92D7C827F1042A0033CB7B /* ProfileView+Extra.swift */,
0E3CD482280DAE92007075C0 /* ProfileView+MainMenu.swift */, 0E3CD482280DAE92007075C0 /* ProfileView+MainMenu.swift */,
0E3B7FD927E51A0200C66F13 /* ProfileView+Provider.swift */, 0E3B7FD927E51A0200C66F13 /* ProfileView+Provider.swift */,
@ -1444,7 +1441,6 @@
0E71ACFB27C12E5300F85C4B /* VersionView.swift in Sources */, 0E71ACFB27C12E5300F85C4B /* VersionView.swift in Sources */,
0ED1D6DC27DBA41700983466 /* DiagnosticsView+OpenVPN.swift in Sources */, 0ED1D6DC27DBA41700983466 /* DiagnosticsView+OpenVPN.swift in Sources */,
0ED30DCC27EA197D0057D8A3 /* RevealingSecureField.swift in Sources */, 0ED30DCC27EA197D0057D8A3 /* RevealingSecureField.swift in Sources */,
0E92D7F427F104B80033CB7B /* ProfileView+Diagnostics.swift in Sources */,
0E5349C627C176C200C71BB3 /* EndpointView+OpenVPN.swift in Sources */, 0E5349C627C176C200C71BB3 /* EndpointView+OpenVPN.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;

View File

@ -1,76 +0,0 @@
//
// ProfileView+Diagnostics.swift
// Passepartout
//
// Created by Davide De Rosa on 3/27/22.
// Copyright (c) 2022 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of Passepartout.
//
// Passepartout is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Passepartout is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
//
import SwiftUI
import PassepartoutLibrary
extension ProfileView {
struct DiagnosticsSection: View {
@ObservedObject private var profileManager: ProfileManager
@ObservedObject private var currentProfile: ObservableProfile
private var isActiveProfile: Bool {
profileManager.isCurrentProfileActive()
}
private var vpnProtocol: VPNProtocolType {
currentProfile.value.currentVPNProtocol
}
private var providerName: ProviderName? {
currentProfile.value.header.providerName
}
private let faqURL = Constants.URLs.faq
init(currentProfile: ObservableProfile) {
profileManager = .shared
self.currentProfile = currentProfile
}
var body: some View {
Section {
if isActiveProfile {
NavigationLink {
DiagnosticsView(
vpnProtocol: vpnProtocol,
providerName: providerName
)
} label: {
Label(L10n.Diagnostics.title, systemImage: themeDiagnosticsImage)
}
}
Button {
URL.openURL(faqURL)
} label: {
Label(Unlocalized.About.faq, systemImage: themeFAQImage)
}
} header: {
Text(L10n.Profile.Sections.Feedback.header)
}
}
}
}

View File

@ -96,7 +96,6 @@ struct ProfileView: View {
modalType: $modalType modalType: $modalType
) )
ExtraSection(currentProfile: currentProfile) ExtraSection(currentProfile: currentProfile)
DiagnosticsSection(currentProfile: currentProfile)
} else { } else {
ProgressView() ProgressView()
} }

View File

@ -27,6 +27,8 @@ import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
struct SettingsView: View { struct SettingsView: View {
@ObservedObject private var profileManager: ProfileManager
@ObservedObject private var productManager: ProductManager @ObservedObject private var productManager: ProductManager
@Environment(\.presentationMode) private var presentationMode @Environment(\.presentationMode) private var presentationMode
@ -40,12 +42,14 @@ struct SettingsView: View {
private let versionString = Constants.Global.appVersionString private let versionString = Constants.Global.appVersionString
init() { init() {
profileManager = .shared
productManager = .shared productManager = .shared
} }
var body: some View { var body: some View {
List { List {
aboutSection aboutSection
diagnosticsSection
}.toolbar { }.toolbar {
themeCloseItem(presentationMode: presentationMode) themeCloseItem(presentationMode: presentationMode)
}.themeSecondaryView() }.themeSecondaryView()
@ -72,4 +76,19 @@ struct SettingsView: View {
} }
} }
} }
private var diagnosticsSection: some View {
profileManager.activeProfile.map { profile in
Section {
NavigationLink {
DiagnosticsView(
vpnProtocol: profile.currentVPNProtocol,
providerName: profile.header.providerName
)
} label: {
Text(L10n.Diagnostics.title)
}
}
}
}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 218 KiB