Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Fix issue in iOS autofill where entire alias object would be null if birthdate was null (#1123)
Leendert de Borstccf473635ece
diff --git a/apps/mobile-app/ios/Autofill/CredentialIdentityStore.swift b/apps/mobile-app/ios/Autofill/CredentialIdentityStore.swiftindex 289b93fc1..8bd99cf67 100644--- a/apps/mobile-app/ios/Autofill/CredentialIdentityStore.swift+++ b/apps/mobile-app/ios/Autofill/CredentialIdentityStore.swift@@ -1,5 +1,6 @@import AuthenticationServicesimport VaultModels+import VaultUI/*** Native iOS implementation of the CredentialIdentityStore protocol.@@ -21,15 +22,18 @@ public class CredentialIdentityStore {let host = url.host else {return nil}- guard let username = credential.username, !username.isEmpty else {- return nil++ // Use the same logic as the UI for determining the identifier+ let identifier = usernameOrEmail(credential: credential)+ guard !identifier.isEmpty else {+ return nil // Skip credentials with no identifier}let effectiveDomain = Self.effectiveDomain(from: host)return ASPasswordCredentialIdentity(serviceIdentifier: ASCredentialServiceIdentifier(identifier: effectiveDomain, type: .domain),- user: username,+ user: identifier,recordIdentifier: credential.id.uuidString)}@@ -59,15 +63,21 @@ public class CredentialIdentityStore {/// Remove one or more specific credentials from iOS credential store.public func removeCredentialIdentities(_ credentials: [Credential]) async throws {- let identities = credentials.map { credential in+ let identities = credentials.compactMap { credential -> ASPasswordCredentialIdentity? inlet serviceIdentifier = ASCredentialServiceIdentifier(identifier: credential.service.name ?? "",type: .domain)++ // Use the same logic as the UI for determining the identifier+ let identifier = usernameOrEmail(credential: credential)+ guard !identifier.isEmpty else {+ return nil // Skip credentials with no identifier+ }return ASPasswordCredentialIdentity(serviceIdentifier: serviceIdentifier,- user: credential.username ?? "",+ user: identifier,recordIdentifier: credential.id.uuidString)}diff --git a/apps/mobile-app/ios/VaultStoreKit/VaultStore+Query.swift b/apps/mobile-app/ios/VaultStoreKit/VaultStore+Query.swiftindex dac7095f7..6245ed3b3 100644--- a/apps/mobile-app/ios/VaultStoreKit/VaultStore+Query.swift+++ b/apps/mobile-app/ios/VaultStoreKit/VaultStore+Query.swift@@ -259,12 +259,26 @@ extension VaultStore {let aliasUpdatedAtString = row[27] as? String,let aliasIsDeletedInt64 = row[28] as? Int64,let aliasCreatedAt = parseDateString(aliasCreatedAtString),- let aliasUpdatedAt = parseDateString(aliasUpdatedAtString),- let aliasBirthDateString = row[24] as? String,- let aliasBirthDate = parseDateString(aliasBirthDateString) {+ let aliasUpdatedAt = parseDateString(aliasUpdatedAtString) {let aliasIsDeleted = aliasIsDeletedInt64 == 1+ let aliasBirthDate: Date+ if let aliasBirthDateString = row[24] as? String,+ let parsedBirthDate = parseDateString(aliasBirthDateString) {+ aliasBirthDate = parsedBirthDate+ } else {+ // Use 0001-01-01 00:00 as the default date if birthDate is null+ var dateComponents = DateComponents()+ dateComponents.year = 1+ dateComponents.month = 1+ dateComponents.day = 1+ dateComponents.hour = 0+ dateComponents.minute = 0+ dateComponents.second = 0+ aliasBirthDate = Calendar(identifier: .gregorian).date(from: dateComponents)!+ }+alias = Alias(id: UUID(uuidString: aliasIdString)!,gender: row[20] as? String,diff --git a/apps/mobile-app/ios/VaultUI/Utils/CredentialFilter.swift b/apps/mobile-app/ios/VaultUI/Utils/CredentialFilter.swiftindex d5be5e974..cc8b29af9 100644--- a/apps/mobile-app/ios/VaultUI/Utils/CredentialFilter.swift+++ b/apps/mobile-app/ios/VaultUI/Utils/CredentialFilter.swift@@ -115,4 +115,4 @@ public class CredentialFilter {}}}-}\ No newline at end of file+}