Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>

This commit is contained in:
Matt Bruce 2026-01-04 12:21:40 -06:00
parent fefb6cf363
commit 7a564b2115

View File

@ -29,13 +29,36 @@ struct ContentView: View {
settings: settings,
sessionKey: cameraSessionKey,
onImageCaptured: { image in
capturedPhoto = CapturedPhoto(image: image, timestamp: Date())
showPhotoReview = true
isSavingPhoto = false
saveError = nil
if settings.isAutoSaveEnabled {
// Auto-save enabled: save immediately without showing review screen
Task {
// Small delay to ensure shutter sound plays before saving
try? await Task.sleep(for: .milliseconds(200))
let quality = settings.photoQuality
let result = await PhotoLibraryService.savePhotoToLibrary(image, quality: quality)
switch result {
case .success:
print("Photo auto-saved successfully")
// Don't reset camera session for auto-save to avoid timing issues
case .failure(let error):
print("Failed to auto-save photo: \(error)")
// Don't reset on failure either
}
}
} else {
// Auto-save disabled: show review screen
capturedPhoto = CapturedPhoto(image: image, timestamp: Date())
showPhotoReview = true
isSavingPhoto = false
saveError = nil
}
print("Photo captured successfully")
}
)
.ignoresSafeArea() // Only camera ignores safe area to fill screen
}
// Photo review overlay
@ -52,33 +75,25 @@ struct ContentView: View {
}
)
.transition(.opacity)
.ignoresSafeArea() // Photo review also fills screen
}
// Settings button overlay - positioned with safe area consideration
VStack {
HStack {
Spacer()
Button {
showSettings = true
} label: {
Image(systemName: "gearshape.fill")
.font(.title3)
.foregroundStyle(.white)
.padding(Design.Spacing.medium)
.background(.ultraThinMaterial, in: Circle())
.shadow(radius: Design.Shadow.radiusSmall)
}
.accessibilityLabel("Settings")
}
.padding(.horizontal, Design.Spacing.large)
.padding(.top, Design.Spacing.small) // Reduced from medium to account for safe area
Spacer()
}
.safeAreaInset(edge: .top) { Color.clear.frame(height: 0) } // Ensures proper safe area handling
}
.ignoresSafeArea()
// Settings button overlay - respects safe area naturally
.overlay(alignment: .topTrailing) {
Button {
showSettings = true
} label: {
Image(systemName: "gearshape.fill")
.font(.title3)
.foregroundStyle(.white)
.padding(Design.Spacing.medium)
.background(.ultraThinMaterial, in: Circle())
.shadow(radius: Design.Shadow.radiusSmall)
}
.accessibilityLabel("Settings")
.padding(.horizontal, Design.Spacing.large)
.padding(.top, Design.Spacing.small)
}
.animation(.easeInOut(duration: Design.Animation.quick), value: showPhotoReview)
.onChange(of: settings.isRingLightEnabled) { _, newValue in
if settings.isFlashSyncedWithRingLight {