matomo-org / matomo-sdk-ios

Matomo iOS, tvOS and macOS SDK: a Matomo tracker written in Swift
MIT License
390 stars 164 forks source link

Strategy for AFNetworking 2.0 #29

Closed mattiaslevin closed 9 years ago

mattiaslevin commented 10 years ago

Need some kind of migration strategy.

shadzik commented 10 years ago

Hi,

I've forked piwik and upgraded it to use AFNetworking 2, you can see the result here https://github.com/shadzik/piwik-sdk-ios

As far as I have tested it (today), it works. I have never used the original version, since I don't have projects that are not migrated to the latest AFNetworking version, so I can't really tell the difference.

Cheers,

mattiaslevin commented 10 years ago

Nice, I will take a look.

Long term I will migrate to AFNetworking 2.0 but as a short and medium term solution I think I need to support both, either in the same code base or as separate branches depending on the differences.

I would like to start by merging back your changes to a separate branch.

/Mattias

macguru commented 10 years ago

Any update on this merge? I'd love to have the AF 2.0 support being sort of "official". Thanks!

ondrejmirtes commented 10 years ago

+1. This is really needed for projects that use AFNetworking 2.

mattiaslevin commented 10 years ago

Ok. I was planning on doing a bigger refactoring and fixing this issue at the same time. The classes are become to big and I like to support both different event storage implementation (e.g in memory, CoreData) and different http clients (e.g. iOS default, AFNetworking etc). This will also open up for adding unit tests.

But I will fix this before I proceed with the refactoring. I hope I will be able to fix this ticket over next weekend.

mattiaslevin commented 9 years ago

Version 3.0 will support dynamic configuration of http dispatcher. 2 dispatcher will be provided by default - AFNetworking2 and iOS NSURLSession.

mattiaslevin commented 9 years ago

Fixed in 3.0.0.

Developers can now decide which http client to use for sending the event to the Piwik server.

In the Podfile:

pod 'PiwikTracker'
--Will use NSURLSession to dispatch events

pod 'PiwikTracker/AFNetworking2'
--Will add AFNetworking2 as dependency and use to dispatch events

Developers can also set their own dispatcher implementation when instantiating the tracker.