Skip to content

Do Not Merge – Only here to trigger CI on https://github.com/wordpress-mobile/WordPress-Android/pull/15653#15659

Closed
renanferrari wants to merge 16 commits intotrunkfrom
feature/hilt-migration
Closed

Do Not Merge – Only here to trigger CI on https://github.com/wordpress-mobile/WordPress-Android/pull/15653#15659
renanferrari wants to merge 16 commits intotrunkfrom
feature/hilt-migration

Conversation

@renanferrari
Copy link
Copy Markdown
Contributor

Only here to trigger CI on #15653

- Updated Dagger modules with @Installin(SingletonComponent::class) annotation.
- AppComponent is converted to entry point aggregator. This is a temporary change. AppComponent will be removed when Hilt migration is done.
- Added @ApplicationContext to context parameters in modules.
Before this commit, app was crashing at start. Because some initializing stuff were working after Hilt injections. Now they are starting together with other injections.
@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Dec 6, 2021

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@renanferrari renanferrari changed the title Do Not Merge – Only here to trigger CI on Only here to trigger CI on #15653 Do Not Merge – Only here to trigger CI on https://github.com/wordpress-mobile/WordPress-Android/pull/15653 Dec 6, 2021
@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Dec 6, 2021

Warnings
⚠️ PR has more than 300 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Dec 6, 2021

You can test the changes on this Pull Request by downloading the APKs:

@irfano irfano mentioned this pull request Dec 12, 2021
3 tasks
Hilt test requires test application but test applications have some drawbacks. While real applications can inject before onCreate, test applications can only inject after onCreate. Thus, AppInitializer is created and will be used as a rule in test cases.
- Added HiltAndroidTest to UserAgentTest
- Moved getUserAgent(), getDefaultUserAgent(), USER_AGENT_APPNAME from WordPress to AppInitializer
# Conflicts:
#	WordPress/src/main/java/org/wordpress/android/modules/AppComponent.java
#	build.gradle
Since SingletonComponent is recreated for each test cases, caching AndroidInjector and AppInitializer causes failing UI tests. AndroidInjector and AppInitializer are no longer cached for UI tests. But some static functions were crashing while AppInitializer is recreating. Added a boolean to AppInitializer to manage reinitializing of these functions.
Other classes are casting application to WordPress but WordPress couldn't be used in UI tests. And test application (WordPressTest) was crashing.
With this common abstract WordPress application, other classes can cast application to WordPress safely.
@jkmassel jkmassel deleted the feature/hilt-migration branch October 17, 2024 18:57
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.

2 participants