adicionando mais StateFlow

This commit is contained in:
Ighor Moura 2025-07-23 10:20:20 -04:00
parent 3bf1ae3648
commit 31ab97af95

View File

@ -49,6 +49,9 @@ class AditumSdkService(private val paymentApplication: PaymentApplication) {
private val _messageFlow = MutableStateFlow("") private val _messageFlow = MutableStateFlow("")
val messageFlow: StateFlow<String> = _messageFlow.asStateFlow() val messageFlow: StateFlow<String> = _messageFlow.asStateFlow()
private val _pinLengthFlow = MutableStateFlow(0)
val pinLengthFlow: StateFlow<Int> = _pinLengthFlow.asStateFlow()
fun register() { fun register() {
coroutineScope.launch { coroutineScope.launch {
val callback = object : IPaymentCallback.Stub() { val callback = object : IPaymentCallback.Stub() {
@ -63,7 +66,7 @@ class AditumSdkService(private val paymentApplication: PaymentApplication) {
} }
override fun pinNotification(message: String?, length: Int) { override fun pinNotification(message: String?, length: Int) {
TODO("Not yet implemented") _pinLengthFlow.value = length
} }
override fun startGetClearData( override fun startGetClearData(
@ -81,11 +84,13 @@ class AditumSdkService(private val paymentApplication: PaymentApplication) {
} }
override fun qrCodeGenerated(qrCode: String?, expirationTime: Int) { override fun qrCodeGenerated(qrCode: String?, expirationTime: Int) {
TODO("Not yet implemented") Log.d(TAG, "\nqrCode - ${ qrCode ?: "" }\nexpirationTime - $expirationTime")
} }
} }
paymentApplication.communicationService?.registerPaymentCallback(callback) paymentApplication.communicationService?.registerPaymentCallback(callback) ?: run {
}
} }
} }