Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import javax.inject.Inject
Expand Down Expand Up @@ -164,7 +165,7 @@ internal class FingerprintCaptureViewModel @Inject constructor(

private fun start(
fingerprintsToCapture: List<IFingerIdentifier>,
fingerprintSdk: FingerprintConfiguration.BioSdk
fingerprintSdk: FingerprintConfiguration.BioSdk,
) {
if (!hasStarted) {
hasStarted = true
Expand Down Expand Up @@ -403,7 +404,11 @@ internal class FingerprintCaptureViewModel @Inject constructor(
imageTransferTask = viewModelScope.launch {
try {
val acquiredImage = bioSdkWrapper.acquireFingerprintImage()
handleImageTransferSuccess(acquiredImage)
if (isActive) {
handleImageTransferSuccess(acquiredImage)
}
} catch (_: CancellationException) {
// No-op - This is expected when job is cancelled manually, i.e. by back press
} catch (ex: Throwable) {
handleScannerCommunicationsError(ex)
}
Expand Down Expand Up @@ -665,7 +670,7 @@ internal class FingerprintCaptureViewModel @Inject constructor(

fun handleOnViewCreated(
fingerprintsToCapture: List<IFingerIdentifier>,
fingerprintSdk: FingerprintConfiguration.BioSdk
fingerprintSdk: FingerprintConfiguration.BioSdk,
) {
updateState {
it.copy(
Expand Down