fix: Catch errors in CaptureSession configuration
				
					
				
			This commit is contained in:
		@@ -159,7 +159,6 @@ class CameraView(context: Context) :
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  fun update(changedProps: ArrayList<String>) {
 | 
					  fun update(changedProps: ArrayList<String>) {
 | 
				
			||||||
    Log.i(TAG, "Props changed: $changedProps")
 | 
					    Log.i(TAG, "Props changed: $changedProps")
 | 
				
			||||||
    try {
 | 
					 | 
				
			||||||
    val shouldReconfigurePreview = changedProps.containsAny(propsThatRequirePreviewReconfiguration)
 | 
					    val shouldReconfigurePreview = changedProps.containsAny(propsThatRequirePreviewReconfiguration)
 | 
				
			||||||
    val shouldReconfigureSession = shouldReconfigurePreview || changedProps.containsAny(propsThatRequireSessionReconfiguration)
 | 
					    val shouldReconfigureSession = shouldReconfigurePreview || changedProps.containsAny(propsThatRequireSessionReconfiguration)
 | 
				
			||||||
    val shouldReconfigureFormat = shouldReconfigureSession || changedProps.containsAny(propsThatRequireFormatReconfiguration)
 | 
					    val shouldReconfigureFormat = shouldReconfigureSession || changedProps.containsAny(propsThatRequireFormatReconfiguration)
 | 
				
			||||||
@@ -169,6 +168,7 @@ class CameraView(context: Context) :
 | 
				
			|||||||
    val shouldReconfigureZoomGesture = changedProps.contains("enableZoomGesture")
 | 
					    val shouldReconfigureZoomGesture = changedProps.contains("enableZoomGesture")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    launch {
 | 
					    launch {
 | 
				
			||||||
 | 
					      try {
 | 
				
			||||||
        // Expensive Calls
 | 
					        // Expensive Calls
 | 
				
			||||||
        if (shouldReconfigurePreview) {
 | 
					        if (shouldReconfigurePreview) {
 | 
				
			||||||
          setupPreviewView()
 | 
					          setupPreviewView()
 | 
				
			||||||
@@ -192,12 +192,12 @@ class CameraView(context: Context) :
 | 
				
			|||||||
        if (shouldReconfigureZoomGesture) {
 | 
					        if (shouldReconfigureZoomGesture) {
 | 
				
			||||||
          updateZoomGesture()
 | 
					          updateZoomGesture()
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      } catch (e: Throwable) {
 | 
					      } catch (e: Throwable) {
 | 
				
			||||||
        Log.e(TAG, "update() threw: ${e.message}")
 | 
					        Log.e(TAG, "update() threw: ${e.message}")
 | 
				
			||||||
        invokeOnError(e)
 | 
					        invokeOnError(e)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private suspend fun configureSession() {
 | 
					  private suspend fun configureSession() {
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user