Amplitude-iOS
Amplitude-iOS copied to clipboard
Allow injection of custom Network Client
Hello! In the business I work we are required to only make connections using mTLS, and, for that reason, we cannot use the SDK as is.
We have an internal proxy server that uses mTLS and talks to the "outside world", but, in order to use that, we need to inject our custom network client that enforces mTLS and uses our custom request encoding.
What do you think about the current implementation? I made it in a way that it won't break the existing API. The Android version of this PR is Android #187.
@fpg1503 Thank you very much for your effort! The support to use a custom http implementation for the Android variant of the SDK would also be very much appreciated to be able to omit additional libraries for Xamarin.Android bindings.
@fpg1503 thank you so much for submitting this PR! Apologies for taking so long to review it. Some of my initial thoughts:
- Rather than passing the client in during
initWithInstanceNameandgetInstancemethods, it might be cleaner to leave those alone and have asetNetworkClientmethod to set it on the instance? That would also fix a bunch of thegetInstanceunit tests that are broken in your branch - Would it be cleaner to have
NSURLSessionas an input to the the network client'suploadEventsmethod instead of keeping it as an instance variable on every client instance?
@fpg1503 thoughts?
@djih thanks for your review so far! I've implemented your suggestions, do you think there are any other points to address?