alterando notificacao

This commit is contained in:
Ighor Moura 2025-07-23 18:18:18 -04:00
parent 79515f1205
commit d931dfeff9

View File

@ -53,23 +53,22 @@ class AditumSdkService(private val paymentApplication: PaymentApplication) {
private val _pinLengthFlow = MutableStateFlow(0) private val _pinLengthFlow = MutableStateFlow(0)
val pinLengthFlow: StateFlow<Int> = _pinLengthFlow.asStateFlow() val pinLengthFlow: StateFlow<Int> = _pinLengthFlow.asStateFlow()
fun register(listener: PaymentRegister) { init {
coroutineScope.launch { coroutineScope.launch {
val callback = object : IPaymentCallback.Stub() { paymentApplication.communicationService?.registerPaymentCallback(paymentCallback)
}
}
val paymentCallback = object : IPaymentCallback.Stub() {
override fun notification( override fun notification(
message: String?, message: String?,
transactionStatus: TransactionStatus?, transactionStatus: TransactionStatus?,
command: AbecsCommands? command: AbecsCommands?
) { ) {
Log.d(TAG, "\nnotification - ${ message ?: "" }") Log.i(TAG, "\nnotification - ${ message ?: "" }")
if (message != null) { if (message != null) {
_messageFlow.value = message.replace("\\s+".toRegex(), " ").trim() _messageFlow.value = message.replace("\\s+".toRegex(), " ").trim()
} }
listener.notification(
message?.replace("\\s+".toRegex(), " ")?.trim(),
transactionStatus,
command
)
} }
override fun pinNotification(message: String?, length: Int) { override fun pinNotification(message: String?, length: Int) {
@ -95,10 +94,6 @@ class AditumSdkService(private val paymentApplication: PaymentApplication) {
} }
} }
paymentApplication.communicationService?.registerPaymentCallback(callback)
}
}
fun initAditumSdk( fun initAditumSdk(
applicationName: String, applicationName: String,
applicationVersion: String, applicationVersion: String,