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

Allow for Fragment ViewModel factory (#69) #148

Merged
merged 2 commits into from
Dec 18, 2018
Merged

Allow for Fragment ViewModel factory (#69) #148

merged 2 commits into from
Dec 18, 2018

Conversation

marukami
Copy link
Contributor

@marukami marukami commented Dec 7, 2018

Injecting with Dagger #69 is very hard without the Fragment been passed for Fragment ViewModels. So, I added a MvRxFragmentViewModelFactory as another factory type. To keep backward compatibility if the Fragment factory can't be found we can fall back to the Activity factory. If no factory can be found then like before try the single state arg ViewModel constructor before crashing as it would before.

@marukami marukami mentioned this pull request Dec 7, 2018
Copy link
Collaborator

@gpeal gpeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marukami This looks great! Could you add some FactoryTests for this? I'll approve and merge it once there are tests 😄

@marukami
Copy link
Contributor Author

Sure, no worries. I added a few tests and fixed an issue they found.

Copy link
Collaborator

@gpeal gpeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@gpeal gpeal merged commit b82e211 into airbnb:master Dec 18, 2018
@gpeal gpeal mentioned this pull request Jan 3, 2019
@marukami marukami deleted the fragment-factory branch December 15, 2019 13:21
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

Successfully merging this pull request may close these issues.

None yet

2 participants