Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Vault.xcworkspace/xcshareddata/swiftpm/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Vault/.swiftformat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# format options

--swiftversion 6.2
--swiftversion 6.4

--allman false
--binarygrouping 4,8
Expand Down
22 changes: 11 additions & 11 deletions Vault/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Vault/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import CompilerPluginSupport
import PackageDescription

let swiftLintVersion: Version = "0.63.3"
let swiftFormatVersion: Version = "0.61.1"
let swiftFormatChecksum: String = "47f7932f35c714b00430f56df1cfaf1bea0b4baae299bb2a09874cb52ee45350"
let swiftLintVersion: Version = "0.65.1"
let swiftFormatVersion: Version = "0.63.0"
let swiftFormatChecksum: String = "d3c350a6655c0f687e2c23aac3e777b35345313a6428bb36b915fe7d9840ec78"

let swiftSettings: [SwiftSetting] = [
.enableUpcomingFeature("ExistentialAny"),
Expand Down Expand Up @@ -47,16 +47,16 @@ let package = Package(
.plugin(name: "FormatLint", targets: ["FormatLint"]),
],
dependencies: [
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", exact: "1.19.2"),
.package(url: "https://github.com/attaswift/BigInt.git", exact: "5.7.0"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", exact: "1.19.4"),
.package(url: "https://github.com/attaswift/BigInt.git", exact: "6.0.1"),
.package(url: "https://github.com/krzyzanowskim/CryptoSwift", exact: "1.10.0"),
.package(url: "https://github.com/sunghyun-k/swiftui-toasts.git", exact: "1.1.1"),
.package(url: "https://github.com/apple/swift-argument-parser", exact: "1.6.2"),
.package(url: "https://github.com/apple/swift-argument-parser", exact: "1.8.2"),
.package(url: "https://github.com/twostraws/CodeScanner", exact: "2.5.2"),
.package(url: "https://github.com/dm-zharov/swift-security.git", exact: "2.5.1"),
.package(url: "https://github.com/gonzalezreal/swift-markdown-ui", exact: "2.4.1"),
.package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", exact: swiftLintVersion),
.package(url: "https://github.com/swiftlang/swift-syntax", from: "600.0.0"),
.package(url: "https://github.com/swiftlang/swift-syntax", exact: "603.0.2"),
],
targets: [
.target(
Expand Down
4 changes: 3 additions & 1 deletion Vault/Sources/CryptoEngine/Symmetric/AESGCMDecryptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public struct AESGCMDecryptor: Decryptor {
public func decrypt(message: Message, iv: Data) throws -> Data {
let gcm = GCM(iv: iv.byteArray, authenticationTag: message.authenticationTag.byteArray, mode: .detached)
let aes = try AES(key: key.byteArray, blockMode: gcm, padding: .noPadding)
if message.ciphertext.isEmpty { return Data() }
if message.ciphertext.isEmpty {
return Data()
}
let plaintextBytes = try aes.decrypt(message.ciphertext.byteArray)
return Data(plaintextBytes)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ extension Task where Failure == any Error {
) async throws -> Success? {
try await withThrowingTaskGroup(of: Success.self) { group -> Success? in
try Task<Never, Never>.checkCancellation()
if tasks.isEmpty { throw TaskRaceError.noTasksScheduled }
if tasks.isEmpty {
throw TaskRaceError.noTasksScheduled
}
for task in tasks {
group.addTask(priority: priority) {
try await task()
Expand Down
8 changes: 6 additions & 2 deletions Vault/Sources/FoundationExtensions/SemVer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ extension SemVer: Codable {

extension SemVer: Comparable {
public static func < (lhs: SemVer, rhs: SemVer) -> Bool {
if lhs.major < rhs.major { return true }
if lhs.major == rhs.major, lhs.minor < rhs.minor { return true }
if lhs.major < rhs.major {
return true
}
if lhs.major == rhs.major, lhs.minor < rhs.minor {
return true
}
return lhs.major == rhs.major && lhs.minor == rhs.minor && lhs.patch < rhs.patch
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ extension VaultExportDataBlockGenerator {
payload.userDescription
.split(separator: "\n")
.compactMap { text in
if text.isEmpty { return nil }
if text.isEmpty {
return nil
}
return .init(
text: String(text),
font: .systemFont(ofSize: 10),
Expand Down
8 changes: 6 additions & 2 deletions Vault/Sources/VaultExport/Helpers/Floating+Equality.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ extension FloatingPoint {
func rescaledAlmostEqual(to other: Self, tolerance: Self) -> Bool {
// NaN is considered to be not approximately equal to anything, not even
// itself.
if isNaN || other.isNaN { return false }
if isNaN || other.isNaN {
return false
}
if isInfinite {
if other.isInfinite { return self == other }
if other.isInfinite {
return self == other
}
// Self is infinite and other is finite. Replace self with the binade
// of the greatestFiniteMagnitude, and reduce the exponent of other by
// one to compensate.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ public final class BackupImportScanningHandler: CodeScanningHandler {
let shardData = Data(data.utf8)
do {
try shardDecoder.add(shardData: shardData)
if !shardDecoder.isReadyToDecode { return .continueScanning(.success) }
if !shardDecoder.isReadyToDecode {
return .continueScanning(.success)
}
} catch let error as DataShardDecoder.AddShardError where error.canIgnoreError {
return .continueScanning(.ignore)
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ extension OTPCodeTimerState {
///
/// This will only give an output `0...1`.
public func fractionCompleted(at epoch: Double) -> Double {
if totalTime == 0 { return 1 }
if totalTime == 0 {
return 1
}
let remainingTime = remainingTime(at: epoch)
let remainingFraction = remainingTime / totalTime
if remainingFraction < 0 { return 0 }
if remainingFraction < 0 {
return 0
}
let fractionCompleted = 1 - remainingFraction
return fractionCompleted.clamped(to: 0 ... 1)
}
Expand Down
12 changes: 9 additions & 3 deletions Vault/Sources/VaultFeed/Storage/VaultDataModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ public final class VaultDataModel {
/// for the lifetime of the unlocked-device session. Safe to call
/// multiple times — no-op if digester is already built.
public func loadKillphraseDigester() async {
if killphraseDigester != nil { return }
if killphraseDigester != nil {
return
}
do {
let key = try await killphraseKeyStore.loadOrCreate()
let digester = KillphraseDigester(key: key)
Expand All @@ -205,7 +207,9 @@ public final class VaultDataModel {
/// shape as `loadKillphraseDigester`; failure leaves passphrase
/// matching disabled until next launch.
public func loadSearchPassphraseDigester() async {
if searchPassphraseDigester != nil { return }
if searchPassphraseDigester != nil {
return
}
do {
let key = try await searchPassphraseKeyStore.loadOrCreate()
let digester = SearchPassphraseDigester(key: key)
Expand Down Expand Up @@ -272,7 +276,9 @@ extension VaultDataModel {
extension VaultDataModel {
public func loadBackupPassword() async {
do {
if case .fetched = backupPassword { return }
if case .fetched = backupPassword {
return
}
backupPasswordLoadingState = .loading
defer { backupPasswordLoadingState = .notLoading }
let password = try await backupPasswordStore.fetchPassword()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,12 @@ struct AutoBackupSettingsView: View {
}

private var isBackingUp: Bool {
if case .backingUp = status { return true }
if case .cleaningUp = status { return true }
if case .backingUp = status {
return true
}
if case .cleaningUp = status {
return true
}
return false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct PDFPageViewerView: View {
if let image = pageImage(for: geometry.size) {
Image(uiImage: image)
.resizable()
.aspectRatio(contentMode: .fit)
.scaledToFit()
.scaleEffect(scale)
.offset(offset)
.gesture(magnificationGesture)
Expand Down
25 changes: 12 additions & 13 deletions Vault/Sources/VaultiOS/Views/Detail/OTP/OTPCodeDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -318,20 +318,19 @@ struct OTPCodeDetailView<PreviewGenerator: VaultItemPreviewViewGenerator<VaultIt
}
}

@ViewBuilder
private var descriptionSection: some View {
Group {
if viewModel.editingModel.detail.description.isNotBlank {
Section {
Text(viewModel.editingModel.detail.description)
.foregroundStyle(.primary)
.textSelection(.enabled)
.font(.callout)
.multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.vertical, 8)
} header: {
Text(viewModel.strings.descriptionTitle)
}
if viewModel.editingModel.detail.description.isNotBlank {
Section {
Text(viewModel.editingModel.detail.description)
.foregroundStyle(.primary)
.textSelection(.enabled)
.font(.callout)
.multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.vertical, 8)
} header: {
Text(viewModel.strings.descriptionTitle)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ struct VaultDetailKillphraseEditView: View {
.animation(.easeOut, value: killphraseEnabled)
.transition(.move(edge: .top))
.onChange(of: killphraseEnabled) { _, newValue in
if !newValue { newKillphrase = "" }
if !newValue {
newKillphrase = ""
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ struct VaultItemFeedReorderer {
return .noMove
}
// If we are moving this item further down the list than we started, advance it by 1 more position.
if to > from { to += 1 }
if to > from {
to += 1
}
let targetPosition: VaultReorderingPosition = if to == 0 {
.start
} else {
Expand Down
4 changes: 3 additions & 1 deletion Vault/Sources/VaultiOS/Views/Feed/VaultItemFeedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ public struct VaultItemFeedView<
}
}
.onChange(of: state.isEditing) { _, isEditing in
if !isEditing { targetedIds.removeAll() }
if !isEditing {
targetedIds.removeAll()
}
}
}

Expand Down
Loading