Skip to content

Commit

Permalink
Run swiftformat
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenperera committed Dec 12, 2024
1 parent fa3d24f commit 52abc59
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion ios/Cove/SettingsScreen/ChangePinView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct ChangePinView: View {
}
)

case .confirm(let pinToConfirm):
case let .confirm(pinToConfirm):
NumberPadPinView(
title: "Confirm New PIN",
isPinCorrect: { $0 == pinToConfirm },
Expand Down
2 changes: 1 addition & 1 deletion ios/Cove/SettingsScreen/NewPinView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct NewPinView: View {
}
}
)
case .confirm(let pinToConfirm):
case let .confirm(pinToConfirm):
NumberPadPinView(
title: "Confirm New PIN",
isPinCorrect: { $0 == pinToConfirm },
Expand Down
10 changes: 5 additions & 5 deletions ios/Cove/Views/LockView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ struct LockView<Content: View>: View {
self.content = content()

// back
self.backEnabled = backAction != nil
backEnabled = backAction != nil
self.backAction = backAction ?? {}

// private
self.animateField = false
self.isUnlocked = false
self.noBiometricAccess = false
self.pinLength = 6
animateField = false
isUnlocked = false
noBiometricAccess = false
pinLength = 6
}

var body: some View {
Expand Down
36 changes: 18 additions & 18 deletions ios/Cove/Views/NumberPadPinView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ struct NumberPadPinView: View {
/// args
var title: String
@Binding var isUnlocked: Bool

let isPinCorrect: (String) -> Bool
var pinLength: Int

// back button
private var backEnabled: Bool
var backAction: () -> Void
Expand All @@ -26,7 +26,7 @@ struct NumberPadPinView: View {
/// private view properties
@State private var pin: String
@State private var animateField: Bool

public init(
title: String = "Enter Pin",
isUnlocked: Binding<Bool> = .constant(false),
Expand All @@ -37,18 +37,18 @@ struct NumberPadPinView: View {
onWrongPin: @escaping (String) -> Void = { _ in }
) {
self.title = title
self._isUnlocked = isUnlocked
_isUnlocked = isUnlocked
self.isPinCorrect = isPinCorrect
self.pinLength = pinLength
self.backEnabled = backAction != nil
backEnabled = backAction != nil
self.backAction = backAction ?? {}
self.onUnlock = onUnlock
self.onWrongPin = onWrongPin
self.pin = ""
self.animateField = false

pin = ""
animateField = false
}

private var isBiometricAvailable: Bool {
/// Lock Context
let context = LAContext()
Expand All @@ -73,7 +73,7 @@ struct NumberPadPinView: View {
.font(.title.bold())
.frame(maxWidth: .infinity)
.foregroundStyle(.white)

/// Adding Wiggling Animation for Wrong Password With Keyframe Animator
HStack(spacing: 10) {
ForEach(0 ..< pinLength, id: \.self) { index in
Expand All @@ -86,7 +86,7 @@ struct NumberPadPinView: View {
if pin.count > index {
let index = pin.index(pin.startIndex, offsetBy: index)
let string = String(pin[index])

Text(string)
.font(.title.bold())
.foregroundStyle(.black)
Expand Down Expand Up @@ -117,15 +117,15 @@ struct NumberPadPinView: View {
.onChange(of: animateField) { _, _ in
let pin = pin
self.pin = ""

let totalDuration = 7 * 0.07
DispatchQueue.main.asyncAfter(deadline: .now() + totalDuration) {
onWrongPin(pin)
}
}
.padding(.top, 15)
.frame(maxHeight: .infinity)

/// Custom Number Pad
GeometryReader { _ in
LazyVGrid(columns: Array(repeating: GridItem(), count: 3), content: {
Expand All @@ -142,10 +142,10 @@ struct NumberPadPinView: View {
})
.tint(.white)
}

// take up space
Button(action: {}) {}

Button(action: {
guard pin.count < pinLength else { return }
pin.append("0")
Expand All @@ -157,7 +157,7 @@ struct NumberPadPinView: View {
.contentShape(.rect)
})
.tint(.white)

/// 0 and Back Button
Button(action: {
if !pin.isEmpty { pin.removeLast() }
Expand Down Expand Up @@ -197,7 +197,7 @@ struct NumberPadPinView: View {
struct Container: View {
@State var pin = ""
@State var isUnlocked = false

var body: some View {
NumberPadPinView(
isUnlocked: $isUnlocked,
Expand All @@ -206,6 +206,6 @@ struct NumberPadPinView: View {
)
}
}

return Container()
}

0 comments on commit 52abc59

Please sign in to comment.