mirror of
https://github.com/maxgoedjen/secretive.git
synced 2024-11-24 22:47:06 +00:00
fixed UI bug. Crash on hot plug/unplug Yubikey or similar
fix:Non-constant range: argument must be an integer literal fix:Generic parameter 'ValueType' shadows generic parameter from outer scope with the same name; this is an error fix:Converting non-sendable function value to '@Sendable (any FileHandleReader, any FileHandleWriter) async -> Bool' may introduce data races
This commit is contained in:
parent
23b3297fee
commit
a530a83e87
@ -2,7 +2,7 @@ import Foundation
|
||||
import Combine
|
||||
|
||||
/// Type eraser for SecretStore.
|
||||
public class AnySecretStore: SecretStore {
|
||||
public class AnySecretStore: SecretStore, ObservableObject {
|
||||
|
||||
let base: Any
|
||||
private let _isAvailable: () -> Bool
|
||||
@ -28,9 +28,11 @@ public class AnySecretStore: SecretStore {
|
||||
_existingPersistedAuthenticationContext = { secretStore.existingPersistedAuthenticationContext(secret: $0.base as! SecretStoreType.SecretType) }
|
||||
_persistAuthentication = { try secretStore.persistAuthentication(secret: $0.base as! SecretStoreType.SecretType, forDuration: $1) }
|
||||
_reloadSecrets = { secretStore.reloadSecrets() }
|
||||
sink = secretStore.objectWillChange.sink { _ in
|
||||
self.objectWillChange.send()
|
||||
}
|
||||
sink = secretStore.objectWillChange
|
||||
.receive(on: DispatchQueue.main) // Ensure updates are received on the main thread
|
||||
.sink { [weak self] _ in
|
||||
self?.objectWillChange.send()
|
||||
}
|
||||
}
|
||||
|
||||
public var isAvailable: Bool {
|
||||
|
@ -32,7 +32,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||
logger.debug("SecretAgent finished launching")
|
||||
DispatchQueue.main.async {
|
||||
self.socketController.handler = self.agent.handle(reader:writer:)
|
||||
self.socketController.handler = { [weak self] reader, writer in
|
||||
guard let self = self else { return false }
|
||||
return await self.agent.handle(reader: reader, writer: writer)
|
||||
}
|
||||
}
|
||||
NotificationCenter.default.addObserver(forName: .secretStoreReloaded, object: nil, queue: .main) { [self] _ in
|
||||
try? publicKeyFileStoreController.generatePublicKeys(for: storeList.allSecrets, clear: true)
|
||||
|
@ -93,14 +93,14 @@ struct ThumbnailPickerView<ValueType: Hashable>: View {
|
||||
|
||||
extension ThumbnailPickerView {
|
||||
|
||||
struct Item<ValueType: Hashable>: Identifiable {
|
||||
struct Item<Value: Hashable>: Identifiable {
|
||||
let id = UUID()
|
||||
let value: ValueType
|
||||
let value: Value
|
||||
let name: LocalizedStringKey
|
||||
let description: LocalizedStringKey
|
||||
let thumbnail: AnyView
|
||||
|
||||
init<ViewType: View>(value: ValueType, name: LocalizedStringKey, description: LocalizedStringKey, thumbnail: ViewType) {
|
||||
init<ThumbnailView: View>(value: Value, name: LocalizedStringKey, description: LocalizedStringKey, thumbnail: ThumbnailView) {
|
||||
self.value = value
|
||||
self.name = name
|
||||
self.description = description
|
||||
|
@ -55,7 +55,7 @@ struct StepView: View {
|
||||
.foregroundColor(.green)
|
||||
.frame(width: max(0, ((width - (Constants.padding * 2)) / Double(numberOfSteps - 1)) * Double(currentStep) - (Constants.circleWidth / 2)), height: 5)
|
||||
HStack {
|
||||
ForEach(0..<numberOfSteps) { index in
|
||||
ForEach(0..<numberOfSteps, id: \.self) { index in
|
||||
ZStack {
|
||||
if currentStep > index {
|
||||
Circle()
|
||||
|
Loading…
Reference in New Issue
Block a user