-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kotlin coroutine support missing #177
Comments
@dave-kennedy Thanks for your report. Do you happen to have your App somewhere on GitHub where we can test this issue? Do you have a crashlog for us? |
@David-Development I sent you an invite on GitLab. |
Just out of curiousity: Which app do you maintain @dave-kennedy ? NCBookmarks? NC Bookmarks Viewer? Is it open source? Sorry for off topic 😉 |
@stefan-niedermann I wasn't really happy with the existing apps and started my own. When I feel it's ready I'll open it up to the public. |
@dave-kennedy Thank you for the invitation and sorry for the delay. Looks like I don't have permission to see the code 🤔 |
Sorry about that. I'm still learning how GitLab works. You should be good to go. |
No worries :) I finally managed to take a look into it and it looks like that the At this point I believe that it is an issue with Kotlin -> Java.. But it needs some more investigation. @tobiasKaminsky do you have experience with Kotlin -> Java? |
I sent an invite to Tobias as well. |
Okay, I looked into it again and I found out that the fourth parameter is actually from kotlin.. ( Another issue is that we are loosing the return type. While the retrofit api spec has the I managed to remove/filter the fourth empty argument however now I get the following exception:
In order to test the current state:
|
@tobiasKaminsky Do you have any ideas why this is happening? @dave-kennedy Did you manage to test it with the fix I provided? |
No idea :/ |
Apparently that continuation parameter is part of how coroutines work. This is an interesting read that explains what's going on: https://blog.kotlin-academy.com/a-little-reflection-about-coroutines-34050cbc4fe6 We might be able to copy how this type of interop is handled by Retrofit: https://github.com/square/retrofit/blob/master/retrofit/src/main/java/retrofit2/RequestFactory.java All this reflection has my head spinning. I wonder if there isn't a simpler way to wrap requests with the necessary authentication info. |
Awesome, thank you so much for the research! I looked through the retrofit The article is very interesting and explains it quite well why the last parameter is added and why the return type is lost.. I think the merge request should be good to go as a fix then.. Or what do you guys think? |
Looks like we're making progress, but I'm getting this error now:
Normally, I'd tell Retrofit to use the GSON converter factory like this: val service = Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create())
.baseUrl(BuildConfig.API_URL)
.build()
.create(BookmarkService::class.java) However, I don't see a way to do that with this lib and I wonder if that's causing the problem. |
@dave-kennedy Sorry for letting you wait that long. It looks like that problem is caused due to the loss of the return type. Gson is then not able to figure out into which type it is supposed to cast the response. I think we need to look into the retrofit implementation again on how they are able to use |
I always get an exception on line 124 of
NextcloudRetrofitServiceMethod.invoke()
:I tried debugging this method, but every time it hits a breakpoint in here the app crashes.
Here's my Retrofit:
These are my dependencies:
Let me know if you need any more info.
The text was updated successfully, but these errors were encountered: