Updated on 2026-08-14
This commit is contained in:
parent
0fbf91c88b
commit
00d5c7ce34
5 changed files with 20 additions and 3 deletions
|
|
@ -74,7 +74,9 @@ abstract class Task<T> {
|
|||
}
|
||||
}
|
||||
is CompletionResult.Failure ->
|
||||
if (result.error is TaskError.UserCancelledError) {
|
||||
if (result.error is TaskError.TagLost) {
|
||||
delegate?.hideSecurityDelay()
|
||||
} else if (result.error is TaskError.UserCancelledError) {
|
||||
callback(CompletionResult.Failure(TaskError.UserCancelledError()))
|
||||
reader?.readingActive = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,15 @@ class DefaultCardManagerDelegate(private val reader: NfcReader) : CardManagerDel
|
|||
}
|
||||
}
|
||||
|
||||
override fun hideSecurityDelay() {
|
||||
postUI {
|
||||
readingDialog?.lTouchCard?.visibility = View.VISIBLE
|
||||
readingDialog?.flSecurityDelay?.visibility = View.GONE
|
||||
readingDialog?.tvTaskTitle?.text = activity.getText(R.string.dialog_ready_to_scan)
|
||||
readingDialog?.tvTaskText?.text = activity.getText(R.string.dialog_scan_text)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTaskCompleted() {
|
||||
postUI {
|
||||
readingDialog?.lTouchCard?.visibility = View.GONE
|
||||
|
|
|
|||
|
|
@ -66,6 +66,10 @@ class NfcReader : CardReader {
|
|||
val rawResponse: ByteArray?
|
||||
try {
|
||||
rawResponse = isoDep?.transceive(data)
|
||||
} catch (exception: TagLostException) {
|
||||
callback?.invoke(CompletionResult.Failure(TaskError.TagLost()))
|
||||
isoDep = null
|
||||
return
|
||||
} catch (exception: Exception) {
|
||||
isoDep = null
|
||||
return
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="Ready to Scan"
|
||||
android:text="@string/dialog_ready_to_scan"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
|
||||
|
||||
<include
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
android:gravity="center"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="\nScan card with your phone as shown above\n"
|
||||
android:text="@string/dialog_scan_text"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,5 +6,7 @@
|
|||
<string name="dialog_security_delay">Security delay</string>
|
||||
<string name="dialog_security_delay_description">This banknote has enforced security delay. Please hold the banknote firmly until the operation is completed…</string>
|
||||
<string name="dialog_error">Error</string>
|
||||
<string name="dialog_ready_to_scan">Ready to Scan</string>
|
||||
<string name="dialog_scan_text">Scan card with your phone as shown above</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue