Skip to content

Commit

Permalink
feat: add warning
Browse files Browse the repository at this point in the history
  • Loading branch information
castdrian committed Jun 23, 2024
1 parent 283b731 commit 20a7625
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CoreDex/Views/DexEntryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ struct DexEntryView: View {
}
}

return corrections
// return corrections
return []
}

private func readDexEntry(with dynamicCorrections: [(String, String)]? = nil) {
Expand Down
38 changes: 32 additions & 6 deletions CoreDex/Views/ScanButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct RotatingRing: View {
startAngle: .degrees(Double(index) * (360.0 / Double(ringCount)) + segmentGap),
endAngle: .degrees(Double(index + 1) * (360.0 / Double(ringCount)) - segmentGap)
)
.stroke(Color.blue, lineWidth: 5) // Scaled down line width
.stroke(Color.blue, lineWidth: 5)
.frame(width: ringRadius * 2, height: ringRadius * 2)
}
}
Expand Down Expand Up @@ -111,27 +111,28 @@ struct ScanButton: View {
Image(systemName: "camera")
.resizable()
.scaledToFit()
.frame(width: 30, height: 30) // Scaled down image size
.frame(width: 30, height: 30)
}
.padding(15) // Reduced padding
.frame(width: 90, height: 90) // Scaled down frame
.padding(15)
.frame(width: 90, height: 90)
.background(
Circle()
.fill(LinearGradient(gradient: Gradient(colors: [Color.blue.opacity(0.5), Color.blue]), startPoint: .top, endPoint: .bottom))
)
.overlay(
Circle()
.stroke(Color.blue, lineWidth: 1) // Reduced stroke width
.stroke(Color.blue, lineWidth: 1)
)
.foregroundColor(Color.white)
.padding()
.scaleEffect(scale)
.onAppear {
withAnimation(Animation.easeInOut(duration: 1).repeatForever(autoreverses: true)) {
self.scale = 1.05 // Slightly reduced scale effect
self.scale = 1.05
}
}
}
.modifier(PulsatingWarning())
}
.sheet(isPresented: $showingScanner) {
ScannerView(onImageCaptured: { image in
Expand All @@ -146,6 +147,31 @@ struct ScanButton: View {
}
}

struct PulsatingWarning: ViewModifier {
@State private var pulsate = false

func body(content: Content) -> some View {
VStack {
content
HStack {
Image(systemName: "exclamationmark.triangle.fill")
.foregroundColor(.red)
Text("scanning is very unstable")
.foregroundColor(.red)
.font(.caption)
Image(systemName: "exclamationmark.triangle.fill")
.foregroundColor(.red)
}
.scaleEffect(pulsate ? 1.1 : 1.0)
.onAppear {
withAnimation(Animation.easeInOut(duration: 0.8).repeatForever(autoreverses: true)) {
pulsate = true
}
}
}
}
}

#Preview {
ScanButton()
}

0 comments on commit 20a7625

Please sign in to comment.