diff --git a/Passepartout.xcodeproj/project.pbxproj b/Passepartout.xcodeproj/project.pbxproj index 01954fcd..1466caa0 100644 --- a/Passepartout.xcodeproj/project.pbxproj +++ b/Passepartout.xcodeproj/project.pbxproj @@ -101,7 +101,6 @@ 0E90DFE627BACC1500EF5078 /* AddHostViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E90DFE527BACC1500EF5078 /* AddHostViewModel.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 */; }; - 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 */; }; 0E96D2E028718E44005EFBCF /* VPNItemGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E96D2DF28718E44005EFBCF /* VPNItemGroup.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 = ""; }; 0E92D7C527F103300033CB7B /* ProfileView+Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProfileView+Configuration.swift"; sourceTree = ""; }; 0E92D7C827F1042A0033CB7B /* ProfileView+Extra.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProfileView+Extra.swift"; sourceTree = ""; }; - 0E92D7F327F104B80033CB7B /* ProfileView+Diagnostics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProfileView+Diagnostics.swift"; sourceTree = ""; }; 0E96D2DD28704C3B005EFBCF /* TextItem+ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TextItem+ViewModel.swift"; sourceTree = ""; }; 0E96D2DF28718E44005EFBCF /* VPNItemGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNItemGroup.swift; sourceTree = ""; }; 0E96D2E128718E78005EFBCF /* VPNItemGroup+ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "VPNItemGroup+ViewModel.swift"; sourceTree = ""; }; @@ -633,7 +631,6 @@ 0EBE880E281B18DE0090D9E6 /* ProfileRow.swift */, 0E44689527B051C300A14CE4 /* ProfileView.swift */, 0E92D7C527F103300033CB7B /* ProfileView+Configuration.swift */, - 0E92D7F327F104B80033CB7B /* ProfileView+Diagnostics.swift */, 0E92D7C827F1042A0033CB7B /* ProfileView+Extra.swift */, 0E3CD482280DAE92007075C0 /* ProfileView+MainMenu.swift */, 0E3B7FD927E51A0200C66F13 /* ProfileView+Provider.swift */, @@ -1444,7 +1441,6 @@ 0E71ACFB27C12E5300F85C4B /* VersionView.swift in Sources */, 0ED1D6DC27DBA41700983466 /* DiagnosticsView+OpenVPN.swift in Sources */, 0ED30DCC27EA197D0057D8A3 /* RevealingSecureField.swift in Sources */, - 0E92D7F427F104B80033CB7B /* ProfileView+Diagnostics.swift in Sources */, 0E5349C627C176C200C71BB3 /* EndpointView+OpenVPN.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Passepartout/App/Views/ProfileView+Diagnostics.swift b/Passepartout/App/Views/ProfileView+Diagnostics.swift deleted file mode 100644 index c67bbeac..00000000 --- a/Passepartout/App/Views/ProfileView+Diagnostics.swift +++ /dev/null @@ -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 . -// - -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) - } - } - } -} diff --git a/Passepartout/App/Views/ProfileView.swift b/Passepartout/App/Views/ProfileView.swift index b21fd830..523dfe5b 100644 --- a/Passepartout/App/Views/ProfileView.swift +++ b/Passepartout/App/Views/ProfileView.swift @@ -96,7 +96,6 @@ struct ProfileView: View { modalType: $modalType ) ExtraSection(currentProfile: currentProfile) - DiagnosticsSection(currentProfile: currentProfile) } else { ProgressView() } diff --git a/Passepartout/App/Views/SettingsView.swift b/Passepartout/App/Views/SettingsView.swift index 040eb204..56bfac97 100644 --- a/Passepartout/App/Views/SettingsView.swift +++ b/Passepartout/App/Views/SettingsView.swift @@ -27,6 +27,8 @@ import SwiftUI import PassepartoutLibrary struct SettingsView: View { + @ObservedObject private var profileManager: ProfileManager + @ObservedObject private var productManager: ProductManager @Environment(\.presentationMode) private var presentationMode @@ -40,12 +42,14 @@ struct SettingsView: View { private let versionString = Constants.Global.appVersionString init() { + profileManager = .shared productManager = .shared } var body: some View { List { aboutSection + diagnosticsSection }.toolbar { themeCloseItem(presentationMode: presentationMode) }.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) + } + } + } + } } diff --git a/res/ios/snap-profile.png b/res/ios/snap-profile.png index 4b5502e3..611344fa 100644 Binary files a/res/ios/snap-profile.png and b/res/ios/snap-profile.png differ