Infinite loading when showing activity.
maxencehenneron opened this issue · comments
Hi, I'm using the following (java) code to initialize Tink:
TinkConfiguration config =
new TinkConfiguration(
Environment.Production.INSTANCE, // Or define your own environment
clientID, // Your clientId. Retrieve it from console.tink.com,
new Uri.Builder()
.scheme(urlScheme)
.encodedAuthority("tink-callback")
.build()
);
Tink.init(config, mainActivity);
LinkUser linkUser = new LinkUser.TemporaryUser("FR", "fr_FR");
CredentialsOperation credentialsOperation = new CredentialsOperation.Create();
List<Scope> scopes = new ArrayList<>();
scopes.add(Scope.AccountsRead.INSTANCE);
Intent intent = TinkLinkUiActivity.Companion.createIntent(mainActivity, linkUser, scopes, R.style.TinkLinkUiStyle, credentialsOperation);
mainActivity.startActivityForResult(intent, REQUEST_CODE);
The activity is correctly shown, but it loads indefinitely.
I used a proxy to see what's going on in the network requests, the calls to /api/v1/user/anonymous and /api/v1/user seem to work and return data.
However, there's a failing call to "/link/v1/analytis". Here's the body of the request sent by Tink Link:
{
"type": "APPLICATION_EVENT",
"applicationEvent": {
"appName": "redacted",
"appIdentifier": "app.redacted.redacted",
"appVersion": "1.0.0",
"market": "FR",
"clientId": "xxxxxxx",
"sessionId": "xxxxxx",
"isTest": false,
"product": "CREDENTIALS",
"version": "0.14.6",
"platform": "ANDROID",
"device": "MOBILE",
"userId": "xxxxxxx",
"providerName": "",
"credentialsId": "",
"flow": "CREDENTIALS_ADD",
"type": "INITIALIZED_WITHOUT_PROVIDER",
"timestamp": "2021-04-02T15:29:38.404+02:00"
}
}
I redacted any sensible information. The server returns a 400 with the following content:
{"code":3,"message":"","details":[]}
I believe this is the failing request that creates this infinite loading issues.
Note: on iOS the call to analytics also seems to fail, but everything works as expected.
Okay, it took me a while to find where the issue is. Apparently, it comes from the following dependencies:
implementation "androidx.activity:activity:1.2.2"
implementation "androidx.fragment:fragment:1.3.2"
Adding them to the project breaks the tink link ui sdk.
It seems to be crashing on the following line, but the reason why is unknown:
I removed those dependencies from my project to resolve the problem, but that's likely something worth investigating in the future.
Hi, I faced the same issue.
I believe the problem is that in recent versions of the activity and fragment libraries they changed to only allow fragment transactions on the main thread. Currently the API calls in the SDK is working on the IO dispatcher and doesn't hand the job back to the main dispatcher once the call has completed before navigating to the ProviderListFragment.
I can't remove these two libraries without making huge changes, so my current temporary workaround is to add link and link-ui modules as internal libraries and manually force the navigation calls to the Main dispatcher in MainFragment.launchLinkUiFlowForUser.
Would love to see a fix for this.
Thanks for the bug report and sorry for the late response.
Like @Aejne says this is due to a fragment transaction on a background thread that doesn't work correctly with Fragment 1.3.x. We have a fix for it and will release a new version of Tink Link in the next few days. Will let you know here once it's live so you can both verify that it works.
0.14.8 is now out, should resolve this problem please try it and let us know if you have any issues.
Closing this as it's resolved, let us know if you encounter any further issues.