You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iceraven-browser/app/src/main/java/org/mozilla/fenix/components
MarcLeclair 990bfa7e6d
16900 make navgraph inflation asynchronous (#18889)
* For #16900: implement async navgraph inflation

For #16900: removed nav graph from xml

For #16900: inflate navGraph programatically

For #16900: Made NavGraph inflation asynchronous

For #16900: Changed to block with runBlocking

For #16900: Refactored blocking call into a function

For 16900: NavGraph inflation is now async

We now attach the nav graph (or check if its attached) on every nav call ( an extension function for NavController).
This is done by checking the value of the job stored in PerfNavController.map which keeps track of the job with the NavController as a Key.
If the job hasn't been completed, it will block the main thread until the job is done. The job itself is responsible for attaching the navgraph
to the navcontroller (and the inflation of the latter too)

For 16900: rebased upstream master

For 16900: Rebase on master

For #16900: Fixed Async Navgraph navigation per review comments.

1)The Asynchronous method is now found in NavGraphProvider.kt. It creates a job on the IO dispatcher
2)The Job is tracked through a WeakHashMap from Controller --> NavGraph
3)The Coroutine scope doesn't use MainScope() anymore
4)The Coroutine is cancelled if the Activity is destroyed
5)The tests mockk the blockForNavGraphInflation method through the FenixReoboelectricTestApplication instead of calling the mock every setup()

For #16900: inflateNavGraphAsync now takes navController

For #16900: Pass lifecycleScope to NavGraphProvider

For #16900: removed unused mock

For #16900: Added linter rules for navigate calls

We need linting rules to make sure no one calls the NavController.navigate() methods

For #16900: Added TestRule to help abstract the mocks in the code

For 16900: Fix linting problems

For #16900: Cleaned duplicated code in tests

For #16900: cleaned up NavGraphTestRule for finished test

For #16900: had to revert an accidentally edited file

For #16900: rebased master

* For #16900: Review nits for async navgraph

This is composed of squash commits, the original messages can be found below:

-> DisableNavGraphProviderAssertionRule + kdoc.

Use test rule in RobolectricApplication.

Fix failing CrashReporterControllerTest

Fix blame by -> navigate in tests.

This commit was generated by the following commands only:
```
find app/src/test -type f -exec sed -i '' "/import org.mozilla.fenix.ext.navigateBlockingForAsyncNavGraph/d" {} \;
find app/src/test -type f -exec sed -i "" "s/navigateBlockingForAsyncNavGraph/navigate/g" {} \;
git checkout app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
```

Fix various blame

This is expected to be squashed into the first commit so, if so, it'd
fix the blame.

Move test rule to helpers pkg.

add missing license header

Add import change I missed

fix unused imports

Replace robolectricTestrunner with test rule.

Improve navGraphProvider docs

Remove unnecessary rule as defined by robolectric.

add clarifying comment to robolectric

remove unnecessary space

* For #16900: nit fixes for MozillaNavigateCheck and lint fixes

3 squash commits:
 *Changed violation message and fixed the lint rule for MozillaNavigateCheck
 *Added suppression to NavController.kt
 *Fixed detekt violations

* For 16900: Fixed failing tests

Co-authored-by: Michael Comella <michael.l.comella@gmail.com>
3 years ago
..
bookmarks Close #18862: Add multi-select banner to tabs tray (#18932) 3 years ago
history 15278 detekt rule runblocking (#15942) 4 years ago
metrics For #18806: Show sync tabs or sync account sign in based on feature flag (#18859) 3 years ago
search Integrate new search code from Android Components into Fenix. 4 years ago
settings FNX-14583 ⁃ Extract and test preference helpers for Settings (#13402) 4 years ago
tips For #11397 - Add lint rule for AppCompatResources instead of ContextCompat (#16011) 4 years ago
toolbar 16900 make navgraph inflation asynchronous (#18889) 3 years ago
AbstractBinding.kt Close #18862: Add multi-select banner to tabs tray (#18932) 3 years ago
AccountAbnormalities.kt No issue: move StrictModeManager to perf package. 4 years ago
Analytics.kt For #17644: Always update add-on's telemetry values before sending metric ping (#18529) 3 years ago
BackgroundServices.kt Update Android Components to 67.0.20201117165227 (#16619) 4 years ago
Components.kt For #18836: replace StartupActivityStateProvider with StartupStateProvider. 3 years ago
Core.kt Upgrade to Android Components 75.0.20210413143139 3 years ago
FenixSnackbar.kt No issue: Update stable androidx and material versions 4 years ago
FindInPageIntegration.kt For #18122 - Update browser layout for find in page bar with bottom toolbar 3 years ago
FxaServer.kt Add domestic China FxA service for Mozilla Online builds 3 years ago
InflationAwareFeature.kt Fix license on remaining files 4 years ago
IntentProcessorType.kt For #10844 - Fennec page shortcuts will open in normal tabs 4 years ago
IntentProcessors.kt Remove Session[Manager] references from Fennec intent processors 3 years ago
NotificationManager.kt No issue: Use SendTabFeature and FxaPushSupportFeature 4 years ago
PerformanceComponent.kt For #18426: record cold start duration telemetry. 3 years ago
PermissionStorage.kt For #16847: Allow autoplay to controlled via the toolbar. 3 years ago
PrivateShortcutCreateManager.kt For #7208 For #7212 - Update parameterized strings 4 years ago
Push.kt For #15279: replace lazy with lazyMonitored in component groups. 4 years ago
ReviewPromptController.kt Closes #12565: Clean up use of Context within ReviewPromptController. (#18537) 3 years ago
SearchWidgetCreator.kt For #9488: Add experimentation support 4 years ago
Services.kt For #15279: replace lazy with lazyMonitored in component groups. 4 years ago
StoreProvider.kt Fix license on remaining files 4 years ago
TabCollectionStorage.kt Switch to new SessionStorage / session restore API. 3 years ago
TrackingProtectionPolicyFactory.kt For #15703 and #17133: allow ETP redirect trackers setting to be customized (#17137) 3 years ago
UseCases.kt Close #18862: Add multi-select banner to tabs tray (#18932) 3 years ago