Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Injecting shared prefs uses activity when not available #137

Open
dbachelder opened this issue Aug 19, 2014 · 2 comments
Open

Injecting shared prefs uses activity when not available #137

dbachelder opened this issue Aug 19, 2014 · 2 comments
Milestone

Comments

@dbachelder
Copy link
Contributor

I am attempting to inject SharedPreferences into a @Provides method in my Module but it's generating this broken code:

PreferenceManager.getDefaultSharedPreferences(this.getActivity())

when it should be reaching for the application scope.

@johncarl81
Copy link
Owner

This highlights a problem with the Context injection into Providers that has not been solved yet... we should inject the Application into Providers. Will address soon.

@johncarl81
Copy link
Owner

Here's the culprit:

https://github.com/johncarl81/transfuse/blob/master/transfuse-core/src/main/java/org/androidtransfuse/gen/variableBuilder/ProviderInjectionNodeBuilder.java#L48-L49

We should be building a new AnalysisContext here with a new InjectionNodeBuilderRepository tailored for building the Provider's injection graph

@johncarl81 johncarl81 added this to the 0.3.0 Release milestone Aug 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants