register()

This commit is contained in:
Ighor Moura 2025-07-22 18:10:16 -04:00
parent 0c168dd33e
commit 3bf1ae3648

View File

@ -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<String> = _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) {