refactor: use guard in handleProfileScan
This commit is contained in:
@@ -243,18 +243,20 @@ struct QRCodeView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handleProfileScan(_ prof: String) {
|
func handleProfileScan(_ prof: String) {
|
||||||
if scannedCode != prof {
|
guard scannedCode != prof else {
|
||||||
generator.impactOccurred()
|
return
|
||||||
cameraAnimate {
|
}
|
||||||
scannedCode = prof
|
|
||||||
|
|
||||||
if profile(for: scannedCode) != nil {
|
generator.impactOccurred()
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + animationDuration) {
|
cameraAnimate {
|
||||||
showProfileView = true
|
scannedCode = prof
|
||||||
}
|
|
||||||
} else {
|
if profile(for: scannedCode) != nil {
|
||||||
print("Profile not found")
|
DispatchQueue.main.asyncAfter(deadline: .now() + animationDuration) {
|
||||||
|
showProfileView = true
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print("Profile not found")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user