Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Tweak swift loading view to show AliasVault logo (#1562)

Leendert de Borst89aa9e11d07d
diff --git a/apps/mobile-app/ios/Autofill/CredentialProviderViewController.swift b/apps/mobile-app/ios/Autofill/CredentialProviderViewController.swift
index e926fd255..fd4a4514c 100644
--- a/apps/mobile-app/ios/Autofill/CredentialProviderViewController.swift
+++ b/apps/mobile-app/ios/Autofill/CredentialProviderViewController.swift
@@ -70,10 +70,9 @@ public class CredentialProviderViewController: ASCredentialProviderViewControlle
super.viewWillAppear(animated)
// Check if we're in quick return mode
- // Don't show any UI - Face ID will appear immediately with no background
+ // Show branded loading view while Face ID authentication is in progress
if isQuickReturnMode {
- // Make the view transparent so system UI shows through
- view.backgroundColor = .clear
+ showBrandedLoadingView()
return
}
@@ -204,6 +203,25 @@ public class CredentialProviderViewController: ASCredentialProviderViewControlle
}
}
+ /// Show branded loading view with AliasVault logo during biometric authentication
+ private func showBrandedLoadingView() {
+ let loadingView = BrandedLoadingView(message: nil, showLoadingAnimation: false)
+ let hostingController = UIHostingController(rootView: loadingView)
+ addChild(hostingController)
+ view.addSubview(hostingController.view)
+
+ hostingController.view.translatesAutoresizingMaskIntoConstraints = false
+ NSLayoutConstraint.activate([
+ hostingController.view.topAnchor.constraint(equalTo: view.topAnchor),
+ hostingController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
+ hostingController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
+ hostingController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor)
+ ])
+
+ hostingController.didMove(toParent: self)
+ currentHostingController = hostingController
+ }
+
/// Show PIN unlock for quick return mode when biometric fails
private func showQuickReturnPinUnlock(vaultStore: VaultStore) {
// Remove the loading view
diff --git a/apps/mobile-app/ios/Autofill/UnlockCoordinator.swift b/apps/mobile-app/ios/Autofill/UnlockCoordinator.swift
index d11bb0681..21f3bcb0f 100644
--- a/apps/mobile-app/ios/Autofill/UnlockCoordinator.swift
+++ b/apps/mobile-app/ios/Autofill/UnlockCoordinator.swift
@@ -26,8 +26,8 @@ struct UnlockCoordinatorView: View {
// Show PIN unlock view
PinUnlockView(viewModel: pinViewModel)
} else {
- // Show logo placeholder while biometric unlock is in progress
- BiometricUnlockPlaceholderView()
+ // Show branded loading view while biometric unlock is in progress
+ BrandedLoadingView(message: nil, showLoadingAnimation: false)
}
}
.onAppear {
@@ -36,29 +36,6 @@ struct UnlockCoordinatorView: View {
}
}
-/// Simple placeholder view showing the AliasVault logo while biometric authentication is in progress
-struct BiometricUnlockPlaceholderView: View {
- @Environment(\.colorScheme) var colorScheme
-
- private var colors: ColorConstants.Colors.Type {
- ColorConstants.colors(for: colorScheme)
- }
-
- var body: some View {
- ZStack {
- colors.background
- .ignoresSafeArea()
-
- VStack {
- Image("Logo", bundle: .vaultUI)
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(width: 70, height: 70)
- }
- }
- }
-}
-
/// Coordinator that manages the unlock flow logic
@MainActor
class UnlockCoordinator: ObservableObject {
diff --git a/apps/mobile-app/ios/VaultStoreKit/VaultStore+Crypto.swift b/apps/mobile-app/ios/VaultStoreKit/VaultStore+Crypto.swift
index 8e53a58a3..70a8a9b34 100644
--- a/apps/mobile-app/ios/VaultStoreKit/VaultStore+Crypto.swift
+++ b/apps/mobile-app/ios/VaultStoreKit/VaultStore+Crypto.swift
@@ -219,7 +219,7 @@ extension VaultStore {
/// Retrieve the encryption key from the keychain
private func retrieveKeyFromKeychain(context: LAContext) throws -> Data {
- // Ensure interaction is allowed so system can prompt for Face ID or passcode fallback
+ // Ensure interaction is allowed so system can prompt for biometric authentication
context.interactionNotAllowed = false
context.localizedReason = "Authenticate to unlock your vault"
diff --git a/apps/mobile-app/ios/VaultUI/Bundle+VaultUI.swift b/apps/mobile-app/ios/VaultUI/Bundle+VaultUI.swift
index 3ae9c8801..74c9c012f 100644
--- a/apps/mobile-app/ios/VaultUI/Bundle+VaultUI.swift
+++ b/apps/mobile-app/ios/VaultUI/Bundle+VaultUI.swift
@@ -2,8 +2,8 @@ import Foundation
private final class VaultUIBundleToken {}
-extension Bundle {
- /// The bundle that contains VaultUI’s localized resources
+public extension Bundle {
+ /// The bundle that contains VaultUI's localized resources
static var vaultUI: Bundle {
// If you don’t use a separate .bundle target, this is the framework bundle itself.
let frameworkBundle = Bundle(for: VaultUIBundleToken.self)
diff --git a/apps/mobile-app/ios/VaultUI/Components/BrandedLoadingView.swift b/apps/mobile-app/ios/VaultUI/Components/BrandedLoadingView.swift
new file mode 100644
index 000000000..cd5afc0d4
--- /dev/null
+++ b/apps/mobile-app/ios/VaultUI/Components/BrandedLoadingView.swift
@@ -0,0 +1,128 @@
+import SwiftUI
+import UIKit
+
+/// A reusable branded loading/placeholder view with the AliasVault logo.
+/// The logo is positioned in the upper portion of the screen to avoid overlap with Face ID prompts.
+/// Supports both light and dark mode automatically.
+public struct BrandedLoadingView: View {
+ /// Optional loading message to display below the logo
+ let message: String?
+
+ /// Whether to show the animated loading dots
+ let showLoadingAnimation: Bool
+
+ @Environment(\.colorScheme) private var colorScheme
+ @State private var animatingDots: [Bool] = [false, false, false, false]
+ @State private var textDots = ""
+ @State private var timer: Timer?
+
+ /// Creates a branded loading view with optional message and loading animation
+ /// - Parameters:
+ /// - message: Optional message to display below the logo
+ /// - showLoadingAnimation: Whether to show the animated loading dots (default: true)
+ public init(message: String? = nil, showLoadingAnimation: Bool = true) {
+ self.message = message
+ self.showLoadingAnimation = showLoadingAnimation
+ }
+
+ /// Determine the effective color scheme, falling back to UIKit if SwiftUI environment is unavailable
+ private var effectiveColorScheme: ColorScheme {
+ // Use UIKit's trait collection as fallback since extension contexts may not
+ // properly propagate the SwiftUI colorScheme environment
+ let uiStyle = UITraitCollection.current.userInterfaceStyle
+ return uiStyle == .dark ? .dark : .light
+ }
+
+ private var colors: ColorConstants.Colors.Type {
+ ColorConstants.colors(for: effectiveColorScheme)
+ }
+
+ public var body: some View {
+ GeometryReader { geometry in
+ ZStack {
+ colors.background
+ .ignoresSafeArea()
+
+ VStack(spacing: 0) {
+ // Position content at 15% from top to avoid Face ID prompt obstruction
+ Spacer()
+ .frame(height: geometry.size.height * 0.15)
+
+ VStack(spacing: 16) {
+ // AliasVault logo
+ Image("Logo", bundle: .vaultUI)
+ .resizable()
+ .aspectRatio(contentMode: .fit)
+ .frame(width: 100, height: 100)
+
+ // Loading animation - four pulsing dots
+ if showLoadingAnimation {
+ HStack(spacing: 10) {
+ ForEach(0..<4) { index in
+ Circle()
+ .fill(colors.tertiary)
+ .frame(width: 8, height: 8)
+ .opacity(animatingDots[index] ? 1.0 : 0.3)
+ .animation(
+ Animation.easeInOut(duration: 0.7)
+ .repeatForever(autoreverses: true)
+ .delay(Double(index) * 0.2),
+ value: animatingDots[index]
+ )
+ }
+ }
+ .padding(12)
+ .padding(.horizontal, 12)
+ .background(
+ RoundedRectangle(cornerRadius: 20)
+ .fill(effectiveColorScheme == .dark ? Color.clear : Color.white)
+ .overlay(
+ RoundedRectangle(cornerRadius: 20)
+ .stroke(colors.tertiary, lineWidth: 5)
+ )
+ .shadow(color: Color.black.opacity(0.05), radius: 2, x: 0, y: 1)
+ )
+ }
+
+ // Loading message with animated dots
+ if let message = message, !message.isEmpty {
+ Text(message + textDots)
+ .font(.body)
+ .foregroundColor(colors.text)
+ .multilineTextAlignment(.center)
+ .padding(.horizontal)
+ .padding(.top, showLoadingAnimation ? 0 : 8)
+ }
+ }
+ .padding(20)
+ .frame(maxWidth: .infinity)
+
+ Spacer()
+ }
+ .frame(maxWidth: .infinity)
+ }
+ }
+ .onAppear {
+ if showLoadingAnimation {
+ // Start dot animations
+ for index in 0..<4 {
+ animatingDots[index] = true
+ }
+
+ // Start text dots animation
+ let textTimer = Timer.scheduledTimer(withTimeInterval: 0.4, repeats: true) { _ in
+ if textDots.count >= 3 {
+ textDots = ""
+ } else {
+ textDots += "."
+ }
+ }
+ timer = textTimer
+ }
+ }
+ .onDisappear {
+ timer?.invalidate()
+ timer = nil
+ }
+ }
+}
diff --git a/apps/mobile-app/ios/VaultUI/Components/LoadingOverlayView.swift b/apps/mobile-app/ios/VaultUI/Components/LoadingOverlayView.swift
deleted file mode 100644
index 170589a7e..000000000
--- a/apps/mobile-app/ios/VaultUI/Components/LoadingOverlayView.swift
+++ /dev/null
@@ -1,93 +0,0 @@
-import SwiftUI
-
-/// Loading overlay component with AliasVault branding
-public struct LoadingOverlayView: View {
- let message: String
-
- @Environment(\.colorScheme) private var colorScheme
- @State private var animatingDots: [Bool] = [false, false, false, false]
- @State private var textDots = ""
- @State private var timer: Timer?
-
- public init(message: String) {
- self.message = message
- }
-
- private var colors: ColorConstants.Colors.Type {
- ColorConstants.colors(for: colorScheme)
- }
-
- public var body: some View {
- GeometryReader { geometry in
- VStack(spacing: 0) {
- // Position content at 20% from top to avoid Face ID prompt obstruction
- Spacer()
- .frame(height: geometry.size.height * 0.15)
-
- VStack(spacing: 0) {
- // AliasVault logo animation - four pulsing dots
- HStack(spacing: 10) {
- ForEach(0..<4) { index in
- Circle()
- .fill(colors.tertiary)
- .frame(width: 8, height: 8)
- .opacity(animatingDots[index] ? 1.0 : 0.3)
- .animation(
- Animation.easeInOut(duration: 0.7)
- .repeatForever(autoreverses: true)
- .delay(Double(index) * 0.2),
- value: animatingDots[index]
- )
- }
- }
- .padding(12)
- .padding(.horizontal, 12)
- .background(
- RoundedRectangle(cornerRadius: 20)
- .fill(colorScheme == .dark ? Color.clear : Color.white)
- .overlay(
- RoundedRectangle(cornerRadius: 20)
- .stroke(colors.tertiary, lineWidth: 5)
- )
- .shadow(color: Color.black.opacity(0.05), radius: 2, x: 0, y: 1)
- )
-
- // Loading message with animated dots
- if !message.isEmpty {
- Text(message + textDots)
- .font(.body)
- .foregroundColor(colors.text)
- .multilineTextAlignment(.center)
- .padding(.horizontal)
- .padding(.top, 16)
- }
- }
- .padding(20)
- .frame(maxWidth: .infinity) // Ensure horizontal centering
-
- Spacer()
- }
- .frame(maxWidth: .infinity) // Ensure horizontal centering for entire VStack
- }
- .onAppear {
- // Start dot animations
- for index in 0..<4 {
- animatingDots[index] = true
- }
-
- // Start text dots animation
- let textTimer = Timer.scheduledTimer(withTimeInterval: 0.4, repeats: true) { _ in
- if textDots.count >= 3 {
- textDots = ""
- } else {
- textDots += "."
- }
- }
- timer = textTimer
- }
- .onDisappear {
- timer?.invalidate()
- timer = nil
- }
- }
-}
diff --git a/apps/mobile-app/ios/VaultUI/Registration/Passkeys/PasskeyFormView.swift b/apps/mobile-app/ios/VaultUI/Registration/Passkeys/PasskeyFormView.swift
index ef09813dd..365833272 100644
--- a/apps/mobile-app/ios/VaultUI/Registration/Passkeys/PasskeyFormView.swift
+++ b/apps/mobile-app/ios/VaultUI/Registration/Passkeys/PasskeyFormView.swift
@@ -139,7 +139,7 @@ struct PasskeyFormView: View {
// Loading overlay
if viewModel.isLoading {
- LoadingOverlayView(message: viewModel.loadingMessage)
+ BrandedLoadingView(message: viewModel.loadingMessage)
}
}
.navigationBarTitleDisplayMode(.inline)
diff --git a/apps/mobile-app/ios/VaultUI/Registration/Passkeys/PasskeyRegistrationView.swift b/apps/mobile-app/ios/VaultUI/Registration/Passkeys/PasskeyRegistrationView.swift
index 05903fe01..2048e1804 100644
--- a/apps/mobile-app/ios/VaultUI/Registration/Passkeys/PasskeyRegistrationView.swift
+++ b/apps/mobile-app/ios/VaultUI/Registration/Passkeys/PasskeyRegistrationView.swift
@@ -42,7 +42,7 @@ public struct PasskeyRegistrationView: View {
// Loading overlay
if viewModel.isLoading {
- LoadingOverlayView(message: viewModel.loadingMessage)
+ BrandedLoadingView(message: viewModel.loadingMessage)
}
}
.navigationBarTitleDisplayMode(.inline)