prof18 / RSS-Parser

A Kotlin Multiplatform library to parse a RSS Feed
Apache License 2.0
489 stars 126 forks source link

Use Ktor for the underlying HTTP request handler #175

Open EdricChan03 opened 3 months ago

EdricChan03 commented 3 months ago

Is your feature request related to a problem? Please describe.

Currently, we need to specify platform-specific options like OkHttpClient and NSURLSession for Android and iOS respectively.

Describe the solution you'd like

Using Ktor would help remove the tight coupling to a specific HTTP client implementation, and also allows for consumers who have already been using it to easily adopt this parser library. Additionally, it's also officially recommended as the Kotlin Multiplatform HTTP client/server to use.

Describe alternatives you've considered

We could use interfaces and/or expect/actual as expected from Kotlin Multiplatform modules.

Additional context

I was looking at the README when I noticed that there were platform-specific instructions for Android and iOS to specify their platform-specific OkHttpClient/NSURLSession for the underlying HTTP client to use when parsing the data.

Hopefully I'm not missing any additional information, but I also did a quick cursory search for "ktor" in the codebase/GitHub issues and found no results. I suspect these requirements were from before the library was converted to a Kotlin Multiplatform project.

prof18 commented 5 days ago

Hi! yes, I deliberately choose not to use Ktor, for now, to maintain backward compatibility with the previous versions before the library became Multiplatform. I'm still thinking if in the future would make sense or not to use Ktor for such a simple scenario.

Btw, you are not required to specify platform-specific stuff to create an instance of RssParser. You can just call RssParser()