Skip to content

Commit

Permalink
Consistent back button behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
vanshg committed Oct 18, 2023
1 parent 5f7cd81 commit 9d5aed9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ private struct IOrchestratedDocumentVerificationScreen<T, U: JobResult>: View {
// imageCaptureDelegate is just for image capture, not job result
imageCaptureDelegate: viewModel
),
showBackButton: false,
delegate: nil
)
case .processing(let state):
Expand Down
17 changes: 3 additions & 14 deletions Sources/SmileID/Classes/SelfieCapture/View/SelfieCaptureView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,20 @@ public struct SelfieCaptureView: View, SelfieViewDelegate {
@EnvironmentObject var router: Router<NavigationDestination>
@ObservedObject var viewModel: SelfieCaptureViewModel
private var delegate: SmartSelfieResultDelegate?
private var originalBrightness: CGFloat
var camera: CameraView?
let arView: ARView?
let faceOverlay: FaceOverlayView
let showBackButton: Bool

init(
viewModel: SelfieCaptureViewModel,
showBackButton: Bool = true,
delegate: SmartSelfieResultDelegate?
) {
self.delegate = delegate
self.viewModel = viewModel
self.showBackButton = showBackButton
faceOverlay = FaceOverlayView(model: viewModel)
viewModel.smartSelfieResultDelegate = delegate
originalBrightness = UIScreen.main.brightness
UIScreen.main.brightness = 1
if ARFaceTrackingConfiguration.isSupported {
arView = ARView()
Expand Down Expand Up @@ -86,20 +85,10 @@ public struct SelfieCaptureView: View, SelfieViewDelegate {
Color.clear
}
}
.overlay(ZStack {
if showBackButton {
NavigationBar {
viewModel.resetState()
viewModel.pauseCameraSession()
router.pop()
}
}
})
}
.edgesIgnoringSafeArea(.all)
.navigationBarBackButtonHidden(true)
.background(SmileID.theme.backgroundMain)
.onDisappear {
UIScreen.main.brightness = originalBrightness
viewModel.cameraManager.pauseSession()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,5 @@ public struct SmartSelfieInstructionsView: View {
)
.padding(.top, 50)
}
.overlay(
NavigationBar {
viewModel.handleClose()
router.dismiss()
}
)
}
}

0 comments on commit 9d5aed9

Please sign in to comment.