From cecf64d8718d35f30249debf29cf86553be8ec69 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Fri, 17 Mar 2023 21:46:53 +0100 Subject: [PATCH] Move Diagnostics view to Profile bottom (#261) --- CHANGELOG.md | 4 ++ Passepartout.xcodeproj/project.pbxproj | 4 ++ .../App/Views/ProfileView+Diagnostics.swift | 46 +++++++++++++++++++ Passepartout/App/Views/ProfileView.swift | 1 + Passepartout/App/Views/SettingsView.swift | 16 ------- 5 files changed, 55 insertions(+), 16 deletions(-) create mode 100644 Passepartout/App/Views/ProfileView+Diagnostics.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a554f24..6f3133f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Ukranian translations (Dmitry Chirkin). [#243](https://github.com/passepartoutvpn/passepartout-apple/pull/243) - OpenVPN: Full implementation of Tunnelblick XOR patch (tmthecoder). [#245](https://github.com/passepartoutvpn/passepartout-apple/pull/245), [tunnelkit#255][https://github.com/passepartoutvpn/tunnelkit/pull/255] +### Changed + +- Move Diagnostics view to Profile bottom. [#261](https://github.com/passepartoutvpn/passepartout-apple/pull/261) + ### Fixed - Improve kill switch behavior. [#181](https://github.com/passepartoutvpn/passepartout-apple/issues/181) diff --git a/Passepartout.xcodeproj/project.pbxproj b/Passepartout.xcodeproj/project.pbxproj index bab8a5ae..0dc5275e 100644 --- a/Passepartout.xcodeproj/project.pbxproj +++ b/Passepartout.xcodeproj/project.pbxproj @@ -26,6 +26,7 @@ 0E0BD27927B2EBE500583AC5 /* ShortcutsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E0BD27827B2EBE500583AC5 /* ShortcutsView.swift */; }; 0E0C0729236087A100155AAC /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0E0C072B236087A100155AAC /* InfoPlist.strings */; }; 0E12BC8F27F62C8600B2F912 /* Validators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E12BC8E27F62C8500B2F912 /* Validators.swift */; }; + 0E1B5F5C29C506AD00FE7D18 /* ProfileView+Diagnostics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E1B5F5B29C506AC00FE7D18 /* ProfileView+Diagnostics.swift */; }; 0E1F5628287F0ECB00F8ADD7 /* ProviderProfileItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E1F5627287F0ECB00F8ADD7 /* ProviderProfileItem.swift */; }; 0E1F562B287F0EF100F8ADD7 /* ProviderProfileItem+ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E1F5629287F0EEE00F8ADD7 /* ProviderProfileItem+ViewModel.swift */; }; 0E293851285A70AC002A6E0E /* AppPreference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E293850285A70AC002A6E0E /* AppPreference.swift */; }; @@ -304,6 +305,7 @@ 0E0C072A236087A100155AAC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 0E0C072C236087C800155AAC /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/InfoPlist.strings; sourceTree = ""; }; 0E12BC8E27F62C8500B2F912 /* Validators.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Validators.swift; sourceTree = ""; }; + 0E1B5F5B29C506AC00FE7D18 /* ProfileView+Diagnostics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProfileView+Diagnostics.swift"; sourceTree = ""; }; 0E1C0A52238FFF97009FC087 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/InfoPlist.strings; sourceTree = ""; }; 0E1F5627287F0ECB00F8ADD7 /* ProviderProfileItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProviderProfileItem.swift; sourceTree = ""; }; 0E1F5629287F0EEE00F8ADD7 /* ProviderProfileItem+ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProviderProfileItem+ViewModel.swift"; sourceTree = ""; }; @@ -655,6 +657,7 @@ 0ED30DD127EA1F650057D8A3 /* PaywallView+Purchase.swift */, 0E44689527B051C300A14CE4 /* ProfileView.swift */, 0E92D7C527F103300033CB7B /* ProfileView+Configuration.swift */, + 0E1B5F5B29C506AC00FE7D18 /* ProfileView+Diagnostics.swift */, 0E92D7C827F1042A0033CB7B /* ProfileView+Extra.swift */, 0E3CD482280DAE92007075C0 /* ProfileView+MainMenu.swift */, 0E3B7FD927E51A0200C66F13 /* ProfileView+Provider.swift */, @@ -1442,6 +1445,7 @@ 0E2A8D4F27B04BBA00207D04 /* OrganizerView.swift in Sources */, 0E49F6BB27D7638300385834 /* EndpointAdvancedView+OpenVPN.swift in Sources */, 0E71ACEF27C106B500F85C4B /* ProviderPresetView.swift in Sources */, + 0E1B5F5C29C506AD00FE7D18 /* ProfileView+Diagnostics.swift in Sources */, 0EF2212F27E66F60001D0BD7 /* AddProfileView.swift in Sources */, 0E96D2FC2871D94E005EFBCF /* DefaultLightProfileManager.swift in Sources */, 0EF0FAF627DD0211007EB181 /* PaywallView.swift in Sources */, diff --git a/Passepartout/App/Views/ProfileView+Diagnostics.swift b/Passepartout/App/Views/ProfileView+Diagnostics.swift new file mode 100644 index 00000000..07e635ed --- /dev/null +++ b/Passepartout/App/Views/ProfileView+Diagnostics.swift @@ -0,0 +1,46 @@ +// +// ProfileView+Diagnostics.swift +// Passepartout +// +// Created by Davide De Rosa on 3/17/23. +// Copyright (c) 2023 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 var currentProfile: ObservableProfile + + var body: some View { + Section { + NavigationLink { + DiagnosticsView( + vpnProtocol: currentProfile.value.currentVPNProtocol, + providerName: currentProfile.value.header.providerName + ) + } label: { + Text(L10n.Diagnostics.title) + } + } + } + } +} diff --git a/Passepartout/App/Views/ProfileView.swift b/Passepartout/App/Views/ProfileView.swift index fcbf94a0..ec26f6e3 100644 --- a/Passepartout/App/Views/ProfileView.swift +++ b/Passepartout/App/Views/ProfileView.swift @@ -101,6 +101,7 @@ 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 143a93c4..623357cc 100644 --- a/Passepartout/App/Views/SettingsView.swift +++ b/Passepartout/App/Views/SettingsView.swift @@ -49,7 +49,6 @@ struct SettingsView: View { var body: some View { List { aboutSection - diagnosticsSection }.toolbar { themeCloseItem(presentationMode: presentationMode) }.themeSecondaryView() @@ -76,19 +75,4 @@ 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) - } - } - } - } }