alterando notificacao
This commit is contained in:
parent
79515f1205
commit
d931dfeff9
@ -53,49 +53,44 @@ class AditumSdkService(private val paymentApplication: PaymentApplication) {
|
||||
private val _pinLengthFlow = MutableStateFlow(0)
|
||||
val pinLengthFlow: StateFlow<Int> = _pinLengthFlow.asStateFlow()
|
||||
|
||||
fun register(listener: PaymentRegister) {
|
||||
init {
|
||||
coroutineScope.launch {
|
||||
val callback = object : IPaymentCallback.Stub() {
|
||||
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
|
||||
)
|
||||
}
|
||||
paymentApplication.communicationService?.registerPaymentCallback(paymentCallback)
|
||||
}
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
val paymentCallback = object : IPaymentCallback.Stub() {
|
||||
override fun notification(
|
||||
message: String?,
|
||||
transactionStatus: TransactionStatus?,
|
||||
command: AbecsCommands?
|
||||
) {
|
||||
Log.i(TAG, "\nnotification - ${ message ?: "" }")
|
||||
if (message != null) {
|
||||
_messageFlow.value = message.replace("\\s+".toRegex(), " ").trim()
|
||||
}
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user