gazman-sdk/Life-Cycle

Gettting a single instance with some parameters

Closed this issue · 3 comments

I've been playing with your sdk for a couple of hours,
I like the idea of having a Factory handling the cleaning of all static references (using weak reference if the Factory would have helped as well), but what if the creation of a singleton requires some parameters to be passes?
You're using the default constructor in you sdk but what if the class doesn't have any?
I would recommend you to add some kind of lambda expression to be passed to the Factory, this lambda would handle the creation of the first instance with some parameters.
Hope you get the idea.

This actualy covered in Factory.injectWithParams

As for weak references I think it will just work if you wrape your singlton with weak refference, but I never try that, I think the dissposable mechanism is enough

Great! Didn't notice it.
I'll give a shot to your skd in some near production app. Is it stable enough for that?

Yes, it's been tested in several apps. If you like, after your integration you can provide me with a link to your app and I will add sdk usage section.