Add common parent class for application classes#16151
Add common parent class for application classes#16151ravishanker merged 3 commits intofeature/dagger-to-hiltfrom
Conversation
|
@ravishanker, I need to update Alternatively, I can use I think application name change is a critical change. It could be used for deeplinks or in some external services. I couldn't find a better solution than changing 225 casting lines from |
@irfano - It is never easy these kind of structural changes. Are these casts only in tests or in the application code? If it is in tests I wouldn't worry about it. In any case, it would be good to socialize this change with the rest of android community. Please post about it to #android-dev slack channel and get some feedback on the proposed change. |
No, it's in the application code. Thanks, I'll share this to get feedback. |
|
After receiving feedback from Slack, I decided to name superclass as |
Generated by 🚫 dangerJS |
| import org.wordpress.android.modules.DaggerAppComponentTest | ||
|
|
||
| class WordPressTest : WordPress() { | ||
| class WordPressTest : WordPressApp() { |
There was a problem hiding this comment.
For now, WordPressTest is extended from WordPressApp. When Hilt added, WordPressTest will extend WordPress and inject and init AppInitializer differently from WordPressApp.
There was a problem hiding this comment.
Sounds good. I've been able to build and run without error
We need different application classes for UI test and real app to use Hilt. The main reason for this requirement is that we can't use
@Injectannotation in the test application because the test application handles injection differently in Hilt.WordPress: Abstract superclass application which contains common jobs for real and test applications.
WordPressApp: Real application
WordPressTest: UI test application. The only difference from
WordPressAppwill be handling injection differently. Difference will be in next PRs.We need the ability to initialize Hilt whenever we want without
@Injectannotation. To provide this, I addedWordPress, which contains common stuff forWordPressTestandWordPressApp.This PR can seem meaningless before future PRs, but it will be useful after adding Hilt.
To test:
Build and run the app. It should be running without an error.
Regression Notes
Potential unintended areas of impact
Building and tests might be broken.
What I did to test those areas of impact (or what existing automated tests I relied on)
I smoke tested the app, and it's working as expected. Also, tests are working fine.
What automated tests I added (or what prevented me from doing so)
No tests are added since no new feature is added.
PR submission checklist:
RELEASE-NOTES.txtif necessary.