From c507c739bd86401945f07c19b2501033e00084f7 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Fri, 22 Apr 2022 20:09:26 +0200 Subject: [PATCH] Move WelcomeView to its own view --- Passepartout.xcodeproj/project.pbxproj | 4 +++ Passepartout/App/Views/MainView.swift | 2 -- Passepartout/App/Views/OrganizerView.swift | 1 + Passepartout/App/Views/ProfileView.swift | 8 +---- Passepartout/App/Views/WelcomeView.swift | 34 ++++++++++++++++++++++ 5 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 Passepartout/App/Views/WelcomeView.swift diff --git a/Passepartout.xcodeproj/project.pbxproj b/Passepartout.xcodeproj/project.pbxproj index b0e5cab2..243b274e 100644 --- a/Passepartout.xcodeproj/project.pbxproj +++ b/Passepartout.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 0E065F112813269500062CAF /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E065F102813269500062CAF /* WelcomeView.swift */; }; 0E0BD27327B2EA2C00583AC5 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E0BD27227B2EA2C00583AC5 /* MainView.swift */; }; 0E0BD27627B2EB2200583AC5 /* DonateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E0BD27527B2EB2200583AC5 /* DonateView.swift */; }; 0E0BD27927B2EBE500583AC5 /* ShortcutsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E0BD27827B2EBE500583AC5 /* ShortcutsView.swift */; }; @@ -184,6 +185,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0E065F102813269500062CAF /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = ""; }; 0E0BD27227B2EA2C00583AC5 /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = ""; }; 0E0BD27527B2EB2200583AC5 /* DonateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DonateView.swift; sourceTree = ""; }; 0E0BD27827B2EBE500583AC5 /* ShortcutsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShortcutsView.swift; sourceTree = ""; }; @@ -456,6 +458,7 @@ 0ED89C1B27DE3ABC008B36D6 /* ShortcutsView+Add.swift */, 0E71ACFA27C12E5300F85C4B /* VersionView.swift */, 0EF708312811CC8400A3A308 /* VPNStatusText.swift */, + 0E065F102813269500062CAF /* WelcomeView.swift */, ); path = Views; sourceTree = ""; @@ -969,6 +972,7 @@ 0EB4042E27CA136300378B1A /* AddingTextField.swift in Sources */, 0EE8B7E327FF340F00B68621 /* VPNProtocolType+FileExtensions.swift in Sources */, 0EF2212B27E667EA001D0BD7 /* AddProviderView+Name.swift in Sources */, + 0E065F112813269500062CAF /* WelcomeView.swift in Sources */, 0E2DE71F27DCD0290067B9E1 /* TunnelKit+L10n.swift in Sources */, 0E49F6BF27D764AF00385834 /* EndpointAdvancedView.swift in Sources */, 0E0BD27627B2EB2200583AC5 /* DonateView.swift in Sources */, diff --git a/Passepartout/App/Views/MainView.swift b/Passepartout/App/Views/MainView.swift index 803ef8c8..b24320a3 100644 --- a/Passepartout/App/Views/MainView.swift +++ b/Passepartout/App/Views/MainView.swift @@ -29,8 +29,6 @@ struct MainView: View { var body: some View { NavigationView { OrganizerView() - .themePrimaryView() - ProfileView() }.themeGlobal() } diff --git a/Passepartout/App/Views/OrganizerView.swift b/Passepartout/App/Views/OrganizerView.swift index 4ec5c917..f8fe3107 100644 --- a/Passepartout/App/Views/OrganizerView.swift +++ b/Passepartout/App/Views/OrganizerView.swift @@ -112,6 +112,7 @@ struct OrganizerView: View { onCompletion: onHostFileImporterResult ).onOpenURL(perform: onOpenURL) .navigationTitle(Unlocalized.appName) + .themePrimaryView() } } diff --git a/Passepartout/App/Views/ProfileView.swift b/Passepartout/App/Views/ProfileView.swift index 6ee9023d..e1e35701 100644 --- a/Passepartout/App/Views/ProfileView.swift +++ b/Passepartout/App/Views/ProfileView.swift @@ -67,7 +67,7 @@ struct ProfileView: View { if isExisting { mainView } else { - welcomeView + WelcomeView() } }.toolbar { ToolbarItemGroup(placement: .navigationBarTrailing) { @@ -108,12 +108,6 @@ struct ProfileView: View { } } - private var welcomeView: some View { - Text(L10n.Profile.Welcome.message) - .multilineTextAlignment(.center) - .themeInformativeText() - } - @ViewBuilder private func presentedModal(_ modalType: ModalType) -> some View { switch modalType { diff --git a/Passepartout/App/Views/WelcomeView.swift b/Passepartout/App/Views/WelcomeView.swift new file mode 100644 index 00000000..29c8fe3c --- /dev/null +++ b/Passepartout/App/Views/WelcomeView.swift @@ -0,0 +1,34 @@ +// +// WelcomeView.swift +// Passepartout +// +// Created by Davide De Rosa on 4/22/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 + +struct WelcomeView: View { + var body: some View { + Text(L10n.Profile.Welcome.message) + .multilineTextAlignment(.center) + .themeInformativeText() + } +}