-
Notifications
You must be signed in to change notification settings - Fork 929
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
�Avoid scoping errors in our Dagger setup (#1597)
Task/Issue URL: https://app.asana.com/0/414730916066338/1201415414578549/f ### Description This PR harmonises the way we will scope dependencies in Dagger so that we avoid past mistakes mixing scope annotations resulting in unpexpected behavior. We have also ditched the `ObjectGraph` naming and use `Scope` all over. Recommended to see the [asana task](https://app.asana.com/0/414730916066338/1201415414578549/f) for more information about this. With this PR we will have the following dagger scopes * `AppScope` -> bound to the life of the application * `ActivityScope` -> should be used for Activities * `FragmentScope` -> should be used for Fragments * `QuickSettingsScope` -> only use the quick tile setting for AppTP * `ReceiverScope` -> should be used for broadcast receivers * `VpnScope` -> only used for Vpn service _Exceptions_ We currently do NOT support nesting dagger scopes, this means that the `AppScope` is the parent of ALL remaining scopes and, ALL remaining scopes are siblings, ie. * children scopes have access to the dependencies in the parent scope * sibling scopes do not have access to the dependencies in other siblins Because we don't yet support nesting, some vpn-related activities that SHOULD use the `ActivityScope` are actually using the `VpnScope`, all because they need some dependencies that are contributed to the `VpnScope`. To track those for future fixes, we have added an annotation dubbed `@WrongScope` that provide information as to what should be the appropriate scope. In the future, when nesting is supported, we just need to find usages of that annotation and fix the scope. Incidentally, and because we are heavy users of multi-bindings and unfortunatelly those require the `JvmSuppressWildcards` annotations, I have added a sugar over `Set` and `Map` multibindings to avoid mistakes. ### Steps to test this PR This PR should not change any behavior, just fixes the usage of dagger annotations. If anything breaks, should now break at build time (this is why the `WrongScope` annotation exists now) * Just perform regular smoke tests for the app and AppTP
- Loading branch information
Showing
307 changed files
with
1,666 additions
and
1,502 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.