ericcornelissen / NervousFish

An app for your :iphone: to exchange public-keys in a secure manner.
GNU Lesser General Public License v3.0
2 stars 4 forks source link

Omit the use of Greenrobot.eventbus to distribute the ServiceLocator #60

Closed ericcornelissen closed 7 years ago

ericcornelissen commented 7 years ago

What

Remove the ServiceLocator + ServiceLocatorCreater construct where the classes that the ServiceLocator instantiates need to be told about the existence of the ServiceLocator via a communication bus.

Why

Because it is incredibly cumbersome. Each of the classes mentioned above now requires three methods just for instantiation, and proper instantiation becomes very hard because the dependencies the ServiceLocator provides cannot be set to final attributes (since they can't be accessed in the constructor).

How

My proposal is to remove the ServiceLocatorCreator entirely, make the ServiceLocator itself a singleton-like class and provide this when the ServiceLocator instantiates other classes.

Definition of done

This is done once there is no longer any need for the greenrobot eventbus to distribute the ServiceLocator AND the ServiceLocator is provided via the constructor of relevant classes.

Notes

n/a