How to destroy singleton when activity is reset?

Clash Royale CLAN TAG#URR8PPPHow to destroy singleton when activity is reset?
I use gwt 2.8 anf google-gin 2.12
I would like to inject some object into a deep custom com.google.gwt.user.client.ui.composite.
com.google.gwt.user.client.ui.composite
For instance this composite may contain a panel which contains other UIBinded views which can contains other nested element...
DeepComposite
APanel
AnObjectToShare
View1
View2
AnotherPanel
AnObjectToShare
View3
AnObjectToShare
You can see in this hierarchy there is an AnObjectToShare I need to access at various level.
My first reflex was to inject it as Scope.SINGLETON. But today I see it too intrusive, as if I run a new activity which initialize a new DeepComposite (which is the starting point of my g-in-jection context), my previous AnObjectToShare instance is reused.
Scope.SINGLETON
To resume I'm looking for a way to make my singletons to be singleton only on my current context. Or a way to reset my singleton. Or any other idea or workaround to resolve this issue.
1 Answer
1
Unfortunately, GIN doesn't support custom scopes; but maybe you could migrate to Dagger? (which would support your use case)
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.