Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion Sources/USDZScanner/AppDataModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ class AppDataModel: ObservableObject, Identifiable {
private func startNewCapture() -> Bool {
logger.log("startNewCapture() called...")
if !ObjectCaptureSession.isSupported {
preconditionFailure("ObjectCaptureSession is not supported on this device!")
//preconditionFailure("ObjectCaptureSession is not supported on this device!")
// App will Show a POP-Up and Progress View instead of Crashing
showLiDARNotAvailableAlert()
return false

}

guard let folderManager = CaptureFolderManager() else {
Expand Down Expand Up @@ -238,7 +242,26 @@ class AppDataModel: ObservableObject, Identifiable {
isObjectFlipped = false
state = .ready
}
private func showLiDARNotAvailableAlert() {
let alertController = UIAlertController(
title: "LiDAR Not Available",
message: "ObjectCaptureSession is not supported on this device.",
preferredStyle: .alert
)

alertController.addAction(UIAlertAction(
title: "OK",
style: .default,
handler: nil
))

// Present the alert
if let viewController = UIApplication.shared.keyWindow?.rootViewController {
viewController.present(alertController, animated: true, completion: nil)
}
}


private func onStateChanged(newState: ObjectCaptureSession.CaptureState) {
logger.info("ObjectCaptureSession switched to state: \(String(describing: newState))")
if case .completed = newState {
Expand Down