tink-ab / tink-link-android

Optimise open banking experiences for mobile apps with Tink Link Android SDK.

Home Page:https://tink.com/products/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bundle Null after wrong credential (0.14.6)

JacoboGonzalezP opened this issue · comments

In version 0.14.6, after entering the wrong credentials to add an entity, if I exit the screen with the "onBack" button of the device in the onActivityResult the Bundle returned is null so I can not get the credentialId to automatically delete that credential that is wrong. On the other hand, if I exit the screen to enter the credential with the close icon (X) of the toolbar, the Bundle is returned.

Screenshot 2021-05-31 at 16 04 45

With device's onBack button intent = null, with the close icon (X) of the toolbar intent has instance:

        when (requestCode) {
            ConstantsUtils.TINK_LINK_CREATE_REQUEST_CODE -> {
                handleTinkLinkResponse(resultCode, intent?.extras)
            }
            ConstantsUtils.TINK_DELETE_ENTITY_REQUEST_CODE -> {
                if (resultCode == Activity.RESULT_OK) {
                    presenter.onDeleteEntityFromManagement()
                }
            }
            else -> {
                super.onActivityResult(requestCode, resultCode, intent)
            }
        }
    }```

```private fun handleTinkLinkResponse(resultCode: Int, data: Bundle?) {
        presenter.cleanCache()
        when (resultCode) {
            TinkLinkUiActivity.RESULT_SUCCESS -> {
                val result: TinkLinkResult? = data?.getParcelable(TinkLinkUiActivity.RESULT_DATA)
                (result as? TinkLinkResult.PermanentUser)?.let {
                    presenter.goToTinkEntityAddedSuccess(it.credentials.id)
                }
            }
            TinkLinkUiActivity.RESULT_FAILURE -> {
                val result: TinkLinkError? = data?.getParcelable(TinkLinkUiActivity.ERROR_DATA)
                (result as? TinkLinkError.FailedToAddCredentials)?.let {
                    presenter.deleteFailureCredentals(result.errorsByCredentialsId.keys.toMutableList())
                }
            }
        }
    }```

Hi,

This is now fixed in version 0.14.9.