From 16d618df0e93903278b87fbd73d7549e571f0e47 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Mon, 16 May 2022 11:06:02 +0200 Subject: [PATCH] Show info menu in ProfileView on iPad/Mac Use .navigationBarTrailing to avoid artifact on Catalyst (item relocates when first clicked). Rename menu files too. --- Passepartout.xcodeproj/project.pbxproj | 16 ++++++++-------- ...erView+AddMenu.swift => AddProfileMenu.swift} | 0 ...zerView+SettingsMenu.swift => InfoMenu.swift} | 0 Passepartout/App/Views/OrganizerView.swift | 4 +++- Passepartout/App/Views/ProfileView.swift | 13 +++++++++---- 5 files changed, 20 insertions(+), 13 deletions(-) rename Passepartout/App/Views/{OrganizerView+AddMenu.swift => AddProfileMenu.swift} (100%) rename Passepartout/App/Views/{OrganizerView+SettingsMenu.swift => InfoMenu.swift} (100%) diff --git a/Passepartout.xcodeproj/project.pbxproj b/Passepartout.xcodeproj/project.pbxproj index 6b51812d..025142ba 100644 --- a/Passepartout.xcodeproj/project.pbxproj +++ b/Passepartout.xcodeproj/project.pbxproj @@ -32,7 +32,7 @@ 0E3B7FCD27E47B3700C66F13 /* AddHostView+Name.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E3B7FCC27E47B3700C66F13 /* AddHostView+Name.swift */; }; 0E3B7FD627E5173A00C66F13 /* ProfileView+VPN.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E3B7FD527E5173A00C66F13 /* ProfileView+VPN.swift */; }; 0E3B7FDA27E51A0200C66F13 /* ProfileView+Provider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E3B7FD927E51A0200C66F13 /* ProfileView+Provider.swift */; }; - 0E3CD47F280DA14B007075C0 /* OrganizerView+AddMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E3CD47E280DA14B007075C0 /* OrganizerView+AddMenu.swift */; }; + 0E3CD47F280DA14B007075C0 /* AddProfileMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E3CD47E280DA14B007075C0 /* AddProfileMenu.swift */; }; 0E3CD483280DAE92007075C0 /* ProfileView+MainMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E3CD482280DAE92007075C0 /* ProfileView+MainMenu.swift */; }; 0E44689627B051C300A14CE4 /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E44689527B051C300A14CE4 /* ProfileView.swift */; }; 0E44689C27B11B5300A14CE4 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E44689B27B11B5300A14CE4 /* AboutView.swift */; }; @@ -111,7 +111,7 @@ 0ED89C1C27DE3ABC008B36D6 /* ShortcutsView+Add.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED89C1B27DE3ABC008B36D6 /* ShortcutsView+Add.swift */; }; 0ED89C1E27DE3F8D008B36D6 /* IntentAddView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED89C1D27DE3F8D008B36D6 /* IntentAddView.swift */; }; 0EDE02C227F61C79000FBE3C /* EditableTextList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EDE02C127F61C79000FBE3C /* EditableTextList.swift */; }; - 0EE11CD2280D8317003BE431 /* OrganizerView+SettingsMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE11CD1280D8317003BE431 /* OrganizerView+SettingsMenu.swift */; }; + 0EE11CD2280D8317003BE431 /* InfoMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE11CD1280D8317003BE431 /* InfoMenu.swift */; }; 0EE8B7E327FF340F00B68621 /* VPNProtocolType+FileExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE8B7E227FF340F00B68621 /* VPNProtocolType+FileExtensions.swift */; }; 0EED0BB92733CEDA00C9FC68 /* PassepartoutCore in Frameworks */ = {isa = PBXBuildFile; productRef = 0EED0BB82733CEDA00C9FC68 /* PassepartoutCore */; }; 0EF0FAF627DD0211007EB181 /* PaywallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EF0FAF527DD0211007EB181 /* PaywallView.swift */; }; @@ -216,7 +216,7 @@ 0E3B7FCC27E47B3700C66F13 /* AddHostView+Name.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AddHostView+Name.swift"; sourceTree = ""; }; 0E3B7FD527E5173A00C66F13 /* ProfileView+VPN.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProfileView+VPN.swift"; sourceTree = ""; }; 0E3B7FD927E51A0200C66F13 /* ProfileView+Provider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProfileView+Provider.swift"; sourceTree = ""; }; - 0E3CD47E280DA14B007075C0 /* OrganizerView+AddMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OrganizerView+AddMenu.swift"; sourceTree = ""; }; + 0E3CD47E280DA14B007075C0 /* AddProfileMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddProfileMenu.swift; sourceTree = ""; }; 0E3CD482280DAE92007075C0 /* ProfileView+MainMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ProfileView+MainMenu.swift"; sourceTree = ""; }; 0E44689527B051C300A14CE4 /* ProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = ""; }; 0E44689B27B11B5300A14CE4 /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = ""; }; @@ -329,7 +329,7 @@ 0EDE8DC320C86910004C739C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 0EDE8DD220C86978004C739C /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; }; 0EDE8DE220C86A13004C739C /* App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = ""; }; - 0EE11CD1280D8317003BE431 /* OrganizerView+SettingsMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OrganizerView+SettingsMenu.swift"; sourceTree = ""; }; + 0EE11CD1280D8317003BE431 /* InfoMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoMenu.swift; sourceTree = ""; }; 0EE8B7E227FF340F00B68621 /* VPNProtocolType+FileExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "VPNProtocolType+FileExtensions.swift"; sourceTree = ""; }; 0EF0FAF527DD0211007EB181 /* PaywallView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaywallView.swift; sourceTree = ""; }; 0EF0FAF827DD212C007EB181 /* IntentActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntentActivity.swift; sourceTree = ""; }; @@ -420,6 +420,7 @@ 0E039278281890B100827C10 /* AddHostView.swift */, 0E3B7FCC27E47B3700C66F13 /* AddHostView+Name.swift */, 0E90DFE527BACC1500EF5078 /* AddHostViewModel.swift */, + 0E3CD47E280DA14B007075C0 /* AddProfileMenu.swift */, 0EF2212E27E66F60001D0BD7 /* AddProfileView.swift */, 0EF2212C27E66EB5001D0BD7 /* AddProviderView.swift */, 0EF2212A27E667EA001D0BD7 /* AddProviderView+Name.swift */, @@ -436,15 +437,14 @@ 0E71ACEA27C1060D00F85C4B /* EndpointView.swift */, 0E5349C527C176C200C71BB3 /* EndpointView+OpenVPN.swift */, 0E5349C727C176D100C71BB3 /* EndpointView+WireGuard.swift */, + 0EE11CD1280D8317003BE431 /* InfoMenu.swift */, 0E0BD27227B2EA2C00583AC5 /* MainView.swift */, 0E71ACE827C1055200F85C4B /* NetworkSettingsView.swift */, 0EB34BC927C6A70200B126DA /* OnDemandView.swift */, 0E34AC8127F892C40042F2AB /* OnDemandView+SSID.swift */, 0E2A8D4E27B04BB900207D04 /* OrganizerView.swift */, - 0E3CD47E280DA14B007075C0 /* OrganizerView+AddMenu.swift */, 0EF8C5A728213C510053CE89 /* OrganizerView+Profiles.swift */, 0E34AC7727F840890042F2AB /* OrganizerView+Scene.swift */, - 0EE11CD1280D8317003BE431 /* OrganizerView+SettingsMenu.swift */, 0EF0FAF527DD0211007EB181 /* PaywallView.swift */, 0ED30DCE27EA1EF80057D8A3 /* PaywallView+Beta.swift */, 0ED30DD127EA1F650057D8A3 /* PaywallView+Purchase.swift */, @@ -917,7 +917,7 @@ 0E34A2CF27CADA6300C73B67 /* GenericVersionView.swift in Sources */, 0E9C233327F47E95007D5FC7 /* IntentDispatcher+Activities.swift in Sources */, 0EBC075D27EC529000208AD9 /* DebugLog+Constants.swift in Sources */, - 0E3CD47F280DA14B007075C0 /* OrganizerView+AddMenu.swift in Sources */, + 0E3CD47F280DA14B007075C0 /* AddProfileMenu.swift in Sources */, 0EB17EAA27D226C900D473B5 /* Constants+Extensions.swift in Sources */, 0E53E63727E34FE2001D4902 /* AppContext.swift in Sources */, 0E3B7FD627E5173A00C66F13 /* ProfileView+VPN.swift in Sources */, @@ -953,7 +953,7 @@ 0E12BC8F27F62C8600B2F912 /* Validators.swift in Sources */, 0E039279281890B100827C10 /* AddHostView.swift in Sources */, 0E9ED48127FD9BAE003B2316 /* CopySavingButton.swift in Sources */, - 0EE11CD2280D8317003BE431 /* OrganizerView+SettingsMenu.swift in Sources */, + 0EE11CD2280D8317003BE431 /* InfoMenu.swift in Sources */, 0E44689C27B11B5300A14CE4 /* AboutView.swift in Sources */, 0E71ACF927C12E4800F85C4B /* CreditsView.swift in Sources */, 0ED89C1527DE0A0C008B36D6 /* Shortcut.swift in Sources */, diff --git a/Passepartout/App/Views/OrganizerView+AddMenu.swift b/Passepartout/App/Views/AddProfileMenu.swift similarity index 100% rename from Passepartout/App/Views/OrganizerView+AddMenu.swift rename to Passepartout/App/Views/AddProfileMenu.swift diff --git a/Passepartout/App/Views/OrganizerView+SettingsMenu.swift b/Passepartout/App/Views/InfoMenu.swift similarity index 100% rename from Passepartout/App/Views/OrganizerView+SettingsMenu.swift rename to Passepartout/App/Views/InfoMenu.swift diff --git a/Passepartout/App/Views/OrganizerView.swift b/Passepartout/App/Views/OrganizerView.swift index 65f883cf..216d4be2 100644 --- a/Passepartout/App/Views/OrganizerView.swift +++ b/Passepartout/App/Views/OrganizerView.swift @@ -67,7 +67,9 @@ struct OrganizerView: View { ) } ToolbarItem(placement: .navigation) { - InfoMenu() + if themeIdiom == .phone { + InfoMenu() + } } }.alert(item: $alertType, content: presentedAlert) .fileImporter( diff --git a/Passepartout/App/Views/ProfileView.swift b/Passepartout/App/Views/ProfileView.swift index 1d50c2e0..431696a6 100644 --- a/Passepartout/App/Views/ProfileView.swift +++ b/Passepartout/App/Views/ProfileView.swift @@ -68,10 +68,15 @@ struct ProfileView: View { WelcomeView() } }.toolbar { - MainMenu( - currentProfile: currentProfile, - modalType: $modalType - ).disabled(!isExisting) + ToolbarItemGroup(placement: .navigationBarTrailing) { + if themeIdiom != .phone { + InfoMenu() + } + MainMenu( + currentProfile: currentProfile, + modalType: $modalType + ).disabled(!isExisting) + } }.sheet(item: $modalType, content: presentedModal) .navigationTitle(title) .themeSecondaryView()