Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
fefb6cf363
commit
7a564b2115
@ -29,13 +29,36 @@ struct ContentView: View {
|
|||||||
settings: settings,
|
settings: settings,
|
||||||
sessionKey: cameraSessionKey,
|
sessionKey: cameraSessionKey,
|
||||||
onImageCaptured: { image in
|
onImageCaptured: { image in
|
||||||
|
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())
|
capturedPhoto = CapturedPhoto(image: image, timestamp: Date())
|
||||||
showPhotoReview = true
|
showPhotoReview = true
|
||||||
isSavingPhoto = false
|
isSavingPhoto = false
|
||||||
saveError = nil
|
saveError = nil
|
||||||
|
}
|
||||||
|
|
||||||
print("Photo captured successfully")
|
print("Photo captured successfully")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
.ignoresSafeArea() // Only camera ignores safe area to fill screen
|
||||||
}
|
}
|
||||||
|
|
||||||
// Photo review overlay
|
// Photo review overlay
|
||||||
@ -52,13 +75,11 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.transition(.opacity)
|
.transition(.opacity)
|
||||||
|
.ignoresSafeArea() // Photo review also fills screen
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Settings button overlay - positioned with safe area consideration
|
// Settings button overlay - respects safe area naturally
|
||||||
VStack {
|
.overlay(alignment: .topTrailing) {
|
||||||
HStack {
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
showSettings = true
|
showSettings = true
|
||||||
} label: {
|
} label: {
|
||||||
@ -70,15 +91,9 @@ struct ContentView: View {
|
|||||||
.shadow(radius: Design.Shadow.radiusSmall)
|
.shadow(radius: Design.Shadow.radiusSmall)
|
||||||
}
|
}
|
||||||
.accessibilityLabel("Settings")
|
.accessibilityLabel("Settings")
|
||||||
}
|
|
||||||
.padding(.horizontal, Design.Spacing.large)
|
.padding(.horizontal, Design.Spacing.large)
|
||||||
.padding(.top, Design.Spacing.small) // Reduced from medium to account for safe area
|
.padding(.top, Design.Spacing.small)
|
||||||
|
|
||||||
Spacer()
|
|
||||||
}
|
}
|
||||||
.safeAreaInset(edge: .top) { Color.clear.frame(height: 0) } // Ensures proper safe area handling
|
|
||||||
}
|
|
||||||
.ignoresSafeArea()
|
|
||||||
.animation(.easeInOut(duration: Design.Animation.quick), value: showPhotoReview)
|
.animation(.easeInOut(duration: Design.Animation.quick), value: showPhotoReview)
|
||||||
.onChange(of: settings.isRingLightEnabled) { _, newValue in
|
.onChange(of: settings.isRingLightEnabled) { _, newValue in
|
||||||
if settings.isFlashSyncedWithRingLight {
|
if settings.isFlashSyncedWithRingLight {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user