Skip to content

Commit

Permalink
fix: add a generic message to android dialog when scan process fails
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielFRico committed Dec 5, 2024
1 parent 3d1f292 commit 3a64be1
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ class EIdReaderModule(reactContext: ReactApplicationContext) :
}

private fun reject(e: Exception) {
stopReading()
currentActivity?.runOnUiThread(Runnable {
_dialog?.setMessage("Sorry, there was a problem reading the passport. Please try again")
})
stopReading(false)
_promise?.reject(e)
}

Expand Down Expand Up @@ -255,11 +258,13 @@ class EIdReaderModule(reactContext: ReactApplicationContext) :
}

@ReactMethod
fun stopReading() {
fun stopReading(removeDialog: Boolean = true) {
isReading = false
mrzInfo = null
if (_dialog != null) _dialog?.dismiss()
_dialog = null
if (_dialog != null && removeDialog) {
_dialog?.dismiss()
_dialog = null
}
}

@ReactMethod
Expand Down

0 comments on commit 3a64be1

Please sign in to comment.