Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
4979bd629a
commit
052e4715dc
BIN
SelfieCam.xcodeproj/project.xcworkspace/xcuserdata/mattbruce.xcuserdatad/UserInterfaceState.xcuserstate
generated
Normal file
BIN
SelfieCam.xcodeproj/project.xcworkspace/xcuserdata/mattbruce.xcuserdatad/UserInterfaceState.xcuserstate
generated
Normal file
Binary file not shown.
@ -61,7 +61,11 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.background(Color.BrandColors.primary.ignoresSafeArea())
|
// Background matches ring light color so rotation transitions are seamless
|
||||||
|
.background(
|
||||||
|
(settings.isRingLightEnabled ? settings.lightColor.opacity(settings.ringLightOpacity) : Color.black)
|
||||||
|
.ignoresSafeArea()
|
||||||
|
)
|
||||||
// Settings button overlay - only show when NOT in photo review mode
|
// Settings button overlay - only show when NOT in photo review mode
|
||||||
.overlay(alignment: .topTrailing) {
|
.overlay(alignment: .topTrailing) {
|
||||||
if !showPhotoReview {
|
if !showPhotoReview {
|
||||||
@ -191,9 +195,9 @@ struct CameraContainerView: View, Equatable {
|
|||||||
let cameraPosition: CameraPosition
|
let cameraPosition: CameraPosition
|
||||||
let onImageCaptured: (UIImage) -> Void
|
let onImageCaptured: (UIImage) -> Void
|
||||||
|
|
||||||
// Only compare sessionKey for equality - ignore settings and callback changes
|
// Only compare sessionKey and cameraPosition for equality
|
||||||
static func == (lhs: CameraContainerView, rhs: CameraContainerView) -> Bool {
|
static func == (lhs: CameraContainerView, rhs: CameraContainerView) -> Bool {
|
||||||
lhs.sessionKey == rhs.sessionKey
|
lhs.sessionKey == rhs.sessionKey && lhs.cameraPosition == rhs.cameraPosition
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
|||||||
@ -341,21 +341,30 @@ struct CustomCameraScreen: MCameraScreen {
|
|||||||
|
|
||||||
print("performActualCapture called - shouldUseCustomScreenFlash: \(shouldUseCustomScreenFlash)")
|
print("performActualCapture called - shouldUseCustomScreenFlash: \(shouldUseCustomScreenFlash)")
|
||||||
if shouldUseCustomScreenFlash {
|
if shouldUseCustomScreenFlash {
|
||||||
// Save original brightness and boost to max
|
// Emulate iPhone Retina Flash behavior:
|
||||||
originalBrightness = UIScreen.main.brightness
|
// 1. Pre-flash (briefly show flash to let camera adjust exposure)
|
||||||
UIScreen.main.brightness = 1.0
|
// 2. Sustain (peak brightness for capture)
|
||||||
|
// 3. Capture (timed during sustain)
|
||||||
// Show flash overlay
|
|
||||||
isShowingScreenFlash = true
|
|
||||||
|
|
||||||
// Wait for camera to adjust to bright screen, then capture
|
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
try? await Task.sleep(for: .milliseconds(150))
|
// Save original brightness
|
||||||
print("Calling captureOutput() with custom flash")
|
originalBrightness = UIScreen.main.brightness
|
||||||
|
|
||||||
|
// 1. Pre-flash: Boost brightness and show overlay briefly
|
||||||
|
UIScreen.main.brightness = 1.0
|
||||||
|
isShowingScreenFlash = true
|
||||||
|
|
||||||
|
// Brief pre-flash duration to let auto-exposure settle
|
||||||
|
try? await Task.sleep(for: .milliseconds(200))
|
||||||
|
|
||||||
|
// 2. Sustain & 3. Capture
|
||||||
|
print("Calling captureOutput() during sustain phase")
|
||||||
captureOutput()
|
captureOutput()
|
||||||
|
|
||||||
// Keep flash visible briefly after capture
|
// Keep flash visible briefly after capture to avoid abrupt cut-off
|
||||||
try? await Task.sleep(for: .milliseconds(100))
|
try? await Task.sleep(for: .milliseconds(150))
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
isShowingScreenFlash = false
|
isShowingScreenFlash = false
|
||||||
UIScreen.main.brightness = originalBrightness
|
UIScreen.main.brightness = originalBrightness
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user