alterando notificacao

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

View File

@ -53,49 +53,44 @@ 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)
override fun notification( }
message: String?, }
transactionStatus: TransactionStatus?,
command: AbecsCommands?
) {
Log.d(TAG, "\nnotification - ${ message ?: "" }")
if (message != null) {
_messageFlow.value = message.replace("\\s+".toRegex(), " ").trim()
}
listener.notification(
message?.replace("\\s+".toRegex(), " ")?.trim(),
transactionStatus,
command
)
}
override fun pinNotification(message: String?, length: Int) { val paymentCallback = object : IPaymentCallback.Stub() {
_pinLengthFlow.value = length override fun notification(
} message: String?,
transactionStatus: TransactionStatus?,
override fun startGetClearData( command: AbecsCommands?
clearDataRequest: GetClearDataRequest?, ) {
finished: GetClearDataFinishedCallback? Log.i(TAG, "\nnotification - ${ message ?: "" }")
) { if (message != null) {
TODO("Not yet implemented") _messageFlow.value = message.replace("\\s+".toRegex(), " ").trim()
}
override fun startGetMenuSelection(
menuSelectionRequest: GetMenuSelectionRequest?,
finished: GetMenuSelectionFinishedCallback?
) {
TODO("Not yet implemented")
}
override fun qrCodeGenerated(qrCode: String?, expirationTime: Int) {
Log.d(TAG, "\nqrCode - ${ qrCode ?: "" }\nexpirationTime - $expirationTime")
}
} }
}
paymentApplication.communicationService?.registerPaymentCallback(callback) override fun pinNotification(message: String?, length: Int) {
_pinLengthFlow.value = length
}
override fun startGetClearData(
clearDataRequest: GetClearDataRequest?,
finished: GetClearDataFinishedCallback?
) {
TODO("Not yet implemented")
}
override fun startGetMenuSelection(
menuSelectionRequest: GetMenuSelectionRequest?,
finished: GetMenuSelectionFinishedCallback?
) {
TODO("Not yet implemented")
}
override fun qrCodeGenerated(qrCode: String?, expirationTime: Int) {
Log.d(TAG, "\nqrCode - ${ qrCode ?: "" }\nexpirationTime - $expirationTime")
} }
} }