From 3bf1ae3648b5c51eae49fa0554464e19753186a1 Mon Sep 17 00:00:00 2001 From: Ighor Moura Date: Tue, 22 Jul 2025 18:10:16 -0400 Subject: [PATCH] register() --- .../com/example/mypos/services/AditumSdkService.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/example/mypos/services/AditumSdkService.kt b/app/src/main/java/com/example/mypos/services/AditumSdkService.kt index 896a73b..24d5802 100644 --- a/app/src/main/java/com/example/mypos/services/AditumSdkService.kt +++ b/app/src/main/java/com/example/mypos/services/AditumSdkService.kt @@ -31,6 +31,9 @@ import com.example.mypos.data.AditumError import com.google.gson.Gson import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.launch class AditumSdkService(private val paymentApplication: PaymentApplication) { @@ -43,6 +46,9 @@ class AditumSdkService(private val paymentApplication: PaymentApplication) { fun getName(): String = "AditumSdkModule" + private val _messageFlow = MutableStateFlow("") + val messageFlow: StateFlow = _messageFlow.asStateFlow() + fun register() { coroutineScope.launch { val callback = object : IPaymentCallback.Stub() { @@ -51,7 +57,9 @@ class AditumSdkService(private val paymentApplication: PaymentApplication) { transactionStatus: TransactionStatus?, command: AbecsCommands? ) { - TODO("Not yet implemented") + if (message != null) { + _messageFlow.value = message.replace("\\s+".toRegex(), " ").trim() + } } override fun pinNotification(message: String?, length: Int) {