openhab / openhab-ios

The repository of the iOS client
Eclipse Public License 2.0
190 stars 127 forks source link

Replace AlamoFire #783

Open digitaldan opened 3 months ago

digitaldan commented 3 months ago

Hey @weakfl and @timbms , this is probably not a small task, but i am finding that AlamoFire is causing issues in the app, specifically they do not support making http calls while the app is in the background (its a long requested feature). This is causing issues for our new push notifications when we try and send commands to items. I may resort to creating an alternative just for background tasks and use the built in networking with support for credentials, certs, etc.... If that works, maybe we move forward with overhauling the rest of the app to use it. Also i have noticed that AlamoFire does not seem very active as a project, seems like a relic of the past perhaps.

weakfl commented 2 months ago

I think URLSession has matured enough over the years. Makes sense to get rid of Alamofire imho.

timbms commented 2 months ago

Are you still pushing to get rid of Alamofire ?

digitaldan commented 2 months ago

Yeah, i think so. My little basic http client that i'm using for the notification calls i think is a good prototype that proves you don't really need a 3rd party library.

weakfl commented 2 months ago

@digitaldan just make sure to use the async functions instead of closures (imho).

digitaldan commented 2 months ago

My plan right now is to swap out the alamo bits with URLSession and friends in the NetworkManager class, and keep the calling code mostly unmodified. I think that will be actually pretty easy, i can then remove my little httpclient prototype. Once thats all working, i think a bigger refactor of the networking will be a nice to have.

timbms commented 2 months ago

@digitaldan just make sure to use the async functions instead of closures (imho).

I made a first step in the direction of using async version. Not yet for the main networking call but for the delegates URLSessionDelegate and URLSessionTaskDelegate. See #798