mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-05-12 09:23:42 -04:00
Add quick unlock type enum to show custom label in view (#520)
This commit is contained in:
@@ -69,8 +69,11 @@ public class CredentialProviderViewController: ASCredentialProviderViewControlle
|
||||
// Check if we're in quick return mode
|
||||
// Setup the loading view (actual unlock happens in viewDidAppear)
|
||||
if isQuickReturnMode {
|
||||
// Show loading view
|
||||
let loadingView = QuickUnlockLoadingView()
|
||||
// Determine the type of credential being retrieved
|
||||
let type: QuickUnlockType = quickReturnPasskeyRequest != nil ? .passkey : .credential
|
||||
|
||||
// Show loading view with appropriate type
|
||||
let loadingView = QuickUnlockLoadingView(type: type)
|
||||
let hostingController = UIHostingController(rootView: loadingView)
|
||||
|
||||
addChild(hostingController)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import Foundation
|
||||
|
||||
/// Type of credential being retrieved during quick unlock
|
||||
public enum QuickUnlockType: Hashable {
|
||||
case credential
|
||||
case passkey
|
||||
}
|
||||
@@ -3,10 +3,22 @@ import SwiftUI
|
||||
/// Loading view shown during quick unlock (biometric authentication)
|
||||
public struct QuickUnlockLoadingView: View {
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
|
||||
private let locBundle = Bundle.vaultUI
|
||||
|
||||
public init() {}
|
||||
private let locBundle = Bundle.vaultUI
|
||||
private let type: QuickUnlockType
|
||||
|
||||
public init(type: QuickUnlockType) {
|
||||
self.type = type
|
||||
}
|
||||
|
||||
private var localizedMessage: String {
|
||||
switch type {
|
||||
case .credential:
|
||||
return String(localized: "retrieving_credential", bundle: locBundle)
|
||||
case .passkey:
|
||||
return String(localized: "retrieving_passkey", bundle: locBundle)
|
||||
}
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
ZStack {
|
||||
@@ -15,17 +27,27 @@ public struct QuickUnlockLoadingView: View {
|
||||
.ignoresSafeArea()
|
||||
|
||||
// Loading overlay
|
||||
LoadingOverlayView(message: String(localized: "retrieving_credential", bundle: locBundle))
|
||||
LoadingOverlayView(message: localizedMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview("Light Mode") {
|
||||
QuickUnlockLoadingView()
|
||||
#Preview("Credential - Light Mode") {
|
||||
QuickUnlockLoadingView(type: .credential)
|
||||
.preferredColorScheme(.light)
|
||||
}
|
||||
|
||||
#Preview("Dark Mode") {
|
||||
QuickUnlockLoadingView()
|
||||
#Preview("Credential - Dark Mode") {
|
||||
QuickUnlockLoadingView(type: .credential)
|
||||
.preferredColorScheme(.dark)
|
||||
}
|
||||
|
||||
#Preview("Passkey - Light Mode") {
|
||||
QuickUnlockLoadingView(type: .passkey)
|
||||
.preferredColorScheme(.light)
|
||||
}
|
||||
|
||||
#Preview("Passkey - Dark Mode") {
|
||||
QuickUnlockLoadingView(type: .passkey)
|
||||
.preferredColorScheme(.dark)
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user