From 8cb2833ce3d44a3424a01628a842890b4458de97 Mon Sep 17 00:00:00 2001 From: Jamil Date: Fri, 8 Dec 2023 10:29:17 -0500 Subject: [PATCH] UI cleanup for iOS (#2832) * Removes remaining traces of account ID. We don't have any external users using the app _yet_ so I wanted to remove the tech debt completely before we get the app to testers * Adds logo to welcome screen * Removes "CONNECTION" section from MainView --- .../LogoText.imageset/Contents.json | 21 +++++++++ .../LogoText.imageset/logo-text.svg | 13 ++++++ .../FirezoneKit/Features/AuthView.swift | 22 ++++++---- .../FirezoneKit/Features/MainView.swift | 44 +++++++------------ .../FirezoneKit/Features/SettingsView.swift | 2 - .../FirezoneKit/Stores/TunnelStore.swift | 8 ---- 6 files changed, 63 insertions(+), 47 deletions(-) create mode 100644 swift/apple/Firezone/Assets.xcassets/LogoText.imageset/Contents.json create mode 100644 swift/apple/Firezone/Assets.xcassets/LogoText.imageset/logo-text.svg diff --git a/swift/apple/Firezone/Assets.xcassets/LogoText.imageset/Contents.json b/swift/apple/Firezone/Assets.xcassets/LogoText.imageset/Contents.json new file mode 100644 index 000000000..da9272175 --- /dev/null +++ b/swift/apple/Firezone/Assets.xcassets/LogoText.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "logo-text.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/swift/apple/Firezone/Assets.xcassets/LogoText.imageset/logo-text.svg b/swift/apple/Firezone/Assets.xcassets/LogoText.imageset/logo-text.svg new file mode 100644 index 000000000..d4712a051 --- /dev/null +++ b/swift/apple/Firezone/Assets.xcassets/LogoText.imageset/logo-text.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/AuthView.swift b/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/AuthView.swift index 9336a888f..652e6742e 100644 --- a/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/AuthView.swift +++ b/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/AuthView.swift @@ -31,16 +31,20 @@ struct AuthView: View { @ObservedObject var model: AuthViewModel var body: some View { - VStack { - Text("Welcome to Firezone").font(.largeTitle) - - Button("Sign in") { - Task { - await model.signInButtonTapped() + VStack( + alignment: .center, + content: { + Image("LogoText") + Spacer() + Button("Sign in") { + Task { + await model.signInButtonTapped() + } } - } - .buttonStyle(.borderedProminent) - } + .buttonStyle(.borderedProminent) + .controlSize(.large) + Spacer() + }) } } diff --git a/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/MainView.swift b/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/MainView.swift index a20aab6d0..c0f9fdcde 100644 --- a/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/MainView.swift +++ b/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/MainView.swift @@ -91,18 +91,22 @@ import SwiftUI Group { switch self.model.loginStatus { case .signedIn(let actorName): - HStack { - Text(actorName.isEmpty ? "Signed in" : "Signed in as") - Spacer() - Text(actorName) - .foregroundColor(.secondary) - } - HStack { - Spacer() - Button("Sign Out") { - self.model.signOutButtonTapped() + if self.model.tunnelStatus == .connected { + HStack { + Text(actorName.isEmpty ? "Signed in" : "Signed in as") + Spacer() + Text(actorName) + .foregroundColor(.secondary) } - Spacer() + HStack { + Spacer() + Button("Sign Out") { + self.model.signOutButtonTapped() + } + Spacer() + } + } else { + Text(self.model.tunnelStatus.description) } case .signedOut: Text("Signed Out") @@ -111,22 +115,6 @@ import SwiftUI } } } - if case .signedIn = self.model.loginStatus { - Section(header: Text("Connection")) { - Text(self.model.tunnelStatus.description) - if self.model.tunnelStatus == .disconnected || self.model.tunnelStatus == .invalid { - HStack { - Spacer() - Button("Reconnect") { - Task { - await self.model.startTunnel() - } - } - Spacer() - } - } - } - } if case .signedIn = self.model.loginStatus, self.model.tunnelStatus == .connected { Section(header: Text("Resources")) { if self.model.orderedResources.isEmpty { @@ -154,7 +142,7 @@ import SwiftUI } } .listStyle(GroupedListStyle()) - .navigationTitle("firezone") + .navigationTitle("Firezone") } private func copyResourceTapped(_ resource: DisplayableResources.Resource) { diff --git a/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/SettingsView.swift b/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/SettingsView.swift index 6f0d3f6f7..26f086c66 100644 --- a/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/SettingsView.swift +++ b/swift/apple/FirezoneKit/Sources/FirezoneKit/Features/SettingsView.swift @@ -110,14 +110,12 @@ public struct SettingsView: View { #endif struct PlaceholderText { - static let accountId = "account-id" static let authBaseURL = "Admin portal base URL" static let apiURL = "Control plane WebSocket URL" static let logFilter = "RUST_LOG-style filter string" } struct FootnoteText { - static let forAccount = "Your account ID is provided by your admin" static let forAdvanced = try! AttributedString( markdown: """ **WARNING:** These settings are intended for internal debug purposes **only**. \ diff --git a/swift/apple/FirezoneKit/Sources/FirezoneKit/Stores/TunnelStore.swift b/swift/apple/FirezoneKit/Sources/FirezoneKit/Stores/TunnelStore.swift index 99b3386b3..e5fd7a515 100644 --- a/swift/apple/FirezoneKit/Sources/FirezoneKit/Stores/TunnelStore.swift +++ b/swift/apple/FirezoneKit/Sources/FirezoneKit/Stores/TunnelStore.swift @@ -21,13 +21,6 @@ enum TunnelStoreError: Error { public struct TunnelProviderKeys { static let keyAuthBaseURLString = "authBaseURLString" public static let keyConnlibLogFilter = "connlibLogFilter" - - // The following key is not added to the tunnel provider. - // The key is defined so that the key can be removed if it exists - // in a tunnel provider configuration. A tunnel configuration - // created by an earlier version of the app could have this - // key, and we use this key definition to remove it. - static let keyAccountId = "accountId" } final class TunnelStore: ObservableObject { @@ -431,7 +424,6 @@ extension NETunnelProviderManager { protocolConfiguration.passwordReference = tokenReference } - providerConfig.removeValue(forKey: TunnelProviderKeys.keyAccountId) protocolConfiguration.providerConfiguration = providerConfig ensureTunnelConfigurationIsValid()