From ffcef5ff2e3f78b6972dd16551f3f653b7035ccc Mon Sep 17 00:00:00 2001 From: mcarare Date: Fri, 9 Sep 2022 15:23:13 +0300 Subject: [PATCH] For #26844: Fix ktlint issues and remove them from baseline. --- .../mozilla/fenix/AppRequestInterceptor.kt | 30 +- .../mozilla/fenix/glean/BaselinePingTest.kt | 10 +- .../fenix/helpers/HomeActivityTestRule.kt | 6 +- .../fenix/helpers/IdlingResourceHelper.kt | 8 +- .../org/mozilla/fenix/helpers/Matchers.kt | 2 +- .../fenix/helpers/MockLocationUpdatesRule.kt | 4 +- .../mozilla/fenix/helpers/TestAssetHelper.kt | 2 +- .../org/mozilla/fenix/helpers/TestHelper.kt | 40 +- .../helpers/ViewVisibilityIdlingResource.kt | 2 +- .../fenix/helpers/ext/ViewInteraction.kt | 4 +- .../mozilla/fenix/helpers/ext/WaitNotNull.kt | 2 +- .../AddonsInstallingIdlingResource.kt | 5 +- .../AddonsLoadingIdlingResource.kt | 9 +- .../NetworkConnectionIdlingResource.kt | 6 +- .../matchers/BottomSheetBehaviorMatchers.kt | 2 +- .../perf/StartupExcessiveResourceUseTest.kt | 2 +- .../screenshots/DefaultHomeScreenTest.kt | 1 + .../syncintegration/SyncIntegrationTest.kt | 4 +- .../org/mozilla/fenix/ui/BookmarksTest.kt | 3 +- .../org/mozilla/fenix/ui/CollectionTest.kt | 13 +- .../mozilla/fenix/ui/CrashReportingTest.kt | 2 +- .../org/mozilla/fenix/ui/CustomTabsTest.kt | 26 +- .../mozilla/fenix/ui/DownloadFileTypesTest.kt | 2 +- .../java/org/mozilla/fenix/ui/DownloadTest.kt | 11 +- .../java/org/mozilla/fenix/ui/HistoryTest.kt | 2 +- .../mozilla/fenix/ui/NavigationToolbarTest.kt | 2 +- .../fenix/ui/NoNetworkAccessStartupTests.kt | 6 +- .../java/org/mozilla/fenix/ui/PwaTest.kt | 4 +- .../org/mozilla/fenix/ui/ReaderViewTest.kt | 10 +- .../java/org/mozilla/fenix/ui/SearchTest.kt | 10 +- .../org/mozilla/fenix/ui/SettingsAboutTest.kt | 2 +- .../mozilla/fenix/ui/SettingsAddonsTest.kt | 6 +- .../mozilla/fenix/ui/SettingsAdvancedTest.kt | 4 +- .../mozilla/fenix/ui/SettingsBasicsTest.kt | 6 +- .../fenix/ui/SettingsDeveloperToolsTest.kt | 2 +- .../mozilla/fenix/ui/SettingsHomepageTest.kt | 2 +- .../mozilla/fenix/ui/SettingsPrivacyTest.kt | 15 +- .../mozilla/fenix/ui/SettingsSearchTest.kt | 13 +- .../org/mozilla/fenix/ui/SettingsSyncTest.kt | 2 +- .../java/org/mozilla/fenix/ui/SettingsTest.kt | 2 +- .../mozilla/fenix/ui/SitePermissionsTest.kt | 2 +- .../java/org/mozilla/fenix/ui/SmokeTest.kt | 73 +- .../mozilla/fenix/ui/TabbedBrowsingTest.kt | 1 - .../java/org/mozilla/fenix/ui/TopSitesTest.kt | 3 +- .../fenix/ui/robots/AccountSettingsRobot.kt | 12 +- .../fenix/ui/robots/AddToHomeScreenRobot.kt | 14 +- .../mozilla/fenix/ui/robots/BookmarksRobot.kt | 54 +- .../mozilla/fenix/ui/robots/BrowserRobot.kt | 131 +- .../fenix/ui/robots/CollectionRobot.kt | 41 +- .../mozilla/fenix/ui/robots/CustomTabRobot.kt | 16 +- .../mozilla/fenix/ui/robots/DownloadRobot.kt | 22 +- .../robots/EnhancedTrackingProtectionRobot.kt | 24 +- .../mozilla/fenix/ui/robots/HistoryRobot.kt | 20 +- .../fenix/ui/robots/HomeScreenRobot.kt | 136 +- ...rySubMenusMultipleSelectionToolbarRobot.kt | 20 +- .../fenix/ui/robots/NavigationToolbarRobot.kt | 70 +- .../fenix/ui/robots/NotificationRobot.kt | 16 +- .../fenix/ui/robots/ReaderViewRobot.kt | 56 +- .../ui/robots/RecentlyClosedTabsRobot.kt | 30 +- .../mozilla/fenix/ui/robots/SearchRobot.kt | 58 +- .../mozilla/fenix/ui/robots/SettingsRobot.kt | 56 +- .../ui/robots/SettingsSubMenuAboutRobot.kt | 21 +- .../SettingsSubMenuAddonsManagerRobot.kt | 52 +- .../ui/robots/SettingsSubMenuAutofillRobot.kt | 2 +- .../SettingsSubMenuDataCollectionRobot.kt | 5 +- ...ngsSubMenuDeleteBrowsingDataOnQuitRobot.kt | 10 +- .../SettingsSubMenuDeleteBrowsingDataRobot.kt | 10 +- ...hancedTrackingProtectionExceptionsRobot.kt | 12 +- ...sSubMenuEnhancedTrackingProtectionRobot.kt | 37 +- .../ui/robots/SettingsSubMenuHomepageRobot.kt | 36 +- .../ui/robots/SettingsSubMenuLanguageRobot.kt | 4 +- .../SettingsSubMenuLoginsAndPasswordRobot.kt | 6 +- ...bMenuLoginsAndPasswordsSavedLoginsRobot.kt | 2 +- .../SettingsSubMenuPrivateBrowsingRobot.kt | 10 +- .../ui/robots/SettingsSubMenuSearchRobot.kt | 74 +- ...ttingsSubMenuSitePermissionsCommonRobot.kt | 21 +- .../SettingsSubMenuSitePermissionsRobot.kt | 72 +- .../ui/robots/SettingsTurnOnSyncRobot.kt | 4 +- .../fenix/ui/robots/ShareOverlayRobot.kt | 18 +- .../fenix/ui/robots/SitePermissionsRobot.kt | 12 +- .../fenix/ui/robots/SyncSignInRobot.kt | 4 +- .../fenix/ui/robots/SystemSettingsRobot.kt | 2 +- .../mozilla/fenix/ui/robots/TabDrawerRobot.kt | 167 +- .../fenix/ui/robots/ThreeDotMenuMainRobot.kt | 42 +- .../mozilla/fenix/DebugFenixApplication.kt | 2 +- .../mozilla/fenix/AppRequestInterceptor.kt | 26 +- .../org/mozilla/fenix/BrowserDirection.kt | 2 +- app/src/main/java/org/mozilla/fenix/Config.kt | 3 +- .../java/org/mozilla/fenix/FeatureFlags.kt | 1 + .../org/mozilla/fenix/FenixApplication.kt | 83 +- .../java/org/mozilla/fenix/FenixLogSink.kt | 2 +- .../org/mozilla/fenix/GlobalDirections.kt | 25 +- .../java/org/mozilla/fenix/HomeActivity.kt | 81 +- .../mozilla/fenix/IntentReceiverActivity.kt | 10 +- .../fenix/ServiceWorkerSupportFeature.kt | 4 +- .../addons/AddonDetailsBindingDelegate.kt | 4 +- .../fenix/addons/AddonDetailsFragment.kt | 2 +- .../addons/AddonInternalSettingsFragment.kt | 2 +- .../AddonPermissionDetailsBindingDelegate.kt | 6 +- .../addons/AddonPermissionsDetailsFragment.kt | 2 +- .../fenix/addons/AddonPopupBaseFragment.kt | 12 +- .../fenix/addons/AddonsManagementFragment.kt | 34 +- .../fenix/addons/AddonsManagementView.kt | 8 +- .../org/mozilla/fenix/addons/Extensions.kt | 2 +- .../addons/InstalledAddonDetailsFragment.kt | 44 +- .../addons/NotYetSupportedAddonFragment.kt | 2 +- .../addons/WebExtensionActionPopupFragment.kt | 4 +- .../fenix/android/FenixDialogFragment.kt | 9 +- .../fenix/autofill/AutofillSearchActivity.kt | 2 +- .../fenix/browser/BaseBrowserFragment.kt | 208 +- .../mozilla/fenix/browser/BrowserAnimator.kt | 2 +- .../mozilla/fenix/browser/BrowserFragment.kt | 76 +- .../browser/CustomTabContextMenuCandidate.kt | 8 +- .../fenix/browser/FenixSnackbarDelegate.kt | 6 +- .../browser/OpenInAppOnboardingObserver.kt | 8 +- .../fenix/browser/SwipeGestureLayout.kt | 8 +- .../org/mozilla/fenix/browser/TabPreview.kt | 6 +- .../fenix/browser/ToolbarGestureHandler.kt | 35 +- .../browsingmode/BrowsingModeManager.kt | 2 +- .../browser/infobanner/DynamicInfoBanner.kt | 14 +- .../infobanner/DynamicInfoBannerBehavior.kt | 2 +- .../fenix/browser/infobanner/InfoBanner.kt | 2 +- .../readermode/ReaderModeController.kt | 14 +- .../CollectionCreationBottomBarView.kt | 10 +- .../CollectionCreationController.kt | 20 +- .../collections/CollectionCreationFragment.kt | 12 +- .../CollectionCreationInteractor.kt | 2 +- .../collections/CollectionCreationStore.kt | 25 +- .../CollectionCreationTabListAdapter.kt | 8 +- .../collections/CollectionCreationView.kt | 66 +- .../fenix/collections/CollectionsDialog.kt | 12 +- .../collections/CollectionsListAdapter.kt | 10 +- .../collections/SaveCollectionListAdapter.kt | 4 +- .../java/org/mozilla/fenix/collections/Tab.kt | 2 +- .../mozilla/fenix/collections/TabDiffUtil.kt | 4 +- .../fenix/components/AccountAbnormalities.kt | 2 +- .../org/mozilla/fenix/components/Analytics.kt | 24 +- .../org/mozilla/fenix/components/AppStore.kt | 2 +- .../fenix/components/BackgroundServices.kt | 23 +- .../mozilla/fenix/components/Components.kt | 24 +- .../mozilla/fenix/components/FenixSnackbar.kt | 12 +- .../fenix/components/FindInPageIntegration.kt | 4 +- .../fenix/components/InflationAwareFeature.kt | 2 +- .../fenix/components/IntentProcessors.kt | 4 +- .../fenix/components/NotificationManager.kt | 10 +- .../fenix/components/PermissionStorage.kt | 2 +- .../PrivateShortcutCreateManager.kt | 12 +- .../java/org/mozilla/fenix/components/Push.kt | 4 +- .../components/ReviewPromptController.kt | 7 +- .../org/mozilla/fenix/components/Services.kt | 7 +- .../mozilla/fenix/components/StoreProvider.kt | 4 +- .../fenix/components/TabCollectionStorage.kt | 4 +- .../org/mozilla/fenix/components/UseCases.kt | 2 +- .../fenix/components/appstate/AppAction.kt | 13 +- .../fenix/components/appstate/AppState.kt | 2 +- .../components/appstate/AppStoreReducer.kt | 44 +- .../components/bookmarks/BookmarksUseCase.kt | 13 +- .../history/PagedHistoryProvider.kt | 18 +- .../components/metrics/ActivationPing.kt | 3 +- .../metrics/AdjustMetricsService.kt | 2 +- .../components/metrics/BreadcrumbsRecorder.kt | 8 +- .../components/metrics/FirstSessionPing.kt | 7 +- .../components/metrics/GleanMetricsService.kt | 4 +- .../components/metrics/MetricController.kt | 83 +- .../fenix/components/metrics/MetricsUtils.kt | 4 +- .../metrics/MozillaProductDetector.kt | 2 +- .../components/search/SearchMigration.kt | 6 +- .../components/settings/CounterPreference.kt | 2 +- .../toolbar/BrowserFragmentStore.kt | 2 +- .../toolbar/BrowserToolbarCFRPresenter.kt | 17 +- .../toolbar/BrowserToolbarController.kt | 32 +- .../toolbar/BrowserToolbarMenuController.kt | 48 +- .../components/toolbar/BrowserToolbarView.kt | 22 +- .../components/toolbar/DefaultToolbarMenu.kt | 60 +- .../components/toolbar/FenixTabCounterMenu.kt | 4 +- .../fenix/components/toolbar/MenuPresenter.kt | 4 +- .../components/toolbar/ToolbarIntegration.kt | 20 +- .../components/toolbar/ToolbarPosition.kt | 2 +- .../interactor/BrowserToolbarInteractor.kt | 2 +- .../fenix/compose/ClickableSubstringLink.kt | 16 +- .../fenix/compose/ComposeViewHolder.kt | 6 +- .../java/org/mozilla/fenix/compose/Favicon.kt | 4 +- .../fenix/compose/HorizontalFadingEdgeBox.kt | 18 +- .../java/org/mozilla/fenix/compose/Image.kt | 6 +- .../fenix/compose/ImagesPlaceholder.kt | 8 +- .../compose/LazyListEagerFlingBehavior.kt | 4 +- .../mozilla/fenix/compose/ListItemTabLarge.kt | 20 +- .../compose/ListItemTabLargePlaceholder.kt | 4 +- .../org/mozilla/fenix/compose/MessageCard.kt | 51 +- .../mozilla/fenix/compose/SectionHeader.kt | 2 +- .../mozilla/fenix/compose/SelectableChip.kt | 12 +- .../fenix/compose/StaggeredHorizontalGrid.kt | 10 +- .../fenix/compose/TabSubtitleWithInterdot.kt | 8 +- .../mozilla/fenix/compose/ThumbnailCard.kt | 20 +- .../mozilla/fenix/compose/button/Button.kt | 2 +- .../org/mozilla/fenix/compose/cfr/CFRPopup.kt | 6 +- .../fenix/compose/cfr/CFRPopupContent.kt | 27 +- .../compose/cfr/CFRPopupFullscreenLayout.kt | 35 +- .../fenix/compose/cfr/CFRPopupShape.kt | 100 +- .../org/mozilla/fenix/compose/ext/Modifier.kt | 11 +- .../fenix/compose/home/HomeSectionHeader.kt | 10 +- .../compose/list/ExpandableListHeader.kt | 4 +- .../mozilla/fenix/compose/list/ListItem.kt | 12 +- .../fenix/compose/tabstray/MediaImage.kt | 2 +- .../fenix/compose/tabstray/TabGridItem.kt | 36 +- .../fenix/compose/tabstray/TabListItem.kt | 19 +- .../fenix/crashes/CrashContentIntegration.kt | 4 +- .../mozilla/fenix/crashes/CrashContentView.kt | 4 +- .../fenix/crashes/CrashReporterController.kt | 4 +- .../customtabs/CustomTabToolbarIntegration.kt | 4 +- .../fenix/customtabs/CustomTabToolbarMenu.kt | 26 +- .../fenix/customtabs/CustomTabsIntegration.kt | 8 +- .../customtabs/ExternalAppBrowserActivity.kt | 6 +- .../customtabs/ExternalAppBrowserFragment.kt | 34 +- .../customtabs/FennecWebAppIntentProcessor.kt | 8 +- .../fenix/customtabs/PoweredByNotification.kt | 4 +- .../customtabs/WebAppSiteControlsBuilder.kt | 2 +- .../org/mozilla/fenix/datastore/DataStores.kt | 2 +- .../fenix/downloads/DynamicDownloadDialog.kt | 22 +- .../DynamicDownloadDialogBehavior.kt | 18 +- .../fenix/exceptions/ExceptionsAdapter.kt | 2 +- .../fenix/exceptions/ExceptionsView.kt | 4 +- .../login/ExceptionsFragmentStore.kt | 2 +- .../login/LoginExceptionsAdapter.kt | 4 +- .../login/LoginExceptionsFragment.kt | 10 +- .../login/LoginExceptionsInteractor.kt | 2 +- .../exceptions/login/LoginExceptionsView.kt | 2 +- .../ExceptionsFragmentStore.kt | 6 +- .../TrackingProtectionExceptionsAdapter.kt | 4 +- .../TrackingProtectionExceptionsFragment.kt | 10 +- .../TrackingProtectionExceptionsInteractor.kt | 8 +- .../TrackingProtectionExceptionsView.kt | 2 +- .../ExceptionsDeleteButtonViewHolder.kt | 2 +- .../viewholders/ExceptionsHeaderViewHolder.kt | 2 +- .../ExceptionsListItemViewHolder.kt | 4 +- .../mozilla/fenix/experiments/NimbusSetup.kt | 7 +- .../java/org/mozilla/fenix/ext/Activity.kt | 28 +- .../java/org/mozilla/fenix/ext/AppState.kt | 11 +- .../main/java/org/mozilla/fenix/ext/Bitmap.kt | 60 +- .../java/org/mozilla/fenix/ext/Context.kt | 2 +- .../main/java/org/mozilla/fenix/ext/Dialog.kt | 2 +- .../java/org/mozilla/fenix/ext/Fragment.kt | 20 +- .../org/mozilla/fenix/ext/NavController.kt | 2 +- .../org/mozilla/fenix/ext/SearchEngine.kt | 2 +- .../org/mozilla/fenix/ext/SpannableString.kt | 4 +- .../main/java/org/mozilla/fenix/ext/String.kt | 2 +- .../org/mozilla/fenix/ext/TabCollection.kt | 4 +- .../main/java/org/mozilla/fenix/ext/View.kt | 16 +- .../org/mozilla/fenix/gecko/GeckoProvider.kt | 12 +- .../gleanplumb/CustomAttributeProvider.kt | 4 +- .../gleanplumb/DefaultMessageController.kt | 6 +- .../org/mozilla/fenix/gleanplumb/Message.kt | 4 +- .../fenix/gleanplumb/MessagingState.kt | 2 +- .../gleanplumb/NimbusMessagingStorage.kt | 13 +- .../OnDiskMessageMetadataStorage.kt | 4 +- .../gleanplumb/state/MessagingMiddleware.kt | 18 +- .../gleanplumb/state/MessagingReducer.kt | 12 +- .../HistoryMetadataMiddleware.kt | 8 +- .../historymetadata/HistoryMetadataService.kt | 16 +- .../org/mozilla/fenix/home/HomeFragment.kt | 101 +- .../java/org/mozilla/fenix/home/HomeMenu.kt | 49 +- .../org/mozilla/fenix/home/HomeMenuBuilder.kt | 34 +- .../main/java/org/mozilla/fenix/home/Mode.kt | 3 +- .../fenix/home/PocketUpdatesMiddleware.kt | 27 +- .../fenix/home/PrivateBrowsingButtonView.kt | 2 +- .../mozilla/fenix/home/TabCounterBuilder.kt | 6 +- .../fenix/home/TopPlaceholderViewHolder.kt | 2 +- .../mozilla/fenix/home/WallpapersObserver.kt | 1 + .../fenix/home/blocklist/BlocklistHandler.kt | 1 + .../home/blocklist/BlocklistMiddleware.kt | 16 +- .../fenix/home/collections/Collection.kt | 8 +- .../fenix/home/collections/CollectionItem.kt | 12 +- .../fenix/home/collections/CollectionMenu.kt | 14 +- .../home/collections/CollectionViewHolder.kt | 2 +- .../FennecBookmarkShortcutsIntentProcessor.kt | 4 +- .../intent/HomeDeepLinkIntentProcessor.kt | 4 +- .../home/intent/OpenBrowserIntentProcessor.kt | 2 +- .../intent/OpenSpecificTabIntentProcessor.kt | 2 +- .../intent/SpeechProcessingIntentProcessor.kt | 6 +- .../home/intent/StartSearchIntentProcessor.kt | 5 +- .../PrivacyContentDisplayActivity.kt | 6 +- .../mozonline/PrivacyContentDisplayHelper.kt | 22 +- .../home/pocket/PocketCategoriesViewHolder.kt | 10 +- .../PocketRecommendationsHeaderViewHolder.kt | 6 +- .../PocketRecommendedStoriesCategory.kt | 2 +- ...ocketRecommendedStoriesSelectedCategory.kt | 2 +- .../home/pocket/PocketStoriesComposables.kt | 40 +- .../home/pocket/PocketStoriesController.kt | 24 +- .../home/pocket/PocketStoriesViewHolder.kt | 6 +- .../recentbookmarks/RecentBookmarksFeature.kt | 4 +- .../controller/RecentBookmarksController.kt | 4 +- .../recentbookmarks/view/RecentBookmarks.kt | 34 +- .../view/RecentBookmarksHeaderViewHolder.kt | 4 +- .../view/RecentBookmarksMenuItem.kt | 2 +- .../view/RecentBookmarksViewHolder.kt | 6 +- .../RecentSyncedTabFeature.kt | 16 +- .../controller/RecentSyncedTabController.kt | 4 +- .../recentsyncedtabs/view/RecentSyncedTab.kt | 26 +- .../view/RecentSyncedTabViewHolder.kt | 5 +- .../home/recenttabs/RecentTabsListFeature.kt | 2 +- .../home/recenttabs/view/RecentTabMenuItem.kt | 2 +- .../recenttabs/view/RecentTabViewHolder.kt | 6 +- .../fenix/home/recenttabs/view/RecentTabs.kt | 42 +- .../view/RecentTabsHeaderViewHolder.kt | 4 +- .../home/recentvisits/RecentVisitsFeature.kt | 38 +- .../home/recentvisits/RecentlyVisitedItem.kt | 4 +- .../controller/RecentVisitsController.kt | 6 +- .../recentvisits/view/RecentVisitMenuItem.kt | 2 +- .../view/RecentVisitsHeaderViewHolder.kt | 2 +- .../home/recentvisits/view/RecentlyVisited.kt | 50 +- .../view/RecentlyVisitedViewHolder.kt | 12 +- .../sessioncontrol/SessionControlAdapter.kt | 54 +- .../SessionControlController.kt | 58 +- .../SessionControlInteractor.kt | 4 +- .../home/sessioncontrol/SessionControlView.kt | 18 +- .../CustomizeHomeButtonViewHolder.kt | 2 +- .../NoCollectionsMessageViewHolder.kt | 4 +- .../PrivateBrowsingDescriptionViewHolder.kt | 16 +- .../onboarding/MessageCardViewHolder.kt | 2 +- .../onboarding/OnboardingFinishViewHolder.kt | 2 +- .../OnboardingPrivacyNoticeViewHolder.kt | 2 +- .../OnboardingThemePickerViewHolder.kt | 27 +- ...boardingToolbarPositionPickerViewHolder.kt | 17 +- .../OnboardingTrackingProtectionViewHolder.kt | 10 +- .../home/topsites/DefaultTopSitesView.kt | 6 +- .../fenix/home/topsites/PagerIndicator.kt | 2 +- .../fenix/home/topsites/TopSiteItemMenu.kt | 14 +- .../home/topsites/TopSiteItemViewHolder.kt | 16 +- .../home/topsites/TopSitePagerViewHolder.kt | 6 +- .../fenix/home/topsites/TopSiteViewHolder.kt | 2 +- .../fenix/home/topsites/TopSitesAdapter.kt | 8 +- .../home/topsites/TopSitesPagerAdapter.kt | 6 +- .../fenix/library/LibraryPageFragment.kt | 2 +- .../mozilla/fenix/library/LibraryPageView.kt | 12 +- .../fenix/library/LibrarySiteItemView.kt | 6 +- .../library/bookmarks/BookmarkAdapter.kt | 18 +- .../library/bookmarks/BookmarkController.kt | 10 +- .../BookmarkDeselectNavigationListener.kt | 2 +- .../library/bookmarks/BookmarkFragment.kt | 35 +- .../bookmarks/BookmarkFragmentInteractor.kt | 3 +- .../bookmarks/BookmarkFragmentStore.kt | 23 +- .../library/bookmarks/BookmarkItemMenu.kt | 19 +- .../bookmarks/BookmarkSearchController.kt | 2 +- .../bookmarks/BookmarkSearchDialogFragment.kt | 14 +- .../BookmarkSearchDialogInteractor.kt | 2 +- .../bookmarks/BookmarkSearchFragmentStore.kt | 6 +- .../fenix/library/bookmarks/BookmarkView.kt | 12 +- .../fenix/library/bookmarks/DesktopFolders.kt | 8 +- .../mozilla/fenix/library/bookmarks/Utils.kt | 6 +- .../addfolder/AddBookmarkFolderFragment.kt | 6 +- .../bookmarks/awesomebar/AwesomeBarView.kt | 2 +- .../bookmarks/awesomebar/AwesomeBarWrapper.kt | 4 +- .../bookmarks/edit/EditBookmarkFragment.kt | 67 +- .../SelectBookmarkFolderAdapter.kt | 8 +- .../SelectBookmarkFolderFragment.kt | 2 +- .../library/bookmarks/toolbar/ToolbarView.kt | 36 +- .../viewholders/BookmarkNodeViewHolder.kt | 4 +- .../library/downloads/DownloadAdapter.kt | 2 +- .../library/downloads/DownloadController.kt | 2 +- .../library/downloads/DownloadFragment.kt | 25 +- .../downloads/DownloadFragmentStore.kt | 12 +- .../library/downloads/DownloadInteractor.kt | 2 +- .../library/downloads/DownloadItemMenu.kt | 10 +- .../fenix/library/downloads/DownloadView.kt | 8 +- .../DownloadsListItemViewHolder.kt | 4 +- .../fenix/library/history/HistoryAdapter.kt | 3 +- .../library/history/HistoryController.kt | 10 +- .../library/history/HistoryDataSource.kt | 6 +- .../fenix/library/history/HistoryFragment.kt | 30 +- .../library/history/HistoryFragmentStore.kt | 16 +- .../library/history/HistoryInteractor.kt | 2 +- .../history/HistorySearchController.kt | 2 +- .../history/HistorySearchDialogFragment.kt | 14 +- .../history/HistorySearchDialogInteractor.kt | 2 +- .../history/HistorySearchFragmentStore.kt | 6 +- .../fenix/library/history/HistoryView.kt | 14 +- .../library/history/PendingDeletionHistory.kt | 10 +- .../fenix/library/history/RemoveTimeFrame.kt | 3 +- .../history/awesomebar/AwesomeBarView.kt | 2 +- .../history/awesomebar/AwesomeBarWrapper.kt | 4 +- .../library/history/toolbar/ToolbarView.kt | 33 +- .../viewholders/HistoryListItemViewHolder.kt | 6 +- .../HistoryMetadataGroupFragment.kt | 37 +- .../HistoryMetadataGroupFragmentStore.kt | 14 +- .../HistoryMetadataGroupController.kt | 12 +- .../HistoryMetadataGroupInteractor.kt | 2 +- .../view/HistoryMetadataGroupAdapter.kt | 2 +- .../HistoryMetadataGroupItemViewHolder.kt | 2 +- .../view/HistoryMetadataGroupView.kt | 6 +- .../recentlyclosed/RecentlyClosedAdapter.kt | 4 +- .../RecentlyClosedController.kt | 12 +- .../recentlyclosed/RecentlyClosedFragment.kt | 14 +- .../RecentlyClosedFragmentInteractor.kt | 2 +- .../RecentlyClosedFragmentStore.kt | 6 +- .../RecentlyClosedFragmentView.kt | 12 +- .../RecentlyClosedItemViewHolder.kt | 2 +- .../fenix/nimbus/NimbusBranchesFragment.kt | 8 +- .../fenix/nimbus/NimbusBranchesStore.kt | 9 +- .../fenix/nimbus/NimbusExperimentsFragment.kt | 4 +- .../controller/NimbusBranchesController.kt | 8 +- .../fenix/nimbus/view/NimbusBranchesView.kt | 2 +- .../nimbus/view/NimbusExperimentsView.kt | 4 +- .../DefaultBrowserNotificationWorker.kt | 12 +- .../fenix/onboarding/FenixOnboarding.kt | 2 +- .../fenix/onboarding/HomeCFRPresenter.kt | 4 +- .../HomeOnboardingDialogFragment.kt | 4 +- .../fenix/onboarding/OnboardingRadioButton.kt | 5 +- .../fenix/onboarding/view/Onboarding.kt | 12 +- .../perf/ApplicationInitTimeContainer.kt | 2 +- .../perf/ColdStartupDurationTelemetry.kt | 2 +- .../perf/MarkersFragmentLifecycleCallbacks.kt | 2 +- .../org/mozilla/fenix/perf/Performance.kt | 3 +- .../mozilla/fenix/perf/PerformanceInflater.kt | 7 +- .../fenix/perf/ProfilerMarkerFactProcessor.kt | 6 +- .../fenix/perf/ProfilerReusableComposable.kt | 14 +- .../fenix/perf/ProfilerStartDialogFragment.kt | 31 +- .../fenix/perf/ProfilerStopDialogFragment.kt | 26 +- .../org/mozilla/fenix/perf/ProfilerUtils.kt | 52 +- .../mozilla/fenix/perf/ProfilerViewModel.kt | 2 +- .../mozilla/fenix/perf/RunBlockingCounter.kt | 2 +- .../mozilla/fenix/perf/StartupActivityLog.kt | 2 +- .../mozilla/fenix/perf/StartupPathProvider.kt | 2 +- .../fenix/perf/StartupStateProvider.kt | 12 +- .../fenix/perf/StartupTypeTelemetry.kt | 5 +- .../mozilla/fenix/perf/StrictModeManager.kt | 2 +- .../ThreadPenaltyDeathWithIgnoresListener.kt | 2 +- .../fenix/perf/VisualCompletenessQueue.kt | 2 +- .../mozilla/fenix/push/PushFxaIntegration.kt | 13 +- .../fenix/push/WebPushEngineIntegration.kt | 12 +- .../fenix/search/SearchDialogController.kt | 36 +- .../fenix/search/SearchDialogFragment.kt | 62 +- .../fenix/search/SearchDialogInteractor.kt | 2 +- .../fenix/search/SearchFragmentStore.kt | 14 +- .../fenix/search/awesomebar/AwesomeBarView.kt | 36 +- .../search/awesomebar/AwesomeBarWrapper.kt | 2 +- .../awesomebar/ShortcutsSuggestionProvider.kt | 10 +- .../IncreasedTapAreaActionDecorator.kt | 2 +- .../fenix/search/toolbar/SearchSelector.kt | 2 +- .../search/toolbar/SearchSelectorMenu.kt | 10 +- .../toolbar/SearchSelectorToolbarAction.kt | 6 +- .../fenix/search/toolbar/ToolbarView.kt | 37 +- .../PerformanceActivityLifecycleCallbacks.kt | 2 +- .../session/PrivateNotificationService.kt | 10 +- .../fenix/settings/AccessibilityFragment.kt | 4 +- ...EtpCookiesOptionsDropDownListPreference.kt | 2 +- .../fenix/settings/CustomizationFragment.kt | 14 +- .../settings/DefaultBrowserPreference.kt | 2 +- .../fenix/settings/DropDownListPreference.kt | 2 +- .../org/mozilla/fenix/settings/Extensions.kt | 6 +- .../fenix/settings/HomeSettingsFragment.kt | 30 +- .../fenix/settings/HttpsOnlyFragment.kt | 10 +- .../OnSharedPreferenceChangeListener.kt | 4 +- .../mozilla/fenix/settings/PairFragment.kt | 18 +- .../mozilla/fenix/settings/PhoneFeature.kt | 7 +- .../settings/PreferenceBackedRadioButton.kt | 5 +- .../settings/RadioButtonInfoPreference.kt | 2 +- .../fenix/settings/RadioButtonPreference.kt | 6 +- .../settings/SecretDebugSettingsFragment.kt | 10 +- .../fenix/settings/SettingsFragment.kt | 40 +- .../mozilla/fenix/settings/SupportUtils.kt | 6 +- .../mozilla/fenix/settings/SyncPreference.kt | 2 +- .../fenix/settings/SyncPreferenceView.kt | 4 +- .../fenix/settings/TabsSettingsFragment.kt | 4 +- .../TextPercentageSeekBarPreference.kt | 24 +- .../settings/TrackingProtectionFragment.kt | 16 +- .../fenix/settings/about/AboutFragment.kt | 38 +- .../settings/about/AboutLibrariesFragment.kt | 2 +- .../settings/about/SecretDebugMenuTrigger.kt | 6 +- .../about/viewholders/AboutItemViewHolder.kt | 2 +- .../account/AccountAuthErrorPreference.kt | 2 +- .../settings/account/AccountPreference.kt | 2 +- .../account/AccountProblemFragment.kt | 2 +- .../account/AccountSettingsFragment.kt | 34 +- .../account/AccountSettingsFragmentStore.kt | 8 +- .../account/AccountSettingsInteractor.kt | 4 +- .../fenix/settings/account/AccountUiView.kt | 4 +- .../settings/account/DefaultSyncController.kt | 8 +- .../fenix/settings/account/SignOutFragment.kt | 6 +- .../settings/account/TurnOnSyncFragment.kt | 8 +- .../settings/address/AddressEditorFragment.kt | 4 +- .../address/AddressManagementFragment.kt | 8 +- .../controller/AddressManagementController.kt | 6 +- .../fenix/settings/address/ext/Address.kt | 2 +- .../interactor/AddressEditorInteractor.kt | 2 +- .../interactor/AddressManagementInteractor.kt | 2 +- .../address/view/AddressEditorView.kt | 10 +- .../settings/address/view/AddressList.kt | 4 +- .../DefaultLocaleSettingsController.kt | 2 +- .../fenix/settings/advanced/LocaleAdapter.kt | 10 +- .../advanced/LocaleManagerExtension.kt | 8 +- .../advanced/LocaleSettingsFragment.kt | 28 +- .../settings/advanced/LocaleSettingsStore.kt | 11 +- .../settings/advanced/LocaleSettingsView.kt | 2 +- .../settings/advanced/LocaleViewHolders.kt | 10 +- .../autofill/AutofillFragmentStore.kt | 11 +- .../autofill/AutofillSettingFragment.kt | 20 +- .../biometric/BiometricPromptFeature.kt | 2 +- .../BiometricPromptPreferenceFragment.kt | 4 +- .../creditcards/CreditCardEditorFragment.kt | 6 +- .../creditcards/CreditCardEditorState.kt | 6 +- .../CreditCardsManagementFragment.kt | 6 +- .../controller/CreditCardEditorController.kt | 2 +- .../CreditCardsManagementController.kt | 6 +- .../interactor/CreditCardEditorInteractor.kt | 2 +- .../creditcards/view/CreditCardEditorView.kt | 18 +- .../view/CreditCardItemViewHolder.kt | 4 +- .../creditcards/view/CreditCardsAdapter.kt | 2 +- .../view/CreditCardsManagementView.kt | 2 +- .../deletebrowsingdata/DeleteAndQuit.kt | 2 +- .../DeleteBrowsingDataController.kt | 10 +- .../DeleteBrowsingDataFragment.kt | 14 +- .../DeleteBrowsingDataItem.kt | 6 +- .../DeleteBrowsingDataOnQuitFragment.kt | 2 +- .../DeleteBrowsingDataOnQuitType.kt | 3 +- .../settings/logins/LoginsFragmentStore.kt | 28 +- .../settings/logins/PasswordRevealHelper.kt | 4 +- .../logins/SavedLoginsSortingStrategyMenu.kt | 19 +- .../logins/controller/LoginsListController.kt | 12 +- .../SavedLoginsStorageController.kt | 34 +- .../logins/fragment/AddLoginFragment.kt | 189 +- .../logins/fragment/EditLoginFragment.kt | 141 +- .../logins/fragment/LoginDetailFragment.kt | 24 +- .../fragment/SavedLoginsAuthFragment.kt | 16 +- .../logins/fragment/SavedLoginsFragment.kt | 54 +- .../fragment/SavedLoginsSettingFragment.kt | 8 +- .../logins/interactor/AddLoginInteractor.kt | 2 +- .../logins/interactor/EditLoginInteractor.kt | 2 +- .../interactor/LoginDetailInteractor.kt | 2 +- .../interactor/SavedLoginsInteractor.kt | 2 +- .../view/LoginDetailsBindingDelegate.kt | 2 +- .../settings/logins/view/LoginsAdapter.kt | 4 +- .../logins/view/LoginsListViewHolder.kt | 4 +- .../logins/view/SavedLoginsListView.kt | 10 +- .../quicksettings/ClearSiteDataView.kt | 11 +- .../ConnectionDetailsController.kt | 4 +- .../ConnectionDetailsInteractor.kt | 2 +- .../quicksettings/ConnectionDetailsView.kt | 4 +- .../ConnectionPanelDialogFragment.kt | 11 +- .../quicksettings/QuickSettingsController.kt | 18 +- .../QuickSettingsFragmentAction.kt | 4 +- .../QuickSettingsFragmentReducer.kt | 18 +- .../QuickSettingsFragmentState.kt | 60 +- .../QuickSettingsFragmentStore.kt | 32 +- .../quicksettings/QuickSettingsInteractor.kt | 2 +- .../QuickSettingsSheetDialogFragment.kt | 17 +- .../quicksettings/TrackingProtectionView.kt | 5 +- .../settings/quicksettings/WebsiteInfoView.kt | 4 +- .../quicksettings/WebsitePermissionsView.kt | 38 +- .../quicksettings/ext/PhoneFeatureExt.kt | 6 +- .../search/AddSearchEngineFragment.kt | 16 +- .../search/EditCustomSearchEngineFragment.kt | 12 +- .../search/RadioSearchEngineListPreference.kt | 20 +- .../fenix/settings/search/SearchEngineMenu.kt | 10 +- .../settings/search/SearchStringValidator.kt | 6 +- .../settings/sitepermissions/Extensions.kt | 2 +- ...itePermissionsDetailsExceptionsFragment.kt | 4 +- .../SitePermissionsExceptionsFragment.kt | 2 +- ...onsManageExceptionsPhoneFeatureFragment.kt | 5 +- ...tePermissionsManagePhoneFeatureFragment.kt | 17 +- .../settings/studies/CustomViewHolder.kt | 2 +- .../fenix/settings/studies/StudiesAdapter.kt | 8 +- .../fenix/settings/studies/StudiesFragment.kt | 3 +- .../settings/studies/StudiesInteractor.kt | 16 +- .../fenix/settings/studies/StudiesView.kt | 8 +- .../settings/wallpaper/WallpaperSettings.kt | 18 +- .../wallpaper/WallpaperSettingsFragment.kt | 2 +- .../fenix/share/AddNewDeviceFragment.kt | 4 +- .../org/mozilla/fenix/share/ShareCloseView.kt | 2 +- .../mozilla/fenix/share/ShareController.kt | 2 +- .../org/mozilla/fenix/share/ShareFragment.kt | 12 +- .../mozilla/fenix/share/ShareInteractor.kt | 2 +- .../fenix/share/ShareToAccountDevicesView.kt | 4 +- .../mozilla/fenix/share/ShareToAppsView.kt | 4 +- .../org/mozilla/fenix/share/ShareViewModel.kt | 12 +- .../listadapters/AccountDevicesAdapter.kt | 2 +- .../share/listadapters/AppShareAdapter.kt | 4 +- .../share/listadapters/ShareTabsAdapter.kt | 2 +- .../viewholders/AccountDeviceViewHolder.kt | 16 +- .../fenix/share/viewholders/AppViewHolder.kt | 2 +- .../fenix/shortcut/CreateShortcutFragment.kt | 2 +- .../shortcut/PwaOnboardingDialogFragment.kt | 2 +- .../fenix/shortcut/PwaOnboardingObserver.kt | 4 +- .../fenix/sync/SyncedTabsIntegration.kt | 4 +- .../fenix/tabhistory/TabHistoryAdapter.kt | 4 +- .../fenix/tabhistory/TabHistoryController.kt | 2 +- .../tabhistory/TabHistoryDialogFragment.kt | 6 +- .../fenix/tabhistory/TabHistoryInteractor.kt | 2 +- .../fenix/tabhistory/TabHistoryView.kt | 6 +- .../fenix/tabhistory/TabHistoryViewHolder.kt | 4 +- .../fenix/tabstray/CloseOnLastTabBinding.kt | 2 +- .../tabstray/FloatingActionButtonBinding.kt | 6 +- .../mozilla/fenix/tabstray/MenuIntegration.kt | 4 +- .../fenix/tabstray/NavigationInteractor.kt | 22 +- .../fenix/tabstray/SecureTabsTrayBinding.kt | 4 +- .../fenix/tabstray/TabCounterBinding.kt | 2 +- .../fenix/tabstray/TabSheetBehaviorManager.kt | 7 +- .../fenix/tabstray/TabsTrayController.kt | 13 +- .../mozilla/fenix/tabstray/TabsTrayDialog.kt | 2 +- .../fenix/tabstray/TabsTrayFragment.kt | 106 +- .../TabsTrayInactiveTabsOnboardingBinding.kt | 2 +- .../tabstray/TabsTrayInfoBannerBinding.kt | 4 +- .../fenix/tabstray/TabsTrayInteractor.kt | 6 +- .../mozilla/fenix/tabstray/TabsTrayMenu.kt | 16 +- .../fenix/tabstray/TabsTrayMiddleware.kt | 2 +- .../mozilla/fenix/tabstray/TabsTrayStore.kt | 10 +- .../fenix/tabstray/TrayPagerAdapter.kt | 12 +- .../browser/AbstractBrowserTabViewHolder.kt | 12 +- .../browser/AbstractBrowserTrayList.kt | 11 +- .../tabstray/browser/BrowserTabViewHolder.kt | 14 +- .../tabstray/browser/BrowserTabsAdapter.kt | 16 +- .../tabstray/browser/BrowserTrayInteractor.kt | 8 +- .../tabstray/browser/DraggableItemAnimator.kt | 2 +- .../tabstray/browser/InactiveTabViewHolder.kt | 2 +- .../tabstray/browser/NormalBrowserTrayList.kt | 4 +- .../tabstray/browser/NormalTabsBinding.kt | 2 +- .../browser/PrivateBrowserTrayList.kt | 4 +- .../tabstray/browser/PrivateTabsBinding.kt | 2 +- .../browser/SelectedItemAdapterBinding.kt | 2 +- .../browser/SelectionBannerBinding.kt | 4 +- .../browser/SelectionHandleBinding.kt | 8 +- .../fenix/tabstray/browser/SelectionMenu.kt | 10 +- .../browser/SelectionMenuIntegration.kt | 2 +- .../tabstray/browser/SwipeToDeleteBinding.kt | 2 +- .../fenix/tabstray/browser/TabSorter.kt | 2 +- .../fenix/tabstray/browser/TabsTouchHelper.kt | 21 +- .../fenix/tabstray/browser/UseCases.kt | 2 +- .../compose/ComposeAbstractTabViewHolder.kt | 2 +- .../browser/compose/ComposeGridViewHolder.kt | 2 +- .../browser/compose/ComposeListViewHolder.kt | 4 +- .../mozilla/fenix/tabstray/ext/BrowserMenu.kt | 4 +- .../fenix/tabstray/ext/FenixSnackbar.kt | 8 +- .../tabstray/ext/SyncedTabsViewErrorType.kt | 2 +- .../fenix/tabstray/ext/TabSelectors.kt | 2 +- .../tabstray/inactivetabs/InactiveTabs.kt | 12 +- .../tabstray/syncedtabs/SyncButtonBinding.kt | 2 +- .../fenix/tabstray/syncedtabs/SyncedTabs.kt | 24 +- .../syncedtabs/SyncedTabsIntegration.kt | 8 +- .../tabstray/syncedtabs/SyncedTabsListItem.kt | 4 +- .../AbstractBrowserPageViewHolder.kt | 5 +- .../viewholders/AbstractPageViewHolder.kt | 4 +- .../NormalBrowserPageViewHolder.kt | 6 +- .../PrivateBrowserPageViewHolder.kt | 6 +- .../telemetry/TelemetryLifecycleObserver.kt | 10 +- .../fenix/telemetry/TelemetryMiddleware.kt | 5 +- .../org/mozilla/fenix/theme/FirefoxTheme.kt | 70 +- .../org/mozilla/fenix/theme/ThemeManager.kt | 5 +- .../SwitchWithDescription.kt | 14 +- .../trackingprotection/TrackerBuckets.kt | 6 +- .../TrackingProtectionBlockingFragment.kt | 1 + .../TrackingProtectionCategoryItem.kt | 14 +- .../TrackingProtectionMode.kt | 10 +- .../TrackingProtectionPanelDialogFragment.kt | 26 +- .../TrackingProtectionPanelInteractor.kt | 4 +- .../TrackingProtectionPanelView.kt | 20 +- .../TrackingProtectionStore.kt | 38 +- .../utils/AccessibilityGridLayoutManager.kt | 6 +- .../mozilla/fenix/utils/ClearableEditText.kt | 2 +- .../org/mozilla/fenix/utils/LinkTextView.kt | 4 +- .../mozilla/fenix/utils/ToolbarPopupWindow.kt | 12 +- .../main/java/org/mozilla/fenix/utils/Undo.kt | 6 +- .../fenix/utils/view/LifecycleViewProvider.kt | 2 +- .../mozilla/fenix/utils/view/ViewHolder.kt | 2 +- .../wallpapers/LegacyWallpaperDownloader.kt | 2 +- .../wallpapers/LegacyWallpaperFileManager.kt | 6 +- .../org/mozilla/fenix/wallpapers/Wallpaper.kt | 7 +- .../fenix/wallpapers/WallpaperDownloader.kt | 6 +- .../fenix/wallpapers/WallpaperFileManager.kt | 6 +- .../wallpapers/WallpaperMetadataFetcher.kt | 2 +- .../fenix/wallpapers/WallpaperState.kt | 2 +- .../fenix/wallpapers/WallpapersUseCases.kt | 25 +- .../org/mozilla/fenix/whatsnew/WhatsNew.kt | 6 +- .../fenix/widget/VoiceSearchActivity.kt | 5 +- .../wifi/SitePermissionsWifiIntegration.kt | 6 +- .../gecko/search/SearchWidgetProvider.kt | 28 +- .../fenix/AppRequestInterceptorTest.kt | 33 +- .../org/mozilla/fenix/FenixLogSinkTest.kt | 10 +- .../org/mozilla/fenix/MockNavHostActivity.kt | 2 +- .../org/mozilla/fenix/ReleaseChannelTest.kt | 2 +- .../mozilla/fenix/ServiceWorkerSupportTest.kt | 2 +- .../addons/AddonDetailsBindingDelegateTest.kt | 32 +- ...donPermissionDetailsBindingDelegateTest.kt | 8 +- .../addons/AddonsManagementFragmentTest.kt | 3 +- .../fenix/addons/AddonsManagementViewTest.kt | 2 +- .../fenix/browser/BaseBrowserFragmentTest.kt | 8 +- .../browser/FenixSnackbarDelegateTest.kt | 14 +- .../OpenInAppOnboardingObserverTest.kt | 32 +- .../DefaultBrowsingModeManagerTest.kt | 4 +- .../browsingmode/SimpleBrowsingModeManager.kt | 2 +- .../infobanner/DynamicInfoBannerTest.kt | 16 +- .../DefaultReaderModeControllerTest.kt | 14 +- .../CollectionCreationBottomBarViewTest.kt | 30 +- .../CollectionCreationFragmentTest.kt | 7 +- .../CollectionCreationStoreTest.kt | 42 +- .../CollectionCreationTabListAdapterTest.kt | 8 +- .../collections/CollectionsListAdapterTest.kt | 2 +- ...DefaultCollectionCreationControllerTest.kt | 23 +- .../SaveCollectionListAdapterTest.kt | 6 +- .../fenix/collections/TabDiffUtilTest.kt | 26 +- .../components/AccountAbnormalitiesTest.kt | 14 +- .../mozilla/fenix/components/AppStoreTest.kt | 70 +- .../components/FindInPageIntegrationTest.kt | 16 +- .../components/ReviewPromptControllerTest.kt | 26 +- .../appstate/AppStoreReducerTest.kt | 6 +- .../bookmarks/BookmarksUseCaseTest.kt | 16 +- .../history/PagedHistoryProviderTest.kt | 110 +- .../metrics/BreadcrumbRecorderTest.kt | 6 +- .../metrics/MetricControllerTest.kt | 81 +- .../components/metrics/MetricsUtilsTest.kt | 2 +- .../metrics/MetricsUtilsTestRobolectric.kt | 26 +- .../settings/CounterPreferenceTest.kt | 1 + .../settings/FeatureFlagPreferenceTest.kt | 3 +- .../sitepermissions/ExtensionsTest.kt | 6 +- .../toolbar/BrowserToolbarCFRPresenterTest.kt | 15 +- .../toolbar/BrowserToolbarViewTest.kt | 2 +- .../DefaultBrowserToolbarControllerTest.kt | 18 +- .../DefaultBrowserToolbarInteractorTest.kt | 3 +- ...DefaultBrowserToolbarMenuControllerTest.kt | 89 +- .../cfr/CFRPopupFullscreenLayoutTest.kt | 8 +- .../crashes/CrashContentIntegrationTest.kt | 8 +- .../fenix/crashes/CrashContentViewTest.kt | 2 +- .../crashes/CrashReporterControllerTest.kt | 4 +- .../customtabs/CustomTabToolbarMenuTest.kt | 12 +- .../ExternalAppBrowserActivityTest.kt | 48 +- .../FennecWebAppIntentProcessorTest.kt | 2 +- .../customtabs/PoweredByNotificationTest.kt | 12 +- .../DynamicDownloadDialogBehaviorTest.kt | 32 +- .../downloads/DynamicDownloadDialogTest.kt | 3 +- .../login/LoginExceptionsAdapterTest.kt | 52 +- .../login/LoginExceptionsViewTest.kt | 4 +- ...TrackingProtectionExceptionsAdapterTest.kt | 52 +- ...ngProtectionExceptionsFragmentStoreTest.kt | 2 +- ...ckingProtectionExceptionsInteractorTest.kt | 12 +- .../TrackingProtectionExceptionsViewTest.kt | 2 +- .../ExceptionsDeleteButtonViewHolderTest.kt | 2 + .../ExceptionsListItemViewHolderTest.kt | 5 +- .../org/mozilla/fenix/ext/AppStateTest.kt | 140 +- .../org/mozilla/fenix/ext/BrowserStateTest.kt | 98 +- .../fenix/ext/ConnectivityManagerTest.kt | 4 - .../mozilla/fenix/ext/DownloadItemKtTest.kt | 2 +- .../java/org/mozilla/fenix/ext/ListTest.kt | 12 +- .../mozilla/fenix/ext/NavControllerTest.kt | 7 +- .../org/mozilla/fenix/ext/SearchEngineTest.kt | 16 +- .../java/org/mozilla/fenix/ext/StringTest.kt | 2 +- .../mozilla/fenix/ext/TabCollectionTest.kt | 8 +- .../java/org/mozilla/fenix/ext/TopSiteTest.kt | 22 +- .../java/org/mozilla/fenix/ext/ViewTest.kt | 2 + .../DefaultMessageControllerTest.kt | 8 +- .../gleanplumb/NimbusMessagingStorageTest.kt | 64 +- .../OnDiskMessageMetadataStorageTest.kt | 2 +- .../state/MessagingMiddlewareTest.kt | 31 +- .../gleanplumb/state/MessagingReducerTest.kt | 12 +- .../fenix/helpers/MockkRetryTestRule.kt | 3 +- .../DefaultSessionControlControllerTest.kt | 123 +- .../mozilla/fenix/home/HomeMenuBuilderTest.kt | 26 +- .../java/org/mozilla/fenix/home/ModeTest.kt | 2 +- .../fenix/home/PocketUpdatesMiddlewareTest.kt | 56 +- .../fenix/home/RecentTabsListFeatureTest.kt | 98 +- .../home/SessionControlInteractorTest.kt | 2 +- .../fenix/home/TabCounterBuilderTest.kt | 2 +- .../home/blocklist/BlocklistHandlerTest.kt | 6 +- .../home/blocklist/BlocklistMiddlewareTest.kt | 108 +- ...necBookmarkShortcutsIntentProcessorTest.kt | 4 +- .../intent/HomeDeepLinkIntentProcessorTest.kt | 6 +- .../SpeechProcessingIntentProcessorTest.kt | 10 +- .../intent/StartSearchIntentProcessorTest.kt | 4 +- .../DefaultPocketStoriesControllerTest.kt | 37 +- .../DefaultRecentBookmarksControllerTest.kt | 7 +- .../RecentBookmarksFeatureTest.kt | 4 +- .../RecentSyncedTabFeatureTest.kt | 54 +- .../DefaultRecentSyncedTabControllerTest.kt | 28 +- .../controller/RecentTabControllerTest.kt | 15 +- .../HistoryMetadataMiddlewareTest.kt | 34 +- .../recentvisits/RecentVisitsFeatureTest.kt | 110 +- .../controller/RecentVisitsControllerTest.kt | 19 +- .../interactor/RecentVisitsInteractorTest.kt | 16 +- .../sessioncontrol/SessionControlViewTest.kt | 16 +- .../NoCollectionsMessageViewHolderTest.kt | 6 +- .../OnboardingSectionHeaderViewHolderTest.kt | 2 +- ...dingToolbarPositionPickerViewHolderTest.kt | 4 +- .../topsites/TopSiteItemViewHolderTest.kt | 10 +- .../home/topsites/TopSiteViewHolderTest.kt | 6 +- .../home/topsites/TopSitesAdapterTest.kt | 10 +- .../home/topsites/TopSitesPagerAdapterTest.kt | 40 +- .../library/bookmarks/BookmarkAdapterTest.kt | 45 +- .../bookmarks/BookmarkControllerTest.kt | 45 +- .../BookmarkDeselectNavigationListenerTest.kt | 2 +- .../BookmarkFragmentInteractorTest.kt | 9 +- .../bookmarks/BookmarkFragmentStoreTest.kt | 17 +- .../library/bookmarks/BookmarkItemMenuTest.kt | 2 +- .../bookmarks/BookmarkSearchControllerTest.kt | 11 +- .../BookmarkSearchDialogInteractorTest.kt | 2 +- .../BookmarkSearchFragmentStoreTest.kt | 2 +- .../library/bookmarks/DesktopFoldersTest.kt | 2 +- .../fenix/library/bookmarks/UtilsKtTest.kt | 21 +- .../viewholders/BookmarkNodeViewHolderTest.kt | 23 +- .../library/downloads/DownloadAdapterTest.kt | 4 +- .../downloads/DownloadControllerTest.kt | 4 +- .../downloads/DownloadFragmentStoreTest.kt | 12 +- .../library/downloads/DownloadFragmentTest.kt | 41 +- .../downloads/DownloadInteractorTest.kt | 2 +- .../library/history/HistoryControllerTest.kt | 16 +- .../library/history/HistoryDataSourceTest.kt | 60 +- .../history/HistoryFragmentStoreTest.kt | 10 +- .../history/HistoryItemTimeGroupTest.kt | 26 +- .../history/HistorySearchControllerTest.kt | 11 +- .../HistorySearchDialogInteractorTest.kt | 2 +- .../history/HistorySearchFragmentStoreTest.kt | 5 +- .../HistoryMetadataGroupFragmentStoreTest.kt | 6 +- .../HistoryMetadataGroupControllerTest.kt | 51 +- .../HistoryMetadataGroupItemViewHolderTest.kt | 2 +- .../DefaultRecentlyClosedControllerTest.kt | 14 +- .../RecentlyClosedFragmentInteractorTest.kt | 2 +- .../nimbus/NimbusBranchesControllerTest.kt | 14 +- .../fenix/perf/PerformanceInflaterTest.kt | 8 +- .../perf/ProfilerMarkerFactProcessorTest.kt | 1 + .../fenix/perf/StartupActivityLogTest.kt | 4 +- .../fenix/perf/StartupReportFullyDrawnTest.kt | 12 +- .../fenix/perf/StartupStateProviderTest.kt | 60 +- .../fenix/perf/StartupTypeTelemetryTest.kt | 4 +- .../fenix/perf/StorageStatsMetricsTest.kt | 1 + .../fenix/perf/StrictModeManagerTest.kt | 11 +- ...readPenaltyDeathWithIgnoresListenerTest.kt | 1 + .../push/WebPushEngineIntegrationTest.kt | 24 +- .../search/SearchDialogControllerTest.kt | 48 +- .../search/SearchDialogInteractorTest.kt | 2 +- .../fenix/search/SearchFragmentStoreTest.kt | 79 +- .../ShortcutsSuggestionProviderTest.kt | 14 +- .../IncreasedTapAreaActionDecoratorTest.kt | 1 + .../SearchSelectorToolbarActionTest.kt | 46 +- .../fenix/search/toolbar/ToolbarViewTest.kt | 12 +- .../session/PrivateNotificationServiceTest.kt | 2 +- ...ookiesOptionsDropDownListPreferenceTest.kt | 2 +- .../mozilla/fenix/settings/ExtensionsTest.kt | 8 +- .../settings/HomeSettingsFragmentTest.kt | 2 +- .../fenix/settings/PhoneFeatureTest.kt | 1 + .../fenix/settings/SettingsFragmentTest.kt | 9 +- .../fenix/settings/SupportUtilsTest.kt | 14 +- .../settings/about/AboutPageAdapterTest.kt | 8 +- .../about/SecretDebugMenuTriggerTest.kt | 8 +- .../account/AccountSettingsInteractorTest.kt | 10 +- .../account/DefaultSyncControllerTest.kt | 4 +- .../settings/address/AddressEditorViewTest.kt | 12 +- .../DefaultAddressEditorControllerTest.kt | 4 +- .../DefaultAddressManagementControllerTest.kt | 10 +- .../fenix/settings/address/ext/AddressTest.kt | 2 +- .../DefaultAddressEditorInteractorTest.kt | 2 +- .../advanced/LocaleSettingsControllerTest.kt | 4 +- .../advanced/LocaleSettingsStoreTest.kt | 2 +- .../advanced/LocaleViewHoldersTest.kt | 4 +- .../autofill/AutofillSettingFragmentTest.kt | 28 +- .../creditcards/CreditCardEditorStateTest.kt | 2 +- .../creditcards/CreditCardEditorViewTest.kt | 28 +- .../CreditCardItemViewHolderTest.kt | 2 +- .../creditcards/CreditCardsAdapterTest.kt | 14 +- .../CreditCardsManagementViewTest.kt | 4 +- .../DefaultCreditCardEditorControllerTest.kt | 10 +- .../DefaultCreditCardEditorInteractorTest.kt | 6 +- ...aultCreditCardsManagementControllerTest.kt | 12 +- ...DefaultDeleteBrowsingDataControllerTest.kt | 9 +- .../deletebrowsingdata/DeleteAndQuitTest.kt | 8 +- .../settings/logins/AddLoginInteractorTest.kt | 6 +- .../settings/logins/LoginDetailViewTest.kt | 2 +- .../logins/LoginsFragmentStoreTest.kt | 22 +- .../logins/LoginsListControllerTest.kt | 6 +- .../logins/LoginsListViewHolderTest.kt | 6 +- .../SavedLoginsSortingStrategyMenuTest.kt | 6 +- .../SavedLoginsStorageControllerTest.kt | 44 +- .../settings/logins/SyncPreferenceViewTest.kt | 18 +- .../quicksettings/AutoplayValueTest.kt | 72 +- .../quicksettings/ClearSiteDataViewTest.kt | 6 +- .../ConnectionDetailsViewTest.kt | 13 +- .../DefaultConnectionDetailsControllerTest.kt | 4 +- .../DefaultQuickSettingsControllerTest.kt | 32 +- .../QuickSettingsFragmentReducerTest.kt | 36 +- .../QuickSettingsFragmentStoreTest.kt | 43 +- .../QuickSettingsSheetDialogFragmentTest.kt | 4 +- .../TrackingProtectionViewTest.kt | 4 +- .../quicksettings/WebsiteInfoViewTest.kt | 8 +- .../WebsitePermissionViewTest.kt | 24 +- .../search/SearchStringValidatorTest.kt | 12 +- ...ermissionsDetailsExceptionsFragmentTest.kt | 1 - ...anageExceptionsPhoneFeatureFragmentTest.kt | 84 +- .../fenix/settings/studies/StudiesViewTest.kt | 4 +- .../fenix/share/ShareControllerTest.kt | 59 +- .../mozilla/fenix/share/ShareViewModelTest.kt | 16 +- .../share/listadapters/AppShareAdapterTest.kt | 2 +- .../AccountDeviceViewHolderTest.kt | 6 +- .../share/viewholders/AppViewHolderTest.kt | 4 +- .../shortcut/PwaOnboardingObserverTest.kt | 8 +- .../fenix/sync/SyncedTabsIntegrationTest.kt | 2 + .../fenix/sync/ext/SyncedDeviceTabsTest.kt | 28 +- .../fenix/tabhistory/TabHistoryAdapterTest.kt | 28 +- .../tabhistory/TabHistoryControllerTest.kt | 7 +- .../tabhistory/TabHistoryViewHolderTest.kt | 9 +- .../tabstray/CloseOnLastTabBindingTest.kt | 24 +- .../tabstray/DefaultTabsTrayControllerTest.kt | 34 +- .../FloatingActionButtonBindingTest.kt | 16 +- .../tabstray/NavigationInteractorTest.kt | 23 +- .../tabstray/SecureTabsTrayBindingTest.kt | 8 +- .../fenix/tabstray/TabsTrayFragmentTest.kt | 12 +- .../tabstray/TabsTrayInfoBannerBindingTest.kt | 4 +- .../fenix/tabstray/TabsTrayMiddlewareTest.kt | 3 +- .../tabstray/TabsTrayStoreReducerTest.kt | 14 +- .../AbstractBrowserTabViewHolderTest.kt | 24 +- .../browser/BrowserTabsAdapterTest.kt | 10 +- .../DefaultInactiveTabsControllerTest.kt | 6 +- .../DefaultInactiveTabsInteractorTest.kt | 4 +- .../fenix/tabstray/browser/TabSorterTest.kt | 20 +- .../tabstray/browser/TabsTouchHelperTest.kt | 4 +- .../fenix/tabstray/ext/BrowserStoreKtTest.kt | 12 +- .../tabstray/ext/TabSessionStateKtTest.kt | 22 +- .../TelemetryLifecycleObserverTest.kt | 10 +- .../telemetry/TelemetryMiddlewareTest.kt | 76 +- .../fenix/toolbar/DefaultToolbarMenuTest.kt | 10 +- .../trackingprotection/TrackerBucketsTest.kt | 25 +- .../TrackingProtectionBlockingFragmentTest.kt | 2 +- .../TrackingProtectionPanelInteractorTest.kt | 12 +- .../TrackingProtectionPanelViewTest.kt | 26 +- .../TrackingProtectionStoreTest.kt | 30 +- .../mozilla/fenix/utils/BrowsersCacheTest.kt | 18 +- .../fenix/utils/ClipboardHandlerTest.kt | 2 +- .../org/mozilla/fenix/utils/SettingsTest.kt | 43 +- .../fenix/utils/ToolbarPopupWindowTest.kt | 6 +- .../wallpapers/WallpaperDownloaderTest.kt | 4 +- .../WallpaperMetadataFetcherTest.kt | 12 +- .../wallpapers/WallpapersUseCasesTest.kt | 26 +- .../fenix/widget/SearchWidgetProviderTest.kt | 26 +- .../fenix/widget/VoiceSearchActivityTest.kt | 10 +- .../fenix/wifi/WifiConnectionMonitorTest.kt | 12 +- detekt-baseline.xml | 107 +- ktlint-baseline.xml | 8376 ----------------- 931 files changed, 7089 insertions(+), 14797 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/AppRequestInterceptor.kt b/app/src/androidTest/java/org/mozilla/fenix/AppRequestInterceptor.kt index 9ece78639f..5e1905b84c 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/AppRequestInterceptor.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/AppRequestInterceptor.kt @@ -39,9 +39,8 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor { isSameDomain: Boolean, isRedirect: Boolean, isDirectNavigation: Boolean, - isSubframeRequest: Boolean + isSubframeRequest: Boolean, ): RequestInterceptor.InterceptionResponse? { - interceptFxaRequest( engineSession, uri, @@ -50,7 +49,7 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor { isSameDomain, isRedirect, isDirectNavigation, - isSubframeRequest + isSubframeRequest, )?.let { response -> return response } @@ -68,14 +67,14 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor { isSameDomain, isRedirect, isDirectNavigation, - isSubframeRequest + isSubframeRequest, ) } override fun onErrorRequest( session: EngineSession, errorType: ErrorType, - uri: String? + uri: String?, ): RequestInterceptor.ErrorResponse? { val improvedErrorType = improveErrorType(errorType) val riskLevel = getRiskLevel(improvedErrorType) @@ -86,7 +85,7 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor { context = context, errorType = improvedErrorType, uri = uri, - htmlResource = riskLevel.htmlRes + htmlResource = riskLevel.htmlRes, ) return RequestInterceptor.ErrorResponse(errorPageUri) @@ -102,20 +101,18 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor { private fun interceptAmoRequest( uri: String, isSameDomain: Boolean, - hasUserGesture: Boolean + hasUserGesture: Boolean, ): RequestInterceptor.InterceptionResponse? { // First we execute a quick check to see if this is a request we're interested in i.e. a // request triggered by the user and coming from AMO. if (hasUserGesture && isSameDomain && uri.startsWith(AMO_BASE_URL)) { - // Check if this is a request to install an add-on. val matchResult = AMO_INSTALL_URL_REGEX.toRegex().matchEntire(uri) if (matchResult != null) { - // Navigate and trigger add-on installation. matchResult.groupValues.getOrNull(1)?.let { addonId -> navController?.get()?.navigate( - NavGraphDirections.actionGlobalAddonsManagementFragment(addonId) + NavGraphDirections.actionGlobalAddonsManagementFragment(addonId), ) // We've redirected to the add-ons management fragment, skip original request. @@ -137,7 +134,7 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor { isSameDomain: Boolean, isRedirect: Boolean, isDirectNavigation: Boolean, - isSubframeRequest: Boolean + isSubframeRequest: Boolean, ): RequestInterceptor.InterceptionResponse? { return appContext.components.services.accountsAuthFeature.interceptor.onLoadRequest( engineSession, @@ -147,7 +144,7 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor { isSameDomain, isRedirect, isDirectNavigation, - isSubframeRequest + isSubframeRequest, ) } @@ -189,16 +186,19 @@ class AppRequestInterceptor(private val context: Context) : RequestInterceptor { ErrorType.ERROR_NO_INTERNET, ErrorType.ERROR_HTTPS_ONLY, ErrorType.ERROR_BAD_HSTS_CERT, - ErrorType.ERROR_UNKNOWN_PROTOCOL -> RiskLevel.Low + ErrorType.ERROR_UNKNOWN_PROTOCOL, + -> RiskLevel.Low ErrorType.ERROR_SECURITY_BAD_CERT, ErrorType.ERROR_SECURITY_SSL, - ErrorType.ERROR_PORT_BLOCKED -> RiskLevel.Medium + ErrorType.ERROR_PORT_BLOCKED, + -> RiskLevel.Medium ErrorType.ERROR_SAFEBROWSING_HARMFUL_URI, ErrorType.ERROR_SAFEBROWSING_MALWARE_URI, ErrorType.ERROR_SAFEBROWSING_PHISHING_URI, - ErrorType.ERROR_SAFEBROWSING_UNWANTED_URI -> RiskLevel.High + ErrorType.ERROR_SAFEBROWSING_UNWANTED_URI, + -> RiskLevel.High } internal enum class RiskLevel(val htmlRes: String) { diff --git a/app/src/androidTest/java/org/mozilla/fenix/glean/BaselinePingTest.kt b/app/src/androidTest/java/org/mozilla/fenix/glean/BaselinePingTest.kt index 236603e1d6..59c89de0d3 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/glean/BaselinePingTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/glean/BaselinePingTest.kt @@ -91,7 +91,7 @@ class BaselinePingTest { val httpClient = ConceptFetchHttpUploader( lazy { GeckoViewFetchClient(ApplicationProvider.getApplicationContext()) - } + }, ) // Fenix does not initialize the Glean SDK in tests/debug builds, but this test @@ -102,7 +102,7 @@ class BaselinePingTest { applicationContext = ApplicationProvider.getApplicationContext(), uploadEnabled = true, configuration = Configuration(httpClient = httpClient), - buildInfo = GleanBuildInfo.buildInfo + buildInfo = GleanBuildInfo.buildInfo, ) } } @@ -119,7 +119,7 @@ class BaselinePingTest { private fun waitForPingContent( pingName: String, pingReason: String?, - maxAttempts: Int = 3 + maxAttempts: Int = 3, ): JSONObject? { var attempts = 0 do { @@ -163,8 +163,8 @@ class BaselinePingTest { mDevice.pressRecentApps() mDevice.findObject( UiSelector().descriptionContains( - ApplicationProvider.getApplicationContext().getString(R.string.app_name) - ) + ApplicationProvider.getApplicationContext().getString(R.string.app_name), + ), ) .click() diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/HomeActivityTestRule.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/HomeActivityTestRule.kt index 3cc9045209..c723abbe7c 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/HomeActivityTestRule.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/HomeActivityTestRule.kt @@ -25,7 +25,7 @@ import org.mozilla.fenix.onboarding.FenixOnboarding class HomeActivityTestRule( initialTouchMode: Boolean = false, launchActivity: Boolean = true, - private val skipOnboarding: Boolean = false + private val skipOnboarding: Boolean = false, ) : ActivityTestRule(HomeActivity::class.java, initialTouchMode, launchActivity) { private val longTapUserPreference = getLongPressTimeout() @@ -54,7 +54,7 @@ class HomeActivityTestRule( class HomeActivityIntentTestRule( initialTouchMode: Boolean = false, launchActivity: Boolean = true, - private val skipOnboarding: Boolean = false + private val skipOnboarding: Boolean = false, ) : IntentsTestRule(HomeActivity::class.java, initialTouchMode, launchActivity) { private val longTapUserPreference = getLongPressTimeout() @@ -94,7 +94,7 @@ private fun skipOnboardingBeforeLaunch() { private fun closeNotificationShade() { if (mDevice.findObject( - UiSelector().resourceId("com.android.systemui:id/notification_stack_scroller") + UiSelector().resourceId("com.android.systemui:id/notification_stack_scroller"), ).exists() ) { mDevice.pressHome() diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/IdlingResourceHelper.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/IdlingResourceHelper.kt index 11883e6c60..3370344e40 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/IdlingResourceHelper.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/IdlingResourceHelper.kt @@ -17,16 +17,16 @@ object IdlingResourceHelper { fun registerAddonInstallingIdlingResource(activityTestRule: ActivityTestRule) { IdlingRegistry.getInstance().register( AddonsInstallingIdlingResource( - activityTestRule.activity.supportFragmentManager - ) + activityTestRule.activity.supportFragmentManager, + ), ) } fun unregisterAddonInstallingIdlingResource(activityTestRule: ActivityTestRule) { IdlingRegistry.getInstance().unregister( AddonsInstallingIdlingResource( - activityTestRule.activity.supportFragmentManager - ) + activityTestRule.activity.supportFragmentManager, + ), ) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/Matchers.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/Matchers.kt index 9063dfa0bc..15fda66a86 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/Matchers.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/Matchers.kt @@ -44,7 +44,7 @@ fun withBitmapDrawable(bitmap: Bitmap, name: String): Matcher? = BitmapDra fun nthChildOf( parentMatcher: Matcher, - childPosition: Int + childPosition: Int, ): Matcher { return object : TypeSafeMatcher() { override fun describeTo(description: Description) { diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/MockLocationUpdatesRule.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/MockLocationUpdatesRule.kt index be6a6f7d8e..3e8ca4d87a 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/MockLocationUpdatesRule.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/MockLocationUpdatesRule.kt @@ -42,7 +42,7 @@ class MockLocationUpdatesRule : ExternalResource() { mDevice.executeShellCommand( "appops set " + appContext.packageName + - " android:mock_location allow" + " android:mock_location allow", ) // To mock locations we need a location provider, so we generate and set it here. @@ -57,7 +57,7 @@ class MockLocationUpdatesRule : ExternalResource() { true, true, 3, - 2 + 2, ) } catch (ex: Exception) { // unstable diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/TestAssetHelper.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/TestAssetHelper.kt index 0ffc4f3049..8b3c423873 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/TestAssetHelper.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/TestAssetHelper.kt @@ -34,7 +34,7 @@ object TestAssetHelper { TestAsset( server.url("pages/generic$it.html").toString().toUri()!!, "Page content: $it", - "" + "", ) } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/TestHelper.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/TestHelper.kt index ae3b0b3401..8372a8fc92 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/TestHelper.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/TestHelper.kt @@ -82,13 +82,13 @@ object TestHelper { fun longTapSelectItem(url: Uri) { mDevice.waitNotNull( Until.findObject(By.text(url.toString())), - waitingTime + waitingTime, ) onView( allOf( withId(R.id.url), - withText(url.toString()) - ) + withText(url.toString()), + ), ).perform(longClick()) } @@ -111,7 +111,7 @@ object TestHelper { fun waitUntilObjectIsFound(resourceName: String) { mDevice.waitNotNull( Until.findObjects(By.res(resourceName)), - waitingTime + waitingTime, ) } @@ -189,7 +189,7 @@ object TestHelper { fun createCustomTabIntent( pageUrl: String, customMenuItemLabel: String = "", - customActionButtonDescription: String = "" + customActionButtonDescription: String = "", ): Intent { val appContext = InstrumentationRegistry.getInstrumentation() .targetContext @@ -200,7 +200,9 @@ object TestHelper { .setShareState(CustomTabsIntent.SHARE_STATE_ON) .setActionButton( createTestBitmap(), - customActionButtonDescription, pendingIntent, true + customActionButtonDescription, + pendingIntent, + true, ) .build() customTabsIntent.intent.data = Uri.parse(pageUrl) @@ -233,7 +235,7 @@ object TestHelper { } else { mDevice.waitNotNull( Until.findObject(By.text("Could not open file")), - waitingTime + waitingTime, ) } } @@ -243,7 +245,7 @@ object TestHelper { mDevice.waitForIdle(waitingTimeShort) assertTrue( mDevice.findObject(UiSelector().packageName(appPackageName)) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) } else { BrowserRobot().verifyUrl(url) @@ -281,9 +283,9 @@ object TestHelper { return withParent( hasSibling( withChild( - matcher - ) - ) + matcher, + ), + ), ) } @@ -302,11 +304,12 @@ object TestHelper { By.text( when (Build.VERSION.SDK_INT) { Build.VERSION_CODES.R -> Pattern.compile( - "WHILE USING THE APP", Pattern.CASE_INSENSITIVE + "WHILE USING THE APP", + Pattern.CASE_INSENSITIVE, ) else -> Pattern.compile("Allow", Pattern.CASE_INSENSITIVE) - } - ) + }, + ), ).click() } } @@ -317,11 +320,12 @@ object TestHelper { By.text( when (Build.VERSION.SDK_INT) { Build.VERSION_CODES.R -> Pattern.compile( - "DENY", Pattern.CASE_INSENSITIVE + "DENY", + Pattern.CASE_INSENSITIVE, ) else -> Pattern.compile("Deny", Pattern.CASE_INSENSITIVE) - } - ) + }, + ), ).click() } } @@ -368,7 +372,7 @@ object TestHelper { config.javaClass.getDeclaredField("userSetLocale").setBoolean(config, true) am.javaClass.getMethod( "updateConfiguration", - Configuration::class.java + Configuration::class.java, ).invoke(am, config) } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/ViewVisibilityIdlingResource.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/ViewVisibilityIdlingResource.kt index 1378b3036d..c029bac0d7 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/ViewVisibilityIdlingResource.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/ViewVisibilityIdlingResource.kt @@ -9,7 +9,7 @@ import androidx.test.espresso.IdlingResource class ViewVisibilityIdlingResource( private val view: View, - private val expectedVisibility: Int + private val expectedVisibility: Int, ) : IdlingResource { private var resourceCallback: IdlingResource.ResourceCallback? = null private var isIdle: Boolean = false diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/ext/ViewInteraction.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/ext/ViewInteraction.kt index e818a0733c..f9d8f1e541 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/ext/ViewInteraction.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/ext/ViewInteraction.kt @@ -43,6 +43,6 @@ fun ViewInteraction.clickAtLocationInView(locationInView: GeneralLocation): View locationInView, Press.FINGER, InputDevice.SOURCE_UNKNOWN, - MotionEvent.BUTTON_PRIMARY - ) + MotionEvent.BUTTON_PRIMARY, + ), ) diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/ext/WaitNotNull.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/ext/WaitNotNull.kt index f726a3ac8a..1a387fa7f4 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/ext/WaitNotNull.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/ext/WaitNotNull.kt @@ -16,5 +16,5 @@ import org.mozilla.fenix.helpers.TestAssetHelper */ fun UiDevice.waitNotNull( searchCondition: SearchCondition<*>, - waitTime: Long = TestAssetHelper.waitingTime + waitTime: Long = TestAssetHelper.waitingTime, ) = assertNotNull(wait(searchCondition, waitTime)) diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/AddonsInstallingIdlingResource.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/AddonsInstallingIdlingResource.kt index 00477d9bd9..0bc68fa13d 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/AddonsInstallingIdlingResource.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/AddonsInstallingIdlingResource.kt @@ -10,7 +10,7 @@ import androidx.test.espresso.IdlingResource import mozilla.components.feature.addons.ui.AddonInstallationDialogFragment class AddonsInstallingIdlingResource( - private val fragmentManager: FragmentManager + private val fragmentManager: FragmentManager, ) : IdlingResource { private var resourceCallback: IdlingResource.ResourceCallback? = null @@ -25,8 +25,9 @@ class AddonsInstallingIdlingResource( } override fun registerIdleTransitionCallback(callback: IdlingResource.ResourceCallback?) { - if (callback != null) + if (callback != null) { resourceCallback = callback + } } private fun isInstalledAddonDialogShown(): Boolean { diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/AddonsLoadingIdlingResource.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/AddonsLoadingIdlingResource.kt index 4a312b882c..aece533de8 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/AddonsLoadingIdlingResource.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/AddonsLoadingIdlingResource.kt @@ -20,14 +20,16 @@ class AddonsLoadingIdlingResource(val fragmentManager: FragmentManager) : Idling override fun isIdleNow(): Boolean { val idle = addonsFinishedLoading() - if (idle) + if (idle) { resourceCallback?.onTransitionToIdle() + } return idle } override fun registerIdleTransitionCallback(callback: IdlingResource.ResourceCallback?) { - if (callback != null) + if (callback != null) { resourceCallback = callback + } } private fun addonsFinishedLoading(): Boolean { @@ -37,8 +39,9 @@ class AddonsLoadingIdlingResource(val fragmentManager: FragmentManager) : Idling addonsManagementFragment.view?.findViewById(R.id.add_ons_progress_bar) } ?: return true - if (progressbar.visibility == VISIBLE) + if (progressbar.visibility == VISIBLE) { return false + } return true } diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/NetworkConnectionIdlingResource.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/NetworkConnectionIdlingResource.kt index f5b3b4364b..f8c61bc514 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/NetworkConnectionIdlingResource.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/idlingresource/NetworkConnectionIdlingResource.kt @@ -32,14 +32,16 @@ class NetworkConnectionIdlingResource(private val networkConnected: Boolean) : I } else { !isOnline() } - if (idle) + if (idle) { resourceCallback?.onTransitionToIdle() + } return idle } override fun registerIdleTransitionCallback(callback: IdlingResource.ResourceCallback?) { - if (callback != null) + if (callback != null) { resourceCallback = callback + } } private fun isOnline(): Boolean { diff --git a/app/src/androidTest/java/org/mozilla/fenix/helpers/matchers/BottomSheetBehaviorMatchers.kt b/app/src/androidTest/java/org/mozilla/fenix/helpers/matchers/BottomSheetBehaviorMatchers.kt index e78088eb68..9a081dc6f6 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/helpers/matchers/BottomSheetBehaviorMatchers.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/helpers/matchers/BottomSheetBehaviorMatchers.kt @@ -28,7 +28,7 @@ class BottomSheetBehaviorHalfExpandedMaxRatioMatcher(private val maxHalfExpanded override fun describeTo(description: Description?) { description?.appendText( "BottomSheetBehavior with an at max halfExpandedRation: " + - "$maxHalfExpandedRatio" + "$maxHalfExpandedRatio", ) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/perf/StartupExcessiveResourceUseTest.kt b/app/src/androidTest/java/org/mozilla/fenix/perf/StartupExcessiveResourceUseTest.kt index 5076301e79..de3c2e12d8 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/perf/StartupExcessiveResourceUseTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/perf/StartupExcessiveResourceUseTest.kt @@ -79,7 +79,7 @@ private val EXPECTED_NUMBER_OF_INFLATION = private val failureMsgStrictMode = getErrorMessage("StrictMode suppression") private val failureMsgRunBlocking = getErrorMessage("runBlockingIncrement") private val failureMsgRecyclerViewConstraintLayoutChildren = getErrorMessage( - "ConstraintLayout being a common direct descendant of a RecyclerView" + "ConstraintLayout being a common direct descendant of a RecyclerView", ) private val failureMsgNumberOfInflation = getErrorMessage("start up inflation") diff --git a/app/src/androidTest/java/org/mozilla/fenix/screenshots/DefaultHomeScreenTest.kt b/app/src/androidTest/java/org/mozilla/fenix/screenshots/DefaultHomeScreenTest.kt index ce6404c901..8f5e632eb9 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/screenshots/DefaultHomeScreenTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/screenshots/DefaultHomeScreenTest.kt @@ -26,6 +26,7 @@ class DefaultHomeScreenTest : ScreenshotTest() { @Rule @JvmField val localeTestRule = LocaleTestRule() + @get:Rule var mActivityTestRule: ActivityTestRule = HomeActivityTestRule() diff --git a/app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt b/app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt index a77deef737..f35fe33d70 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/syncintegration/SyncIntegrationTest.kt @@ -177,7 +177,7 @@ class SyncIntegrationTest { val emailInput = mDevice.findObject( UiSelector() .instance(0) - .className(EditText::class.java) + .className(EditText::class.java), ) emailInput.waitForExists(TestAssetHelper.waitingTime) @@ -194,7 +194,7 @@ class SyncIntegrationTest { val passwordInput = mDevice.findObject( UiSelector() .instance(0) - .className(EditText::class.java) + .className(EditText::class.java), ) val passwordValue = javaClass.classLoader!!.getResource("password.txt").readText() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt index cf89659baf..11f08e7225 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt @@ -89,7 +89,7 @@ class BookmarksTest { bookmarksListIdlingResource = RecyclerViewIdlingResource( activityTestRule.activity.findViewById(R.id.bookmark_list), - 1 + 1, ) IdlingRegistry.getInstance().register(bookmarksListIdlingResource!!) @@ -642,7 +642,6 @@ class BookmarksTest { @SmokeTest @Test fun undoDeleteBookmarkFolderTest() { - browserScreen { }.openThreeDotMenu { }.openBookmarks { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/CollectionTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/CollectionTest.kt index 120736cf3b..d2fc9d0c5a 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/CollectionTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/CollectionTest.kt @@ -40,7 +40,7 @@ class CollectionTest { @get:Rule val composeTestRule = AndroidComposeTestRule( HomeActivityIntentTestRule(), - { it.activity } + { it.activity }, ) @Before @@ -168,7 +168,7 @@ class CollectionTest { createCollection( firstTestPage.title, secondTestPage.title, - collectionName = collectionName + collectionName = collectionName, ) closeTab() } @@ -324,8 +324,9 @@ class CollectionTest { createCollection(webPage.title, collectionName = firstCollectionName) verifySnackBarText("Collection saved!") createCollection( - webPage.title, collectionName = secondCollectionName, - firstCollection = false + webPage.title, + collectionName = secondCollectionName, + firstCollection = false, ) verifySnackBarText("Collection saved!") }.closeTabDrawer { @@ -369,7 +370,7 @@ class CollectionTest { }.openTabDrawer { createCollection( testPage.title, - collectionName = collectionName + collectionName = collectionName, ) closeTab() } @@ -396,7 +397,7 @@ class CollectionTest { }.openTabDrawer { createCollection( testPage.title, - collectionName = collectionName + collectionName = collectionName, ) closeTab() } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/CrashReportingTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/CrashReportingTest.kt index 5d1635dd69..a8b690302d 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/CrashReportingTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/CrashReportingTest.kt @@ -28,7 +28,7 @@ class CrashReportingTest { @get:Rule val activityTestRule = AndroidComposeTestRule( HomeActivityIntentTestRule(), - { it.activity } + { it.activity }, ) @Before diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/CustomTabsTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/CustomTabsTest.kt index 0b441cf9f9..dbc52ad252 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/CustomTabsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/CustomTabsTest.kt @@ -30,6 +30,7 @@ class CustomTabsTest { private lateinit var mDevice: UiDevice private lateinit var mockWebServer: MockWebServer private val customMenuItem = "TestMenuItem" + /* Updated externalLinks.html to v2.0, changed the hypertext reference to mozilla-mobile.github.io/testapp/downloads for "External link" */ @@ -41,7 +42,9 @@ class CustomTabsTest { @get: Rule val intentReceiverActivityTestRule = ActivityTestRule( - IntentReceiverActivity::class.java, true, false + IntentReceiverActivity::class.java, + true, + false, ) private val featureSettingsHelper = FeatureSettingsHelper() @@ -71,8 +74,8 @@ class CustomTabsTest { intentReceiverActivityTestRule.launchActivity( createCustomTabIntent( externalLinksPWAPage.toUri().toString(), - customMenuItem - ) + customMenuItem, + ), ) customTabScreen { @@ -86,12 +89,11 @@ class CustomTabsTest { @SmokeTest @Test fun customTabsSaveLoginTest() { - intentReceiverActivityTestRule.launchActivity( createCustomTabIntent( loginPage.toUri().toString(), - customMenuItem - ) + customMenuItem, + ), ) customTabScreen { @@ -125,8 +127,8 @@ class CustomTabsTest { intentReceiverActivityTestRule.launchActivity( createCustomTabIntent( customTabPage.url.toString(), - customMenuItem - ) + customMenuItem, + ), ) customTabScreen { @@ -155,8 +157,8 @@ class CustomTabsTest { intentReceiverActivityTestRule.launchActivity( createCustomTabIntent( customTabPage.url.toString(), - customMenuItem - ) + customMenuItem, + ), ) customTabScreen { @@ -179,8 +181,8 @@ class CustomTabsTest { intentReceiverActivityTestRule.launchActivity( createCustomTabIntent( customTabPage.toUri().toString(), - customMenuItem - ) + customMenuItem, + ), ) customTabScreen { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadFileTypesTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadFileTypesTest.kt index 576c19ee4c..d5c4f9388b 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadFileTypesTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadFileTypesTest.kt @@ -44,7 +44,7 @@ class DownloadFileTypesTest(fileName: String) { "web_icon.png", "videoSample.webm", "CSVfile.csv", - "XMLfile.xml" + "XMLfile.xml", ) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt index 460996ad4f..5fde9f0abb 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/DownloadTest.kt @@ -38,6 +38,7 @@ import org.mozilla.fenix.ui.robots.notificationShade class DownloadTest { private lateinit var mDevice: UiDevice private val featureSettingsHelper = FeatureSettingsHelper() + /* Remote test page managed by Mozilla Mobile QA team at https://github.com/mozilla-mobile/testapp */ private val downloadTestPage = "https://storage.googleapis.com/mobile_test_assets/test_app/downloads.html" private var downloadFile: String = "" @@ -45,15 +46,15 @@ class DownloadTest { @get:Rule val activityTestRule = HomeActivityIntentTestRule() - @get: Rule // Making sure to grant storage access for this test running on API 28 + @get: Rule var watcher: TestRule = object : TestWatcher() { override fun starting(description: Description) { if (description.methodName == "pauseResumeCancelDownloadTest") { PermissionRequester().apply { addPermissions( android.Manifest.permission.WRITE_EXTERNAL_STORAGE, - android.Manifest.permission.READ_EXTERNAL_STORAGE + android.Manifest.permission.READ_EXTERNAL_STORAGE, ) requestPermissions() } @@ -166,12 +167,12 @@ class DownloadTest { } } - @SmokeTest - @Test - /* Verifies downloads in the Downloads Menu: + /* Verifies downloads in the Downloads Menu: - downloads appear in the list - deleting a download from device storage, removes it from the Downloads Menu too */ + @SmokeTest + @Test fun manageDownloadsInDownloadsMenuTest() { // a long filename to verify it's correctly displayed on the prompt and in the Downloads menu downloadFile = "tAJwqaWjJsXS8AhzSninBMCfIZbHBGgcc001lx5DIdDwIcfEgQ6vE5Gb5VgAled17DFZ2A7ZDOHA0NpQPHXXFt.svg" diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/HistoryTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/HistoryTest.kt index 01348dca5f..dd785899e6 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/HistoryTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/HistoryTest.kt @@ -92,9 +92,9 @@ class HistoryTest { } } - @Test // Test running on beta/release builds in CI: // caution when making changes to it, so they don't block the builds + @Test fun visitedUrlHistoryTest() { val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/NavigationToolbarTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/NavigationToolbarTest.kt index 83bf82f5cb..bc20381227 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/NavigationToolbarTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/NavigationToolbarTest.kt @@ -98,9 +98,9 @@ class NavigationToolbarTest { } } - @Test // Test running on beta/release builds in CI: // caution when making changes to it, so they don't block the builds + @Test fun visitURLTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/NoNetworkAccessStartupTests.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/NoNetworkAccessStartupTests.kt index 2f29478572..3ac6dd6d06 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/NoNetworkAccessStartupTests.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/NoNetworkAccessStartupTests.kt @@ -46,10 +46,10 @@ class NoNetworkAccessStartupTests { featureSettingsHelper.resetAllFeatureFlags() } - @Test // Test running on beta/release builds in CI: // caution when making changes to it, so they don't block the builds // Based on STR from https://github.com/mozilla-mobile/fenix/issues/16886 + @Test fun noNetworkConnectionStartupTest() { setNetworkEnabled(false) @@ -62,8 +62,8 @@ class NoNetworkAccessStartupTests { } } - @Test // Based on STR from https://github.com/mozilla-mobile/fenix/issues/16886 + @Test fun networkInterruptedFromBrowserToHomeTest() { val url = "example.com" val settings = InstrumentationRegistry.getInstrumentation().targetContext.settings() @@ -113,7 +113,7 @@ class NoNetworkAccessStartupTests { verifyUrl( "firefox.com", "$packageName:id/mozac_browser_toolbar_url_view", - R.id.mozac_browser_toolbar_url_view + R.id.mozac_browser_toolbar_url_view, ) } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/PwaTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/PwaTest.kt index bb165fba78..54d661769e 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/PwaTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/PwaTest.kt @@ -17,6 +17,7 @@ import org.mozilla.fenix.ui.robots.pwaScreen class PwaTest { private val featureSettingsHelper = FeatureSettingsHelper() + /* Updated externalLinks.html to v2.0, changed the hypertext reference to mozilla-mobile.github.io/testapp/downloads for "External link" */ @@ -63,7 +64,6 @@ class PwaTest { @SmokeTest @Test fun emailLinkPWATest() { - navigationToolbar { }.enterURLAndEnterToBrowser(externalLinksPWAPage.toUri()) { waitForPageToLoad() @@ -80,7 +80,6 @@ class PwaTest { @SmokeTest @Test fun telephoneLinkPWATest() { - navigationToolbar { }.enterURLAndEnterToBrowser(externalLinksPWAPage.toUri()) { waitForPageToLoad() @@ -97,7 +96,6 @@ class PwaTest { @SmokeTest @Test fun appLikeExperiencePWATest() { - navigationToolbar { }.enterURLAndEnterToBrowser(externalLinksPWAPage.toUri()) { waitForPageToLoad() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/ReaderViewTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/ReaderViewTest.kt index c4e4ecad5f..c297b03047 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/ReaderViewTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/ReaderViewTest.kt @@ -77,7 +77,7 @@ class ReaderViewTest { readerViewNotification = ViewVisibilityIdlingResource( activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions), - View.VISIBLE + View.VISIBLE, ) IdlingRegistry.getInstance().register(readerViewNotification) @@ -120,7 +120,7 @@ class ReaderViewTest { readerViewNotification = ViewVisibilityIdlingResource( activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions), - View.VISIBLE + View.VISIBLE, ) IdlingRegistry.getInstance().register(readerViewNotification) @@ -158,7 +158,7 @@ class ReaderViewTest { readerViewNotification = ViewVisibilityIdlingResource( activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions), - View.VISIBLE + View.VISIBLE, ) IdlingRegistry.getInstance().register(readerViewNotification) @@ -198,7 +198,7 @@ class ReaderViewTest { readerViewNotification = ViewVisibilityIdlingResource( activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions), - View.VISIBLE + View.VISIBLE, ) IdlingRegistry.getInstance().register(readerViewNotification) @@ -244,7 +244,7 @@ class ReaderViewTest { readerViewNotification = ViewVisibilityIdlingResource( activityIntentTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions), - View.VISIBLE + View.VISIBLE, ) IdlingRegistry.getInstance().register(readerViewNotification) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SearchTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SearchTest.kt index 32ea8a10c8..d855f99569 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SearchTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SearchTest.kt @@ -54,7 +54,7 @@ class SearchTest { @get:Rule val activityTestRule = AndroidComposeTestRule( HomeActivityTestRule(), - { it.activity } + { it.activity }, ) @Before @@ -184,7 +184,7 @@ class SearchTest { val customSearchEngine = createSearchEngine( name = "TestSearchEngine", url = searchString, - icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap + icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap, ) setCustomSearchEngine(customSearchEngine) @@ -219,7 +219,7 @@ class SearchTest { val customSearchEngine = createSearchEngine( name = "TestSearchEngine", url = searchString, - icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap + icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap, ) setCustomSearchEngine(customSearchEngine) @@ -250,7 +250,7 @@ class SearchTest { val customSearchEngine = createSearchEngine( name = "TestSearchEngine", url = searchString, - icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap + icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap, ) setCustomSearchEngine(customSearchEngine) @@ -288,7 +288,7 @@ class SearchTest { val customSearchEngine = createSearchEngine( name = "TestSearchEngine", url = searchString, - icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap + icon = DefaultIconGenerator().generate(appContext, IconRequest(searchString)).bitmap, ) setCustomSearchEngine(customSearchEngine) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt index a692385f6f..5f876df3b7 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt @@ -53,8 +53,8 @@ class SettingsAboutTest { mockWebServer.shutdown() } - @Test // Walks through settings menu and sub-menus to ensure all items are present + @Test fun settingsAboutItemsTest() { // ABOUT homeScreen { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAddonsTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAddonsTest.kt index e814821df3..81ab847c26 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAddonsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAddonsTest.kt @@ -90,7 +90,7 @@ class SettingsAddonsTest { addonsListIdlingResource = RecyclerViewIdlingResource( activityTestRule.activity.findViewById(R.id.add_ons_list), - 1 + 1, ) IdlingRegistry.getInstance().register(addonsListIdlingResource!!) clickInstallAddon(addonName) @@ -119,7 +119,7 @@ class SettingsAddonsTest { }.openDetailedMenuForAddon(addonName) { addonContainerIdlingResource = ViewVisibilityIdlingResource( activityTestRule.activity.findViewById(R.id.addon_container), - View.VISIBLE + View.VISIBLE, ) IdlingRegistry.getInstance().register(addonContainerIdlingResource!!) }.removeAddon { @@ -128,9 +128,9 @@ class SettingsAddonsTest { } } + // Installs uBlock add-on and checks that the app doesn't crash while loading pages with trackers @SmokeTest @Test - // Installs uBlock add-on and checks that the app doesn't crash while loading pages with trackers fun noCrashWithAddonInstalledTest() { // setting ETP to Strict mode to test it works with add-ons activityTestRule.activity.settings().setStrictETP() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAdvancedTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAdvancedTest.kt index ce525f9a59..ed65db6ca5 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAdvancedTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAdvancedTest.kt @@ -54,8 +54,8 @@ class SettingsAdvancedTest { featureSettingsHelper.resetAllFeatureFlags() } - @Test // Walks through settings menu and sub-menus to ensure all items are present + @Test fun settingsAboutItemsTest() { // ADVANCED homeScreen { @@ -71,9 +71,9 @@ class SettingsAdvancedTest { } } + // Assumes Play Store is installed and enabled @SmokeTest @Test - // Assumes Play Store is installed and enabled fun openLinkInAppTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 3) val playStoreUrl = "play.google.com/store/apps/details?id=org.mozilla.fenix" diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt index a8513310a3..b2f64ca32d 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt @@ -180,7 +180,7 @@ class SettingsBasicsTest { "94105", "United States", "555-5555", - "foo@bar.com" + "foo@bar.com", ) }.goBack { }.goBack { @@ -212,7 +212,7 @@ class SettingsBasicsTest { "94105", "United States", "555-5555", - "foo@bar.com" + "foo@bar.com", ) clickManageAddressesButton() clickSavedAddress("Mozilla") @@ -281,7 +281,7 @@ class SettingsBasicsTest { localeListIdlingResource = RecyclerViewIdlingResource( activityIntentTestRule.activity.findViewById(R.id.locale_list), - 2 + 2, ) IdlingRegistry.getInstance().register(localeListIdlingResource) selectLanguage("Romanian") diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsDeveloperToolsTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsDeveloperToolsTest.kt index d4c9a3e1aa..40dc488546 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsDeveloperToolsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsDeveloperToolsTest.kt @@ -44,8 +44,8 @@ class SettingsDeveloperToolsTest { mockWebServer.shutdown() } - @Test // Walks through settings developer tools menu and sub-menus to ensure all items are present + @Test fun settingsDeveloperToolsItemsTest() { homeScreen { }.openThreeDotMenu { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsHomepageTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsHomepageTest.kt index 9fbb4f98af..8e3e60481d 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsHomepageTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsHomepageTest.kt @@ -150,7 +150,7 @@ class SettingsHomepageTest { val wallpapers = listOf( "Wallpaper Item: amethyst", "Wallpaper Item: cerulean", - "Wallpaper Item: sunrise" + "Wallpaper Item: sunrise", ) for (wallpaper in wallpapers) { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt index edcaa467b5..e9eb814fa6 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt @@ -79,8 +79,8 @@ class SettingsPrivacyTest { featureSettingsHelper.resetAllFeatureFlags() } - @Test // Walks through settings privacy menu and sub-menus to ensure all items are present + @Test fun settingsPrivacyItemsTest() { homeScreen { }.openThreeDotMenu { @@ -110,7 +110,6 @@ class SettingsPrivacyTest { verifyEnhancedTrackingProtectionProtectionExceptionsSubMenuItems() }.goBack { }.goBack { - // SITE PERMISSIONS verifySitePermissionsButton() }.openSettingsSubMenuSitePermissions { @@ -122,54 +121,46 @@ class SettingsPrivacyTest { verifyNavigationToolBarHeader("Autoplay") verifySitePermissionsAutoPlaySubMenuItems() }.goBack { - // SITE PERMISSIONS CAMERA }.openCamera { verifyNavigationToolBarHeader("Camera") verifySitePermissionsCommonSubMenuItems() verifyToggleNameToON("3. Toggle Camera to ON") }.goBack { - // SITE PERMISSIONS LOCATION }.openLocation { verifyNavigationToolBarHeader("Location") verifySitePermissionsCommonSubMenuItems() verifyToggleNameToON("3. Toggle Location to ON") }.goBack { - // SITE PERMISSIONS MICROPHONE }.openMicrophone { verifyNavigationToolBarHeader("Microphone") verifySitePermissionsCommonSubMenuItems() verifyToggleNameToON("3. Toggle Microphone to ON") }.goBack { - // SITE PERMISSIONS NOTIFICATION }.openNotification { verifyNavigationToolBarHeader("Notification") verifySitePermissionsNotificationSubMenuItems() }.goBack { - // SITE PERMISSIONS PERSISTENT STORAGE }.openPersistentStorage { verifyNavigationToolBarHeader("Persistent Storage") verifySitePermissionsPersistentStorageSubMenuItems() }.goBack { - // SITE PERMISSIONS EXCEPTIONS }.openExceptions { verifyNavigationToolBarHeader() verifySitePermissionsExceptionSubMenuItems() }.goBack { }.goBack { - // DELETE BROWSING DATA verifyDeleteBrowsingDataButton() }.openSettingsSubMenuDeleteBrowsingData { verifyNavigationToolBarHeader() verifyDeleteBrowsingDataSubMenuItems() }.goBack { - // DELETE BROWSING DATA ON QUIT verifyDeleteBrowsingDataOnQuitButton() verifyDeleteBrowsingDataOnQuitState("Off") @@ -177,13 +168,11 @@ class SettingsPrivacyTest { verifyNavigationToolBarHeader() verifyDeleteBrowsingDataOnQuitSubMenuItems() }.goBack { - // NOTIFICATIONS verifyNotificationsButton() }.openSettingsSubMenuNotifications { verifySystemNotificationsView() }.goBack { - // DATA COLLECTION verifyDataCollectionButton() }.openSettingsSubMenuDataCollection { @@ -455,10 +444,10 @@ class SettingsPrivacyTest { } } + // Verifies that you can go to System settings and change app's permissions from inside the app @SmokeTest @Test @SdkSuppress(minSdkVersion = 29) - // Verifies that you can go to System settings and change app's permissions from inside the app fun redirectToAppPermissionsSystemSettingsTest() { homeScreen { }.openThreeDotMenu { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsSearchTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsSearchTest.kt index 56fbc569ac..935920bf9a 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsSearchTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsSearchTest.kt @@ -24,7 +24,7 @@ class SettingsSearchTest { @get:Rule val activityTestRule = AndroidComposeTestRule( - HomeActivityIntentTestRule() + HomeActivityIntentTestRule(), ) { it.activity } @Before @@ -121,9 +121,9 @@ class SettingsSearchTest { } } + // Ads a new search engine from the list of custom engines @SmokeTest @Test - // Ads a new search engine from the list of custom engines fun addPredefinedSearchEngineTest() { val searchEngine = "Reddit" @@ -147,9 +147,9 @@ class SettingsSearchTest { } } + // Verifies setting as default a customized search engine name and URL @SmokeTest @Test - // Verifies setting as default a customized search engine name and URL fun editCustomSearchEngineTest() { searchMockServer = MockWebServer().apply { dispatcher = SearchDispatcher() @@ -183,14 +183,13 @@ class SettingsSearchTest { } } - @Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/23817") - @SmokeTest - @Test // Test running on beta/release builds in CI: // caution when making changes to it, so they don't block the builds // Goes through the settings and changes the search suggestion toggle, then verifies it changes. + @Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/23817") + @SmokeTest + @Test fun toggleSearchSuggestionsTest() { - homeScreen { }.openSearch { typeSearch("mozilla") diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsSyncTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsSyncTest.kt index 5da875d4ed..24eb93c800 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsSyncTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsSyncTest.kt @@ -43,9 +43,9 @@ class SettingsSyncTest { mockWebServer.shutdown() } + // Walks through settings sync menu and sub-menus to ensure all items are present @Ignore("This is a stub test, ignore for now") @Test - // Walks through settings sync menu and sub-menus to ensure all items are present fun settingsSyncItemsTest() { // SYNC diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsTest.kt index 82169976e2..bf2b1224f2 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsTest.kt @@ -43,9 +43,9 @@ class SettingsTest { mockWebServer.shutdown() } + // Walks through settings menu and sub-menus to ensure all items are present @Ignore("This is a stub test, ignore for now") @Test - // Walks through settings menu and sub-menus to ensure all items are present fun settingsMenusItemsTest() { // SYNC diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SitePermissionsTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SitePermissionsTest.kt index 2e3ff83c6c..29f24381d9 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SitePermissionsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SitePermissionsTest.kt @@ -45,7 +45,7 @@ class SitePermissionsTest { val grantPermissionRule: GrantPermissionRule = GrantPermissionRule.grant( Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA, - Manifest.permission.ACCESS_COARSE_LOCATION + Manifest.permission.ACCESS_COARSE_LOCATION, ) @get: Rule diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt index 227c40cbba..c03f566e4a 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt @@ -72,12 +72,14 @@ class SmokeTest { @get:Rule val activityTestRule = AndroidComposeTestRule( HomeActivityIntentTestRule(), - { it.activity } + { it.activity }, ) @get: Rule val intentReceiverActivityTestRule = ActivityTestRule( - IntentReceiverActivity::class.java, true, false + IntentReceiverActivity::class.java, + true, + false, ) @Rule @@ -171,8 +173,8 @@ class SmokeTest { } } - @Test // Verifies the functionality of the onboarding Start Browsing button + @Test fun startBrowsingButtonTest() { homeScreen { verifyStartBrowsingButton() @@ -209,9 +211,9 @@ class SmokeTest { } } + // Verifies the list of items in a tab's 3 dot menu @Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/26711") @Test - // Verifies the list of items in a tab's 3 dot menu fun verifyPageMainMenuItemsTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -223,8 +225,8 @@ class SmokeTest { } // Could be removed when more smoke tests from the History category are added - @Test // Verifies the History menu opens from a tab's 3 dot menu + @Test fun openMainMenuHistoryItemTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -237,8 +239,8 @@ class SmokeTest { } // Could be removed when more smoke tests from the Bookmarks category are added - @Test // Verifies the Bookmarks menu opens from a tab's 3 dot menu + @Test fun openMainMenuBookmarksItemTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -250,8 +252,8 @@ class SmokeTest { } } - @Test // Verifies the Add-ons menu opens from a tab's 3 dot menu + @Test fun openMainMenuAddonsTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -262,7 +264,7 @@ class SmokeTest { addonsListIdlingResource = RecyclerViewIdlingResource( activityTestRule.activity.findViewById(R.id.add_ons_list), - 1 + 1, ) IdlingRegistry.getInstance().register(addonsListIdlingResource!!) verifyAddonsItems() @@ -270,9 +272,9 @@ class SmokeTest { } } - @Test // Verifies the Synced tabs menu or Sync Sign In menu opens from a tab's 3 dot menu. // The test is assuming we are NOT signed in. + @Test fun openMainMenuSyncItemTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -285,10 +287,10 @@ class SmokeTest { } } - @Test // Test running on beta/release builds in CI: // caution when making changes to it, so they don't block the builds // Verifies the Settings menu opens from a tab's 3 dot menu + @Test fun openMainMenuSettingsItemTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -300,8 +302,8 @@ class SmokeTest { } } - @Test // Verifies the Find in page option in a tab's 3 dot menu + @Test fun openMainMenuFindInPageTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -313,8 +315,8 @@ class SmokeTest { } } - @Test // Verifies the Add to home screen option in a tab's 3 dot menu + @Test fun mainMenuAddToHomeScreenTest() { val website = TestAssetHelper.getGenericAsset(mockWebServer, 1) val shortcutTitle = generateRandomString(5) @@ -342,8 +344,8 @@ class SmokeTest { } } - @Test // Verifies the Add to collection option in a tab's 3 dot menu + @Test fun openMainMenuAddToCollectionTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -355,8 +357,8 @@ class SmokeTest { } } - @Test // Verifies the Bookmark button in a tab's 3 dot menu + @Test fun mainMenuBookmarkButtonTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -368,10 +370,10 @@ class SmokeTest { } } - @Ignore("Failing with frequent ANR: https://github.com/mozilla-mobile/fenix/issues/25926") - @Test // Device or AVD requires a Google Services Android OS installation with Play Store installed // Verifies the Open in app button when an app is installed + @Ignore("Failing with frequent ANR: https://github.com/mozilla-mobile/fenix/issues/25926") + @Test fun mainMenuOpenInAppTest() { val playStoreUrl = "play.google.com/store/apps/details?id=org.mozilla.fenix" @@ -384,8 +386,8 @@ class SmokeTest { } } - @Test // Verifies the Desktop site toggle in a tab's 3 dot menu + @Test fun mainMenuDesktopSiteTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -398,8 +400,8 @@ class SmokeTest { } } - @Test // Verifies the Share button in a tab's 3 dot menu + @Test fun mainMenuShareButtonTest() { val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -413,8 +415,8 @@ class SmokeTest { } } - @Test // Verifies the refresh button in a tab's 3 dot menu + @Test fun mainMenuRefreshButtonTest() { val refreshWebPage = TestAssetHelper.getRefreshAsset(mockWebServer) @@ -460,8 +462,8 @@ class SmokeTest { } } - @Test // Verifies changing the default engine from the Search Shortcut menu + @Test fun selectSearchEnginesShortcutTest() { val enginesList = listOf("DuckDuckGo", "Google", "Amazon.com", "Wikipedia", "Bing", "eBay") @@ -479,8 +481,8 @@ class SmokeTest { } } - @Test // Swipes the nav bar left/right to switch between tabs + @Test fun swipeToSwitchTabTest() { val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2) @@ -497,8 +499,8 @@ class SmokeTest { } } - @Test // Saves a login, then changes it and verifies the update + @Test fun updateSavedLoginTest() { val saveLoginTest = TestAssetHelper.getSaveLoginAsset(mockWebServer) @@ -579,8 +581,8 @@ class SmokeTest { } } - @Test // Verifies that deleting a Bookmarks folder also removes the item from inside it. + @Test fun deleteNonEmptyBookmarkFolderTest() { val website = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -651,8 +653,9 @@ class SmokeTest { }.clickShareAllTabsButton { verifyShareTabsOverlay(firstWebsiteTitle, secondWebsiteTitle) verifySharingWithSelectedApp( - sharingApp, sharedUrlsString, - "$firstWebsiteTitle, $secondWebsiteTitle" + sharingApp, + sharedUrlsString, + "$firstWebsiteTitle, $secondWebsiteTitle", ) } } @@ -698,9 +701,9 @@ class SmokeTest { } } - @Test // Test running on beta/release builds in CI: // caution when making changes to it, so they don't block the builds + @Test fun noHistoryInPrivateBrowsingTest() { FeatureSettingsHelper().setTCPCFREnabled(false) val website = TestAssetHelper.getGenericAsset(mockWebServer, 1) @@ -753,8 +756,8 @@ class SmokeTest { } } - @Test // Verifies that reader mode is detected and the custom appearance controls are displayed + @Test fun verifyReaderViewAppearanceUI() { val readerViewPage = TestAssetHelper.getLoremIpsumAsset(mockWebServer) @@ -767,7 +770,7 @@ class SmokeTest { readerViewNotification = ViewVisibilityIdlingResource( activityTestRule.activity.findViewById(R.id.mozac_browser_toolbar_page_actions), - View.VISIBLE + View.VISIBLE, ) IdlingRegistry.getInstance().register(readerViewNotification) @@ -795,16 +798,16 @@ class SmokeTest { } } - @Test // Verifies the main menu of a custom tab with a custom menu item + @Test fun customTabMenuItemsTest() { val customTabPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) intentReceiverActivityTestRule.launchActivity( createCustomTabIntent( customTabPage.url.toString(), - customMenuItem - ) + customMenuItem, + ), ) customTabScreen { @@ -821,15 +824,15 @@ class SmokeTest { } } - @Test // The test opens a link in a custom tab then sends it to the browser + @Test fun openCustomTabInBrowserTest() { val customTabPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) intentReceiverActivityTestRule.launchActivity( createCustomTabIntent( - customTabPage.url.toString() - ) + customTabPage.url.toString(), + ), ) customTabScreen { @@ -893,9 +896,9 @@ class SmokeTest { } } - @Test // For API>23 // Verifies the default browser switch opens the system default apps menu. + @Test fun changeDefaultBrowserSetting() { homeScreen { }.openThreeDotMenu { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt index c46049f31b..0f363ccef5 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/TabbedBrowsingTest.kt @@ -287,7 +287,6 @@ class TabbedBrowsingTest { @Test fun verifyTabTrayNotShowingStateHalfExpanded() { - navigationToolbar { }.openTabTray { verifyNoOpenTabsInNormalBrowsing() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/TopSitesTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/TopSitesTest.kt index ab32f22f3a..f811d1eb60 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/TopSitesTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/TopSitesTest.kt @@ -203,7 +203,7 @@ class TopSitesTest { val defaultTopSites = arrayOf( "Top Articles", "Wikipedia", - "Google" + "Google", ) homeScreen { }.dismissOnboarding() @@ -245,7 +245,6 @@ class TopSitesTest { @SmokeTest @Test fun verifySponsoredShortcutsListTest() { - homeScreen { }.openThreeDotMenu { }.openCustomizeHome { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/AccountSettingsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/AccountSettingsRobot.kt index f54c4cb789..32918b2c29 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/AccountSettingsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/AccountSettingsRobot.kt @@ -50,17 +50,17 @@ private fun disconnectButton() = Espresso.onView(CoreMatchers.allOf(ViewMatchers private fun assertBookmarksCheckbox() = bookmarksCheckbox().check( ViewAssertions.matches( ViewMatchers.withEffectiveVisibility( - ViewMatchers.Visibility.VISIBLE - ) - ) + ViewMatchers.Visibility.VISIBLE, + ), + ), ) private fun assertHistoryCheckbox() = historyCheckbox().check( ViewAssertions.matches( ViewMatchers.withEffectiveVisibility( - ViewMatchers.Visibility.VISIBLE - ) - ) + ViewMatchers.Visibility.VISIBLE, + ), + ), ) private fun assertSignOutButton() = signOutButton().check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/AddToHomeScreenRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/AddToHomeScreenRobot.kt index b80a3ec596..a79e0de65f 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/AddToHomeScreenRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/AddToHomeScreenRobot.kt @@ -55,10 +55,10 @@ class AddToHomeScreenRobot { mDevice.wait( Until.findObject( By.text( - Pattern.compile("Add Automatically", Pattern.CASE_INSENSITIVE) - ) + Pattern.compile("Add Automatically", Pattern.CASE_INSENSITIVE), + ), ), - waitingTime + waitingTime, ) addAutomaticallyButton().click() } @@ -67,7 +67,7 @@ class AddToHomeScreenRobot { fun verifyShortcutAdded(shortcutTitle: String) { assertTrue( mDevice.findObject(UiSelector().text(shortcutTitle)) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) } @@ -75,7 +75,7 @@ class AddToHomeScreenRobot { fun openHomeScreenShortcut(title: String, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { mDevice.wait( Until.findObject(By.text(title)), - waitingTime + waitingTime, ) mDevice.findObject((UiSelector().text(title))).clickAndWaitForNewWindow(waitingTime) @@ -112,8 +112,8 @@ private fun assertShortcutNameField(expectedText: String) { onView( allOf( withId(R.id.shortcut_text), - withText(expectedText) - ) + withText(expectedText), + ), ) .check(matches(isCompletelyDisplayed())) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BookmarksRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BookmarksRobot.kt index 2ea505d806..0b4a6d0431 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BookmarksRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BookmarksRobot.kt @@ -46,7 +46,7 @@ class BookmarksRobot { fun verifyBookmarksMenuView() { mDevice.findObject( - UiSelector().text("Bookmarks") + UiSelector().text("Bookmarks"), ).waitForExists(waitingTime) assertBookmarksView() @@ -83,7 +83,7 @@ class BookmarksRobot { fun verifySnackBarHidden() { mDevice.waitNotNull( Until.gone(By.text("UNDO")), - TestAssetHelper.waitingTime + TestAssetHelper.waitingTime, ) onView(withId(R.id.snackbar_layout)).check(doesNotExist()) } @@ -115,15 +115,15 @@ class BookmarksRobot { fun verifyCurrentFolderTitle(title: String) { mDevice.findObject( UiSelector().resourceId("$packageName:id/navigationToolbar") - .textContains(title) + .textContains(title), ) .waitForExists(waitingTime) onView( allOf( withText(title), - withParent(withId(R.id.navigationToolbar)) - ) + withParent(withId(R.id.navigationToolbar)), + ), ) .check(matches(isDisplayed())) } @@ -131,7 +131,7 @@ class BookmarksRobot { fun waitForBookmarksFolderContentToExist(parentFolderName: String, childFolderName: String) { mDevice.findObject( UiSelector().resourceId("$packageName:id/navigationToolbar") - .textContains(parentFolderName) + .textContains(parentFolderName), ) .waitForExists(waitingTime) @@ -159,7 +159,7 @@ class BookmarksRobot { fun clickAddFolderButton() { mDevice.waitNotNull( Until.findObject(By.desc("Add folder")), - TestAssetHelper.waitingTime + TestAssetHelper.waitingTime, ) addFolderButton().click() } @@ -266,10 +266,10 @@ private fun bookmarkFavicon(url: String) = onView( withId(R.id.favicon), withParent( withParent( - withChild(allOf(withId(R.id.url), withText(url))) - ) - ) - ) + withChild(allOf(withId(R.id.url), withText(url))), + ), + ), + ), ) private fun bookmarkURL(url: String) = onView(allOf(withId(R.id.url), withText(containsString(url)))) @@ -283,15 +283,15 @@ private fun saveFolderButton() = onView(withId(R.id.confirm_add_folder_button)) private fun threeDotMenu(bookmarkUrl: Uri) = onView( allOf( withId(R.id.overflow_menu), - withParent(withChild(allOf(withId(R.id.url), withText(bookmarkUrl.toString())))) - ) + withParent(withChild(allOf(withId(R.id.url), withText(bookmarkUrl.toString())))), + ), ) private fun threeDotMenu(bookmarkTitle: String) = onView( allOf( withId(R.id.overflow_menu), - withParent(withChild(allOf(withId(R.id.title), withText(bookmarkTitle)))) - ) + withParent(withChild(allOf(withId(R.id.title), withText(bookmarkTitle)))), + ), ) private fun snackBarText() = onView(withId(R.id.snackbar_text)) @@ -314,8 +314,8 @@ private fun assertBookmarksView() { onView( allOf( withText("Bookmarks"), - withParent(withId(R.id.navigationToolbar)) - ) + withParent(withId(R.id.navigationToolbar)), + ), ) .check(matches(isDisplayed())) } @@ -331,23 +331,23 @@ private fun assertEmptyBookmarksList() = private fun assertBookmarkFolderIsNotCreated(title: String) { mDevice.findObject( UiSelector() - .resourceId("$packageName:id/bookmarks_wrapper") + .resourceId("$packageName:id/bookmarks_wrapper"), ).waitForExists(waitingTime) assertFalse( mDevice.findObject( UiSelector() - .textContains(title) - ).waitForExists(waitingTime) + .textContains(title), + ).waitForExists(waitingTime), ) } private fun assertBookmarkFavicon(forUrl: Uri) = bookmarkFavicon(forUrl.toString()).check( matches( withEffectiveVisibility( - ViewMatchers.Visibility.VISIBLE - ) - ) + ViewMatchers.Visibility.VISIBLE, + ), + ), ) private fun assertBookmarkURL(expectedURL: String) = @@ -362,15 +362,15 @@ private fun assertBookmarkTitle(expectedTitle: String) = private fun assertBookmarkIsDeleted(expectedTitle: String) { mDevice.findObject( UiSelector() - .resourceId("$packageName:id/bookmarks_wrapper") + .resourceId("$packageName:id/bookmarks_wrapper"), ).waitForExists(waitingTime) assertFalse( mDevice.findObject( UiSelector() .resourceId("$packageName:id/title") - .textContains(expectedTitle) - ).waitForExists(waitingTime) + .textContains(expectedTitle), + ).waitForExists(waitingTime), ) } private fun assertUndoDeleteSnackBarButton() = @@ -399,7 +399,7 @@ private fun assertKeyboardVisibility(isExpectedToBeVisible: Boolean) = isExpectedToBeVisible, mDevice .executeShellCommand("dumpsys input_method | grep mInputShown") - .contains("mInputShown=true") + .contains("mInputShown=true"), ) private fun assertShareOverlay() = diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt index 2c782531ef..2c41c2e47e 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt @@ -67,8 +67,8 @@ class BrowserRobot { mDevice.findObject( UiSelector() .resourceId("$packageName:id/mozac_browser_toolbar_url_view") - .textContains(url.replace("http://", "")) - ).waitForExists(waitingTime) + .textContains(url.replace("http://", "")), + ).waitForExists(waitingTime), ) } } @@ -95,13 +95,13 @@ class BrowserRobot { mDevice.waitNotNull( Until.findObject(By.res("$packageName:id/engineView")), - waitingTime + waitingTime, ) runWithIdleRes(sessionLoadedIdlingResource) { assertTrue( "Page didn't load or doesn't contain the expected text", - mDevice.findObject(UiSelector().textContains(expectedText)).waitForExists(waitingTime) + mDevice.findObject(UiSelector().textContains(expectedText)).waitForExists(waitingTime), ) } } @@ -115,21 +115,21 @@ class BrowserRobot { memorySection.getFromParent( UiSelector() .className("android.widget.GridView") - .index(2) + .index(2), ) } else { memorySection.getFromParent( UiSelector() .className("android.widget.GridView") - .index(4) + .index(4), ) } val cacheSizeInfo = gridView.getChild( - UiSelector().text("Number of entries:") + UiSelector().text("Number of entries:"), ).getFromParent( - UiSelector().text("0") + UiSelector().text("0"), ) for (i in 1..RETRY_COUNT) { @@ -149,7 +149,7 @@ class BrowserRobot { mDevice.findObject( UiSelector() .resourceId("$packageName:id/counter_text") - .text(expectedText) + .text(expectedText), ) assertTrue(counter.waitForExists(waitingTime)) } @@ -160,23 +160,23 @@ class BrowserRobot { assertTrue( mDevice.findObject( UiSelector() - .textContains(expectedText) - ).waitForExists(waitingTime) + .textContains(expectedText), + ).waitForExists(waitingTime), ) } fun verifyLinkContextMenuItems(containsURL: Uri) { mDevice.waitNotNull( Until.findObject(By.textContains(containsURL.toString())), - waitingTime + waitingTime, ) mDevice.waitNotNull( Until.findObject(text("Open link in new tab")), - waitingTime + waitingTime, ) mDevice.waitNotNull( Until.findObject(text("Open link in private tab")), - waitingTime + waitingTime, ) mDevice.waitNotNull(Until.findObject(text("Copy link")), waitingTime) mDevice.waitNotNull(Until.findObject(text("Share link")), waitingTime) @@ -185,19 +185,23 @@ class BrowserRobot { fun verifyLinkImageContextMenuItems(containsURL: Uri) { mDevice.waitNotNull(Until.findObject(By.textContains(containsURL.toString()))) mDevice.waitNotNull( - Until.findObject(text("Open link in new tab")), waitingTime + Until.findObject(text("Open link in new tab")), + waitingTime, ) mDevice.waitNotNull( - Until.findObject(text("Open link in private tab")), waitingTime + Until.findObject(text("Open link in private tab")), + waitingTime, ) mDevice.waitNotNull(Until.findObject(text("Copy link")), waitingTime) mDevice.waitNotNull(Until.findObject(text("Share link")), waitingTime) mDevice.waitNotNull( - Until.findObject(text("Open image in new tab")), waitingTime + Until.findObject(text("Open image in new tab")), + waitingTime, ) mDevice.waitNotNull(Until.findObject(text("Save image")), waitingTime) mDevice.waitNotNull( - Until.findObject(text("Copy image location")), waitingTime + Until.findObject(text("Copy image location")), + waitingTime, ) } @@ -220,18 +224,19 @@ class BrowserRobot { mDevice.waitNotNull(Until.findObject(By.textContains(containsURL.toString()))) mDevice.waitNotNull( Until.findObject(text("Open image in new tab")), - waitingTime + waitingTime, ) mDevice.waitNotNull(Until.findObject(text("Save image")), waitingTime) mDevice.waitNotNull( - Until.findObject(text("Copy image location")), waitingTime + Until.findObject(text("Copy image location")), + waitingTime, ) } fun verifyNotificationDotOnMainMenu() { assertTrue( mDevice.findObject(UiSelector().resourceId("$packageName:id/notification_dot")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) } @@ -249,7 +254,7 @@ class BrowserRobot { fun clickContextOpenLinkInNewTab() { mDevice.waitNotNull( Until.findObject(text("Open link in new tab")), - waitingTime + waitingTime, ) val menuOpenInNewTab = mDevice.findObject(text("Open link in new tab")) @@ -259,7 +264,7 @@ class BrowserRobot { fun clickContextOpenLinkInPrivateTab() { mDevice.waitNotNull( Until.findObject(text("Open link in private tab")), - waitingTime + waitingTime, ) val menuOpenInPrivateTab = mDevice.findObject(text("Open link in private tab")) @@ -292,20 +297,20 @@ class BrowserRobot { IntentMatchers.hasType("text/plain"), IntentMatchers.hasExtra( Intent.EXTRA_TEXT, - url.toString() - ) - ) - ) - ) - ) - ) + url.toString(), + ), + ), + ), + ), + ), + ), ) } fun clickContextCopyImageLocation() { mDevice.waitNotNull( Until.findObject(text("Copy image location")), - waitingTime + waitingTime, ) val menuCopyImageLocation = mDevice.findObject(text("Copy image location")) @@ -315,7 +320,7 @@ class BrowserRobot { fun clickContextOpenImageNewTab() { mDevice.waitNotNull( Until.findObject(text("Open image in new tab")), - waitingTime + waitingTime, ) val menuOpenImageNewTab = mDevice.findObject(text("Open image in new tab")) @@ -463,7 +468,7 @@ class BrowserRobot { val switchButton = mDevice.findObject( UiSelector() - .resourceId("$packageName:id/snackbar_btn") + .resourceId("$packageName:id/snackbar_btn"), ) switchButton.waitForExists(waitingTime) switchButton.clickAndWaitForNewWindow(waitingTime) @@ -487,8 +492,8 @@ class BrowserRobot { fun saveLoginFromPrompt(optionToSaveLogin: String) { mDevice.waitForObjects( mDevice.findObject( - UiSelector().resourceId("$packageName:id/feature_prompt_login_fragment") - ) + UiSelector().resourceId("$packageName:id/feature_prompt_login_fragment"), + ), ) mDevice.findObject(text(optionToSaveLogin)).click() } @@ -497,14 +502,14 @@ class BrowserRobot { val passwordField = mDevice.findObject( UiSelector() .resourceId("password") - .className(EditText::class.java) + .className(EditText::class.java), ) try { passwordField.waitForExists(waitingTime) mDevice.findObject( By .res("password") - .clazz(EditText::class.java) + .clazz(EditText::class.java), ).click() passwordField.clearTextField() passwordField.text = password @@ -524,7 +529,7 @@ class BrowserRobot { mDevice.findObject( By .res("password") - .clazz(EditText::class.java) + .clazz(EditText::class.java), ).click() passwordField.clearTextField() passwordField.text = password @@ -592,7 +597,7 @@ class BrowserRobot { fun clickTabCrashedRestoreButton() { assertTrue( mDevice.findObject(UiSelector().resourceId("$packageName:id/restoreTabButton")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) val tabCrashRestoreButton = mDevice.findObject(UiSelector().resourceIdMatches("$packageName:id/restoreTabButton")) @@ -662,7 +667,7 @@ class BrowserRobot { mDevice.findObject( UiSelector() .textContains(userName) - .resourceId("$packageName:id/username") + .resourceId("$packageName:id/username"), ) loginSuggestion.click() @@ -681,11 +686,11 @@ class BrowserRobot { fun verifySuggestedUserName(userName: String) { mDevice.findObject( UiSelector() - .resourceId("$packageName:id/mozac_feature_login_multiselect_expand") + .resourceId("$packageName:id/mozac_feature_login_multiselect_expand"), ).waitForExists(waitingTime) assertTrue( - mDevice.findObject(UiSelector().textContains(userName)).waitForExists(waitingTime) + mDevice.findObject(UiSelector().textContains(userName)).waitForExists(waitingTime), ) } @@ -744,8 +749,8 @@ class BrowserRobot { assertTrue( mDevice.findObject( UiSelector() - .resourceId("$packageName:id/feature_prompt_login_fragment") - ).waitForExists(waitingTime) + .resourceId("$packageName:id/feature_prompt_login_fragment"), + ).waitForExists(waitingTime), ) } @@ -754,8 +759,8 @@ class BrowserRobot { try { assertTrue( mDevice.findObject( - UiSelector().textContains(state) - ).waitForExists(waitingTimeLong) + UiSelector().textContains(state), + ).waitForExists(waitingTimeLong), ) break @@ -784,9 +789,9 @@ class BrowserRobot { private fun threeDotButton() = onView( allOf( ViewMatchers.withContentDescription( - "Menu" - ) - ) + "Menu", + ), + ), ) fun openThreeDotMenu(interact: ThreeDotMenuMainRobot.() -> Unit): ThreeDotMenuMainRobot.Transition { @@ -808,7 +813,7 @@ class BrowserRobot { fun openTabDrawer(interact: TabDrawerRobot.() -> Unit): TabDrawerRobot.Transition { mDevice.findObject( - UiSelector().descriptionContains("Tap to switch tabs.") + UiSelector().descriptionContains("Tap to switch tabs."), ).waitForExists(waitingTime) tabsCounter().click() @@ -836,7 +841,7 @@ class BrowserRobot { fun goToHomescreen(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition { assertTrue( mDevice.findObject(UiSelector().description("Home screen")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) onView(withContentDescription("Home screen")) @@ -845,7 +850,7 @@ class BrowserRobot { assertTrue( mDevice.findObject(UiSelector().resourceId("$packageName:id/homeLayout")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) HomeScreenRobot().interact() @@ -862,7 +867,7 @@ class BrowserRobot { fun clickTabCrashedCloseButton(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition { assertTrue( mDevice.findObject(UiSelector().resourceId("$packageName:id/closeTabButton")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) val tabCrashedCloseButton = mDevice.findObject(text("Close tab")) @@ -887,7 +892,7 @@ class BrowserRobot { assertTrue( "$title download link not found", - downloadLink.waitForExists(waitingTime) + downloadLink.waitForExists(waitingTime), ) downloadLink.click() @@ -981,12 +986,12 @@ private fun mediaPlayerPlayButton() = mDevice.findObject( UiSelector() .className("android.widget.Button") - .text("Play") + .text("Play"), ) private var progressBar = mDevice.findObject( - UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_progress") + UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_progress"), ) private val suggestedLogins = mDevice.findObject(UiSelector().resourceId("$packageName:id/loginSelectBar")) @@ -997,7 +1002,7 @@ private fun addressSuggestion(streetName: String) = mDevice.findObject( UiSelector() .resourceId("$packageName:id/address_name") - .textContains(streetName) + .textContains(streetName), ) private fun streetAddressTextBox(streetAddress: String = "") = @@ -1006,7 +1011,7 @@ private fun streetAddressTextBox(streetAddress: String = "") = .resourceId("streetAddress") .textContains(streetAddress) .className("android.widget.EditText") - .packageName("$packageName") + .packageName("$packageName"), ) private fun creditCardNumberTextBox(creditCardNumber: String = "") = @@ -1015,14 +1020,14 @@ private fun creditCardNumberTextBox(creditCardNumber: String = "") = .resourceId("cardNumber") .textContains(creditCardNumber) .className("android.widget.EditText") - .packageName("$packageName") + .packageName("$packageName"), ) private fun creditCardSuggestion(creditCardNumber: String) = mDevice.findObject( UiSelector() .resourceId("$packageName:id/credit_card_number") - .textContains(creditCardNumber) + .textContains(creditCardNumber), ) // Permissions test page elements & prompts @@ -1044,7 +1049,7 @@ val userNameTextBox = UiSelector() .resourceId("username") .className("android.widget.EditText") - .packageName("$packageName") + .packageName("$packageName"), ) private val submitLoginButton = @@ -1053,7 +1058,7 @@ private val submitLoginButton = .resourceId("submit") .textContains("Submit Query") .className("android.widget.Button") - .packageName("$packageName") + .packageName("$packageName"), ) val passwordTextBox = @@ -1061,5 +1066,5 @@ val passwordTextBox = UiSelector() .resourceId("password") .className("android.widget.EditText") - .packageName("$packageName") + .packageName("$packageName"), ) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/CollectionRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/CollectionRobot.kt index 4218131671..b6a993c7fe 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/CollectionRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/CollectionRobot.kt @@ -34,15 +34,15 @@ class CollectionRobot { fun verifySelectCollectionScreen() { assertTrue( mDevice.findObject(UiSelector().text("Select collection")) - .exists() + .exists(), ) assertTrue( mDevice.findObject(UiSelector().resourceId("$packageName:id/collections_list")) - .exists() + .exists(), ) assertTrue( mDevice.findObject(UiSelector().text("Add new collection")) - .exists() + .exists(), ) } @@ -50,7 +50,7 @@ class CollectionRobot { fun verifyCollectionNameTextField() { assertTrue( - mainMenuEditCollectionNameField().waitForExists(waitingTime) + mainMenuEditCollectionNameField().waitForExists(waitingTime), ) } @@ -79,12 +79,13 @@ class CollectionRobot { if (visible) { scrollToElementByText(title) assertTrue( - collectionListItem(title).waitForExists(waitingTime) + collectionListItem(title).waitForExists(waitingTime), ) - } else + } else { assertTrue( - collectionListItem(title).waitUntilGone(waitingTime) + collectionListItem(title).waitUntilGone(waitingTime), ) + } } fun verifyCollectionTabUrl(visible: Boolean, url: String) { @@ -152,11 +153,11 @@ class CollectionRobot { fun verifyCollectionItemRemoveButtonIsVisible(title: String, visible: Boolean) { if (visible) { assertTrue( - removeTabFromCollectionButton(title).exists() + removeTabFromCollectionButton(title).exists(), ) } else { assertFalse( - removeTabFromCollectionButton(title).exists() + removeTabFromCollectionButton(title).exists(), ) } } @@ -183,13 +184,13 @@ class CollectionRobot { fun swipeToBottom() = UiScrollable( - UiSelector().resourceId("$packageName:id/sessionControlRecyclerView") + UiSelector().resourceId("$packageName:id/sessionControlRecyclerView"), ).scrollToEnd(3) class Transition { fun collapseCollection( title: String, - interact: HomeScreenRobot.() -> Unit + interact: HomeScreenRobot.() -> Unit, ): HomeScreenRobot.Transition { try { collectionTitle(title).waitForExists(waitingTime) @@ -206,7 +207,7 @@ class CollectionRobot { // names a collection saved from the 3dot menu fun typeCollectionNameAndSave( name: String, - interact: BrowserRobot.() -> Unit + interact: BrowserRobot.() -> Unit, ): BrowserRobot.Transition { mainMenuEditCollectionNameField().waitForExists(waitingTime) mainMenuEditCollectionNameField().text = name @@ -221,7 +222,7 @@ class CollectionRobot { fun selectExistingCollection( title: String, - interact: BrowserRobot.() -> Unit + interact: BrowserRobot.() -> Unit, ): BrowserRobot.Transition { collectionTitle(title).waitForExists(waitingTime) collectionTitle(title).click() @@ -248,7 +249,7 @@ fun collectionRobot(interact: CollectionRobot.() -> Unit): CollectionRobot.Trans private fun collectionTitle(title: String) = mDevice.findObject( UiSelector() - .text(title) + .text(title), ) private fun collectionThreeDotButton(rule: ComposeTestRule) = @@ -258,27 +259,27 @@ private fun collectionListItem(title: String) = mDevice.findObject(UiSelector(). private fun shareCollectionButton() = mDevice.findObject( - UiSelector().description("Share") + UiSelector().description("Share"), ) private fun removeTabFromCollectionButton(title: String) = mDevice.findObject( - UiSelector().text(title) + UiSelector().text(title), ).getFromParent( UiSelector() - .description("Remove tab from collection") + .description("Remove tab from collection"), ) // collection name text field, opened from tab drawer private fun collectionNameTextField() = mDevice.findObject( - UiSelector().resourceId("$packageName:id/collection_name") + UiSelector().resourceId("$packageName:id/collection_name"), ) // collection name text field, when saving from the main menu option private fun mainMenuEditCollectionNameField() = mDevice.findObject( - UiSelector().resourceId("$packageName:id/name_collection_edittext") + UiSelector().resourceId("$packageName:id/name_collection_edittext"), ) private fun addNewCollectionButton() = @@ -286,5 +287,5 @@ private fun addNewCollectionButton() = private fun backButton() = mDevice.findObject( - UiSelector().resourceId("$packageName:id/back_button") + UiSelector().resourceId("$packageName:id/back_button"), ) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/CustomTabRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/CustomTabRobot.kt index 0d939be6e5..7730ec0d61 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/CustomTabRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/CustomTabRobot.kt @@ -38,7 +38,7 @@ class CustomTabRobot { fun verifyPoweredByTextIsDisplayed() { assertTrue( mDevice.findObject(UiSelector().textContains("POWERED BY $appName")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) } @@ -67,19 +67,19 @@ class CustomTabRobot { mDevice.findObject( UiSelector() .resourceId("$packageName:id/mozac_browser_toolbar_title_view") - .textContains(title) + .textContains(title), ) .getFromParent( - UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_origin_view") - ) + UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_origin_view"), + ), ) assertTrue( mDevice.findObject( UiSelector() .resourceId("$packageName:id/mozac_browser_toolbar_title_view") - .textContains(title) - ).waitForExists(waitingTime) + .textContains(title), + ).waitForExists(waitingTime), ) } @@ -178,7 +178,7 @@ private fun customTabToolbar() = mDevice.findObject(By.res("$packageName:id/tool private val progressBar = mDevice.findObject( - UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_progress") + UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_progress"), ) private val submitLoginButton = @@ -187,5 +187,5 @@ private val submitLoginButton = .resourceId("submit") .textContains("Submit Query") .className("android.widget.Button") - .packageName("$packageName") + .packageName("$packageName"), ) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/DownloadRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/DownloadRobot.kt index 2fcc9b440f..fc33ffd7a2 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/DownloadRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/DownloadRobot.kt @@ -49,7 +49,7 @@ class DownloadRobot { assertTrue( "$fileName not found in Downloads list", mDevice.findObject(UiSelector().text(fileName)) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) } @@ -65,7 +65,7 @@ class DownloadRobot { assertTrue( "Downloads list either empty or not displayed", mDevice.findObject(UiSelector().resourceId("$packageName:id/download_list")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) fun openDownloadedFile(fileName: String) { @@ -96,8 +96,8 @@ class DownloadRobot { Intents.intended( CoreMatchers.allOf( IntentMatchers.hasAction(Intent.ACTION_VIEW), - IntentMatchers.hasType(type) - ) + IntentMatchers.hasType(type), + ), ) BrowserRobot().interact() @@ -107,7 +107,7 @@ class DownloadRobot { fun clickAllowPermission(interact: DownloadRobot.() -> Unit): Transition { mDevice.waitNotNull( Until.findObject(By.res(TestHelper.getPermissionAllowID() + ":id/permission_allow_button")), - waitingTime + waitingTime, ) val allowPermissionButton = mDevice.findObject(By.res(TestHelper.getPermissionAllowID() + ":id/permission_allow_button")) @@ -138,12 +138,12 @@ private fun assertDownloadPrompt(fileName: String) { assertTrue( "Download prompt button not visible", mDevice.findObject(UiSelector().resourceId("$packageName:id/download_button")) - .waitForExists(waitingTimeLong) + .waitForExists(waitingTimeLong), ) assertTrue( "$fileName title doesn't match", mDevice.findObject(UiSelector().text(fileName)) - .waitForExists(waitingTimeLong) + .waitForExists(waitingTimeLong), ) break @@ -161,17 +161,17 @@ private fun assertDownloadNotificationPopup() { assertTrue( "Download notification Open button not found", mDevice.findObject(UiSelector().text("Open")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) assertTrue( "Download completed notification text doesn't match", mDevice.findObject(UiSelector().textContains("Download completed")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) assertTrue( "Downloaded file name not visible", mDevice.findObject(UiSelector().resourceId("$packageName:id/download_dialog_filename")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) } @@ -193,5 +193,5 @@ private fun assertDownloadedFileIcon() = assertTrue( "Downloaded file icon not found", mDevice.findObject(UiSelector().resourceId("$packageName:id/favicon")) - .exists() + .exists(), ) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/EnhancedTrackingProtectionRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/EnhancedTrackingProtectionRobot.kt index 542904bc00..e71dcd95a2 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/EnhancedTrackingProtectionRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/EnhancedTrackingProtectionRobot.kt @@ -59,10 +59,10 @@ class EnhancedTrackingProtectionRobot { containsString( "social-track-digest256.dummytracker.org\n" + "ads-track-digest256.dummytracker.org\n" + - "analytics-track-digest256.dummytracker.org" - ) - ) - ) + "analytics-track-digest256.dummytracker.org", + ), + ), + ), ) } @@ -130,9 +130,9 @@ private fun assertEnhancedTrackingProtectionSheetStatus(status: String, state: B onView(ViewMatchers.withResourceName("switch_widget")).check( matches( isChecked( - state - ) - ) + state, + ), + ), ) } @@ -149,8 +149,8 @@ private fun enhancedTrackingProtectionSwitch() = private fun trackingProtectionSettingsButton() = onView(withId(R.id.protection_settings)).inRoot(RootMatchers.isDialog()).check( matches( - isDisplayed() - ) + isDisplayed(), + ), ) private fun openEnhancedTrackingProtectionDetails() = @@ -180,7 +180,7 @@ private fun assertCryptominersBlocked() { private fun assertTrackingContentBlocked() { assertTrue( mDevice.findObject(UiSelector().resourceId("$packageName:id/tracking_content")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) } @@ -191,7 +191,7 @@ private fun assertSecuritySheetIsCompletelyDisplayed() { .waitForExists(waitingTime) assertTrue( mDevice.findObject( - UiSelector().resourceId("$packageName:id/quick_action_sheet") - ).waitForExists(waitingTime) + UiSelector().resourceId("$packageName:id/quick_action_sheet"), + ).waitForExists(waitingTime), ) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HistoryRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HistoryRobot.kt index 7c9457772c..b1c1c88769 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HistoryRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HistoryRobot.kt @@ -39,7 +39,7 @@ class HistoryRobot { fun verifyEmptyHistoryView() { mDevice.findObject( - UiSelector().text("No history here") + UiSelector().text("No history here"), ).waitForExists(waitingTime) assertEmptyHistoryView() @@ -50,9 +50,9 @@ class HistoryRobot { fun verifyVisitedTimeTitle() { mDevice.waitNotNull( Until.findObject( - By.text("Today") + By.text("Today"), ), - waitingTime + waitingTime, ) assertVisitedTimeTitle() } @@ -88,7 +88,7 @@ class HistoryRobot { mDevice .findObject( UiSelector() - .textContains(getStringResource(R.string.delete_browsing_data_prompt_cancel)) + .textContains(getStringResource(R.string.delete_browsing_data_prompt_cancel)), ).click() fun verifyDeleteSnackbarText(text: String) = assertSnackBarText(text) @@ -127,7 +127,7 @@ private fun snackBarText() = onView(withId(R.id.snackbar_text)) private fun assertHistoryMenuView() { onView( - allOf(withText("History"), withParent(withId(R.id.navigationToolbar))) + allOf(withText("History"), withParent(withId(R.id.navigationToolbar))), ) .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) } @@ -136,8 +136,8 @@ private fun assertEmptyHistoryView() = onView( allOf( withId(R.id.history_empty_view), - withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE) - ) + withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE), + ), ) .check(matches(withText("No history here"))) @@ -183,7 +183,7 @@ private fun deleteHistoryPromptTitle() = .findObject( UiSelector() .textContains(getStringResource(R.string.delete_history_prompt_title)) - .resourceId("$packageName:id/title") + .resourceId("$packageName:id/title"), ) private fun deleteHistoryPromptSummary() = @@ -191,7 +191,7 @@ private fun deleteHistoryPromptSummary() = .findObject( UiSelector() .textContains(getStringResource(R.string.delete_history_prompt_body)) - .resourceId("$packageName:id/body") + .resourceId("$packageName:id/body"), ) private fun deleteHistoryEverythingOption() = @@ -199,5 +199,5 @@ private fun deleteHistoryEverythingOption() = .findObject( UiSelector() .textContains(getStringResource(R.string.delete_history_prompt_button_everything)) - .resourceId("$packageName:id/everything_button") + .resourceId("$packageName:id/everything_button"), ) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt index e4e604534d..07ad70e1f4 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/HomeScreenRobot.kt @@ -92,14 +92,14 @@ class HomeScreenRobot { if (isEnabled) { assertTrue( mDevice.findObject( - UiSelector().resourceId("$packageName:id/wallpaperImageView") - ).waitForExists(waitingTimeShort) + UiSelector().resourceId("$packageName:id/wallpaperImageView"), + ).waitForExists(waitingTimeShort), ) } else { assertFalse( mDevice.findObject( - UiSelector().resourceId("$packageName:id/wallpaperImageView") - ).waitForExists(waitingTimeShort) + UiSelector().resourceId("$packageName:id/wallpaperImageView"), + ).waitForExists(waitingTimeShort), ) } @@ -159,13 +159,13 @@ class HomeScreenRobot { assertTrue( mDevice.findObject(UiSelector().text(searchTerm)) .getFromParent(UiSelector().text("$groupSize sites")) - .waitForExists(waitingTimeShort) + .waitForExists(waitingTimeShort), ) } else { assertFalse( mDevice.findObject(UiSelector().text(searchTerm)) .getFromParent(UiSelector().text("$groupSize sites")) - .waitForExists(waitingTimeShort) + .waitForExists(waitingTimeShort), ) } } @@ -176,12 +176,12 @@ class HomeScreenRobot { assertTrue( mDevice.findObject(UiSelector().text("""Your search for "$searchTerm"""")) .getFromParent(UiSelector().textContains("$groupSize sites")) - .waitForExists(waitingTimeShort) + .waitForExists(waitingTimeShort), ) } else { assertFalse( mDevice.findObject(UiSelector().text("""Your search for "$searchTerm"""")) - .waitForExists(waitingTimeShort) + .waitForExists(waitingTimeShort), ) } } @@ -215,8 +215,8 @@ class HomeScreenRobot { onView( allOf( withId(R.id.snackbar_btn), - withText(expectedText) - ) + withText(expectedText), + ), ).click() } @@ -229,9 +229,9 @@ class HomeScreenRobot { mDevice.findObject( UiSelector() .textContains( - getStringResource(R.string.pocket_stories_header_1) - ) - ).waitForExists(waitingTime) + getStringResource(R.string.pocket_stories_header_1), + ), + ).waitForExists(waitingTime), ) } else { homeScreenList().scrollToEnd(LISTS_MAXSWIPES) @@ -239,9 +239,9 @@ class HomeScreenRobot { mDevice.findObject( UiSelector() .textContains( - getStringResource(R.string.pocket_stories_header_1) - ) - ).waitForExists(waitingTime) + getStringResource(R.string.pocket_stories_header_1), + ), + ).waitForExists(waitingTime), ) } } @@ -253,9 +253,9 @@ class HomeScreenRobot { mDevice.findObject( UiSelector() .textContains( - getStringResource(R.string.pocket_stories_categories_header) - ) - ).waitForExists(waitingTime) + getStringResource(R.string.pocket_stories_categories_header), + ), + ).waitForExists(waitingTime), ) } else { homeScreenList().scrollToEnd(LISTS_MAXSWIPES) @@ -263,9 +263,9 @@ class HomeScreenRobot { mDevice.findObject( UiSelector() .textContains( - getStringResource(R.string.pocket_stories_categories_header) - ) - ).waitForExists(waitingTime) + getStringResource(R.string.pocket_stories_categories_header), + ), + ).waitForExists(waitingTime), ) } } @@ -276,16 +276,16 @@ class HomeScreenRobot { assertTrue( mDevice.findObject( UiSelector() - .textContains("Customize homepage") - ).waitForExists(waitingTime) + .textContains("Customize homepage"), + ).waitForExists(waitingTime), ) } else { homeScreenList().scrollToEnd(LISTS_MAXSWIPES) assertFalse( mDevice.findObject( UiSelector() - .textContains("Customize homepage") - ).waitForExists(waitingTime) + .textContains("Customize homepage"), + ).waitForExists(waitingTime), ) } } @@ -294,7 +294,7 @@ class HomeScreenRobot { fun openTabDrawer(interact: TabDrawerRobot.() -> Unit): TabDrawerRobot.Transition { mDevice.findObject( - UiSelector().descriptionContains("open tab. Tap to switch tabs.") + UiSelector().descriptionContains("open tab. Tap to switch tabs."), ).waitForExists(waitingTime) tabsCounter().click() @@ -309,7 +309,7 @@ class HomeScreenRobot { try { mDevice.waitNotNull( Until.findObject(By.res("$packageName:id/menuButton")), - waitingTime + waitingTime, ) } catch (e: AssertionError) { mDevice.pressBack() @@ -343,7 +343,7 @@ class HomeScreenRobot { fun togglePrivateBrowsingMode() { mDevice.findObject(UiSelector().resourceId("$packageName:id/privateBrowsingButton")) .waitForExists( - waitingTime + waitingTime, ) privateBrowsingButton() .perform(click()) @@ -354,7 +354,7 @@ class HomeScreenRobot { for (i in 1..5) { mDevice.findObject(UiSelector().resourceId("$packageName:id/privateBrowsingButton")) .waitForExists( - waitingTime + waitingTime, ) privateBrowsingButton() @@ -380,13 +380,13 @@ class HomeScreenRobot { fun openContextMenuOnTopSitesWithTitle( title: String, - interact: HomeScreenRobot.() -> Unit + interact: HomeScreenRobot.() -> Unit, ): Transition { onView(withId(R.id.top_sites_list)).perform( actionOnItem( hasDescendant(withText(title)), - ViewActions.longClick() - ) + ViewActions.longClick(), + ), ) HomeScreenRobot().interact() @@ -395,10 +395,10 @@ class HomeScreenRobot { fun openTopSiteTabWithTitle( title: String, - interact: BrowserRobot.() -> Unit + interact: BrowserRobot.() -> Unit, ): BrowserRobot.Transition { onView(withId(R.id.top_sites_list)).perform( - actionOnItem(hasDescendant(withText(title)), click()) + actionOnItem(hasDescendant(withText(title)), click()), ) BrowserRobot().interact() @@ -428,7 +428,7 @@ class HomeScreenRobot { fun deleteTopSiteFromHistory(interact: HomeScreenRobot.() -> Unit): Transition { mDevice.findObject( - UiSelector().resourceId("$packageName:id/simple_text") + UiSelector().resourceId("$packageName:id/simple_text"), ).waitForExists(waitingTime) deleteFromHistory.click() @@ -449,8 +449,8 @@ class HomeScreenRobot { mDevice.findObject( UiSelector() .textContains( - getStringResource(R.string.private_browsing_common_myths) - ) + getStringResource(R.string.private_browsing_common_myths), + ), ).also { it.click() } BrowserRobot().interact() @@ -490,8 +490,8 @@ class HomeScreenRobot { mDevice.findObject( UiSelector() .textContains( - "Customize homepage" - ) + "Customize homepage", + ), ).clickAndWaitForNewWindow(waitingTime) SettingsSubMenuHomepageRobot().interact() @@ -509,7 +509,7 @@ private fun homeScreenList() = UiScrollable( UiSelector() .resourceId("$packageName:id/sessionControlRecyclerView") - .scrollable(true) + .scrollable(true), ).setAsVerticalList() private fun assertKeyboardVisibility(isExpectedToBeVisible: Boolean) = @@ -517,7 +517,7 @@ private fun assertKeyboardVisibility(isExpectedToBeVisible: Boolean) = isExpectedToBeVisible, mDevice .executeShellCommand("dumpsys input_method | grep mInputShown") - .contains("mInputShown=true") + .contains("mInputShown=true"), ) private fun navigationToolbar() = mDevice.findObject(UiSelector().resourceId("$packageName:id/toolbar")) @@ -561,9 +561,9 @@ private fun assertNoCollectionsText() = withText( containsString( "Collect the things that matter to you.\n" + - "Group together similar searches, sites, and tabs for quick access later." - ) - ) + "Group together similar searches, sites, and tabs for quick access later.", + ), + ), ).check(matches(isDisplayed())) private fun assertHomeComponent() = @@ -593,9 +593,9 @@ private fun assertWelcomeHeader() = assertTrue( mDevice.findObject( UiSelector().textContains( - getStringResource(R.string.onboarding_header_2) - ) - ).waitForExists(waitingTime) + getStringResource(R.string.onboarding_header_2), + ), + ).waitForExists(waitingTime), ) private fun assertStartSyncHeader() { @@ -664,9 +664,9 @@ private fun assertAlwaysPrivacyText() { onView( allOf( withText( - "Featuring Total Cookie Protection to stop trackers from using cookies to stalk you across sites." - ) - ) + "Featuring Total Cookie Protection to stop trackers from using cookies to stalk you across sites.", + ), + ), ) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -682,9 +682,9 @@ private fun assertYourPrivacyText() { onView( allOf( withText( - "Firefox gives you control over what you share online and what you share with us." - ) - ) + "Firefox gives you control over what you share online and what you share with us.", + ), + ), ) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -723,9 +723,9 @@ private fun assertPrivateSessionMessage() = mDevice.findObject( UiSelector() .textContains( - getStringResource(R.string.private_browsing_common_myths) - ) - ).waitForExists(waitingTime) + getStringResource(R.string.private_browsing_common_myths), + ), + ).waitForExists(waitingTime), ) private fun collectionTitle(title: String, rule: ComposeTestRule) = @@ -739,7 +739,7 @@ private fun assertExistingTopSitesTabs(title: String) { mDevice.findObject( UiSelector() .resourceId("$packageName:id/top_site_title") - .textContains(title) + .textContains(title), ).waitForExists(waitingTime) onView(allOf(withId(R.id.top_sites_list))) @@ -751,14 +751,14 @@ private fun assertSponsoredTopSiteIsDisplayed(position: Int) { mDevice.findObject( UiSelector() .resourceId("$packageName:id/top_site_subtitle") - .textContains(getStringResource(R.string.top_sites_sponsored_label)) + .textContains(getStringResource(R.string.top_sites_sponsored_label)), ).waitForExists(waitingTime) onView( allOf( withText(R.string.top_sites_sponsored_label), - withParent(withParentIndex(position - 1)) - ) + withParent(withParentIndex(position - 1)), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -775,19 +775,19 @@ private fun assertSponsoredTopSitesNotDisplayed() { mDevice.findObject( UiSelector() .resourceId("$packageName:id/top_site_subtitle") - .textContains(getStringResource(R.string.top_sites_sponsored_label)) - ).waitForExists(waitingTime) + .textContains(getStringResource(R.string.top_sites_sponsored_label)), + ).waitForExists(waitingTime), ) } private fun assertTopSiteContextMenuItems() { mDevice.waitNotNull( findObject(By.text("Open in private tab")), - waitingTime + waitingTime, ) mDevice.waitNotNull( findObject(By.text("Remove")), - waitingTime + waitingTime, ) } @@ -826,12 +826,12 @@ val deleteFromHistory = onView( allOf( withId(R.id.simple_text), - withText(R.string.delete_from_history) - ) + withText(R.string.delete_from_history), + ), ).inRoot(RootMatchers.isPlatformPopup()) private val recentlyVisitedList = UiScrollable( UiSelector() - .className("android.widget.HorizontalScrollView") + .className("android.widget.HorizontalScrollView"), ).setAsHorizontalList() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/LibrarySubMenusMultipleSelectionToolbarRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/LibrarySubMenusMultipleSelectionToolbarRobot.kt index 41ffa07d81..942a7f44a1 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/LibrarySubMenusMultipleSelectionToolbarRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/LibrarySubMenusMultipleSelectionToolbarRobot.kt @@ -58,9 +58,9 @@ class LibrarySubMenusMultipleSelectionToolbarRobot { mDevice.waitNotNull( Until.findObject( - By.text("ALL ACTIONS") + By.text("ALL ACTIONS"), ), - waitingTime + waitingTime, ) } @@ -69,9 +69,9 @@ class LibrarySubMenusMultipleSelectionToolbarRobot { mDevice.waitNotNull( Until.findObject( - By.text("ALL ACTIONS") + By.text("ALL ACTIONS"), ), - waitingTime + waitingTime, ) } @@ -81,7 +81,6 @@ class LibrarySubMenusMultipleSelectionToolbarRobot { class Transition { fun closeShareDialogReturnToPage(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { - BrowserRobot().interact() return BrowserRobot.Transition() } @@ -104,7 +103,7 @@ class LibrarySubMenusMultipleSelectionToolbarRobot { openInNewTabButton().click() mDevice.waitNotNull( Until.findObject(By.res("$packageName:id/tab_layout")), - waitingTime + waitingTime, ) TabDrawerRobot().interact() @@ -115,7 +114,7 @@ class LibrarySubMenusMultipleSelectionToolbarRobot { openInPrivateTabButton().click() mDevice.waitNotNull( Until.findObject(By.res("$packageName:id/tab_layout")), - waitingTime + waitingTime, ) TabDrawerRobot().interact() @@ -125,7 +124,6 @@ class LibrarySubMenusMultipleSelectionToolbarRobot { } fun multipleSelectionToolbar(interact: LibrarySubMenusMultipleSelectionToolbarRobot.() -> Unit): LibrarySubMenusMultipleSelectionToolbarRobot.Transition { - LibrarySubMenusMultipleSelectionToolbarRobot().interact() return LibrarySubMenusMultipleSelectionToolbarRobot.Transition() } @@ -156,8 +154,8 @@ private fun assertMultiSelectionCheckmark(url: Uri) = // the match above is finding two checkmark views - one visible, one hidden, which is throwing off // the matcher. This 'isDisplayed' check is a hacky workaround for this, we're explicitly ignoring // the hidden one. Why are there two to begin with, though? - isDisplayed() - ) + isDisplayed(), + ), ) .check(matches(isDisplayed())) @@ -177,7 +175,7 @@ private fun assertShareAppsLayout() = { val sendToDeviceTitle = mDevice.findObject( UiSelector() .instance(0) - .className(TextView::class.java) + .className(TextView::class.java), ) sendToDeviceTitle.waitForExists(TestAssetHelper.waitingTime) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NavigationToolbarRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NavigationToolbarRobot.kt index eebc424c6f..cddd0a9821 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NavigationToolbarRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NavigationToolbarRobot.kt @@ -59,7 +59,7 @@ class NavigationToolbarRobot { fun toggleReaderView() { mDevice.findObject( UiSelector() - .resourceId("$packageName:id/mozac_browser_toolbar_page_actions") + .resourceId("$packageName:id/mozac_browser_toolbar_page_actions"), ) .waitForExists(waitingTime) @@ -76,8 +76,8 @@ class NavigationToolbarRobot { mDevice.findObject( UiSelector() .resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view") - .textContains("") - ).waitForExists(waitingTime) + .textContains(""), + ).waitForExists(waitingTime), ) goBackButton() @@ -88,7 +88,7 @@ class NavigationToolbarRobot { fun enterURLAndEnterToBrowser( url: Uri, - interact: BrowserRobot.() -> Unit + interact: BrowserRobot.() -> Unit, ): BrowserRobot.Transition { sessionLoadedIdlingResource = SessionLoadedIdlingResource() @@ -101,8 +101,8 @@ class NavigationToolbarRobot { onView( anyOf( withResourceName("browserLayout"), - withResourceName("download_button") - ) + withResourceName("download_button"), + ), ).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) } @@ -141,7 +141,7 @@ class NavigationToolbarRobot { tabTrayButton().click() mDevice.waitNotNull( Until.findObject(By.res("$packageName:id/tab_layout")), - waitingTime + waitingTime, ) TabDrawerRobot().interact() @@ -151,13 +151,13 @@ class NavigationToolbarRobot { fun visitLinkFromClipboard(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { mDevice.waitNotNull( Until.findObject(By.res("org.mozilla.fenix.debug:id/mozac_browser_toolbar_clear_view")), - waitingTime + waitingTime, ) clearAddressBar().click() mDevice.waitNotNull( Until.findObject(By.res("org.mozilla.fenix.debug:id/clipboard_title")), - waitingTime + waitingTime, ) // On Android 12 or above we don't SHOW the URL unless the user requests to do so. @@ -165,7 +165,7 @@ class NavigationToolbarRobot { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) { mDevice.waitNotNull( Until.findObject(By.res("org.mozilla.fenix.debug:id/clipboard_url")), - waitingTime + waitingTime, ) } @@ -189,10 +189,10 @@ class NavigationToolbarRobot { .perform( RecyclerViewActions.actionOnItem( hasDescendant( - withText("Close tab") + withText("Close tab"), ), - ViewActions.click() - ) + ViewActions.click(), + ), ) NavigationToolbarRobot().interact() @@ -206,10 +206,10 @@ class NavigationToolbarRobot { .perform( RecyclerViewActions.actionOnItem( hasDescendant( - withText("New tab") + withText("New tab"), ), - ViewActions.click() - ) + ViewActions.click(), + ), ) HomeScreenRobot().interact() @@ -223,10 +223,10 @@ class NavigationToolbarRobot { .perform( RecyclerViewActions.actionOnItem( hasDescendant( - withText("New private tab") + withText("New private tab"), ), - ViewActions.click() - ) + ViewActions.click(), + ), ) HomeScreenRobot().interact() @@ -237,7 +237,7 @@ class NavigationToolbarRobot { urlBar().click() mDevice.findObject( - UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view") + UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view"), ).waitForExists(waitingTime) SearchRobot().interact() @@ -254,12 +254,12 @@ fun navigationToolbar(interact: NavigationToolbarRobot.() -> Unit): NavigationTo fun openEditURLView() { mDevice.waitNotNull( Until.findObject(By.res("$packageName:id/toolbar")), - waitingTime + waitingTime, ) urlBar().click() mDevice.waitNotNull( Until.findObject(By.res("$packageName:id/mozac_browser_toolbar_edit_url_view")), - waitingTime + waitingTime, ) } @@ -292,36 +292,42 @@ private fun readerViewToggle() = private fun assertReaderViewDetected(visible: Boolean) { mDevice.findObject( UiSelector() - .description("Reader view") + .description("Reader view"), ) .waitForExists(waitingTime) onView( allOf( withParent(withId(R.id.mozac_browser_toolbar_page_actions)), - withContentDescription("Reader view") - ) + withContentDescription("Reader view"), + ), ).check( - if (visible) matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)) - else ViewAssertions.doesNotExist() + if (visible) { + matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)) + } else { + ViewAssertions.doesNotExist() + }, ) } private fun assertCloseReaderViewDetected(visible: Boolean) { mDevice.findObject( UiSelector() - .description("Close reader view") + .description("Close reader view"), ) .waitForExists(waitingTime) onView( allOf( withParent(withId(R.id.mozac_browser_toolbar_page_actions)), - withContentDescription("Close reader view") - ) + withContentDescription("Close reader view"), + ), ).check( - if (visible) matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)) - else ViewAssertions.doesNotExist() + if (visible) { + matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)) + } else { + ViewAssertions.doesNotExist() + }, ) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NotificationRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NotificationRobot.kt index 383b03f9b9..0efe1131d5 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NotificationRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/NotificationRobot.kt @@ -54,13 +54,13 @@ class NotificationRobot { fun verifySystemNotificationGone(notificationMessage: String) { mDevice.waitNotNull( Until.gone(text(notificationMessage)), - waitingTime + waitingTime, ) assertFalse( mDevice.findObject( - UiSelector().text(notificationMessage) - ).exists() + UiSelector().text(notificationMessage), + ).exists(), ) } @@ -117,7 +117,7 @@ class NotificationRobot { fun clickClosePrivateTabsNotification(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition { try { assertTrue( - closePrivateTabsNotification().exists() + closePrivateTabsNotification().exists(), ) } catch (e: AssertionError) { notificationTray().flingToEnd(1) @@ -143,25 +143,25 @@ private fun downloadSystemNotificationButton(action: String) = mDevice.findObject( UiSelector() .resourceId("android:id/action0") - .textContains(action) + .textContains(action), ) private fun mediaSystemNotificationButton(action: String) = mDevice.findObject( UiSelector() .resourceId("com.android.systemui:id/action0") - .descriptionContains(action) + .descriptionContains(action), ) private fun notificationTray() = UiScrollable( - UiSelector().resourceId("com.android.systemui:id/notification_stack_scroller") + UiSelector().resourceId("com.android.systemui:id/notification_stack_scroller"), ).setAsVerticalList() private val notificationHeader = mDevice.findObject( UiSelector() .resourceId("android:id/app_name_text") - .text(appName) + .text(appName), ) private fun scrollToEnd() { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ReaderViewRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ReaderViewRobot.kt index 2ebaafc8bb..217d2d9dbc 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ReaderViewRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ReaderViewRobot.kt @@ -56,7 +56,7 @@ class ReaderViewRobot { val prefs = InstrumentationRegistry.getInstrumentation() .targetContext.getSharedPreferences( "mozac_feature_reader_view", - Context.MODE_PRIVATE + Context.MODE_PRIVATE, ) assertEquals(fontType, prefs.getString(fontTypeKey, "")) @@ -68,7 +68,7 @@ class ReaderViewRobot { val prefs = InstrumentationRegistry.getInstrumentation() .targetContext.getSharedPreferences( "mozac_feature_reader_view", - Context.MODE_PRIVATE + Context.MODE_PRIVATE, ) val fontSizeKeyValue = prefs.getInt(fontSizeKey, 3) @@ -82,7 +82,7 @@ class ReaderViewRobot { val prefs = InstrumentationRegistry.getInstrumentation() .targetContext.getSharedPreferences( "mozac_feature_reader_view", - Context.MODE_PRIVATE + Context.MODE_PRIVATE, ) assertEquals(expectedColorScheme, prefs.getString(colorSchemeKey, "")) @@ -92,7 +92,7 @@ class ReaderViewRobot { fun toggleSansSerif(interact: ReaderViewRobot.() -> Unit): Transition { fun sansSerifButton() = onView( - withId(R.id.mozac_feature_readerview_font_sans_serif) + withId(R.id.mozac_feature_readerview_font_sans_serif), ) sansSerifButton().click() @@ -104,7 +104,7 @@ class ReaderViewRobot { fun toggleSerif(interact: ReaderViewRobot.() -> Unit): Transition { fun serifButton() = onView( - withId(R.id.mozac_feature_readerview_font_serif) + withId(R.id.mozac_feature_readerview_font_serif), ) serifButton().click() @@ -116,7 +116,7 @@ class ReaderViewRobot { fun toggleFontSizeDecrease(interact: ReaderViewRobot.() -> Unit): Transition { fun fontSizeDecrease() = onView( - withId(R.id.mozac_feature_readerview_font_size_decrease) + withId(R.id.mozac_feature_readerview_font_size_decrease), ) fontSizeDecrease().click() @@ -128,7 +128,7 @@ class ReaderViewRobot { fun toggleFontSizeIncrease(interact: ReaderViewRobot.() -> Unit): Transition { fun fontSizeIncrease() = onView( - withId(R.id.mozac_feature_readerview_font_size_increase) + withId(R.id.mozac_feature_readerview_font_size_increase), ) fontSizeIncrease().click() @@ -140,7 +140,7 @@ class ReaderViewRobot { fun toggleColorSchemeChangeLight(interact: ReaderViewRobot.() -> Unit): Transition { fun toggleLightColorSchemeButton() = onView( - withId(R.id.mozac_feature_readerview_color_light) + withId(R.id.mozac_feature_readerview_color_light), ) toggleLightColorSchemeButton().click() @@ -152,7 +152,7 @@ class ReaderViewRobot { fun toggleColorSchemeChangeDark(interact: ReaderViewRobot.() -> Unit): Transition { fun toggleDarkColorSchemeButton() = onView( - withId(R.id.mozac_feature_readerview_color_dark) + withId(R.id.mozac_feature_readerview_color_dark), ) toggleDarkColorSchemeButton().click() @@ -164,7 +164,7 @@ class ReaderViewRobot { fun toggleColorSchemeChangeSepia(interact: ReaderViewRobot.() -> Unit): Transition { fun toggleSepiaColorSchemeButton() = onView( - withId(R.id.mozac_feature_readerview_color_sepia) + withId(R.id.mozac_feature_readerview_color_sepia), ) toggleSepiaColorSchemeButton().click() @@ -182,65 +182,65 @@ fun readerViewRobot(interact: ReaderViewRobot.() -> Unit): ReaderViewRobot.Trans private fun assertAppearanceFontGroup(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_font_group) + withId(R.id.mozac_feature_readerview_font_group), ).check( - matches(withEffectiveVisibility(visibleOrGone(visible))) + matches(withEffectiveVisibility(visibleOrGone(visible))), ) private fun assertAppearanceFontSansSerif(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_font_sans_serif) + withId(R.id.mozac_feature_readerview_font_sans_serif), ).check( - matches(withEffectiveVisibility(visibleOrGone(visible))) + matches(withEffectiveVisibility(visibleOrGone(visible))), ) private fun assertAppearanceFontSerif(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_font_serif) + withId(R.id.mozac_feature_readerview_font_serif), ).check( - matches(withEffectiveVisibility(visibleOrGone(visible))) + matches(withEffectiveVisibility(visibleOrGone(visible))), ) private fun assertAppearanceFontDecrease(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_font_size_decrease) + withId(R.id.mozac_feature_readerview_font_size_decrease), ).check( - matches(withEffectiveVisibility(visibleOrGone(visible))) + matches(withEffectiveVisibility(visibleOrGone(visible))), ) private fun assertAppearanceFontIncrease(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_font_size_increase) + withId(R.id.mozac_feature_readerview_font_size_increase), ).check( - matches(withEffectiveVisibility(visibleOrGone(visible))) + matches(withEffectiveVisibility(visibleOrGone(visible))), ) private fun assertAppearanceColorDark(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_color_dark) + withId(R.id.mozac_feature_readerview_color_dark), ).check( - matches(withEffectiveVisibility(visibleOrGone(visible))) + matches(withEffectiveVisibility(visibleOrGone(visible))), ) private fun assertAppearanceColorLight(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_color_light) + withId(R.id.mozac_feature_readerview_color_light), ).check( - matches(withEffectiveVisibility(visibleOrGone(visible))) + matches(withEffectiveVisibility(visibleOrGone(visible))), ) private fun assertAppearanceColorSepia(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_color_sepia) + withId(R.id.mozac_feature_readerview_color_sepia), ).check( - matches(withEffectiveVisibility(visibleOrGone(visible))) + matches(withEffectiveVisibility(visibleOrGone(visible))), ) private fun assertAppearanceColorGroup(visible: Boolean) = onView( - withId(R.id.mozac_feature_readerview_color_scheme_group) + withId(R.id.mozac_feature_readerview_color_scheme_group), ).check( - matches(withEffectiveVisibility(visibleOrGone(visible))) + matches(withEffectiveVisibility(visibleOrGone(visible))), ) private fun visibleOrGone(visibility: Boolean) = diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/RecentlyClosedTabsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/RecentlyClosedTabsRobot.kt index d3146a968c..4e492a3529 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/RecentlyClosedTabsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/RecentlyClosedTabsRobot.kt @@ -30,7 +30,7 @@ class RecentlyClosedTabsRobot { fun waitForListToExist() = mDevice.findObject(UiSelector().resourceId("$packageName:id/recently_closed_list")) .waitForExists( - TestAssetHelper.waitingTime + TestAssetHelper.waitingTime, ) fun verifyRecentlyClosedTabsMenuView() = assertRecentlyClosedTabsMenuView() @@ -58,11 +58,11 @@ private fun assertRecentlyClosedTabsMenuView() { onView( allOf( withText("Recently closed tabs"), - withParent(withId(R.id.navigationToolbar)) - ) + withParent(withId(R.id.navigationToolbar)), + ), ) .check( - matches(withEffectiveVisibility(Visibility.VISIBLE)) + matches(withEffectiveVisibility(Visibility.VISIBLE)), ) } @@ -72,8 +72,8 @@ private fun assertEmptyRecentlyClosedTabsList() { onView( allOf( withId(R.id.recently_closed_empty_view), - withText(R.string.recently_closed_empty_message) - ) + withText(R.string.recently_closed_empty_message), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -81,19 +81,19 @@ private fun assertPageUrl(expectedUrl: Uri) = onView( allOf( withId(R.id.url), withEffectiveVisibility( - Visibility.VISIBLE - ) - ) + Visibility.VISIBLE, + ), + ), ) .check( - matches(withText(Matchers.containsString(expectedUrl.toString()))) + matches(withText(Matchers.containsString(expectedUrl.toString()))), ) private fun recentlyClosedTabsPageTitle(title: String) = onView( allOf( withId(R.id.title), - withText(title) - ) + withText(title), + ), ) private fun assertRecentlyClosedTabsPageTitle(title: String) { @@ -106,7 +106,7 @@ private fun recentlyClosedTabsDeleteButton() = allOf( withId(R.id.overflow_menu), withEffectiveVisibility( - Visibility.VISIBLE - ) - ) + Visibility.VISIBLE, + ), + ), ) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt index 56e35fc3fa..7e3a54b706 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SearchRobot.kt @@ -79,8 +79,8 @@ class SearchRobot { when { Build.VERSION.SDK_INT == Build.VERSION_CODES.R -> "Allow all the time" else -> "While using the app" - } - ) + }, + ), ) if (allowPermission.exists()) { @@ -119,7 +119,7 @@ class SearchRobot { fun clickSearchEngineShortcutButton() { val searchEnginesShortcutButton = mDevice.findObject( UiSelector() - .resourceId("$packageName:id/search_engines_shortcut_button") + .resourceId("$packageName:id/search_engines_shortcut_button"), ) searchEnginesShortcutButton.waitForExists(waitingTime) searchEnginesShortcutButton.click() @@ -143,13 +143,13 @@ class SearchRobot { fun verifyScannerOpen() { assertTrue( mDevice.findObject(UiSelector().resourceId("$packageName:id/view_finder")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) } fun typeSearch(searchTerm: String) { mDevice.findObject( - UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view") + UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view"), ).waitForExists(waitingTime) browserToolbarEditView().setText(searchTerm) @@ -162,8 +162,8 @@ class SearchRobot { mDevice.waitForObjects( mDevice.findObject( - UiSelector().textContains(searchEngineName) - ) + UiSelector().textContains(searchEngineName), + ), ) rule.onNodeWithText(searchEngineName) @@ -175,7 +175,7 @@ class SearchRobot { fun clickSearchEngineResult(rule: ComposeTestRule, searchSuggestion: String) { mDevice.waitNotNull( Until.findObjects(By.text(searchSuggestion)), - waitingTime + waitingTime, ) rule.onNodeWithText(searchSuggestion) @@ -188,7 +188,7 @@ class SearchRobot { fun scrollToSearchEngineSettings(rule: ComposeTestRule) { // Soft keyboard is visible on screen on view access; hide it onView(allOf(withId(R.id.search_wrapper))).perform( - closeSoftKeyboard() + closeSoftKeyboard(), ) mDevice.findObject(UiSelector().text("Google")) @@ -267,8 +267,8 @@ class SearchRobot { runWithIdleRes(sessionLoadedIdlingResource) { assertTrue( mDevice.findObject( - UiSelector().resourceId("$packageName:id/browserLayout") - ).waitForExists(waitingTime) + UiSelector().resourceId("$packageName:id/browserLayout"), + ).waitForExists(waitingTime), ) } @@ -318,7 +318,7 @@ private fun assertSearchEngineSuggestionResults(rule: ComposeTestRule, searchRes assertTrue( mDevice.findObject(UiSelector().textContains(searchResult)) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) } @@ -327,34 +327,34 @@ private fun assertNoSuggestionsAreDisplayed(rule: ComposeTestRule, searchTerm: S assertFalse( mDevice.findObject(UiSelector().textContains(searchTerm)) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) } private fun assertSearchView() = assertTrue( mDevice.findObject( - UiSelector().resourceId("$packageName:id/search_wrapper") - ).waitForExists(waitingTime) + UiSelector().resourceId("$packageName:id/search_wrapper"), + ).waitForExists(waitingTime), ) private fun assertBrowserToolbarEditView() = assertTrue( mDevice.findObject( - UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view") - ).waitForExists(waitingTime) + UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view"), + ).waitForExists(waitingTime), ) private fun assertScanButton() = assertTrue( - scanButton.waitForExists(waitingTime) + scanButton.waitForExists(waitingTime), ) private fun assertSearchButton() = assertTrue( mDevice.findObject( - UiSelector().resourceId("$packageName:id/search_engines_shortcut_button") - ).waitForExists(waitingTime) + UiSelector().resourceId("$packageName:id/search_engines_shortcut_button"), + ).waitForExists(waitingTime), ) private fun assertSearchWithText() = @@ -370,8 +370,8 @@ private fun assertSearchBarEmpty() = mDevice.findObject( UiSelector() .resourceId("$packageName:id/mozac_browser_toolbar_edit_url_view") - .textContains("") - ).waitForExists(waitingTime) + .textContains(""), + ).waitForExists(waitingTime), ) fun searchScreen(interact: SearchRobot.() -> Unit): SearchRobot.Transition { @@ -387,7 +387,7 @@ private fun assertKeyboardVisibility(isExpectedToBeVisible: Boolean): () -> Unit isExpectedToBeVisible, mDevice .executeShellCommand("dumpsys input_method | grep mInputShown") - .contains("mInputShown=true") + .contains("mInputShown=true"), ) } @@ -431,7 +431,7 @@ private fun assertEngineListShortcutContains(rule: ComposeTestRule, searchEngine } } finally { mDevice.findObject( - UiSelector().textContains("Google") + UiSelector().textContains("Google"), ).waitForExists(waitingTime) rule.onNodeWithTag("mozac.awesomebar.suggestions") @@ -458,8 +458,8 @@ private fun assertDefaultSearchEngine(expectedText: String) = mDevice.findObject( UiSelector() .resourceId("$packageName:id/mozac_browser_toolbar_edit_icon") - .descriptionContains(expectedText) - ).waitForExists(waitingTime) + .descriptionContains(expectedText), + ).waitForExists(waitingTime), ) private fun assertPastedToolbarText(expectedText: String) { @@ -470,8 +470,8 @@ private fun assertPastedToolbarText(expectedText: String) { onView( allOf( withSubstring(expectedText), - withId(R.id.mozac_browser_toolbar_edit_url_view) - ) + withId(R.id.mozac_browser_toolbar_edit_url_view), + ), ).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) } @@ -482,5 +482,5 @@ private val voiceSearchButton = mDevice.findObject(UiSelector().description("Voi private val searchSuggestionsList = UiScrollable( - UiSelector().className("android.widget.ScrollView") + UiSelector().className("android.widget.ScrollView"), ) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsRobot.kt index 71e0c3d7e5..d23d71f1c0 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsRobot.kt @@ -127,7 +127,6 @@ class SettingsRobot { fun openAboutFirefoxPreview(interact: SettingsSubMenuAboutRobot.() -> Unit): SettingsSubMenuAboutRobot.Transition { - aboutFirefoxHeading().click() SettingsSubMenuAboutRobot().interact() @@ -136,7 +135,6 @@ class SettingsRobot { fun openSearchSubMenu(interact: SettingsSubMenuSearchRobot.() -> Unit): SettingsSubMenuSearchRobot.Transition { - fun searchEngineButton() = onView(withText("Search")) searchEngineButton().click() @@ -145,7 +143,6 @@ class SettingsRobot { } fun openCustomizeSubMenu(interact: SettingsSubMenuThemeRobot.() -> Unit): SettingsSubMenuThemeRobot.Transition { - fun customizeButton() = onView(withText("Customize")) customizeButton().click() @@ -154,7 +151,6 @@ class SettingsRobot { } fun openTabsSubMenu(interact: SettingsSubMenuTabsRobot.() -> Unit): SettingsSubMenuTabsRobot.Transition { - fun tabsButton() = onView(withText("Tabs")) tabsButton().click() @@ -163,7 +159,6 @@ class SettingsRobot { } fun openHomepageSubMenu(interact: SettingsSubMenuHomepageRobot.() -> Unit): SettingsSubMenuHomepageRobot.Transition { - mDevice.findObject(UiSelector().textContains("Homepage")).waitForExists(waitingTime) onView(withText(R.string.preferences_home_2)).click() @@ -172,7 +167,6 @@ class SettingsRobot { } fun openAutofillSubMenu(interact: SettingsSubMenuAutofillRobot.() -> Unit): SettingsSubMenuAutofillRobot.Transition { - mDevice.findObject(UiSelector().textContains(getStringResource(R.string.preferences_autofill))).waitForExists(waitingTime) onView(withText(R.string.preferences_autofill)).click() @@ -194,16 +188,16 @@ class SettingsRobot { fun openLanguageSubMenu( localizedText: String = getStringResource(R.string.preferences_language), - interact: SettingsSubMenuLanguageRobot.() -> Unit + interact: SettingsSubMenuLanguageRobot.() -> Unit, ): SettingsSubMenuLanguageRobot.Transition { onView(withId(R.id.recycler_view)) .perform( RecyclerViewActions.actionOnItem( hasDescendant( - withText(localizedText) + withText(localizedText), ), - ViewActions.click() - ) + ViewActions.click(), + ), ) SettingsSubMenuLanguageRobot().interact() @@ -333,8 +327,8 @@ private fun assertSettingsToolbar() = CoreMatchers.allOf( withId(R.id.navigationToolbar), hasDescendant(ViewMatchers.withContentDescription(R.string.action_bar_up_description)), - hasDescendant(withText(R.string.settings)) - ) + hasDescendant(withText(R.string.settings)), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) private fun assertGeneralHeading() { @@ -404,7 +398,7 @@ private fun assertPrivacyHeading() { private fun assertHTTPSOnlyModeButton() { scrollToElementByText(getStringResource(R.string.preferences_https_only_title)) onView( - withText(R.string.preferences_https_only_title) + withText(R.string.preferences_https_only_title), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -412,8 +406,8 @@ private fun assertHTTPSOnlyModeState(state: String) { onView( allOf( withText(R.string.preferences_https_only_title), - hasSibling(withText(state)) - ) + hasSibling(withText(state)), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -421,8 +415,8 @@ private fun assertEnhancedTrackingProtectionButton() { mDevice.wait(Until.findObject(By.text("Privacy and Security")), waitingTime) onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Enhanced Tracking Protection")) - ) + hasDescendant(withText("Enhanced Tracking Protection")), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -466,8 +460,8 @@ private fun assertDeleteBrowsingDataState(state: String) { onView( allOf( withText(R.string.preferences_delete_browsing_data_on_quit), - hasSibling(withText(state)) - ) + hasSibling(withText(state)), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -500,10 +494,10 @@ fun assertOpenLinksInAppsSwitchState(enabled: Boolean) { hasCousin( allOf( withClassName(endsWith("Switch")), - isChecked() - ) - ) - ) + isChecked(), + ), + ), + ), ) } else { openLinksInAppsButton() @@ -512,10 +506,10 @@ fun assertOpenLinksInAppsSwitchState(enabled: Boolean) { hasCousin( allOf( withClassName(endsWith("Switch")), - isNotChecked() - ) - ) - ) + isNotChecked(), + ), + ), + ), ) } } @@ -530,8 +524,8 @@ private fun assertDeveloperToolsHeading() { private fun assertAdvancedHeading() { onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Add-ons")) - ) + hasDescendant(withText("Add-ons")), + ), ) onView(withText("Add-ons")) @@ -541,8 +535,8 @@ private fun assertAdvancedHeading() { private fun assertAddonsButton() { onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Add-ons")) - ) + hasDescendant(withText("Add-ons")), + ), ) addonsManagerButton() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAboutRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAboutRobot.kt index 0e99dde703..e9d5c1bcdf 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAboutRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAboutRobot.kt @@ -90,8 +90,8 @@ private fun assertAboutToolbar() = onView( allOf( withId(R.id.navigationToolbar), - hasDescendant(withText("About $appName")) - ) + hasDescendant(withText("About $appName")), + ), ).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) private fun assertVersionNumber() { @@ -146,7 +146,7 @@ private fun assertSupport() { TestHelper.verifyUrl( "support.mozilla.org", "org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view", - R.id.mozac_browser_toolbar_url_view + R.id.mozac_browser_toolbar_url_view, ) } @@ -164,8 +164,8 @@ private fun assertCrashes() { assertTrue( mDevice.findObject( - UiSelector().textContains("No crash reports have been submitted.") - ).waitForExists(waitingTime) + UiSelector().textContains("No crash reports have been submitted."), + ).waitForExists(waitingTime), ) for (i in 1..3) { @@ -183,7 +183,7 @@ private fun assertPrivacyNotice() { TestHelper.verifyUrl( "/privacy/firefox", "org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view", - R.id.mozac_browser_toolbar_url_view + R.id.mozac_browser_toolbar_url_view, ) } @@ -197,7 +197,7 @@ private fun assertKnowYourRights() { TestHelper.verifyUrl( SupportUtils.SumoTopic.YOUR_RIGHTS.topicStr, "org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view", - R.id.mozac_browser_toolbar_url_view + R.id.mozac_browser_toolbar_url_view, ) } @@ -211,7 +211,7 @@ private fun assertLicensingInformation() { TestHelper.verifyUrl( "about:license", "org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view", - R.id.mozac_browser_toolbar_url_view + R.id.mozac_browser_toolbar_url_view, ) } @@ -238,6 +238,7 @@ class BuildDateAssertion { companion object { // this pattern represents the following date format: "Monday 12/30 @ 6:49 PM" private const val DATE_PATTERN = "EEEE M/d @ h:m a" + // private const val NUM_OF_HOURS = 1 @@ -287,7 +288,7 @@ class BuildDateAssertion { val maxDate = calendar.time calendar.add( Calendar.HOUR_OF_DAY, - hours * -2 + hours * -2, ) // Gets the minDate by subtracting from maxDate val minDate = calendar.time return updatedDate.after(minDate) && updatedDate.before(maxDate) @@ -295,7 +296,7 @@ class BuildDateAssertion { private fun LocalDateTime.isWithinRangeOf( hours: Int, - baselineDate: LocalDateTime + baselineDate: LocalDateTime, ): Boolean { val upperBound = baselineDate.plusHours(hours.toLong()) val lowerBound = baselineDate.minusHours(hours.toLong()) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAddonsManagerRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAddonsManagerRobot.kt index d7a49a8d78..47ded7ca24 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAddonsManagerRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAddonsManagerRobot.kt @@ -53,7 +53,7 @@ class SettingsSubMenuAddonsManagerRobot { fun clickInstallAddon(addonName: String) { mDevice.waitNotNull( Until.findObject(By.textContains(addonName)), - waitingTime + waitingTime, ) installButtonForAddon(addonName) @@ -66,12 +66,12 @@ class SettingsSubMenuAddonsManagerRobot { try { assertFalse( mDevice.findObject(UiSelector().text("Failed to install $addonName")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) assertTrue( mDevice.findObject(UiSelector().text("Okay, Got it")) - .waitForExists(waitingTimeLong) + .waitForExists(waitingTimeLong), ) break } catch (e: AssertionError) { @@ -93,8 +93,8 @@ class SettingsSubMenuAddonsManagerRobot { withParent(instanceOf(RelativeLayout::class.java)), hasSibling(withText("$addonName has been added to $appName")), hasSibling(withText("Open it in the menu")), - hasSibling(withText("Allow in private browsing")) - ) + hasSibling(withText("Allow in private browsing")), + ), ) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -122,7 +122,7 @@ class SettingsSubMenuAddonsManagerRobot { assertTrue( "Addon install confirmation prompt not displayed", mDevice.findObject(UiSelector().text("Allow in private browsing")) - .waitForExists(waitingTimeLong) + .waitForExists(waitingTimeLong), ) onView(withId(R.id.allow_in_private_browsing)).click() } @@ -148,7 +148,7 @@ class SettingsSubMenuAddonsManagerRobot { fun openDetailedMenuForAddon( addonName: String, - interact: SettingsSubMenuAddonsManagerAddonDetailedMenuRobot.() -> Unit + interact: SettingsSubMenuAddonsManagerAddonDetailedMenuRobot.() -> Unit, ): SettingsSubMenuAddonsManagerAddonDetailedMenuRobot.Transition { scrollToElementByText(addonName) @@ -158,10 +158,10 @@ class SettingsSubMenuAddonsManagerRobot { hasDescendant( allOf( withId(R.id.add_on_name), - withText(addonName) - ) - ) - ) + withText(addonName), + ), + ), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) .perform(click()) @@ -175,8 +175,8 @@ class SettingsSubMenuAddonsManagerRobot { allOf( withContentDescription(R.string.mozac_feature_addons_install_addon_content_description), isDescendantOfA(withId(R.id.add_on_item)), - hasSibling(hasDescendant(withText(addonName))) - ) + hasSibling(hasDescendant(withText(addonName))), + ), ) private fun assertAddonIsEnabled(addonName: String) { @@ -191,8 +191,8 @@ class SettingsSubMenuAddonsManagerRobot { onView( allOf( withId(R.id.permissions), - withText(containsString("It requires your permission to:")) - ) + withText(containsString("It requires your permission to:")), + ), ) .check(matches(isCompletelyDisplayed())) @@ -208,8 +208,8 @@ class SettingsSubMenuAddonsManagerRobot { allOf( withId(R.id.add_button), isDescendantOfA(withId(R.id.add_on_item)), - hasSibling(hasDescendant(withText(addonName))) - ) + hasSibling(hasDescendant(withText(addonName))), + ), ).check(matches(withEffectiveVisibility(Visibility.GONE))) } @@ -251,11 +251,11 @@ class SettingsSubMenuAddonsManagerRobot { hasDescendant(withText("uBlock Origin")), hasDescendant(withText("Finally, an efficient wide-spectrum content blocker. Easy on CPU and memory.")), hasDescendant(withId(R.id.rating)), - hasDescendant(withId(R.id.users_count)) - ) + hasDescendant(withId(R.id.users_count)), + ), ), - hasDescendant(withId(R.id.add_button)) - ) + hasDescendant(withId(R.id.add_button)), + ), ).check(matches(isCompletelyDisplayed())) } @@ -270,11 +270,11 @@ class SettingsSubMenuAddonsManagerRobot { hasDescendant( allOf( withId(R.id.add_on_name), - withText(addonName) - ) - ) - ) - ) + withText(addonName), + ), + ), + ), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAutofillRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAutofillRobot.kt index 23eef99d8c..f133d03d82 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAutofillRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAutofillRobot.kt @@ -50,7 +50,7 @@ class SettingsSubMenuAutofillRobot { zipCode: String, country: String, phoneNumber: String, - emailAddress: String + emailAddress: String, ) { firstNameTextInput.waitForExists(waitingTime) firstNameTextInput.setText(firstName) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuDataCollectionRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuDataCollectionRobot.kt index 3ee1873ebc..c8d469dd0b 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuDataCollectionRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuDataCollectionRobot.kt @@ -58,13 +58,12 @@ private fun goBackButton() = private fun assertNavigationToolBarHeader() = onView( allOf( withParent(withId(R.id.navigationToolbar)), - withText(R.string.preferences_data_collection) - ) + withText(R.string.preferences_data_collection), + ), ) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) private fun assertDataCollectionOptions() { - onView(withText(R.string.preference_usage_data)) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuDeleteBrowsingDataOnQuitRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuDeleteBrowsingDataOnQuitRobot.kt index 9f89cef656..fab066353e 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuDeleteBrowsingDataOnQuitRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuDeleteBrowsingDataOnQuitRobot.kt @@ -62,23 +62,23 @@ private fun goBackButton() = onView(withContentDescription("Navigate up")) private fun assertNavigationToolBarHeader() = onView( allOf( withId(R.id.navigationToolbar), - withChild(withText(R.string.preferences_delete_browsing_data_on_quit)) - ) + withChild(withText(R.string.preferences_delete_browsing_data_on_quit)), + ), ) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) private fun deleteBrowsingOnQuitButton() = onView( allOf( withParentIndex(0), - withChild(withText(R.string.preferences_delete_browsing_data_on_quit)) - ) + withChild(withText(R.string.preferences_delete_browsing_data_on_quit)), + ), ) private fun assertDeleteBrowsingOnQuitButton() = deleteBrowsingOnQuitButton() .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) private fun assertDeleteBrowsingOnQuitButtonSummary() = onView( - withText(R.string.preference_summary_delete_browsing_data_on_quit_2) + withText(R.string.preference_summary_delete_browsing_data_on_quit_2), ) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuDeleteBrowsingDataRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuDeleteBrowsingDataRobot.kt index 255e2080a8..64d91e7c32 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuDeleteBrowsingDataRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuDeleteBrowsingDataRobot.kt @@ -141,7 +141,7 @@ class SettingsSubMenuDeleteBrowsingDataRobot { fun clickCancelButtonInDialogBoxAndVerifyContentsInDialogBox() { mDevice.wait( Until.findObject(By.text("Delete browsing data")), - waitingTime + waitingTime, ) clickDeleteBrowsingDataButton() verifyDialogElements() @@ -176,8 +176,8 @@ private fun navigationToolBarHeader() = onView( allOf( withId(R.id.navigationToolbar), - withChild(withText(R.string.preferences_delete_browsing_data)) - ) + withChild(withText(R.string.preferences_delete_browsing_data)), + ), ) private fun deleteBrowsingDataButton() = onView(withId(R.id.delete_data)) @@ -288,8 +288,8 @@ private fun assertBrowsingHistoryDescription(addresses: String) = private fun assertDeleteBrowsingDataSnackbar() { assertTrue( mDevice.findObject( - UiSelector().text("Browsing data deleted") - ).waitUntilGone(waitingTime) + UiSelector().text("Browsing data deleted"), + ).waitUntilGone(waitingTime), ) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuEnhancedTrackingProtectionExceptionsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuEnhancedTrackingProtectionExceptionsRobot.kt index b66e4e08af..83f886a3b6 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuEnhancedTrackingProtectionExceptionsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuEnhancedTrackingProtectionExceptionsRobot.kt @@ -65,22 +65,22 @@ private fun assertNavigationToolBarHeader() { private fun assertExceptionDefault() = assertTrue( mDevice.findObject( - UiSelector().text("Exceptions let you disable tracking protection for selected sites.") - ).waitForExists(waitingTime) + UiSelector().text("Exceptions let you disable tracking protection for selected sites."), + ).waitForExists(waitingTime), ) private fun assertExceptionLearnMoreText() = assertTrue( mDevice.findObject( - UiSelector().text("Learn more") - ).waitForExists(waitingTime) + UiSelector().text("Learn more"), + ).waitForExists(waitingTime), ) private fun assertExceptionURL(url: String) = assertTrue( mDevice.findObject( - UiSelector().textContains(url.replace("http://", "https://")) - ).waitForExists(waitingTime) + UiSelector().textContains(url.replace("http://", "https://")), + ).waitForExists(waitingTime), ) private fun disableExceptionsButton() = diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuEnhancedTrackingProtectionRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuEnhancedTrackingProtectionRobot.kt index b857c0136f..61808b0c92 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuEnhancedTrackingProtectionRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuEnhancedTrackingProtectionRobot.kt @@ -86,13 +86,12 @@ class SettingsSubMenuEnhancedTrackingProtectionRobot { } fun openExceptions( - interact: SettingsSubMenuEnhancedTrackingProtectionExceptionsRobot.() -> Unit + interact: SettingsSubMenuEnhancedTrackingProtectionExceptionsRobot.() -> Unit, ): SettingsSubMenuEnhancedTrackingProtectionExceptionsRobot.Transition { - onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Exceptions")) - ) + hasDescendant(withText("Exceptions")), + ), ) openExceptions().click() @@ -107,8 +106,8 @@ private fun assertNavigationToolBarHeader() { onView( allOf( withParent(withId(org.mozilla.fenix.R.id.navigationToolbar)), - withText("Enhanced Tracking Protection") - ) + withText("Enhanced Tracking Protection"), + ), ) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -122,8 +121,8 @@ private fun assertEnhancedTrackingProtectionHeaderDescription() { onView( allOf( withParent(withParentIndex(0)), - withText("Keep your data to yourself. $appName protects you from many of the most common trackers that follow what you do online.") - ) + withText("Keep your data to yourself. $appName protects you from many of the most common trackers that follow what you do online."), + ), ) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -132,8 +131,8 @@ private fun assertLearnMoreText() { onView( allOf( withParent(withParentIndex(0)), - withText("Learn more") - ) + withText("Learn more"), + ), ) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -142,8 +141,8 @@ private fun assertEnhancedTrackingProtectionTextWithSwitchWidget() { onView( allOf( withParentIndex(1), - withChild(withText("Enhanced Tracking Protection")) - ) + withChild(withText("Enhanced Tracking Protection")), + ), ) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -172,26 +171,26 @@ private fun assertTrackingProtectionSwitchEnabled() { onView(withResourceName("switch_widget")).check( matches( isChecked( - true - ) - ) + true, + ), + ), ) } private fun assertRadioButtonDefaults() { onView( - withText("Strict") + withText("Strict"), ).assertIsChecked(false) onView( allOf( withId(org.mozilla.fenix.R.id.radio_button), - hasSibling(withText("Standard (default)")) - ) + hasSibling(withText("Standard (default)")), + ), ).assertIsChecked(true) onView( - withText("Custom") + withText("Custom"), ).assertIsChecked(false) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuHomepageRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuHomepageRobot.kt index 0b065ca0ce..18953d0e42 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuHomepageRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuHomepageRobot.kt @@ -65,8 +65,8 @@ class SettingsSubMenuHomepageRobot { assertTrue( mDevice.findObject( UiSelector() - .textContains(expectedText) - ).waitForExists(waitingTimeShort) + .textContains(expectedText), + ).waitForExists(waitingTimeShort), ) fun verifySponsoredShortcutsCheckBox(checked: Boolean) { @@ -78,11 +78,11 @@ class SettingsSubMenuHomepageRobot { withChild( allOf( withClassName(endsWith("CheckBox")), - isChecked() - ) - ) - ) - ) + isChecked(), + ), + ), + ), + ), ) } else { sponsoredShortcuts() @@ -92,11 +92,11 @@ class SettingsSubMenuHomepageRobot { withChild( allOf( withClassName(endsWith("CheckBox")), - isNotChecked() - ) - ) - ) - ) + isNotChecked(), + ), + ), + ), + ), ) } } @@ -146,8 +146,8 @@ private fun homepageButton() = allOf( withId(R.id.title), withText(R.string.opening_screen_homepage), - hasSibling(withId(R.id.radio_button)) - ) + hasSibling(withId(R.id.radio_button)), + ), ) private fun lastTabButton() = @@ -155,8 +155,8 @@ private fun lastTabButton() = allOf( withId(R.id.title), withText(R.string.opening_screen_last_tab), - hasSibling(withId(R.id.radio_button)) - ) + hasSibling(withId(R.id.radio_button)), + ), ) private fun homepageAfterFourHoursButton() = @@ -164,8 +164,8 @@ private fun homepageAfterFourHoursButton() = allOf( withId(R.id.title), withText(R.string.opening_screen_after_four_hours_of_inactivity), - hasSibling(withId(R.id.radio_button)) - ) + hasSibling(withId(R.id.radio_button)), + ), ) private fun goBackButton() = onView(allOf(withContentDescription(R.string.action_bar_up_description))) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLanguageRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLanguageRobot.kt index 7724f98e6f..3a2dfd8eac 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLanguageRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLanguageRobot.kt @@ -40,7 +40,7 @@ class SettingsSubMenuLanguageRobot { languagesList .getChildByText(UiSelector().text(language), language, true) .getFromParent(UiSelector().resourceId("$packageName:id/locale_selected_icon")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) } @@ -84,7 +84,7 @@ private val languagesList = UiScrollable( UiSelector() .resourceId("$packageName:id/locale_list") - .scrollable(true) + .scrollable(true), ) private fun language(name: String) = mDevice.findObject(UiSelector().text(name)) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLoginsAndPasswordRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLoginsAndPasswordRobot.kt index f1389e1e47..103f6e5fea 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLoginsAndPasswordRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLoginsAndPasswordRobot.kt @@ -101,9 +101,9 @@ private fun assertDefaultValueAutofillLogins(context: Context) = onView( ViewMatchers.withText( context.getString( R.string.preferences_passwords_autofill2, - context.getString(R.string.app_name) - ) - ) + context.getString(R.string.app_name), + ), + ), ) .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot.kt index 1402772692..5b0ff7d2b3 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot.kt @@ -33,7 +33,7 @@ class SettingsSubMenuLoginsAndPasswordsSavedLoginsRobot { fun verifySavedLoginsAfterSync() { mDevice.waitNotNull( Until.findObjects(By.text("https://accounts.google.com")), - TestAssetHelper.waitingTime + TestAssetHelper.waitingTime, ) assertSavedLoginAppears() } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuPrivateBrowsingRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuPrivateBrowsingRobot.kt index 2c5e30dfa1..8ce3e9d9cf 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuPrivateBrowsingRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuPrivateBrowsingRobot.kt @@ -53,7 +53,7 @@ class SettingsSubMenuPrivateBrowsingRobot { fun cancelPrivateShortcutAddition() { mDevice.wait( Until.findObject(text("Add private browsing shortcut")), - waitingTime + waitingTime, ) addPrivateBrowsingShortcutButton().click() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { @@ -65,7 +65,7 @@ class SettingsSubMenuPrivateBrowsingRobot { fun addPrivateShortcutToHomescreen() { mDevice.wait( Until.findObject(text("Add private browsing shortcut")), - waitingTime + waitingTime, ) addPrivateBrowsingShortcutButton().click() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { @@ -95,8 +95,8 @@ private fun assertNavigationToolBarHeader() { onView( CoreMatchers.allOf( withId(R.id.navigationToolbar), - withChild(withText(R.string.preferences_private_browsing_options)) - ) + withChild(withText(R.string.preferences_private_browsing_options)), + ), ) .check((matches(withEffectiveVisibility(Visibility.VISIBLE)))) } @@ -122,7 +122,7 @@ private fun privateBrowsingShortcutIcon() = mDevice.findObject(text("Private $ap private fun assertAddPrivateBrowsingShortcutButton() { mDevice.wait( Until.findObject(text("Add private browsing shortcut")), - waitingTime + waitingTime, ) addPrivateBrowsingShortcutButton() .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSearchRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSearchRobot.kt index ea8709818e..935b8b70d0 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSearchRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSearchRobot.kt @@ -54,8 +54,8 @@ class SettingsSubMenuSearchRobot { fun toggleVoiceSearch() { onView(withId(androidx.preference.R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Show voice search")) - ) + hasDescendant(withText("Show voice search")), + ), ) onView(withText("Show voice search")).perform(click()) } @@ -63,8 +63,8 @@ class SettingsSubMenuSearchRobot { fun switchSearchHistoryToggle() { onView(withId(androidx.preference.R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Search browsing history")) - ) + hasDescendant(withText("Search browsing history")), + ), ) searchHistoryToggle.click() } @@ -72,8 +72,8 @@ class SettingsSubMenuSearchRobot { fun switchSearchBookmarksToggle() { onView(withId(androidx.preference.R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Search bookmarks")) - ) + hasDescendant(withText("Search bookmarks")), + ), ) searchBookmarksToggle.click() } @@ -88,8 +88,8 @@ class SettingsSubMenuSearchRobot { addSearchEngineSaveButton().click() assertTrue( mDevice.findObject( - UiSelector().textContains("Default search engine") - ).waitForExists(waitingTime) + UiSelector().textContains("Default search engine"), + ).waitForExists(waitingTime), ) } @@ -111,16 +111,16 @@ class SettingsSubMenuSearchRobot { mDevice.findObject( UiSelector() .resourceId("$packageName:id/edit_engine_name") - .text(engineName) - ).waitForExists(waitingTime) + .text(engineName), + ).waitForExists(waitingTime), ) assertTrue( mDevice.findObject( UiSelector() .resourceId("$packageName:id/edit_search_string") - .text(engineURL) - ).waitForExists(waitingTime) + .text(engineURL), + ).waitForExists(waitingTime), ) } catch (e: AssertionError) { println("The name or the search string were not set properly") @@ -139,23 +139,23 @@ class SettingsSubMenuSearchRobot { mDevice.findObject( UiSelector() .resourceId("$packageName:id/edit_engine_name") - .text(engineName) - ).waitForExists(waitingTime) + .text(engineName), + ).waitForExists(waitingTime), ) assertTrue( mDevice.findObject( UiSelector() .resourceId("$packageName:id/edit_search_string") - .text(engineURL) - ).waitForExists(waitingTime) + .text(engineURL), + ).waitForExists(waitingTime), ) } } fun openEngineOverflowMenu(searchEngineName: String) { mDevice.findObject( - UiSelector().resourceId("org.mozilla.fenix.debug:id/overflow_menu") + UiSelector().resourceId("org.mozilla.fenix.debug:id/overflow_menu"), ).waitForExists(waitingTime) threeDotMenu(searchEngineName).click() } @@ -166,8 +166,8 @@ class SettingsSubMenuSearchRobot { onView(withId(R.id.save_button)).click() assertTrue( mDevice.findObject( - UiSelector().textContains("Saved") - ).waitForExists(waitingTime) + UiSelector().textContains("Saved"), + ).waitForExists(waitingTime), ) } @@ -192,8 +192,8 @@ private fun assertSearchToolbar() = allOf( withId(R.id.navigationToolbar), hasDescendant(withContentDescription(R.string.action_bar_up_description)), - hasDescendant(withText(R.string.preferences_search)) - ) + hasDescendant(withText(R.string.preferences_search)), + ), ).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) private fun assertDefaultSearchEngineHeader() = @@ -218,8 +218,8 @@ private fun assertSearchEngineList() { private fun assertShowSearchSuggestions() { onView(withId(androidx.preference.R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Show search suggestions")) - ) + hasDescendant(withText("Show search suggestions")), + ), ) onView(withText("Show search suggestions")) .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) @@ -228,8 +228,8 @@ private fun assertShowSearchSuggestions() { private fun assertShowSearchShortcuts() { onView(withId(androidx.preference.R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Show search engines")) - ) + hasDescendant(withText("Show search engines")), + ), ) onView(withText("Show search engines")) .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) @@ -238,8 +238,8 @@ private fun assertShowSearchShortcuts() { private fun assertShowClipboardSuggestions() { onView(withId(androidx.preference.R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Show clipboard suggestions")) - ) + hasDescendant(withText("Show clipboard suggestions")), + ), ) onView(withText("Show clipboard suggestions")) .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) @@ -248,8 +248,8 @@ private fun assertShowClipboardSuggestions() { private fun assertSearchBrowsingHistory() { onView(withId(androidx.preference.R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Search browsing history")) - ) + hasDescendant(withText("Search browsing history")), + ), ) searchHistoryToggle .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) @@ -260,8 +260,8 @@ private val searchHistoryToggle = onView(withText("Search browsing history")) private fun assertSearchBookmarks() { onView(withId(androidx.preference.R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Search bookmarks")) - ) + hasDescendant(withText("Search bookmarks")), + ), ) searchBookmarksToggle .check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) @@ -278,8 +278,8 @@ private fun selectSearchEngine(searchEngine: String) { private fun toggleShowSearchSuggestions() { onView(withId(androidx.preference.R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Show search suggestions")) - ) + hasDescendant(withText("Show search suggestions")), + ), ) onView(withText("Show search suggestions")) @@ -289,8 +289,8 @@ private fun toggleShowSearchSuggestions() { private fun toggleShowSearchShortcuts() { onView(withId(androidx.preference.R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Show search engines")) - ) + hasDescendant(withText("Show search engines")), + ), ) onView(withText("Show search engines")) @@ -318,6 +318,6 @@ private fun threeDotMenu(searchEngineName: String) = onView( allOf( withId(R.id.overflow_menu), - withParent(withChild(withText(searchEngineName))) - ) + withParent(withChild(withText(searchEngineName))), + ), ) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSitePermissionsCommonRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSitePermissionsCommonRobot.kt index 4d7db0a4bf..b64e4ad317 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSitePermissionsCommonRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSitePermissionsCommonRobot.kt @@ -124,22 +124,22 @@ class SettingsSubMenuSitePermissionsCommonRobot { fun verifySystemGrantedPermission(permissionCategory: String) { assertTrue( mDevice.findObject( - UiSelector().className("android.widget.RelativeLayout") + UiSelector().className("android.widget.RelativeLayout"), ).getChild( UiSelector() .resourceId("android:id/title") - .textContains(permissionCategory) - ).waitForExists(waitingTime) + .textContains(permissionCategory), + ).waitForExists(waitingTime), ) assertTrue( mDevice.findObject( - UiSelector().className("android.widget.RelativeLayout") + UiSelector().className("android.widget.RelativeLayout"), ).getChild( UiSelector() .resourceId("android:id/summary") - .textContains("Only while app is in use") - ).waitForExists(waitingTime) + .textContains("Only while app is in use"), + ).waitForExists(waitingTime), ) } @@ -166,7 +166,6 @@ private fun assertVideoAndAudioBlockedRecommended() = onView(withId(R.id.fourth_ .check((matches(withEffectiveVisibility(Visibility.VISIBLE)))) private fun assertCheckAutoPayRadioButtonDefault() { - // Allow audio and video onView(withId(R.id.block_radio)) .assertIsChecked(isChecked = false) @@ -199,8 +198,8 @@ private fun assertBlockedByAndroid() { blockedByAndroidContainer().waitForExists(waitingTime) assertTrue( mDevice.findObject( - UiSelector().textContains(getStringResource(R.string.phone_feature_blocked_by_android)) - ).waitForExists(waitingTimeShort) + UiSelector().textContains(getStringResource(R.string.phone_feature_blocked_by_android)), + ).waitForExists(waitingTimeShort), ) } @@ -208,8 +207,8 @@ private fun assertUnblockedByAndroid() { blockedByAndroidContainer().waitUntilGone(waitingTime) assertFalse( mDevice.findObject( - UiSelector().textContains(getStringResource(R.string.phone_feature_blocked_by_android)) - ).waitForExists(waitingTimeShort) + UiSelector().textContains(getStringResource(R.string.phone_feature_blocked_by_android)), + ).waitForExists(waitingTimeShort), ) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSitePermissionsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSitePermissionsRobot.kt index 5284566ae6..3c119cd33f 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSitePermissionsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSitePermissionsRobot.kt @@ -36,13 +36,12 @@ class SettingsSubMenuSitePermissionsRobot { } fun openAutoPlay( - interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit + interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit, ): SettingsSubMenuSitePermissionsCommonRobot.Transition { - onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Autoplay")) - ) + hasDescendant(withText("Autoplay")), + ), ) openAutoPlay().click() @@ -52,13 +51,12 @@ class SettingsSubMenuSitePermissionsRobot { } fun openCamera( - interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit + interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit, ): SettingsSubMenuSitePermissionsCommonRobot.Transition { - onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Camera")) - ) + hasDescendant(withText("Camera")), + ), ) openCamera().click() @@ -68,13 +66,12 @@ class SettingsSubMenuSitePermissionsRobot { } fun openLocation( - interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit + interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit, ): SettingsSubMenuSitePermissionsCommonRobot.Transition { - onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Location")) - ) + hasDescendant(withText("Location")), + ), ) openLocation().click() @@ -84,13 +81,12 @@ class SettingsSubMenuSitePermissionsRobot { } fun openMicrophone( - interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit + interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit, ): SettingsSubMenuSitePermissionsCommonRobot.Transition { - onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Microphone")) - ) + hasDescendant(withText("Microphone")), + ), ) openMicrophone().click() @@ -100,13 +96,12 @@ class SettingsSubMenuSitePermissionsRobot { } fun openNotification( - interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit + interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit, ): SettingsSubMenuSitePermissionsCommonRobot.Transition { - onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Notification")) - ) + hasDescendant(withText("Notification")), + ), ) openNotification().click() @@ -116,13 +111,12 @@ class SettingsSubMenuSitePermissionsRobot { } fun openPersistentStorage( - interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit + interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit, ): SettingsSubMenuSitePermissionsCommonRobot.Transition { - onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Persistent Storage")) - ) + hasDescendant(withText("Persistent Storage")), + ), ) openPersistentStorage().click() @@ -132,13 +126,12 @@ class SettingsSubMenuSitePermissionsRobot { } fun openExceptions( - interact: SettingsSubMenuSitePermissionsExceptionsRobot.() -> Unit + interact: SettingsSubMenuSitePermissionsExceptionsRobot.() -> Unit, ): SettingsSubMenuSitePermissionsExceptionsRobot.Transition { - onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - hasDescendant(withText("Exceptions")) - ) + hasDescendant(withText("Exceptions")), + ), ) openExceptions().click() @@ -152,7 +145,6 @@ class SettingsSubMenuSitePermissionsRobot { .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) private fun assertSitePermissionsSubMenuItems() { - onView(withText("Autoplay")) .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) @@ -164,24 +156,24 @@ class SettingsSubMenuSitePermissionsRobot { "Blocked by Android" onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - allOf(hasDescendant(withText("Camera")), hasDescendant(withText(cameraText))) - ) + allOf(hasDescendant(withText("Camera")), hasDescendant(withText(cameraText))), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) val locationText = "Blocked by Android" onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - allOf(hasDescendant(withText("Location")), hasDescendant(withText(locationText))) - ) + allOf(hasDescendant(withText("Location")), hasDescendant(withText(locationText))), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) val microphoneText = "Blocked by Android" onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - allOf(hasDescendant(withText("Microphone")), hasDescendant(withText(microphoneText))) - ) + allOf(hasDescendant(withText("Microphone")), hasDescendant(withText(microphoneText))), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) onView(withText("Notification")) @@ -192,8 +184,8 @@ class SettingsSubMenuSitePermissionsRobot { onView(withId(R.id.recycler_view)).perform( RecyclerViewActions.scrollTo( - allOf(hasDescendant(withText("Notification")), hasDescendant(withText(notificationText))) - ) + allOf(hasDescendant(withText("Notification")), hasDescendant(withText(notificationText))), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) onView(withText("Persistent Storage")) @@ -206,9 +198,9 @@ class SettingsSubMenuSitePermissionsRobot { RecyclerViewActions.scrollTo( allOf( hasDescendant(withText("Persistent Storage")), - hasDescendant(withText(persistentStorageText)) - ) - ) + hasDescendant(withText(persistentStorageText)), + ), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsTurnOnSyncRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsTurnOnSyncRobot.kt index dd0dc3dd5b..7bee7c53ec 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsTurnOnSyncRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsTurnOnSyncRobot.kt @@ -56,6 +56,6 @@ private fun assertTurnOnSyncToolbarTitle() = onView( allOf( withParent(withId(R.id.navigationToolbar)), - withText(R.string.preferences_sync_2) - ) + withText(R.string.preferences_sync_2), + ), ).check(matches(isDisplayed())) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ShareOverlayRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ShareOverlayRobot.kt index 1603d0d7e9..5c7b6c7c35 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ShareOverlayRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ShareOverlayRobot.kt @@ -35,9 +35,9 @@ class ShareOverlayRobot { matches( allOf( hasSibling(withId(R.id.share_tab_favicon)), - hasSibling(withId(R.id.share_tab_url)) - ) - ) + hasSibling(withId(R.id.share_tab_url)), + ), + ), ) } } @@ -66,8 +66,8 @@ class ShareOverlayRobot { Intents.intended( allOf( IntentMatchers.hasExtra(Intent.EXTRA_TEXT, text), - IntentMatchers.hasExtra(Intent.EXTRA_SUBJECT, subject) - ) + IntentMatchers.hasExtra(Intent.EXTRA_SUBJECT, subject), + ), ) } @@ -83,8 +83,8 @@ private fun sendToDeviceTitle() = onView( allOf( withText("SEND TO DEVICE"), - withResourceName("accountHeaderText") - ) + withResourceName("accountHeaderText"), + ), ) private fun assertSendToDeviceTitle() = sendToDeviceTitle() @@ -94,8 +94,8 @@ private fun shareALinkTitle() = onView( allOf( withText("ALL ACTIONS"), - withResourceName("apps_link_header") - ) + withResourceName("apps_link_header"), + ), ) private fun assertShareALinkTitle() = shareALinkTitle() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SitePermissionsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SitePermissionsRobot.kt index fc09fb4ef4..3e35bca01f 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SitePermissionsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SitePermissionsRobot.kt @@ -31,7 +31,7 @@ class SitePermissionsRobot { fun verifyMicrophonePermissionPrompt(url: String) { assertTrue( mDevice.findObject(UiSelector().text("Allow $url to use your microphone?")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) assertTrue(denyPagePermissionButton.text.equals("Don’t allow")) assertTrue(allowPagePermissionButton.text.equals("Allow")) @@ -40,7 +40,7 @@ class SitePermissionsRobot { fun verifyCameraPermissionPrompt(url: String) { assertTrue( mDevice.findObject(UiSelector().text("Allow $url to use your camera?")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) assertTrue(denyPagePermissionButton.text.equals("Don’t allow")) assertTrue(allowPagePermissionButton.text.equals("Allow")) @@ -49,7 +49,7 @@ class SitePermissionsRobot { fun verifyAudioVideoPermissionPrompt(url: String) { assertTrue( mDevice.findObject(UiSelector().text("Allow $url to use your camera and microphone?")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) assertTrue(denyPagePermissionButton.text.equals("Don’t allow")) assertTrue(allowPagePermissionButton.text.equals("Allow")) @@ -58,7 +58,7 @@ class SitePermissionsRobot { fun verifyLocationPermissionPrompt(url: String) { assertTrue( mDevice.findObject(UiSelector().text("Allow $url to use your location?")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) assertTrue(denyPagePermissionButton.text.equals("Don’t allow")) assertTrue(allowPagePermissionButton.text.equals("Allow")) @@ -68,7 +68,7 @@ class SitePermissionsRobot { if (!blocked) { assertTrue( mDevice.findObject(UiSelector().text("Allow $url to send notifications?")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) assertTrue(denyPagePermissionButton.text.equals("Never")) assertTrue(allowPagePermissionButton.text.equals("Always")) @@ -77,7 +77,7 @@ class SitePermissionsRobot { the Notifications permission prompt won't be displayed anymore */ assertFalse( mDevice.findObject(UiSelector().text("Allow $url to send notifications?")) - .exists() + .exists(), ) } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SyncSignInRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SyncSignInRobot.kt index 47cb2d15b2..403f38730b 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SyncSignInRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SyncSignInRobot.kt @@ -53,7 +53,7 @@ private fun assertTurnOnSyncMenu() { mDevice.findObject( UiSelector() .resourceId("$packageName:id/signInScanButton") - .resourceId("$packageName:id/signInEmailButton") - ).waitForExists(waitingTime) + .resourceId("$packageName:id/signInEmailButton"), + ).waitForExists(waitingTime), ) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SystemSettingsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SystemSettingsRobot.kt index 8cde2985a5..22520a3cd3 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SystemSettingsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SystemSettingsRobot.kt @@ -43,6 +43,6 @@ private fun assertSystemNotificationsView() { .waitForExists(waitingTime) assertTrue( mDevice.findObject(UiSelector().textContains("All ${TestHelper.appName} notifications")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) } diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/TabDrawerRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/TabDrawerRobot.kt index be5cdcc51c..57528dae29 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/TabDrawerRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/TabDrawerRobot.kt @@ -61,7 +61,7 @@ class TabDrawerRobot { fun verifyBrowserTabsTrayURL(url: String) { mDevice.waitNotNull( Until.findObject(By.res("$packageName:id/mozac_browser_tabstray_url")), - waitingTime + waitingTime, ) onView(withId(R.id.mozac_browser_tabstray_url)) .check(matches(withText(containsString(url)))) @@ -70,10 +70,13 @@ class TabDrawerRobot { fun verifyNormalBrowsingButtonIsDisplayed() = assertNormalBrowsingButton() fun verifyNormalBrowsingButtonIsSelected(isSelected: Boolean) = assertNormalBrowsingButtonIsSelected(isSelected) + fun verifyPrivateBrowsingButtonIsSelected(isSelected: Boolean) = assertPrivateBrowsingButtonIsSelected(isSelected) + fun verifySyncedTabsButtonIsSelected(isSelected: Boolean) = assertSyncedTabsButtonIsSelected(isSelected) + fun verifyExistingOpenTabs(vararg titles: String) = assertExistingOpenTabs(*titles) fun verifyCloseTabsButton(title: String) = assertCloseTabsButton(title) @@ -127,8 +130,8 @@ class TabDrawerRobot { fun verifySnackBarText(expectedText: String) { assertTrue( mDevice.findObject( - UiSelector().text(expectedText) - ).waitForExists(waitingTime) + UiSelector().text(expectedText), + ).waitForExists(waitingTime), ) } @@ -137,7 +140,7 @@ class TabDrawerRobot { mDevice.findObject( UiSelector() .resourceId("$packageName:id/snackbar_btn") - .text(expectedText) + .text(expectedText), ) snackBarButton.waitForExists(waitingTime) @@ -147,21 +150,22 @@ class TabDrawerRobot { fun verifyTabMediaControlButtonState(action: String) { try { mDevice.findObject( - UiSelector().resourceId("$packageName:id/tab_tray_empty_view") + UiSelector().resourceId("$packageName:id/tab_tray_empty_view"), ).waitUntilGone(waitingTime) mDevice.findObject( - UiSelector().resourceId("$packageName:id/tab_tray_grid_item") + UiSelector().resourceId("$packageName:id/tab_tray_grid_item"), ).waitForExists(waitingTime) mDevice.findObject( UiSelector() .resourceId("$packageName:id/play_pause_button") - .descriptionContains(action) + .descriptionContains(action), ).waitForExists(waitingTime) assertTrue( - mDevice.findObject(UiSelector().descriptionContains(action)).waitForExists(waitingTime) + mDevice.findObject(UiSelector().descriptionContains(action)) + .waitForExists(waitingTime), ) } catch (e: AssertionFailedError) { // In some cases the tab media button isn't updated after performing an action on it @@ -171,7 +175,7 @@ class TabDrawerRobot { mDevice.pressBack() mDevice.findObject( UiSelector() - .resourceId("$packageName:id/toolbar") + .resourceId("$packageName:id/toolbar"), ).waitForExists(waitingTime) browserScreen { @@ -180,21 +184,22 @@ class TabDrawerRobot { tabMediaControlButton().click() mDevice.findObject( - UiSelector().resourceId("$packageName:id/tab_tray_empty_view") + UiSelector().resourceId("$packageName:id/tab_tray_empty_view"), ).waitUntilGone(waitingTime) mDevice.findObject( - UiSelector().resourceId("$packageName:id/tab_tray_grid_item") + UiSelector().resourceId("$packageName:id/tab_tray_grid_item"), ).waitForExists(waitingTime) mDevice.findObject( UiSelector() .resourceId("$packageName:id/play_pause_button") - .descriptionContains(action) + .descriptionContains(action), ).waitForExists(waitingTime) assertTrue( - mDevice.findObject(UiSelector().descriptionContains(action)).waitForExists(waitingTime) + mDevice.findObject(UiSelector().descriptionContains(action)) + .waitForExists(waitingTime), ) } } @@ -205,9 +210,9 @@ class TabDrawerRobot { Until.findObjects( By .res("$packageName:id/play_pause_button") - .descContains(action) + .descContains(action), ), - waitingTime + waitingTime, ) tabMediaControlButton().click() @@ -235,7 +240,7 @@ class TabDrawerRobot { fun longClickTab(title: String) { mDevice.waitNotNull( findObject(text(title)), - waitingTime + waitingTime, ) tab(title).perform(longClick()) @@ -244,7 +249,7 @@ class TabDrawerRobot { fun createCollection( vararg tabTitles: String, collectionName: String, - firstCollection: Boolean = true + firstCollection: Boolean = true, ) { tabDrawer { clickSelectTabsOption() @@ -252,8 +257,9 @@ class TabDrawerRobot { selectTab(tab, tabTitles.indexOf(tab) + 1) } }.clickSaveCollection { - if (!firstCollection) + if (!firstCollection) { clickAddNewCollection() + } typeCollectionNameAndSave(collectionName) } } @@ -261,7 +267,7 @@ class TabDrawerRobot { fun verifyTabsMultiSelectionCounter(numOfTabs: Int) { assertTrue( mDevice.findObject(UiSelector().text("$numOfTabs selected")) - .waitForExists(waitingTime) + .waitForExists(waitingTime), ) } @@ -279,7 +285,7 @@ class TabDrawerRobot { tabsCounter().click() mDevice.waitNotNull( Until.findObject(By.res("$packageName:id/tab_layout")), - waitingTime + waitingTime, ) TabDrawerRobot().interact() @@ -290,7 +296,7 @@ class TabDrawerRobot { mDevice.waitForIdle(waitingTime) onView(withId(R.id.handle)).perform( - click() + click(), ) BrowserRobot().interact() return BrowserRobot.Transition() @@ -332,7 +338,10 @@ class TabDrawerRobot { return BrowserRobot.Transition() } - fun openTabFromGroup(title: String, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition { + fun openTabFromGroup( + title: String, + interact: BrowserRobot.() -> Unit, + ): BrowserRobot.Transition { val tab = UiScrollable(UiSelector().resourceId("$packageName:id/tab_group_list")) .setAsHorizontalList() .getChildByText( @@ -340,7 +349,7 @@ class TabDrawerRobot { .resourceId("$packageName:id/mozac_browser_tabstray_title") .textContains(title), title, - true + true, ) tab.click() @@ -357,20 +366,22 @@ class TabDrawerRobot { } fun advanceToHalfExpandedState(interact: TabDrawerRobot.() -> Unit): Transition { - onView(withId(R.id.tab_wrapper)).perform(object : ViewAction { - override fun getDescription(): String { - return "Advance a BottomSheetBehavior to STATE_HALF_EXPANDED" - } + onView(withId(R.id.tab_wrapper)).perform( + object : ViewAction { + override fun getDescription(): String { + return "Advance a BottomSheetBehavior to STATE_HALF_EXPANDED" + } - override fun getConstraints(): Matcher { - return ViewMatchers.isAssignableFrom(View::class.java) - } + override fun getConstraints(): Matcher { + return ViewMatchers.isAssignableFrom(View::class.java) + } - override fun perform(uiController: UiController?, view: View?) { - val behavior = BottomSheetBehavior.from(view!!) - behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED - } - }) + override fun perform(uiController: UiController?, view: View?) { + val behavior = BottomSheetBehavior.from(view!!) + behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED + } + }, + ) TabDrawerRobot().interact() return Transition() } @@ -380,19 +391,21 @@ class TabDrawerRobot { var behavior: BottomSheetBehavior<*>? = null // Null check here since it's possible that the view is already animated away from the screen. - onView(withId(R.id.tab_wrapper))?.perform(object : ViewAction { - override fun getDescription(): String { - return "Postpone actions to after the BottomSheetBehavior has settled" - } + onView(withId(R.id.tab_wrapper))?.perform( + object : ViewAction { + override fun getDescription(): String { + return "Postpone actions to after the BottomSheetBehavior has settled" + } - override fun getConstraints(): Matcher { - return ViewMatchers.isAssignableFrom(View::class.java) - } + override fun getConstraints(): Matcher { + return ViewMatchers.isAssignableFrom(View::class.java) + } - override fun perform(uiController: UiController?, view: View?) { - behavior = BottomSheetBehavior.from(view!!) - } - }) + override fun perform(uiController: UiController?, view: View?) { + behavior = BottomSheetBehavior.from(view!!) + } + }, + ) behavior?.let { runWithIdleRes(BottomSheetBehaviorStateIdlingResource(it)) { @@ -405,12 +418,11 @@ class TabDrawerRobot { fun openRecentlyClosedTabs(interact: RecentlyClosedTabsRobot.() -> Unit): RecentlyClosedTabsRobot.Transition { - threeDotMenu().click() mDevice.waitNotNull( Until.findObject(text("Recently closed tabs")), - waitingTime + waitingTime, ) val menuRecentlyClosedTabs = mDevice.findObject(text("Recently closed tabs")) @@ -440,25 +452,28 @@ private fun tabMediaControlButton() = private fun closeTabButton() = mDevice.findObject(UiSelector().resourceId("$packageName:id/mozac_browser_tabstray_close")) + private fun assertCloseTabsButton(title: String) = assertTrue( mDevice.findObject( UiSelector() .resourceId("$packageName:id/mozac_browser_tabstray_close") - .descriptionContains("Close tab $title") - ).waitForExists(waitingTime) + .descriptionContains("Close tab $title"), + ).waitForExists(waitingTime), ) private fun normalBrowsingButton() = onView( anyOf( withContentDescription(containsString("open tabs. Tap to switch tabs.")), - withContentDescription(containsString("open tab. Tap to switch tabs.")) - ) + withContentDescription(containsString("open tab. Tap to switch tabs.")), + ), ) private fun privateBrowsingButton() = onView(withContentDescription("Private tabs")) private fun syncedTabsButton() = onView(withContentDescription("Synced tabs")) -private fun newTabButton() = mDevice.findObject(UiSelector().resourceId("$packageName:id/new_tab_button")) +private fun newTabButton() = + mDevice.findObject(UiSelector().resourceId("$packageName:id/new_tab_button")) + private fun threeDotMenu() = onView(withId(R.id.tab_tray_overflow)) private fun assertExistingOpenTabs(vararg tabTitles: String) { @@ -469,7 +484,7 @@ private fun assertExistingOpenTabs(vararg tabTitles: String) { tabsList .getChildByText(UiSelector().text(title), title, true) assertTrue( - tabItem(title).waitForExists(waitingTimeLong) + tabItem(title).waitForExists(waitingTimeLong), ) } } @@ -477,13 +492,13 @@ private fun assertExistingOpenTabs(vararg tabTitles: String) { private fun assertExistingTabList() { mDevice.findObject( - UiSelector().resourceId("$packageName:id/tabsTray") + UiSelector().resourceId("$packageName:id/tabsTray"), ).waitForExists(waitingTime) assertTrue( mDevice.findObject( - UiSelector().resourceId("$packageName:id/tab_item") - ).waitForExists(waitingTime) + UiSelector().resourceId("$packageName:id/tab_item"), + ).waitForExists(waitingTime), ) } @@ -491,32 +506,32 @@ private fun assertNoOpenTabsInNormalBrowsing() = onView( allOf( withId(R.id.tab_tray_empty_view), - withText(R.string.no_open_tabs_description) - ) + withText(R.string.no_open_tabs_description), + ), ).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) private fun assertNoOpenTabsInPrivateBrowsing() = onView( allOf( withId(R.id.tab_tray_empty_view), - withText(R.string.no_private_tabs_description) - ) + withText(R.string.no_private_tabs_description), + ), ).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) private fun assertNormalBrowsingNewTabButton() = onView( allOf( withId(R.id.new_tab_button), - withContentDescription(R.string.add_tab) - ) + withContentDescription(R.string.add_tab), + ), ).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) private fun assertPrivateBrowsingNewTabButton() = onView( allOf( withId(R.id.new_tab_button), - withContentDescription(R.string.add_private_tab) - ) + withContentDescription(R.string.add_private_tab), + ), ).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) private fun assertSelectTabsButton() = @@ -587,19 +602,21 @@ private fun assertSyncedTabsButtonIsSelected(isSelected: Boolean) { private fun assertTabThumbnail() { assertTrue( mDevice.findObject( - UiSelector().resourceId("$packageName:id/mozac_browser_tabstray_thumbnail") - ).waitForExists(waitingTime) + UiSelector().resourceId("$packageName:id/mozac_browser_tabstray_thumbnail"), + ).waitForExists(waitingTime), ) } -private val tabsList = UiScrollable(UiSelector().className("androidx.recyclerview.widget.RecyclerView")) + +private val tabsList = + UiScrollable(UiSelector().className("androidx.recyclerview.widget.RecyclerView")) // This Espresso tab selector is used for actions that UIAutomator doesn't handle very well: swipe and long-tap private fun tab(title: String) = onView( allOf( withId(R.id.mozac_browser_tabstray_title), - withText(title) - ) + withText(title), + ), ) // This tab selector is used for actions that involve waiting and asserting the existence of the view @@ -607,7 +624,7 @@ private fun tabItem(title: String) = mDevice.findObject( UiSelector() .resourceId("$packageName:id/tab_item") - .childSelector(UiSelector().text(title)) + .childSelector(UiSelector().text(title)), ) private fun tabsCounter() = onView(withId(R.id.tab_button)) @@ -618,16 +635,16 @@ private fun tabsSettingsButton() = onView( allOf( withId(R.id.simple_text), - withText(R.string.tab_tray_menu_tab_settings) - ) + withText(R.string.tab_tray_menu_tab_settings), + ), ) private fun recentlyClosedTabsButton() = onView( allOf( withId(R.id.simple_text), - withText(R.string.tab_tray_menu_recently_closed) - ) + withText(R.string.tab_tray_menu_recently_closed), + ), ) private fun visibleOrGone(visibility: Boolean) = diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt index e166e945e2..865e17adaf 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt @@ -85,7 +85,9 @@ class ThreeDotMenuMainRobot { expandMenu() if (state) { desktopSiteButton().check(matches(isChecked())) - } else desktopSiteButton().check(matches(not(isChecked()))) + } else { + desktopSiteButton().check(matches(not(isChecked()))) + } } fun verifyPageThreeDotMainMenuItems() { @@ -128,7 +130,7 @@ class ThreeDotMenuMainRobot { try { assertTrue( "Addon not listed in the Add-ons menu", - mDevice.findObject(UiSelector().text(addonName)).waitForExists(waitingTime) + mDevice.findObject(UiSelector().text(addonName)).waitForExists(waitingTime), ) break } catch (e: AssertionError) { @@ -148,7 +150,7 @@ class ThreeDotMenuMainRobot { class Transition { fun openSettings( localizedText: String = getStringResource(R.string.browser_menu_settings), - interact: SettingsRobot.() -> Unit + interact: SettingsRobot.() -> Unit, ): SettingsRobot.Transition { // We require one swipe to display the full size 3-dot menu. On smaller devices // such as the Pixel 2, we require two swipes to display the "Settings" menu item @@ -215,19 +217,18 @@ class ThreeDotMenuMainRobot { } fun openCustomizeHome(interact: SettingsSubMenuHomepageRobot.() -> Unit): SettingsSubMenuHomepageRobot.Transition { - mDevice.wait( Until .findObject( - By.textContains("$packageName:id/browser_menu_customize_home_1") + By.textContains("$packageName:id/browser_menu_customize_home_1"), ), - waitingTime + waitingTime, ) customizeHomeButton().click() mDevice.findObject( - UiSelector().resourceId("$packageName:id/recycler_view") + UiSelector().resourceId("$packageName:id/recycler_view"), ).waitForExists(waitingTime) SettingsSubMenuHomepageRobot().interact() @@ -418,8 +419,8 @@ private fun customizeHomeButton() = onView( allOf( withId(R.id.text), - withText(R.string.browser_menu_customize_home_1) - ) + withText(R.string.browser_menu_customize_home_1), + ), ) private fun assertCustomizeHomeButton() = @@ -495,8 +496,8 @@ private fun assertFindInPageButton() = findInPageButton() private fun whatsNewButton() = onView( allOf( withText("What’s new"), - withEffectiveVisibility(Visibility.VISIBLE) - ) + withEffectiveVisibility(Visibility.VISIBLE), + ), ) private fun assertWhatsNewButton() = whatsNewButton() @@ -534,18 +535,17 @@ private fun assertAddToTopSitesButton() { onView(withId(R.id.mozac_browser_menu_recyclerView)) .perform( RecyclerViewActions.scrollTo( - hasDescendant(withText(R.string.browser_menu_add_to_shortcuts)) - ) + hasDescendant(withText(R.string.browser_menu_add_to_shortcuts)), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } private fun assertRemoveFromShortcutsButton() { - onView(withId(R.id.mozac_browser_menu_recyclerView)) .perform( RecyclerViewActions.scrollTo( - hasDescendant(withText(R.string.browser_menu_settings)) - ) + hasDescendant(withText(R.string.browser_menu_settings)), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -556,8 +556,8 @@ private fun assertAddToMobileHome() { onView(withId(R.id.mozac_browser_menu_recyclerView)) .perform( RecyclerViewActions.scrollTo( - hasDescendant(withText(R.string.browser_menu_add_to_homescreen)) - ) + hasDescendant(withText(R.string.browser_menu_add_to_homescreen)), + ), ).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) } @@ -573,8 +573,8 @@ private fun openInAppButton() = onView( allOf( withText("Open in app"), - withEffectiveVisibility(Visibility.VISIBLE) - ) + withEffectiveVisibility(Visibility.VISIBLE), + ), ) private fun downloadsButton() = onView(withText(R.string.library_downloads)) @@ -594,7 +594,7 @@ private fun shareAllTabsButton() = private fun assertShareAllTabsButton() { shareAllTabsButton() .check( - matches(isDisplayed()) + matches(isDisplayed()), ) } diff --git a/app/src/debug/java/org/mozilla/fenix/DebugFenixApplication.kt b/app/src/debug/java/org/mozilla/fenix/DebugFenixApplication.kt index 76dc85afad..c57f7db011 100644 --- a/app/src/debug/java/org/mozilla/fenix/DebugFenixApplication.kt +++ b/app/src/debug/java/org/mozilla/fenix/DebugFenixApplication.kt @@ -17,7 +17,7 @@ class DebugFenixApplication : FenixApplication() { if (!AppWatcher.isInstalled) { AppWatcher.manualInstall( application = application, - watchersToInstall = AppWatcher.appDefaultWatchers(application) + watchersToInstall = AppWatcher.appDefaultWatchers(application), ) } diff --git a/app/src/main/java/org/mozilla/fenix/AppRequestInterceptor.kt b/app/src/main/java/org/mozilla/fenix/AppRequestInterceptor.kt index 61820688ae..486e7b174f 100644 --- a/app/src/main/java/org/mozilla/fenix/AppRequestInterceptor.kt +++ b/app/src/main/java/org/mozilla/fenix/AppRequestInterceptor.kt @@ -18,7 +18,7 @@ import org.mozilla.fenix.ext.isOnline import java.lang.ref.WeakReference class AppRequestInterceptor( - private val context: Context + private val context: Context, ) : RequestInterceptor { private var navController: WeakReference? = null @@ -35,9 +35,8 @@ class AppRequestInterceptor( isSameDomain: Boolean, isRedirect: Boolean, isDirectNavigation: Boolean, - isSubframeRequest: Boolean + isSubframeRequest: Boolean, ): RequestInterceptor.InterceptionResponse? { - interceptAmoRequest(uri, isSameDomain, hasUserGesture)?.let { response -> return response } @@ -51,14 +50,14 @@ class AppRequestInterceptor( isSameDomain, isRedirect, isDirectNavigation, - isSubframeRequest + isSubframeRequest, ) } override fun onErrorRequest( session: EngineSession, errorType: ErrorType, - uri: String? + uri: String?, ): RequestInterceptor.ErrorResponse? { val improvedErrorType = improveErrorType(errorType) val riskLevel = getRiskLevel(improvedErrorType) @@ -71,7 +70,7 @@ class AppRequestInterceptor( uri = uri, htmlResource = riskLevel.htmlRes, titleOverride = { type -> getErrorPageTitle(context, type) }, - descriptionOverride = { type -> getErrorPageDescription(context, type) } + descriptionOverride = { type -> getErrorPageDescription(context, type) }, ) return RequestInterceptor.ErrorResponse(errorPageUri) @@ -87,20 +86,18 @@ class AppRequestInterceptor( private fun interceptAmoRequest( uri: String, isSameDomain: Boolean, - hasUserGesture: Boolean + hasUserGesture: Boolean, ): RequestInterceptor.InterceptionResponse? { // First we execute a quick check to see if this is a request we're interested in i.e. a // request triggered by the user and coming from AMO. if (hasUserGesture && isSameDomain && uri.startsWith(AMO_BASE_URL)) { - // Check if this is a request to install an add-on. val matchResult = AMO_INSTALL_URL_REGEX.toRegex().find(uri) if (matchResult != null) { - // Navigate and trigger add-on installation. matchResult.groupValues.getOrNull(1)?.let { addonId -> navController?.get()?.navigate( - NavGraphDirections.actionGlobalAddonsManagementFragment(addonId) + NavGraphDirections.actionGlobalAddonsManagementFragment(addonId), ) // We've redirected to the add-ons management fragment, skip original request. @@ -152,16 +149,19 @@ class AppRequestInterceptor( ErrorType.ERROR_NO_INTERNET, ErrorType.ERROR_HTTPS_ONLY, ErrorType.ERROR_BAD_HSTS_CERT, - ErrorType.ERROR_UNKNOWN_PROTOCOL -> RiskLevel.Low + ErrorType.ERROR_UNKNOWN_PROTOCOL, + -> RiskLevel.Low ErrorType.ERROR_SECURITY_BAD_CERT, ErrorType.ERROR_SECURITY_SSL, - ErrorType.ERROR_PORT_BLOCKED -> RiskLevel.Medium + ErrorType.ERROR_PORT_BLOCKED, + -> RiskLevel.Medium ErrorType.ERROR_SAFEBROWSING_HARMFUL_URI, ErrorType.ERROR_SAFEBROWSING_MALWARE_URI, ErrorType.ERROR_SAFEBROWSING_PHISHING_URI, - ErrorType.ERROR_SAFEBROWSING_UNWANTED_URI -> RiskLevel.High + ErrorType.ERROR_SAFEBROWSING_UNWANTED_URI, + -> RiskLevel.High } private fun getErrorPageTitle(context: Context, type: ErrorType): String? { diff --git a/app/src/main/java/org/mozilla/fenix/BrowserDirection.kt b/app/src/main/java/org/mozilla/fenix/BrowserDirection.kt index 0220eeeec6..481c355af3 100644 --- a/app/src/main/java/org/mozilla/fenix/BrowserDirection.kt +++ b/app/src/main/java/org/mozilla/fenix/BrowserDirection.kt @@ -37,5 +37,5 @@ enum class BrowserDirection(@IdRes val fragmentId: Int) { FromAddonPermissionsDetailsFragment(R.id.addonPermissionsDetailFragment), FromLoginDetailFragment(R.id.loginDetailFragment), FromTabsTray(R.id.tabsTrayFragment), - FromRecentlyClosed(R.id.recentlyClosedFragment) + FromRecentlyClosed(R.id.recentlyClosedFragment), } diff --git a/app/src/main/java/org/mozilla/fenix/Config.kt b/app/src/main/java/org/mozilla/fenix/Config.kt index 114eab8123..bb5688fe25 100644 --- a/app/src/main/java/org/mozilla/fenix/Config.kt +++ b/app/src/main/java/org/mozilla/fenix/Config.kt @@ -8,7 +8,8 @@ enum class ReleaseChannel { Debug, Nightly, Beta, - Release; + Release, + ; val isReleased: Boolean get() = when (this) { diff --git a/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt b/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt index b6874d06aa..c6585c4135 100644 --- a/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt +++ b/app/src/main/java/org/mozilla/fenix/FeatureFlags.kt @@ -103,6 +103,7 @@ object FeatureFlags { * Enables receiving from the messaging framework. */ const val messagingFeature = true + /** * Enables compose on the tabs tray items. */ diff --git a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt index 68ae069275..7f164eb26b 100644 --- a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +++ b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt @@ -159,11 +159,11 @@ open class FenixApplication : LocaleAwareApplication(), Provider { configuration = Configuration( channel = BuildConfig.BUILD_TYPE, httpClient = ConceptFetchHttpUploader( - lazy(LazyThreadSafetyMode.NONE) { components.core.client } - ) + lazy(LazyThreadSafetyMode.NONE) { components.core.client }, + ), ), uploadEnabled = telemetryEnabled, - buildInfo = GleanBuildInfo.buildInfo + buildInfo = GleanBuildInfo.buildInfo, ) // We avoid blocking the main thread on startup by setting startup metrics on the background thread. @@ -275,15 +275,15 @@ open class FenixApplication : LocaleAwareApplication(), Provider { components.core.topSitesStorage.getTopSites( totalSites = components.settings.topSitesMaxLimit, frecencyConfig = TopSitesFrecencyConfig( - FrecencyThresholdOption.SKIP_ONE_TIME_PAGES + FrecencyThresholdOption.SKIP_ONE_TIME_PAGES, ) { !Uri.parse(it.url) .containsQueryParameters(components.settings.frecencyFilterQuery) }, providerConfig = TopSitesProviderConfig( showProviderTopSites = components.settings.showContileFeature, - maxThreshold = TOP_SITES_PROVIDER_MAX_THRESHOLD - ) + maxThreshold = TOP_SITES_PROVIDER_MAX_THRESHOLD, + ), ) // This service uses `historyStorage`, and so we can only touch it when we know @@ -291,7 +291,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider { // places library will be able to load, which requires first running Megazord.init(). // The visual completeness tasks are scheduled after the Megazord.init() call. components.core.historyMetadataService.cleanup( - System.currentTimeMillis() - Core.HISTORY_METADATA_MAX_AGE_IN_MS + System.currentTimeMillis() - Core.HISTORY_METADATA_MAX_AGE_IN_MS, ) } } @@ -436,11 +436,13 @@ open class FenixApplication : LocaleAwareApplication(), Provider { } private fun setupNimbusObserver(nimbus: Observable) { - nimbus.register(object : NimbusInterface.Observer { - override fun onUpdatesApplied(updated: List) { - onNimbusStartupAndUpdate() - } - }) + nimbus.register( + object : NimbusInterface.Observer { + override fun onUpdatesApplied(updated: List) { + onNimbusStartupAndUpdate() + } + }, + ) } private fun onNimbusStartupAndUpdate() { @@ -472,10 +474,10 @@ open class FenixApplication : LocaleAwareApplication(), Provider { message = "onTrimMemory()", data = mapOf( "level" to level.toString(), - "main" to isMainProcess().toString() + "main" to isMainProcess().toString(), ), - level = Breadcrumb.Level.INFO - ) + level = Breadcrumb.Level.INFO, + ), ) runOnlyInMainProcess { @@ -491,34 +493,34 @@ open class FenixApplication : LocaleAwareApplication(), Provider { when { settings.shouldUseLightTheme -> { AppCompatDelegate.setDefaultNightMode( - AppCompatDelegate.MODE_NIGHT_NO + AppCompatDelegate.MODE_NIGHT_NO, ) } settings.shouldUseDarkTheme -> { AppCompatDelegate.setDefaultNightMode( - AppCompatDelegate.MODE_NIGHT_YES + AppCompatDelegate.MODE_NIGHT_YES, ) } SDK_INT < Build.VERSION_CODES.P && settings.shouldUseAutoBatteryTheme -> { AppCompatDelegate.setDefaultNightMode( - AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY + AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY, ) } SDK_INT >= Build.VERSION_CODES.P && settings.shouldFollowDeviceTheme -> { AppCompatDelegate.setDefaultNightMode( - AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM + AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM, ) } // First run of app no default set, set the default to Follow System for 28+ and Normal Mode otherwise else -> { if (SDK_INT >= Build.VERSION_CODES.P) { AppCompatDelegate.setDefaultNightMode( - AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM + AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM, ) settings.shouldFollowDeviceTheme = true } else { AppCompatDelegate.setDefaultNightMode( - AppCompatDelegate.MODE_NIGHT_NO + AppCompatDelegate.MODE_NIGHT_NO, ) settings.shouldUseLightTheme = true } @@ -542,13 +544,12 @@ open class FenixApplication : LocaleAwareApplication(), Provider { components.addonUpdater, onCrash = { exception -> components.analytics.crashReporter.submitCaughtException(exception) - } + }, ) WebExtensionSupport.initialize( components.core.engine, components.core.store, - onNewTabOverride = { - _, engineSession, url -> + onNewTabOverride = { _, engineSession, url -> val shouldCreatePrivateSession = components.core.store.state.selectedTab?.content?.private ?: components.settings.openLinksInAPrivateTab @@ -557,22 +558,20 @@ open class FenixApplication : LocaleAwareApplication(), Provider { url = url, selectTab = true, engineSession = engineSession, - private = shouldCreatePrivateSession + private = shouldCreatePrivateSession, ) }, - onCloseTabOverride = { - _, sessionId -> + onCloseTabOverride = { _, sessionId -> components.useCases.tabsUseCases.removeTab(sessionId) }, - onSelectTabOverride = { - _, sessionId -> + onSelectTabOverride = { _, sessionId -> components.useCases.tabsUseCases.selectTab(sessionId) }, onExtensionsLoaded = { extensions -> components.addonUpdater.registerForFutureUpdates(extensions) subscribeForNewAddonsIfNeeded(components.supportedAddonsChecker, extensions) }, - onUpdatePermissionRequest = components.addonUpdater::onUpdatePermissionRequest + onUpdatePermissionRequest = components.addonUpdater::onUpdatePermissionRequest, ) } catch (e: UnsupportedOperationException) { Logger.error("Failed to initialize web extension support", e) @@ -582,7 +581,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider { @VisibleForTesting internal fun subscribeForNewAddonsIfNeeded( checker: DefaultSupportedAddonsChecker, - installedExtensions: List + installedExtensions: List, ) { val hasUnsupportedAddons = installedExtensions.any { it.isUnsupported() } if (hasUnsupportedAddons) { @@ -608,7 +607,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider { browserStore: BrowserStore, settings: Settings, browsersCache: BrowsersCache = BrowsersCache, - mozillaProductDetector: MozillaProductDetector = MozillaProductDetector + mozillaProductDetector: MozillaProductDetector = MozillaProductDetector, ) { setPreferenceMetrics(settings) with(Metrics) { @@ -617,7 +616,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider { when (Config.channel.isMozillaOnline) { true -> "MozillaOnline" false -> "Mozilla" - } + }, ) defaultBrowser.set(browsersCache.all(applicationContext).isDefaultBrowser) @@ -631,7 +630,11 @@ open class FenixApplication : LocaleAwareApplication(), Provider { TopSites.contextId.set(UUID.fromString(settings.contileContextId)) } - mozillaProducts.set(mozillaProductDetector.getInstalledMozillaProducts(applicationContext)) + mozillaProducts.set( + mozillaProductDetector.getInstalledMozillaProducts( + applicationContext, + ), + ) adjustCampaign.set(settings.adjustCampaignId) adjustAdGroup.set(settings.adjustAdGroup) @@ -680,7 +683,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider { when (settings.toolbarPosition) { ToolbarPosition.BOTTOM -> CustomizationFragment.Companion.Position.BOTTOM.name ToolbarPosition.TOP -> CustomizationFragment.Companion.Position.TOP.name - } + }, ) tabViewSetting.set(settings.getTabViewPingString()) @@ -725,7 +728,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider { @Suppress("ComplexMethod") private fun setPreferenceMetrics( - settings: Settings + settings: Settings, ) { with(Preferences) { searchSuggestionsEnabled.set(settings.shouldShowSearchSuggestions) @@ -750,7 +753,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider { settings.shouldUseFixedTopToolbar -> "fixed_top" settings.shouldUseBottomToolbar -> "bottom" else -> "top" - } + }, ) enhancedTrackingProtection.set( @@ -760,7 +763,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider { settings.useStrictTrackingProtection -> "strict" settings.useCustomTrackingProtection -> "custom" else -> "" - } + }, ) etpCustomCookiesSelection.set(settings.blockCookiesSelectionInCustomTrackingProtection) @@ -783,7 +786,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider { settings.shouldFollowDeviceTheme -> "system" settings.shouldUseAutoBatteryTheme -> "battery" else -> "" - } + }, ) inactiveTabsEnabled.set(settings.inactiveTabsAreEnabled) @@ -804,7 +807,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider { settings.alwaysOpenTheLastTabWhenOpeningTheApp -> "last tab" settings.openHomepageAfterFourHoursOfInactivity -> "homepage after four hours" else -> "" - } + }, ) } diff --git a/app/src/main/java/org/mozilla/fenix/FenixLogSink.kt b/app/src/main/java/org/mozilla/fenix/FenixLogSink.kt index 6b5d59087e..15993ea020 100644 --- a/app/src/main/java/org/mozilla/fenix/FenixLogSink.kt +++ b/app/src/main/java/org/mozilla/fenix/FenixLogSink.kt @@ -21,7 +21,7 @@ class FenixLogSink(private val logsDebug: Boolean = true) : LogSink { priority: Log.Priority, tag: String?, throwable: Throwable?, - message: String? + message: String?, ) { if (priority == Log.Priority.DEBUG && !logsDebug) { return diff --git a/app/src/main/java/org/mozilla/fenix/GlobalDirections.kt b/app/src/main/java/org/mozilla/fenix/GlobalDirections.kt index a9b55d421b..6637b52f35 100644 --- a/app/src/main/java/org/mozilla/fenix/GlobalDirections.kt +++ b/app/src/main/java/org/mozilla/fenix/GlobalDirections.kt @@ -17,45 +17,46 @@ enum class GlobalDirections(val navDirections: NavDirections, val destinationId: Home(NavGraphDirections.actionGlobalHome(), R.id.homeFragment), Bookmarks( NavGraphDirections.actionGlobalBookmarkFragment(BookmarkRoot.Root.id), - R.id.bookmarkFragment + R.id.bookmarkFragment, ), History( NavGraphDirections.actionGlobalHistoryFragment(), - R.id.historyFragment + R.id.historyFragment, ), Settings( NavGraphDirections.actionGlobalSettingsFragment(), - R.id.settingsFragment + R.id.settingsFragment, ), Sync( NavGraphDirections.actionGlobalTurnOnSync(), - R.id.turnOnSyncFragment + R.id.turnOnSyncFragment, ), SearchEngine( NavGraphDirections.actionGlobalSearchEngineFragment(), - R.id.searchEngineFragment + R.id.searchEngineFragment, ), Accessibility( NavGraphDirections.actionGlobalAccessibilityFragment(), - R.id.accessibilityFragment + R.id.accessibilityFragment, ), DeleteData( NavGraphDirections.actionGlobalDeleteBrowsingDataFragment(), - R.id.deleteBrowsingDataFragment + R.id.deleteBrowsingDataFragment, ), SettingsAddonManager( NavGraphDirections.actionGlobalAddonsManagementFragment(), - R.id.addonsManagementFragment + R.id.addonsManagementFragment, ), SettingsLogins( NavGraphDirections.actionGlobalSavedLoginsAuthFragment(), - R.id.saveLoginSettingFragment + R.id.saveLoginSettingFragment, ), SettingsTrackingProtection( NavGraphDirections.actionGlobalTrackingProtectionFragment(), - R.id.trackingProtectionFragment + R.id.trackingProtectionFragment, ), WallpaperSettings( - NavGraphDirections.actionGlobalWallpaperSettingsFragment(), R.id.wallpaperSettingsFragment - ) + NavGraphDirections.actionGlobalWallpaperSettingsFragment(), + R.id.wallpaperSettingsFragment, + ), } diff --git a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt index c118cc3dfe..46c6bcd5da 100644 --- a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt @@ -181,7 +181,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { StartSearchIntentProcessor(), OpenBrowserIntentProcessor(this, ::getIntentSessionId), OpenSpecificTabIntentProcessor(this), - DefaultBrowserIntentProcessor(this) + DefaultBrowserIntentProcessor(this), ) } @@ -219,8 +219,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { message = "onCreate()", data = mapOf( "recreated" to (savedInstanceState != null).toString(), - "intent" to (intent?.action ?: "null") - ) + "intent" to (intent?.action ?: "null"), + ), ) components.publicSuffixList.prefetch() @@ -238,7 +238,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { privateNotificationObserver = PrivateNotificationFeature( applicationContext, components.core.store, - PrivateNotificationService::class + PrivateNotificationService::class, ).also { it.start() } @@ -265,8 +265,9 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { lifecycle.addObserver( BreadcrumbsRecorder( components.analytics.crashReporter, - navHost.navController, ::getBreadcrumbMessage - ) + navHost.navController, + ::getBreadcrumbMessage, + ), ) val safeIntent = intent?.toSafeIntent() @@ -318,7 +319,9 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { } components.core.engine.profiler?.addMarker( - MarkersActivityLifecycleCallbacks.MARKER_NAME, startTimeProfiler, "HomeActivity.onCreate" + MarkersActivityLifecycleCallbacks.MARKER_NAME, + startTimeProfiler, + "HomeActivity.onCreate", ) StartupTimeline.onActivityCreateEndHome(this) // DO NOT MOVE ANYTHING BELOW HERE. } @@ -338,7 +341,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { components.performance.visualCompletenessQueue, components.startupStateProvider, safeIntent, - binding.rootContainer + binding.rootContainer, ) } @@ -350,7 +353,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { // Diagnostic breadcrumb for "Display already aquired" crash: // https://github.com/mozilla-mobile/android-components/issues/7960 breadcrumb( - message = "onResume()" + message = "onResume()", ) lifecycleScope.launch(IO) { @@ -379,12 +382,14 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { // Diagnostic breadcrumb for "Display already aquired" crash: // https://github.com/mozilla-mobile/android-components/issues/7960 breadcrumb( - message = "onStart()" + message = "onStart()", ) ProfilerMarkers.homeActivityOnStart(binding.rootContainer, components.core.engine.profiler) components.core.engine.profiler?.addMarker( - MarkersActivityLifecycleCallbacks.MARKER_NAME, startProfilerTime, "HomeActivity.onStart" + MarkersActivityLifecycleCallbacks.MARKER_NAME, + startProfilerTime, + "HomeActivity.onStart", ) // DO NOT MOVE ANYTHING BELOW THIS addMarker CALL. } @@ -396,8 +401,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { breadcrumb( message = "onStop()", data = mapOf( - "finishing" to isFinishing.toString() - ) + "finishing" to isFinishing.toString(), + ), ) } @@ -410,7 +415,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { components.core.bookmarksStorage.getTree(BookmarkRoot.Root.id, true)?.let { val desktopRootNode = DesktopFolders( applicationContext, - showMobileRoot = false + showMobileRoot = false, ).withOptionalDesktopFolders(it) settings().desktopBookmarksSize = getBookmarkCount(desktopRootNode) } @@ -427,8 +432,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { breadcrumb( message = "onPause()", data = mapOf( - "finishing" to isFinishing.toString() - ) + "finishing" to isFinishing.toString(), + ), ) // Every time the application goes into the background, it is possible that the user @@ -466,8 +471,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { breadcrumb( message = "onDestroy()", data = mapOf( - "finishing" to isFinishing.toString() - ) + "finishing" to isFinishing.toString(), + ), ) components.core.contileTopSitesUpdater.stopPeriodicWork() @@ -482,7 +487,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { // Diagnostic breadcrumb for "Display already aquired" crash: // https://github.com/mozilla-mobile/android-components/issues/7960 breadcrumb( - message = "onConfigurationChanged()" + message = "onConfigurationChanged()", ) } @@ -490,7 +495,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { // Diagnostic breadcrumb for "Display already aquired" crash: // https://github.com/mozilla-mobile/android-components/issues/7960 breadcrumb( - message = "recreate()" + message = "recreate()", ) super.recreate() @@ -513,8 +518,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { breadcrumb( message = "onNewIntent()", data = mapOf( - "intent" to intent.action.toString() - ) + "intent" to intent.action.toString(), + ), ) val tab = components.core.store.state.findActiveMediaTab() @@ -524,7 +529,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { val intentProcessors = listOf( - CrashReporterIntentProcessor(components.appStore) + CrashReporterIntentProcessor(components.appStore), ) + externalSourceIntentProcessors val intentHandled = intentProcessors.any { it.process(intent, navHost.navController, this.intent) } @@ -548,19 +553,19 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { parent: View?, name: String, context: Context, - attrs: AttributeSet + attrs: AttributeSet, ): View? = when (name) { EngineView::class.java.name -> components.core.engine.createView(context, attrs).apply { selectionActionDelegate = DefaultSelectionActionDelegate( BrowserStoreSearchAdapter( components.core.store, - tabId = getIntentSessionId(intent.toSafeIntent()) + tabId = getIntentSessionId(intent.toSafeIntent()), ), resources = context.resources, shareTextClicked = { share(it) }, emailTextClicked = { email(it) }, callTextClicked = { call(it) }, - actionSorter = ::actionSorter + actionSorter = ::actionSorter, ) }.asView() else -> super.onCreateView(parent, name, context, attrs) @@ -757,7 +762,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { NavigationUI.setupWithNavController( navigationToolbar, navHost.navController, - AppBarConfiguration.Builder(*topLevelDestinationIds).build() + AppBarConfiguration.Builder(*topLevelDestinationIds).build(), ) navigationToolbar.setNavigationOnClickListener { @@ -783,7 +788,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { forceSearch: Boolean = false, flags: EngineSession.LoadUrlFlags = EngineSession.LoadUrlFlags.none(), requestDesktopMode: Boolean = false, - historyMetadata: HistoryMetadataKey? = null + historyMetadata: HistoryMetadataKey? = null, ) { openToBrowser(from, customTabSessionId) load(searchTermOrURL, newTab, engine, forceSearch, flags, requestDesktopMode, historyMetadata) @@ -800,7 +805,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { protected open fun getNavDirections( from: BrowserDirection, - customTabSessionId: String? + customTabSessionId: String?, ): NavDirections? = when (from) { BrowserDirection.FromGlobal -> NavGraphDirections.actionGlobalBrowser(customTabSessionId) @@ -849,7 +854,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { BrowserDirection.FromRecentlyClosed -> RecentlyClosedFragmentDirections.actionGlobalBrowser(customTabSessionId) BrowserDirection.FromStudiesFragment -> StudiesFragmentDirections.actionGlobalBrowser( - customTabSessionId + customTabSessionId, ) } @@ -867,7 +872,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { forceSearch: Boolean, flags: EngineSession.LoadUrlFlags = EngineSession.LoadUrlFlags.none(), requestDesktopMode: Boolean = false, - historyMetadata: HistoryMetadataKey? = null + historyMetadata: HistoryMetadataKey? = null, ) { val startTime = components.core.engine.profiler?.getProfilerTime() val mode = browsingModeManager.mode @@ -886,12 +891,12 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { url = searchTermOrURL.toNormalizedUrl(), flags = flags, private = private, - historyMetadata = historyMetadata + historyMetadata = historyMetadata, ) } else { components.useCases.sessionUseCases.loadUrl( url = searchTermOrURL.toNormalizedUrl(), - flags = flags + flags = flags, ) components.core.store.state.selectedTabId } @@ -907,7 +912,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { SessionState.Source.Internal.UserEntered, true, mode.isPrivate, - searchEngine = engine + searchEngine = engine, ) } else { components.useCases.searchUseCases.defaultSearch.invoke(searchTermOrURL, engine) @@ -920,7 +925,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { components.core.engine.profiler?.addMarker( "HomeActivity.load", startTime, - "newTab: $newTab" + "newTab: $newTab", ) } } @@ -990,7 +995,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { private fun openPopup(webExtensionState: WebExtensionState) { val action = NavGraphDirections.actionGlobalWebExtensionActionPopupFragment( webExtensionId = webExtensionState.id, - webExtensionTitle = webExtensionState.name + webExtensionTitle = webExtensionState.name, ) navHost.navController.navigate(action) } @@ -1006,7 +1011,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { private fun captureSnapshotTelemetryMetrics() = CoroutineScope(IO).launch { // PWA val recentlyUsedPwaCount = components.core.webAppShortcutManager.recentlyUsedWebAppsCount( - activeThresholdMs = PWA_RECENTLY_USED_THRESHOLD + activeThresholdMs = PWA_RECENTLY_USED_THRESHOLD, ) if (recentlyUsedPwaCount == 0) { Metrics.hasRecentPwas.set(false) @@ -1047,7 +1052,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { it.process( intent, navHost.navController, - this.intent + this.intent, ) } } diff --git a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt index 08d98ec1b2..d633d31600 100644 --- a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt @@ -48,7 +48,9 @@ class IntentReceiverActivity : Activity() { processIntent(intent) components.core.engine.profiler?.addMarker( - MarkersActivityLifecycleCallbacks.MARKER_NAME, startTimeProfiler, "IntentReceiverActivity.onCreate" + MarkersActivityLifecycleCallbacks.MARKER_NAME, + startTimeProfiler, + "IntentReceiverActivity.onCreate", ) StartupTimeline.onActivityCreateEndIntentReceiver() // DO NOT MOVE ANYTHING BELOW HERE. } @@ -78,7 +80,7 @@ class IntentReceiverActivity : Activity() { if (!intent.hasExtra(HomeActivity.OPEN_TO_BROWSER)) { intent.putExtra( HomeActivity.OPEN_TO_BROWSER, - intentProcessorType.shouldOpenToBrowser(intent) + intentProcessorType.shouldOpenToBrowser(intent), ) } // StrictMode violation on certain devices such as Samsung @@ -92,13 +94,13 @@ class IntentReceiverActivity : Activity() { val modeDependentProcessors = if (private) { listOf( components.intentProcessors.privateCustomTabIntentProcessor, - components.intentProcessors.privateIntentProcessor + components.intentProcessors.privateIntentProcessor, ) } else { Events.openedLink.record(Events.OpenedLinkExtra("NORMAL")) listOf( components.intentProcessors.customTabIntentProcessor, - components.intentProcessors.intentProcessor + components.intentProcessors.intentProcessor, ) } diff --git a/app/src/main/java/org/mozilla/fenix/ServiceWorkerSupportFeature.kt b/app/src/main/java/org/mozilla/fenix/ServiceWorkerSupportFeature.kt index 7334c9faf9..574d77831c 100644 --- a/app/src/main/java/org/mozilla/fenix/ServiceWorkerSupportFeature.kt +++ b/app/src/main/java/org/mozilla/fenix/ServiceWorkerSupportFeature.kt @@ -21,7 +21,7 @@ import org.mozilla.fenix.ext.components * @param homeActivity [HomeActivity] used for navigating to browser or accessing various app components. */ class ServiceWorkerSupportFeature( - private val homeActivity: HomeActivity + private val homeActivity: HomeActivity, ) : ServiceWorkerDelegate, DefaultLifecycleObserver { override fun onDestroy(owner: LifecycleOwner) { homeActivity.components.core.engine.unregisterServiceWorkerDelegate() @@ -38,7 +38,7 @@ class ServiceWorkerSupportFeature( components.useCases.tabsUseCases.addTab( flags = LoadUrlFlags.external(), engineSession = engineSession, - source = SessionState.Source.Internal.None + source = SessionState.Source.Internal.None, ) } diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsBindingDelegate.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsBindingDelegate.kt index 99bfb4be5a..428438ae43 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsBindingDelegate.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsBindingDelegate.kt @@ -40,7 +40,7 @@ interface AddonDetailsInteractor { */ class AddonDetailsBindingDelegate( private val binding: FragmentAddOnDetailsBinding, - private val interactor: AddonDetailsInteractor + private val interactor: AddonDetailsInteractor, ) { private val dateFormatter = DateFormat.getDateInstance() @@ -115,7 +115,7 @@ class AddonDetailsBindingDelegate( private fun addActionToLinks( spannableStringBuilder: SpannableStringBuilder, - link: URLSpan + link: URLSpan, ) { val start = spannableStringBuilder.getSpanStart(link) val end = spannableStringBuilder.getSpanEnd(link) diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsFragment.kt index e7cabf2a37..0a8b34a73f 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonDetailsFragment.kt @@ -49,7 +49,7 @@ class AddonDetailsFragment : Fragment(R.layout.fragment_add_on_details), AddonDe (activity as HomeActivity).openToBrowserAndLoad( searchTermOrURL = addonSiteUrl.toString(), newTab = true, - from = BrowserDirection.FromAddonDetailsFragment + from = BrowserDirection.FromAddonDetailsFragment, ) } diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonInternalSettingsFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonInternalSettingsFragment.kt index b3c19250ad..8c08a95fd7 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonInternalSettingsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonInternalSettingsFragment.kt @@ -25,7 +25,7 @@ class AddonInternalSettingsFragment : AddonPopupBaseFragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View? { initializeSession() return inflater.inflate(R.layout.fragment_add_on_internal_settings, container, false) diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionDetailsBindingDelegate.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionDetailsBindingDelegate.kt index e5dd5cad7d..a1d72cd698 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionDetailsBindingDelegate.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionDetailsBindingDelegate.kt @@ -26,7 +26,7 @@ interface AddonPermissionsDetailsInteractor { */ class AddonPermissionDetailsBindingDelegate( val binding: FragmentAddOnPermissionsBinding, - private val interactor: AddonPermissionsDetailsInteractor + private val interactor: AddonPermissionsDetailsInteractor, ) { fun bind(addon: Addon) { @@ -41,8 +41,8 @@ class AddonPermissionDetailsBindingDelegate( adapter = AddonPermissionsAdapter( sortedPermissions, style = AddonPermissionsAdapter.Style( - ThemeManager.resolveAttribute(R.attr.textPrimary, context) - ) + ThemeManager.resolveAttribute(R.attr.textPrimary, context), + ), ) } } diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionsDetailsFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionsDetailsFragment.kt index 5cc7c1f9d4..8c2a0773ad 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionsDetailsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonPermissionsDetailsFragment.kt @@ -42,7 +42,7 @@ class AddonPermissionsDetailsFragment : (activity as HomeActivity).openToBrowserAndLoad( searchTermOrURL = addonSiteUrl.toString(), newTab = true, - from = BrowserDirection.FromAddonPermissionsDetailsFragment + from = BrowserDirection.FromAddonPermissionsDetailsFragment, ) } } diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonPopupBaseFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonPopupBaseFragment.kt index 3cf7ce346e..8fbd32ab42 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonPopupBaseFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonPopupBaseFragment.kt @@ -45,10 +45,10 @@ abstract class AddonPopupBaseFragment : Fragment(), EngineSession.Observer, User fragmentManager = parentFragmentManager, onNeedToRequestPermissions = { permissions -> requestPermissions(permissions, REQUEST_CODE_PROMPT_PERMISSIONS) - } + }, ), owner = this, - view = view + view = view, ) } } @@ -76,8 +76,8 @@ abstract class AddonPopupBaseFragment : Fragment(), EngineSession.Observer, User requireComponents.core.store.dispatch( ContentAction.UpdatePromptRequestAction( session.id, - promptRequest - ) + promptRequest, + ), ) } } @@ -107,7 +107,7 @@ abstract class AddonPopupBaseFragment : Fragment(), EngineSession.Observer, User engineSession = fromEngineSession ?: requireComponents.core.engine.createSession() session = createCustomTab( url = "", - source = SessionState.Source.Internal.CustomTab + source = SessionState.Source.Internal.CustomTab, ).copy(engineState = EngineState(engineSession)) requireComponents.core.store.dispatch(CustomTabListAction.AddCustomTabAction(session as CustomTabSessionState)) } @@ -115,7 +115,7 @@ abstract class AddonPopupBaseFragment : Fragment(), EngineSession.Observer, User final override fun onRequestPermissionsResult( requestCode: Int, permissions: Array, - grantResults: IntArray + grantResults: IntArray, ) { when (requestCode) { REQUEST_CODE_PROMPT_PERMISSIONS -> promptsFeature.get()?.onPermissionsResult(permissions, grantResults) diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt index 165afa8749..e5aba26216 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementFragment.kt @@ -95,7 +95,7 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) private fun bindRecyclerView() { val managementView = AddonsManagementView( navController = findNavController(), - showPermissionDialog = ::showPermissionDialog + showPermissionDialog = ::showPermissionDialog, ) val recyclerView = binding?.addOnsList @@ -124,7 +124,7 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) managementView, addons, style = createAddonStyle(requireContext()), - excludedAddonIDs + excludedAddonIDs, ) } isInstallationInProgress = false @@ -194,7 +194,7 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) addonNameTextColor = ThemeManager.resolveAttribute(R.attr.textPrimary, context), addonSummaryTextColor = ThemeManager.resolveAttribute(R.attr.textSecondary, context), sectionsTypeFace = sectionsTypeFace, - addonAllowPrivateBrowsingLabelDrawableRes = R.drawable.ic_add_on_private_browsing_label + addonAllowPrivateBrowsingLabelDrawableRes = R.drawable.ic_add_on_private_browsing_label, ) } @@ -221,15 +221,15 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) shouldWidthMatchParent = true, positiveButtonBackgroundColor = ThemeManager.resolveAttribute( R.attr.accent, - requireContext() + requireContext(), ), positiveButtonTextColor = ThemeManager.resolveAttribute( R.attr.textOnColorPrimary, - requireContext() + requireContext(), ), - positiveButtonRadius = (resources.getDimensionPixelSize(R.dimen.tab_corner_radius)).toFloat() + positiveButtonRadius = (resources.getDimensionPixelSize(R.dimen.tab_corner_radius)).toFloat(), ), - onPositiveButtonClicked = onPositiveButtonClicked + onPositiveButtonClicked = onPositiveButtonClicked, ) dialog.show(parentFragmentManager, PERMISSIONS_DIALOG_FRAGMENT_TAG) } @@ -255,13 +255,13 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) shouldWidthMatchParent = true, confirmButtonBackgroundColor = ThemeManager.resolveAttribute( R.attr.accent, - requireContext() + requireContext(), ), confirmButtonTextColor = ThemeManager.resolveAttribute( R.attr.textOnColorPrimary, - requireContext() + requireContext(), ), - confirmButtonRadius = (resources.getDimensionPixelSize(R.dimen.tab_corner_radius)).toFloat() + confirmButtonRadius = (resources.getDimensionPixelSize(R.dimen.tab_corner_radius)).toFloat(), ), onConfirmButtonClicked = { _, allowInPrivateBrowsing -> if (allowInPrivateBrowsing) { @@ -272,10 +272,10 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) runIfFragmentIsAttached { adapter?.updateAddon(it) } - } + }, ) } - } + }, ) dialog.show(parentFragmentManager, INSTALLATION_DIALOG_FRAGMENT_TAG) @@ -311,15 +311,15 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) rootView, getString( R.string.mozac_feature_addons_failed_to_install, - addon.translateName(it) - ) + addon.translateName(it), + ), ) } } binding?.addonProgressOverlay?.overlayCardView?.visibility = View.GONE isInstallationInProgress = false } - } + }, ) binding?.addonProgressOverlay?.cancelButton?.setOnClickListener { @@ -335,7 +335,7 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) private fun announceForAccessibility(announcementText: CharSequence) { val event = AccessibilityEvent.obtain( - AccessibilityEvent.TYPE_ANNOUNCEMENT + AccessibilityEvent.TYPE_ANNOUNCEMENT, ) binding?.addonProgressOverlay?.overlayCardView?.onInitializeAccessibilityEvent(event) @@ -343,7 +343,7 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management) event.contentDescription = null binding?.addonProgressOverlay?.overlayCardView?.parent?.requestSendAccessibilityEvent( binding?.addonProgressOverlay?.overlayCardView, - event + event, ) } diff --git a/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementView.kt b/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementView.kt index 4e9e24cabc..593beb49af 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementView.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/AddonsManagementView.kt @@ -15,7 +15,7 @@ import org.mozilla.fenix.ext.navigateSafe */ class AddonsManagementView( private val navController: NavController, - private val showPermissionDialog: (Addon) -> Unit + private val showPermissionDialog: (Addon) -> Unit, ) : AddonsManagerAdapterDelegate { override fun onAddonItemClicked(addon: Addon) { @@ -37,7 +37,7 @@ class AddonsManagementView( private fun showInstalledAddonDetailsFragment(addon: Addon) { val directions = AddonsManagementFragmentDirections.actionAddonsManagementFragmentToInstalledAddonDetails( - addon + addon, ) navController.navigateSafe(R.id.addonsManagementFragment, directions) } @@ -45,7 +45,7 @@ class AddonsManagementView( private fun showDetailsFragment(addon: Addon) { val directions = AddonsManagementFragmentDirections.actionAddonsManagementFragmentToAddonDetailsFragment( - addon + addon, ) navController.navigateSafe(R.id.addonsManagementFragment, directions) } @@ -53,7 +53,7 @@ class AddonsManagementView( private fun showNotYetSupportedAddonFragment(unsupportedAddons: List) { val directions = AddonsManagementFragmentDirections.actionAddonsManagementFragmentToNotYetSupportedAddonFragment( - unsupportedAddons.toTypedArray() + unsupportedAddons.toTypedArray(), ) navController.navigate(directions) } diff --git a/app/src/main/java/org/mozilla/fenix/addons/Extensions.kt b/app/src/main/java/org/mozilla/fenix/addons/Extensions.kt index ece5d82c26..c13b28752e 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/Extensions.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/Extensions.kt @@ -17,7 +17,7 @@ internal fun showSnackBar(view: View, text: String, duration: Int = FenixSnackba FenixSnackbar.make( view = view, duration = duration, - isDisplayedWithBrowserToolbar = true + isDisplayedWithBrowserToolbar = true, ) .setText(text) .show() diff --git a/app/src/main/java/org/mozilla/fenix/addons/InstalledAddonDetailsFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/InstalledAddonDetailsFragment.kt index 66dd80f98e..7eb06ba7a3 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/InstalledAddonDetailsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/InstalledAddonDetailsFragment.kt @@ -39,7 +39,7 @@ class InstalledAddonDetailsFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { if (!::addon.isInitialized) { addon = AddonDetailsFragmentArgs.fromBundle(requireNotNull(arguments)).addon @@ -48,7 +48,7 @@ class InstalledAddonDetailsFragment : Fragment() { _binding = FragmentInstalledAddOnDetailsBinding.inflate( inflater, container, - false + false, ) bindUI() @@ -96,7 +96,7 @@ class InstalledAddonDetailsFragment : Fragment() { runIfFragmentIsAttached { showSnackBar( binding.root, - getString(R.string.mozac_feature_addons_failed_to_query_add_ons) + getString(R.string.mozac_feature_addons_failed_to_query_add_ons), ) findNavController().popBackStack() } @@ -140,8 +140,8 @@ class InstalledAddonDetailsFragment : Fragment() { binding.root, getString( R.string.mozac_feature_addons_successfully_enabled, - addon.translateName(it) - ) + addon.translateName(it), + ), ) } } @@ -156,12 +156,12 @@ class InstalledAddonDetailsFragment : Fragment() { binding.root, getString( R.string.mozac_feature_addons_failed_to_enable, - addon.translateName(it) - ) + addon.translateName(it), + ), ) } } - } + }, ) } else { binding.settings.isVisible = false @@ -179,8 +179,8 @@ class InstalledAddonDetailsFragment : Fragment() { binding.root, getString( R.string.mozac_feature_addons_successfully_disabled, - addon.translateName(it) - ) + addon.translateName(it), + ), ) } } @@ -196,12 +196,12 @@ class InstalledAddonDetailsFragment : Fragment() { binding.root, getString( R.string.mozac_feature_addons_failed_to_disable, - addon.translateName(it) - ) + addon.translateName(it), + ), ) } } - } + }, ) } } @@ -233,7 +233,7 @@ class InstalledAddonDetailsFragment : Fragment() { binding.details.setOnClickListener { val directions = InstalledAddonDetailsFragmentDirections.actionInstalledAddonFragmentToAddonDetailsFragment( - addon + addon, ) Navigation.findNavController(binding.root).navigate(directions) } @@ -243,7 +243,7 @@ class InstalledAddonDetailsFragment : Fragment() { binding.permissions.setOnClickListener { val directions = InstalledAddonDetailsFragmentDirections.actionInstalledAddonFragmentToAddonPermissionsDetailsFragment( - addon + addon, ) Navigation.findNavController(binding.root).navigate(directions) } @@ -273,7 +273,7 @@ class InstalledAddonDetailsFragment : Fragment() { switch.isClickable = true binding.removeAddOn.isEnabled = true } - } + }, ) } } @@ -290,8 +290,8 @@ class InstalledAddonDetailsFragment : Fragment() { binding.root, getString( R.string.mozac_feature_addons_successfully_uninstalled, - addon.translateName(it) - ) + addon.translateName(it), + ), ) } binding.root.findNavController().popBackStack() @@ -305,19 +305,19 @@ class InstalledAddonDetailsFragment : Fragment() { binding.root, getString( R.string.mozac_feature_addons_failed_to_uninstall, - addon.translateName(it) - ) + addon.translateName(it), + ), ) } } - } + }, ) } } private fun setAllInteractiveViewsClickable( binding: FragmentInstalledAddOnDetailsBinding, - clickable: Boolean + clickable: Boolean, ) { binding.enableSwitch.isClickable = clickable binding.settings.isClickable = clickable diff --git a/app/src/main/java/org/mozilla/fenix/addons/NotYetSupportedAddonFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/NotYetSupportedAddonFragment.kt index 258d472430..708611ab73 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/NotYetSupportedAddonFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/NotYetSupportedAddonFragment.kt @@ -37,7 +37,7 @@ class NotYetSupportedAddonFragment : unsupportedAddonsAdapter = UnsupportedAddonsAdapter( addonManager = requireContext().components.addonManager, unsupportedAddonsAdapterDelegate = this@NotYetSupportedAddonFragment, - addons = args.addons.toList() + addons = args.addons.toList(), ) val binding = FragmentNotYetSupportedAddonsBinding.bind(view) diff --git a/app/src/main/java/org/mozilla/fenix/addons/WebExtensionActionPopupFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/WebExtensionActionPopupFragment.kt index e4cb41da56..95b2246c5c 100644 --- a/app/src/main/java/org/mozilla/fenix/addons/WebExtensionActionPopupFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/addons/WebExtensionActionPopupFragment.kt @@ -36,7 +36,7 @@ class WebExtensionActionPopupFragment : AddonPopupBaseFragment(), EngineSession. override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View? { // Grab the [EngineSession] from the store when the view is created if it is available. coreComponents.store.state.extensions[args.webExtensionId]?.popupSession?.let { @@ -84,7 +84,7 @@ class WebExtensionActionPopupFragment : AddonPopupBaseFragment(), EngineSession. private fun consumePopupSession() { coreComponents.store.dispatch( - WebExtensionAction.UpdatePopupSessionAction(args.webExtensionId, popupSession = null) + WebExtensionAction.UpdatePopupSessionAction(args.webExtensionId, popupSession = null), ) sessionConsumed = true } diff --git a/app/src/main/java/org/mozilla/fenix/android/FenixDialogFragment.kt b/app/src/main/java/org/mozilla/fenix/android/FenixDialogFragment.kt index 09577577a7..d3841a7ba5 100644 --- a/app/src/main/java/org/mozilla/fenix/android/FenixDialogFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/android/FenixDialogFragment.kt @@ -29,6 +29,7 @@ abstract class FenixDialogFragment : AppCompatDialogFragment() { * Indicates the position of the dialog top or bottom. */ abstract val gravity: Int + /** * The layout id that will be render on the dialog. */ @@ -54,8 +55,8 @@ abstract class FenixDialogFragment : AppCompatDialogFragment() { rootView, LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.MATCH_PARENT - ) + LinearLayout.LayoutParams.MATCH_PARENT, + ), ) window?.apply { @@ -70,12 +71,12 @@ abstract class FenixDialogFragment : AppCompatDialogFragment() { fun inflateRootView(container: ViewGroup? = null): View { val contextThemeWrapper = ContextThemeWrapper( activity, - (activity as HomeActivity).themeManager.currentThemeResource + (activity as HomeActivity).themeManager.currentThemeResource, ) return LayoutInflater.from(contextThemeWrapper).inflate( layoutId, container, - false + false, ) } } diff --git a/app/src/main/java/org/mozilla/fenix/autofill/AutofillSearchActivity.kt b/app/src/main/java/org/mozilla/fenix/autofill/AutofillSearchActivity.kt index d72ef135bd..789f91ae99 100644 --- a/app/src/main/java/org/mozilla/fenix/autofill/AutofillSearchActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/autofill/AutofillSearchActivity.kt @@ -27,7 +27,7 @@ class AutofillSearchActivity : AbstractAutofillSearchActivity() { // the full width of the screen for the dialog. window.setLayout( ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.WRAP_CONTENT + ViewGroup.LayoutParams.WRAP_CONTENT, ) } } diff --git a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt index eb33424434..3c4a45c8d4 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -172,6 +172,7 @@ abstract class BaseBrowserFragment : @VisibleForTesting @Suppress("VariableNaming") internal var _browserToolbarView: BrowserToolbarView? = null + @VisibleForTesting internal val browserToolbarView: BrowserToolbarView get() = _browserToolbarView!! @@ -220,7 +221,7 @@ abstract class BaseBrowserFragment : override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View { // DO NOT ADD ANYTHING ABOVE THIS getProfilerTime CALL! val profilerStartTime = requireComponents.core.engine.profiler?.getProfilerTime() @@ -232,8 +233,8 @@ abstract class BaseBrowserFragment : breadcrumb( message = "onCreateView()", data = mapOf( - "customTabSessionId" to customTabSessionId.toString() - ) + "customTabSessionId" to customTabSessionId.toString(), + ), ) _binding = FragmentBrowserBinding.inflate(inflater, container, false) @@ -243,13 +244,15 @@ abstract class BaseBrowserFragment : browserFragmentStore = StoreProvider.get(this) { BrowserFragmentStore( - BrowserFragmentState() + BrowserFragmentState(), ) } // DO NOT MOVE ANYTHING BELOW THIS addMarker CALL! requireComponents.core.engine.profiler?.addMarker( - MarkersFragmentLifecycleCallbacks.MARKER_NAME, profilerStartTime, "BaseBrowserFragment.onCreateView", + MarkersFragmentLifecycleCallbacks.MARKER_NAME, + profilerStartTime, + "BaseBrowserFragment.onCreateView", ) return binding.root } @@ -277,7 +280,9 @@ abstract class BaseBrowserFragment : // DO NOT MOVE ANYTHING BELOW THIS addMarker CALL! requireComponents.core.engine.profiler?.addMarker( - MarkersFragmentLifecycleCallbacks.MARKER_NAME, profilerStartTime, "BaseBrowserFragment.onViewCreated", + MarkersFragmentLifecycleCallbacks.MARKER_NAME, + profilerStartTime, + "BaseBrowserFragment.onViewCreated", ) } @@ -305,7 +310,7 @@ abstract class BaseBrowserFragment : fragment = WeakReference(this), engineView = WeakReference(binding.engineView), swipeRefresh = WeakReference(binding.swipeRefresh), - viewLifecycleScope = WeakReference(viewLifecycleOwner.lifecycleScope) + viewLifecycleScope = WeakReference(viewLifecycleOwner.lifecycleScope), ).apply { beginAnimateInIfNecessary() } @@ -319,7 +324,7 @@ abstract class BaseBrowserFragment : readerViewFeature, binding.readerViewControlsBar, isPrivate = activity.browsingModeManager.mode.isPrivate, - onReaderModeChanged = { activity.finishActionMode() } + onReaderModeChanged = { activity.finishActionMode() }, ) val browserToolbarController = DefaultBrowserToolbarController( store = store, @@ -335,7 +340,7 @@ abstract class BaseBrowserFragment : thumbnailsFeature.get()?.requestScreenshot() findNavController().nav( R.id.browserFragment, - BrowserFragmentDirections.actionGlobalTabsTrayFragment() + BrowserFragmentDirections.actionGlobalTabsTrayFragment(), ) }, onCloseTab = { closedSession -> @@ -355,9 +360,9 @@ abstract class BaseBrowserFragment : requireComponents.useCases.tabsUseCases.undo.invoke() }, paddedForBottomToolbar = true, - operation = { } + operation = { }, ) - } + }, ) val browserToolbarMenuController = DefaultBrowserToolbarMenuController( store = store, @@ -380,12 +385,12 @@ abstract class BaseBrowserFragment : tabCollectionStorage = requireComponents.core.tabCollectionStorage, topSitesStorage = requireComponents.core.topSitesStorage, pinnedSiteStorage = requireComponents.core.pinnedSiteStorage, - browserStore = store + browserStore = store, ) _browserToolbarInteractor = DefaultBrowserToolbarInteractor( browserToolbarController, - browserToolbarMenuController + browserToolbarMenuController, ) _browserToolbarView = BrowserToolbarView( @@ -394,13 +399,13 @@ abstract class BaseBrowserFragment : settings = context.settings(), interactor = browserToolbarInteractor, customTabSession = customTabSessionId?.let { store.state.findCustomTab(it) }, - lifecycleOwner = viewLifecycleOwner + lifecycleOwner = viewLifecycleOwner, ) toolbarIntegration.set( feature = browserToolbarView.toolbarIntegration, owner = this, - view = view + view = view, ) findInPageIntegration.set( @@ -412,11 +417,11 @@ abstract class BaseBrowserFragment : toolbarInfo = FindInPageIntegration.ToolbarInfo( browserToolbarView.view, !context.settings().shouldUseFixedTopToolbar && context.settings().isDynamicToolbarEnabled, - !context.settings().shouldUseBottomToolbar - ) + !context.settings().shouldUseBottomToolbar, + ), ), owner = this, - view = view + view = view, ) browserToolbarView.view.display.setOnSiteSecurityClickedListener { @@ -430,10 +435,10 @@ abstract class BaseBrowserFragment : candidates = getContextMenuCandidates(context, binding.browserLayout), engineView = binding.engineView, useCases = context.components.useCases.contextMenuUseCases, - tabId = customTabSessionId + tabId = customTabSessionId, ), owner = this, - view = view + view = view, ) val allowScreenshotsInPrivateMode = context.settings().allowScreenshotsInPrivateMode @@ -443,27 +448,27 @@ abstract class BaseBrowserFragment : store = store, customTabId = customTabSessionId, isSecure = { !allowScreenshotsInPrivateMode && it.content.private }, - clearFlagOnStop = false + clearFlagOnStop = false, ), owner = this, - view = view + view = view, ) fullScreenMediaSessionFeature.set( feature = MediaSessionFullscreenFeature( requireActivity(), context.components.core.store, - customTabSessionId + customTabSessionId, ), owner = this, - view = view + view = view, ) val shareDownloadFeature = ShareDownloadFeature( context = context.applicationContext, httpClient = context.components.core.client, store = store, - tabId = customTabSessionId + tabId = customTabSessionId, ) val downloadFeature = DownloadsFeature( @@ -475,11 +480,12 @@ abstract class BaseBrowserFragment : downloadManager = FetchDownloadManager( context.applicationContext, store, - DownloadService::class + DownloadService::class, ), shouldForwardToThirdParties = { PreferenceManager.getDefaultSharedPreferences(context).getBoolean( - context.getPreferenceKey(R.string.pref_key_external_download_manager), false + context.getPreferenceKey(R.string.pref_key_external_download_manager), + false, ) }, promptsStyling = DownloadsFeature.PromptsStyling( @@ -487,27 +493,26 @@ abstract class BaseBrowserFragment : shouldWidthMatchParent = true, positiveButtonBackgroundColor = ThemeManager.resolveAttribute( R.attr.accent, - context + context, ), positiveButtonTextColor = ThemeManager.resolveAttribute( R.attr.textOnColorPrimary, - context + context, ), - positiveButtonRadius = (resources.getDimensionPixelSize(R.dimen.tab_corner_radius)).toFloat() + positiveButtonRadius = (resources.getDimensionPixelSize(R.dimen.tab_corner_radius)).toFloat(), ), onNeedToRequestPermissions = { permissions -> requestPermissions(permissions, REQUEST_CODE_DOWNLOAD_PERMISSIONS) - } + }, ) downloadFeature.onDownloadStopped = { downloadState, _, downloadJobStatus -> // If the download is just paused, don't show any in-app notification if (shouldShowCompletedDownloadDialog(downloadState, downloadJobStatus)) { - saveDownloadDialogState( downloadState.sessionId, downloadState, - downloadJobStatus + downloadJobStatus, ) val dynamicDownloadDialog = DynamicDownloadDialog( @@ -519,7 +524,7 @@ abstract class BaseBrowserFragment : showCannotOpenFileError(binding.browserLayout, context, it) }, binding = binding.viewDynamicDownloadDialog, - toolbarHeight = toolbarHeight + toolbarHeight = toolbarHeight, ) { sharedViewModel.downloadDialogState.remove(downloadState.sessionId) } dynamicDownloadDialog.show() @@ -533,26 +538,28 @@ abstract class BaseBrowserFragment : resumeDownloadDialogState( getCurrentTab()?.id, - store, context, toolbarHeight + store, + context, + toolbarHeight, ) shareDownloadsFeature.set( shareDownloadFeature, owner = this, - view = view + view = view, ) downloadsFeature.set( downloadFeature, owner = this, - view = view + view = view, ) pipFeature = PictureInPictureFeature( store = store, activity = requireActivity(), crashReporting = context.components.analytics.crashReporter, - tabId = customTabSessionId + tabId = customTabSessionId, ) appLinksFeature.set( @@ -562,10 +569,10 @@ abstract class BaseBrowserFragment : sessionId = customTabSessionId, fragmentManager = parentFragmentManager, launchInApp = { context.settings().openLinksInExternalApp }, - loadUrlUseCase = context.components.useCases.sessionUseCases.loadUrl + loadUrlUseCase = context.components.useCases.sessionUseCases.loadUrl, ), owner = this, - view = view + view = view, ) biometricPromptFeature.set( @@ -577,10 +584,10 @@ abstract class BaseBrowserFragment : }, onAuthSuccess = { promptsFeature.get()?.onBiometricResult(isAuthenticated = true) - } + }, ), owner = this, - view = view + view = view, ) promptsFeature.set( @@ -590,10 +597,10 @@ abstract class BaseBrowserFragment : customTabId = customTabSessionId, fragmentManager = parentFragmentManager, creditCardValidationDelegate = DefaultCreditCardValidationDelegate( - context.components.core.lazyAutofillStorage + context.components.core.lazyAutofillStorage, ), loginValidationDelegate = DefaultLoginValidationDelegate( - context.components.core.lazyPasswordsStorage + context.components.core.lazyPasswordsStorage, ), isSaveLoginEnabled = { context.settings().shouldPromptToSaveLogins @@ -610,12 +617,12 @@ abstract class BaseBrowserFragment : context: Context, shareData: ShareData, onDismiss: () -> Unit, - onSuccess: () -> Unit + onSuccess: () -> Unit, ) { val directions = NavGraphDirections.actionGlobalShareFragment( data = arrayOf(shareData), showPage = true, - sessionId = getCurrentTab()?.id + sessionId = getCurrentTab()?.id, ) findNavController().navigate(directions) } @@ -653,10 +660,10 @@ abstract class BaseBrowserFragment : val directions = NavGraphDirections.actionGlobalAutofillSettingFragment() findNavController().navigate(directions) } - } + }, ), owner = this, - view = view + view = view, ) sessionFeature.set( @@ -664,10 +671,10 @@ abstract class BaseBrowserFragment : requireComponents.core.store, requireComponents.useCases.sessionUseCases.goBack, binding.engineView, - customTabSessionId + customTabSessionId, ), owner = this, - view = view + view = view, ) crashContentIntegration.set( @@ -680,10 +687,10 @@ abstract class BaseBrowserFragment : components = requireComponents, settings = context.settings(), navController = findNavController(), - sessionId = customTabSessionId + sessionId = customTabSessionId, ), owner = this, - view = view + view = view, ) searchFeature.set( @@ -703,7 +710,7 @@ abstract class BaseBrowserFragment : } }, owner = this, - view = view + view = view, ) val accentHighContrastColor = @@ -718,7 +725,7 @@ abstract class BaseBrowserFragment : gravity = getAppropriateLayoutGravity(), shouldWidthMatchParent = true, positiveButtonBackgroundColor = accentHighContrastColor, - positiveButtonTextColor = R.color.photonWhite + positiveButtonTextColor = R.color.photonWhite, ), sessionId = customTabSessionId, onNeedToRequestPermissions = { permissions -> @@ -726,22 +733,22 @@ abstract class BaseBrowserFragment : }, onShouldShowRequestPermissionRationale = { shouldShowRequestPermissionRationale( - it + it, ) }, - store = store + store = store, ), owner = this, - view = view + view = view, ) sitePermissionWifiIntegration.set( feature = SitePermissionsWifiIntegration( settings = context.settings(), - wifiConnectionMonitor = context.components.wifiConnectionMonitor + wifiConnectionMonitor = context.components.wifiConnectionMonitor, ), owner = this, - view = view + view = view, ) // This component feature only works on Fenix when built on Mozilla infrastructure. @@ -749,20 +756,20 @@ abstract class BaseBrowserFragment : webAuthnFeature.set( feature = WebAuthnFeature( engine = requireComponents.core.engine, - activity = requireActivity() + activity = requireActivity(), ), owner = this, - view = view + view = view, ) } screenOrientationFeature.set( feature = ScreenOrientationFeature( engine = requireComponents.core.engine, - activity = requireActivity() + activity = requireActivity(), ), owner = this, - view = view + view = view, ) context.settings().setSitePermissionSettingListener(viewLifecycleOwner) { @@ -780,10 +787,10 @@ abstract class BaseBrowserFragment : requireComponents.useCases.sessionUseCases, customTabSessionId, ::viewportFitChange, - ::fullScreenChanged + ::fullScreenChanged, ), owner = this, - view = view + view = view, ) closeFindInPageBarOnNavigation(store) @@ -805,10 +812,10 @@ abstract class BaseBrowserFragment : requireComponents.core.store, context.components.useCases.sessionUseCases.reload, binding.swipeRefresh, - customTabSessionId + customTabSessionId, ), owner = this, - view = view + view = view, ) } @@ -819,10 +826,10 @@ abstract class BaseBrowserFragment : requireComponents.core.store, requireComponents.backgroundServices.accountManager, requireComponents.backgroundServices.serverConfig, - setOf(FxaCapability.CHOOSE_WHAT_TO_SYNC) + setOf(FxaCapability.CHOOSE_WHAT_TO_SYNC), ), owner = this, - view = view + view = view, ) initializeEngineView(toolbarHeight) @@ -859,7 +866,7 @@ abstract class BaseBrowserFragment : private fun showPinVerification(manager: KeyguardManager) { val intent = manager.createConfirmDeviceCredentialIntent( getString(R.string.credit_cards_biometric_prompt_message_pin), - getString(R.string.credit_cards_biometric_prompt_unlock_message) + getString(R.string.credit_cards_biometric_prompt_unlock_message), ) requireActivity().startActivityForResult(intent, PIN_REQUEST) } @@ -894,7 +901,7 @@ abstract class BaseBrowserFragment : state.findCustomTabOrSelectedTab(customTabSessionId) } .ifAnyChanged { - tab -> + tab -> arrayOf(tab.content.url, tab.content.loadRequest) } .collect { @@ -910,12 +917,12 @@ abstract class BaseBrowserFragment : private fun saveDownloadDialogState( sessionId: String?, downloadState: DownloadState, - downloadJobStatus: DownloadState.Status + downloadJobStatus: DownloadState.Status, ) { sessionId?.let { id -> sharedViewModel.downloadDialogState[id] = Pair( downloadState, - downloadJobStatus == DownloadState.Status.FAILED + downloadJobStatus == DownloadState.Status.FAILED, ) } } @@ -931,7 +938,7 @@ abstract class BaseBrowserFragment : sessionId: String?, store: BrowserStore, context: Context, - toolbarHeight: Int + toolbarHeight: Int, ) { val savedDownloadState = sharedViewModel.downloadDialogState[sessionId] @@ -945,8 +952,9 @@ abstract class BaseBrowserFragment : savedDownloadState.first?.let { dlState -> store.dispatch( ContentAction.UpdateDownloadAction( - sessionId, dlState.copy(skipConfirmation = true) - ) + sessionId, + dlState.copy(skipConfirmation = true), + ), ) } } @@ -964,7 +972,7 @@ abstract class BaseBrowserFragment : }, binding = binding.viewDynamicDownloadDialog, toolbarHeight = toolbarHeight, - onDismiss = onDismiss + onDismiss = onDismiss, ).show() browserToolbarView.expand() @@ -995,7 +1003,7 @@ abstract class BaseBrowserFragment : null, getSwipeRefreshLayout(), toolbarHeight, - toolbarPosition + toolbarPosition, ) } else { // Ensure webpage's bottom elements are aligned to the very bottom of the engineView. @@ -1017,7 +1025,7 @@ abstract class BaseBrowserFragment : */ protected abstract fun getContextMenuCandidates( context: Context, - view: View + view: View, ): List @VisibleForTesting @@ -1031,7 +1039,7 @@ abstract class BaseBrowserFragment : // Once tab restoration is complete, if there are no tabs to show in the browser, go home val tabs = store.state.getNormalOrPrivateTabs( - activity.browsingModeManager.mode.isPrivate + activity.browsingModeManager.mode.isPrivate, ) if (tabs.isEmpty() || store.state.selectedTabId == null) { navController.popBackStack(R.id.homeFragment, false) @@ -1141,8 +1149,8 @@ abstract class BaseBrowserFragment : override fun onBackLongPressed(): Boolean { findNavController().navigate( NavGraphDirections.actionGlobalTabHistoryDialogFragment( - activeSessionId = customTabSessionId - ) + activeSessionId = customTabSessionId, + ), ) return true } @@ -1173,7 +1181,7 @@ abstract class BaseBrowserFragment : final override fun onRequestPermissionsResult( requestCode: Int, permissions: Array, - grantResults: IntArray + grantResults: IntArray, ) { val feature: PermissionsFeature? = when (requestCode) { REQUEST_CODE_DOWNLOAD_PERMISSIONS -> downloadsFeature.get() @@ -1190,7 +1198,7 @@ abstract class BaseBrowserFragment : override fun onActivityResult(requestCode: Int, data: Intent?, resultCode: Int): Boolean { return listOf( promptsFeature, - webAuthnFeature + webAuthnFeature, ).any { it.onActivityResult(requestCode, data, resultCode) } } @@ -1219,7 +1227,7 @@ abstract class BaseBrowserFragment : protected abstract fun navToQuickSettingsSheet( tab: SessionState, - sitePermissions: SitePermissions? + sitePermissions: SitePermissions?, ) /** @@ -1280,7 +1288,7 @@ abstract class BaseBrowserFragment : withContext(Main) { nav( R.id.browserFragment, - BrowserFragmentDirections.actionGlobalBookmarkEditFragment(existing.guid, true) + BrowserFragmentDirections.actionGlobalBookmarkEditFragment(existing.guid, true), ) } } else { @@ -1290,7 +1298,7 @@ abstract class BaseBrowserFragment : BookmarkRoot.Mobile.id, url = sessionUrl, title = sessionTitle, - position = null + position = null, ) withContext(Main) { @@ -1298,7 +1306,7 @@ abstract class BaseBrowserFragment : FenixSnackbar.make( view = binding.browserLayout, duration = FenixSnackbar.LENGTH_LONG, - isDisplayedWithBrowserToolbar = true + isDisplayedWithBrowserToolbar = true, ) .setText(getString(R.string.bookmark_saved_snackbar)) .setAction(getString(R.string.edit_bookmark_snackbar_action)) { @@ -1306,8 +1314,8 @@ abstract class BaseBrowserFragment : R.id.browserFragment, BrowserFragmentDirections.actionGlobalBookmarkEditFragment( guid, - true - ) + true, + ), ) } .show() @@ -1315,12 +1323,11 @@ abstract class BaseBrowserFragment : } } catch (e: PlacesException.UrlParseFailed) { withContext(Main) { - view?.let { FenixSnackbar.make( view = binding.browserLayout, duration = FenixSnackbar.LENGTH_LONG, - isDisplayedWithBrowserToolbar = true + isDisplayedWithBrowserToolbar = true, ) .setText(getString(R.string.bookmark_invalid_url_error)) .show() @@ -1363,7 +1370,7 @@ abstract class BaseBrowserFragment : FenixSnackbar.make( view = binding.browserLayout, duration = Snackbar.LENGTH_SHORT, - isDisplayedWithBrowserToolbar = false + isDisplayedWithBrowserToolbar = false, ) .setText(getString(R.string.full_screen_notification)) .show() @@ -1405,7 +1412,7 @@ abstract class BaseBrowserFragment : // Diagnostic breadcrumb for "Display already aquired" crash: // https://github.com/mozilla-mobile/android-components/issues/7960 breadcrumb( - message = "onDestroyView()" + message = "onDestroyView()", ) requireContext().accessibilityManager.removeAccessibilityStateChangeListener(this) @@ -1420,7 +1427,7 @@ abstract class BaseBrowserFragment : // Diagnostic breadcrumb for "Display already aquired" crash: // https://github.com/mozilla-mobile/android-components/issues/7960 breadcrumb( - message = "onAttach()" + message = "onAttach()", ) } @@ -1430,19 +1437,19 @@ abstract class BaseBrowserFragment : // Diagnostic breadcrumb for "Display already aquired" crash: // https://github.com/mozilla-mobile/android-components/issues/7960 breadcrumb( - message = "onDetach()" + message = "onDetach()", ) } private fun showCannotOpenFileError( view: View, context: Context, - downloadState: DownloadState + downloadState: DownloadState, ) { FenixSnackbar.make( view = view, duration = Snackbar.LENGTH_SHORT, - isDisplayedWithBrowserToolbar = true + isDisplayedWithBrowserToolbar = true, ).setText(DynamicDownloadDialog.getCannotOpenFileErrorMessage(context, downloadState)) .show() } @@ -1455,7 +1462,7 @@ abstract class BaseBrowserFragment : val onboardingLinksList: List = listOf( SupportUtils.getMozillaPageUrl(SupportUtils.MozillaPage.PRIVATE_NOTICE), - SupportUtils.getFirefoxAccountSumoUrl() + SupportUtils.getFirefoxAccountSumoUrl(), ) } @@ -1499,9 +1506,8 @@ abstract class BaseBrowserFragment : @VisibleForTesting internal fun shouldShowCompletedDownloadDialog( downloadState: DownloadState, - status: DownloadState.Status + status: DownloadState.Status, ): Boolean { - val isValidStatus = status in listOf(DownloadState.Status.COMPLETED, DownloadState.Status.FAILED) val isSameTab = downloadState.sessionId == getCurrentTab()?.id ?: false diff --git a/app/src/main/java/org/mozilla/fenix/browser/BrowserAnimator.kt b/app/src/main/java/org/mozilla/fenix/browser/BrowserAnimator.kt index bfb9c8bc1d..e32735e2ba 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BrowserAnimator.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BrowserAnimator.kt @@ -28,7 +28,7 @@ class BrowserAnimator( private val fragment: WeakReference, private val engineView: WeakReference, private val swipeRefresh: WeakReference, - private val viewLifecycleScope: WeakReference + private val viewLifecycleScope: WeakReference, ) { private val unwrappedEngineView: EngineView? diff --git a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt index 49b11f1ae7..f4e02b49a9 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt @@ -67,19 +67,19 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { tabPreview = binding.tabPreview, toolbarLayout = browserToolbarView.view, store = components.core.store, - selectTabUseCase = components.useCases.tabsUseCases.selectTab - ) + selectTabUseCase = components.useCases.tabsUseCases.selectTab, + ), ) } val homeAction = BrowserToolbar.Button( imageDrawable = AppCompatResources.getDrawable( context, - R.drawable.mozac_ic_home + R.drawable.mozac_ic_home, )!!, contentDescription = context.getString(R.string.browser_toolbar_home), iconTintColorResource = ThemeManager.resolveAttribute(R.attr.textPrimary, context), - listener = browserToolbarInteractor::onHomeButtonClicked + listener = browserToolbarInteractor::onHomeButtonClicked, ) browserToolbarView.view.addNavigationAction(homeAction) @@ -90,7 +90,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { val backAction = BrowserToolbar.TwoStateButton( primaryImage = AppCompatResources.getDrawable( context, - R.drawable.mozac_ic_back + R.drawable.mozac_ic_back, )!!, primaryContentDescription = context.getString(R.string.browser_menu_back), primaryImageTintResource = enableTint, @@ -99,20 +99,20 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { disableInSecondaryState = true, longClickListener = { browserToolbarInteractor.onBrowserToolbarMenuItemTapped( - ToolbarMenu.Item.Back(viewHistory = true) + ToolbarMenu.Item.Back(viewHistory = true), ) }, listener = { browserToolbarInteractor.onBrowserToolbarMenuItemTapped( - ToolbarMenu.Item.Back(viewHistory = false) + ToolbarMenu.Item.Back(viewHistory = false), ) - } + }, ) browserToolbarView.view.addNavigationAction(backAction) val forwardAction = BrowserToolbar.TwoStateButton( primaryImage = AppCompatResources.getDrawable( context, - R.drawable.mozac_ic_forward + R.drawable.mozac_ic_forward, )!!, primaryContentDescription = context.getString(R.string.browser_menu_forward), primaryImageTintResource = enableTint, @@ -121,20 +121,20 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { disableInSecondaryState = true, longClickListener = { browserToolbarInteractor.onBrowserToolbarMenuItemTapped( - ToolbarMenu.Item.Forward(viewHistory = true) + ToolbarMenu.Item.Forward(viewHistory = true), ) }, listener = { browserToolbarInteractor.onBrowserToolbarMenuItemTapped( - ToolbarMenu.Item.Forward(viewHistory = false) + ToolbarMenu.Item.Forward(viewHistory = false), ) - } + }, ) browserToolbarView.view.addNavigationAction(forwardAction) val refreshAction = BrowserToolbar.TwoStateButton( primaryImage = AppCompatResources.getDrawable( context, - R.drawable.mozac_ic_refresh + R.drawable.mozac_ic_refresh, )!!, primaryContentDescription = context.getString(R.string.browser_menu_refresh), primaryImageTintResource = enableTint, @@ -143,13 +143,13 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { }, secondaryImage = AppCompatResources.getDrawable( context, - R.drawable.mozac_ic_stop + R.drawable.mozac_ic_stop, )!!, secondaryContentDescription = context.getString(R.string.browser_menu_stop), disableInSecondaryState = false, longClickListener = { browserToolbarInteractor.onBrowserToolbarMenuItemTapped( - ToolbarMenu.Item.Reload(bypassCache = true) + ToolbarMenu.Item.Reload(bypassCache = true), ) }, listener = { @@ -157,10 +157,10 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { browserToolbarInteractor.onBrowserToolbarMenuItemTapped(ToolbarMenu.Item.Stop) } else { browserToolbarInteractor.onBrowserToolbarMenuItemTapped( - ToolbarMenu.Item.Reload(bypassCache = false) + ToolbarMenu.Item.Reload(bypassCache = false), ) } - } + }, ) browserToolbarView.view.addNavigationAction(refreshAction) } @@ -169,12 +169,12 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { BrowserToolbar.ToggleButton( image = AppCompatResources.getDrawable( context, - R.drawable.ic_readermode + R.drawable.ic_readermode, )!!, imageSelected = AppCompatResources.getDrawable( context, - R.drawable.ic_readermode_selected + R.drawable.ic_readermode_selected, )!!, contentDescription = context.getString(R.string.browser_menu_read), contentDescriptionSelected = context.getString(R.string.browser_menu_read_close), @@ -184,7 +184,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { selected = getCurrentTab()?.let { activity?.components?.core?.store?.state?.findTab(it.id)?.readerState?.active } ?: false, - listener = browserToolbarInteractor::onReaderModePressed + listener = browserToolbarInteractor::onReaderModePressed, ) browserToolbarView.view.addPageAction(readerModeAction) @@ -192,7 +192,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { thumbnailsFeature.set( feature = BrowserThumbnails(context, binding.engineView, components.core.store), owner = this, - view = view + view = view, ) readerViewFeature.set( @@ -201,7 +201,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { context, components.core.engine, components.core.store, - binding.readerViewControlsBar + binding.readerViewControlsBar, ) { available, active -> if (available) { ReaderMode.available.record(NoExtras()) @@ -213,16 +213,16 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { } }, owner = this, - view = view + view = view, ) windowFeature.set( feature = WindowFeature( store = components.core.store, - tabsUseCases = components.useCases.tabsUseCases + tabsUseCases = components.useCases.tabsUseCases, ), owner = this, - view = view + view = view, ) if (context.settings().shouldShowOpenInAppCfr) { @@ -235,10 +235,10 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { settings = context.settings(), appLinksUseCases = context.components.useCases.appLinksUseCases, container = binding.browserLayout as ViewGroup, - shouldScrollWithTopToolbar = !context.settings().shouldUseBottomToolbar + shouldScrollWithTopToolbar = !context.settings().shouldUseBottomToolbar, ), owner = this, - view = view + view = view, ) } } @@ -254,7 +254,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { lifecycleOwner = this, navController = findNavController(), settings = settings, - webAppUseCases = context.components.useCases.webAppUseCases + webAppUseCases = context.components.useCases.webAppUseCases, ).also { it.start() } @@ -310,7 +310,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { gravity = getAppropriateLayoutGravity(), certificateName = tab.content.securityInfo.issuer, permissionHighlights = tab.content.permissionHighlights, - isTrackingProtectionEnabled = isTrackingProtectionEnabled + isTrackingProtectionEnabled = isTrackingProtectionEnabled, ) nav(R.id.browserFragment, directions) } @@ -321,7 +321,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { override fun onCollectionCreated( title: String, sessions: List, - id: Long? + id: Long?, ) { showTabSavedToCollectionSnackbar(sessions.size, true) } @@ -332,7 +332,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { private fun showTabSavedToCollectionSnackbar( tabSize: Int, - isNewCollection: Boolean = false + isNewCollection: Boolean = false, ) { view?.let { view -> val messageStringRes = when { @@ -349,15 +349,15 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { FenixSnackbar.make( view = binding.browserLayout, duration = Snackbar.LENGTH_SHORT, - isDisplayedWithBrowserToolbar = true + isDisplayedWithBrowserToolbar = true, ) .setText(view.context.getString(messageStringRes)) .setAction(requireContext().getString(R.string.create_collection_view)) { findNavController().navigate( BrowserFragmentDirections.actionGlobalHome( focusOnAddressBar = false, - scrollToCollection = true - ) + scrollToCollection = true, + ), ) } .show() @@ -367,11 +367,11 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { override fun getContextMenuCandidates( context: Context, - view: View + view: View, ): List { val contextMenuCandidateAppLinksUseCases = AppLinksUseCases( requireContext(), - { true } + { true }, ) return ContextMenuCandidate.defaultCandidates( @@ -379,10 +379,10 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { context.components.useCases.tabsUseCases, context.components.useCases.contextMenuUseCases, view, - FenixSnackbarDelegate(view) + FenixSnackbarDelegate(view), ) + ContextMenuCandidate.createOpenInExternalAppCandidate( requireContext(), - contextMenuCandidateAppLinksUseCases + contextMenuCandidateAppLinksUseCases, ) } diff --git a/app/src/main/java/org/mozilla/fenix/browser/CustomTabContextMenuCandidate.kt b/app/src/main/java/org/mozilla/fenix/browser/CustomTabContextMenuCandidate.kt index 4753360c36..be54beb3a6 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/CustomTabContextMenuCandidate.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/CustomTabContextMenuCandidate.kt @@ -20,12 +20,12 @@ class CustomTabContextMenuCandidate { context: Context, contextMenuUseCases: ContextMenuUseCases, snackBarParentView: View, - snackbarDelegate: ContextMenuCandidate.SnackbarDelegate = DefaultSnackbarDelegate() + snackbarDelegate: ContextMenuCandidate.SnackbarDelegate = DefaultSnackbarDelegate(), ): List = listOf( ContextMenuCandidate.createCopyLinkCandidate( context, snackBarParentView, - snackbarDelegate + snackbarDelegate, ), ContextMenuCandidate.createShareLinkCandidate(context), ContextMenuCandidate.createSaveImageCandidate(context, contextMenuUseCases), @@ -33,8 +33,8 @@ class CustomTabContextMenuCandidate { ContextMenuCandidate.createCopyImageLocationCandidate( context, snackBarParentView, - snackbarDelegate - ) + snackbarDelegate, + ), ) } } diff --git a/app/src/main/java/org/mozilla/fenix/browser/FenixSnackbarDelegate.kt b/app/src/main/java/org/mozilla/fenix/browser/FenixSnackbarDelegate.kt index 5de15a759f..12113cd1fb 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/FenixSnackbarDelegate.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/FenixSnackbarDelegate.kt @@ -16,13 +16,13 @@ class FenixSnackbarDelegate(private val view: View) : ContextMenuCandidate.Snack @StringRes text: Int, duration: Int, @StringRes action: Int, - listener: ((v: View) -> Unit)? + listener: ((v: View) -> Unit)?, ) { if (listener != null && action != 0) { FenixSnackbar.make( view = view, duration = FenixSnackbar.LENGTH_SHORT, - isDisplayedWithBrowserToolbar = true + isDisplayedWithBrowserToolbar = true, ) .setText(view.context.getString(text)) .setAction(view.context.getString(action)) { listener.invoke(view) } @@ -31,7 +31,7 @@ class FenixSnackbarDelegate(private val view: View) : ContextMenuCandidate.Snack FenixSnackbar.make( view, duration = FenixSnackbar.LENGTH_SHORT, - isDisplayedWithBrowserToolbar = true + isDisplayedWithBrowserToolbar = true, ) .setText(view.context.getString(text)) .show() diff --git a/app/src/main/java/org/mozilla/fenix/browser/OpenInAppOnboardingObserver.kt b/app/src/main/java/org/mozilla/fenix/browser/OpenInAppOnboardingObserver.kt index 5fcfa20d95..bfb4c6b5c2 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/OpenInAppOnboardingObserver.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/OpenInAppOnboardingObserver.kt @@ -39,7 +39,7 @@ class OpenInAppOnboardingObserver( private val appLinksUseCases: AppLinksUseCases, private val container: ViewGroup, @VisibleForTesting - internal val shouldScrollWithTopToolbar: Boolean = false + internal val shouldScrollWithTopToolbar: Boolean = false, ) : LifecycleAwareFeature { private var scope: CoroutineScope? = null private var currentUrl: String? = null @@ -54,7 +54,7 @@ class OpenInAppOnboardingObserver( state.selectedTab } .ifAnyChanged { - tab -> + tab -> arrayOf(tab.content.url, tab.content.loading) } .collect { tab -> @@ -100,10 +100,10 @@ class OpenInAppOnboardingObserver( dismissText = context.getString(R.string.open_in_app_cfr_negative_button_text), actionText = context.getString(R.string.open_in_app_cfr_positive_button_text), container = container, - shouldScrollWithTopToolbar = shouldScrollWithTopToolbar + shouldScrollWithTopToolbar = shouldScrollWithTopToolbar, ) { val directions = BrowserFragmentDirections.actionBrowserFragmentToSettingsFragment( - preferenceToScrollTo = context.getString(R.string.pref_key_open_links_in_external_app) + preferenceToScrollTo = context.getString(R.string.pref_key_open_links_in_external_app), ) navController.nav(R.id.browserFragment, directions) } diff --git a/app/src/main/java/org/mozilla/fenix/browser/SwipeGestureLayout.kt b/app/src/main/java/org/mozilla/fenix/browser/SwipeGestureLayout.kt index c1bccab6c6..a1084602e3 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/SwipeGestureLayout.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/SwipeGestureLayout.kt @@ -53,7 +53,7 @@ interface SwipeGestureListener { class SwipeGestureLayout @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, - defStyleAttr: Int = 0 + defStyleAttr: Int = 0, ) : FrameLayout(context, attrs, defStyleAttr) { private val gestureListener = object : GestureDetector.SimpleOnGestureListener() { @@ -65,7 +65,7 @@ class SwipeGestureLayout @JvmOverloads constructor( e1: MotionEvent?, e2: MotionEvent?, distanceX: Float, - distanceY: Float + distanceY: Float, ): Boolean { val start = e1?.let { event -> PointF(event.rawX, event.rawY) } ?: return false val next = e2?.let { event -> PointF(event.rawX, event.rawY) } ?: return false @@ -84,7 +84,7 @@ class SwipeGestureLayout @JvmOverloads constructor( e1: MotionEvent?, e2: MotionEvent?, velocityX: Float, - velocityY: Float + velocityY: Float, ): Boolean { activeListener?.onSwipeFinished(velocityX, velocityY) return if (activeListener != null) { @@ -125,7 +125,7 @@ class SwipeGestureLayout @JvmOverloads constructor( // so notify the listener that the swipe was finished with 0 velocity activeListener?.onSwipeFinished( velocityX = 0f, - velocityY = 0f + velocityY = 0f, ) activeListener = null false diff --git a/app/src/main/java/org/mozilla/fenix/browser/TabPreview.kt b/app/src/main/java/org/mozilla/fenix/browser/TabPreview.kt index 061cb4df8a..0a31705296 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/TabPreview.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/TabPreview.kt @@ -25,7 +25,7 @@ import kotlin.math.max class TabPreview @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, - defStyle: Int = 0 + defStyle: Int = 0, ) : FrameLayout(context, attrs, defStyle) { private val binding = TabPreviewBinding.inflate(LayoutInflater.from(context), this) @@ -39,7 +39,7 @@ class TabPreview @JvmOverloads constructor( binding.fakeToolbar.background = AppCompatResources.getDrawable( context, - ThemeManager.resolveAttribute(R.attr.bottomBarBackgroundTop, context) + ThemeManager.resolveAttribute(R.attr.bottomBarBackgroundTop, context), ) } @@ -63,7 +63,7 @@ class TabPreview @JvmOverloads constructor( val thumbnailSize = max(previewThumbnail.height, previewThumbnail.width) thumbnailLoader.loadIntoView( previewThumbnail, - ImageLoadRequest(thumbnailId, thumbnailSize) + ImageLoadRequest(thumbnailId, thumbnailSize), ) } } diff --git a/app/src/main/java/org/mozilla/fenix/browser/ToolbarGestureHandler.kt b/app/src/main/java/org/mozilla/fenix/browser/ToolbarGestureHandler.kt index 6860c1d8b0..ef5cedf523 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/ToolbarGestureHandler.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/ToolbarGestureHandler.kt @@ -45,7 +45,7 @@ class ToolbarGestureHandler( private val tabPreview: TabPreview, private val toolbarLayout: View, private val store: BrowserStore, - private val selectTabUseCase: TabsUseCases.SelectTabUseCase + private val selectTabUseCase: TabsUseCases.SelectTabUseCase, ) : SwipeGestureListener { private enum class GestureDirection { @@ -100,21 +100,21 @@ class ToolbarGestureHandler( tabPreview.translationX = when (gestureDirection) { GestureDirection.RIGHT_TO_LEFT -> min( windowWidth.toFloat() + previewOffset, - tabPreview.translationX - distanceX + tabPreview.translationX - distanceX, ).coerceAtLeast(0f) GestureDirection.LEFT_TO_RIGHT -> max( -windowWidth.toFloat() - previewOffset, - tabPreview.translationX - distanceX + tabPreview.translationX - distanceX, ).coerceAtMost(0f) } contentLayout.translationX = when (gestureDirection) { GestureDirection.RIGHT_TO_LEFT -> min( 0f, - contentLayout.translationX - distanceX + contentLayout.translationX - distanceX, ).coerceAtLeast(-windowWidth.toFloat() - previewOffset) GestureDirection.LEFT_TO_RIGHT -> max( 0f, - contentLayout.translationX - distanceX + contentLayout.translationX - distanceX, ).coerceAtMost(windowWidth.toFloat() + previewOffset) } } @@ -125,11 +125,11 @@ class ToolbarGestureHandler( contentLayout.translationX = when (gestureDirection) { GestureDirection.RIGHT_TO_LEFT -> max( -maxContentHidden.toFloat(), - contentLayout.translationX - distanceX + contentLayout.translationX - distanceX, ).coerceAtMost(0f) GestureDirection.LEFT_TO_RIGHT -> min( maxContentHidden.toFloat(), - contentLayout.translationX - distanceX + contentLayout.translationX - distanceX, ).coerceAtLeast(0f) } } @@ -138,7 +138,7 @@ class ToolbarGestureHandler( override fun onSwipeFinished( velocityX: Float, - velocityY: Float + velocityY: Float, ) { val destination = getDestination() if (destination is Destination.Tab && isGestureComplete(velocityX)) { @@ -151,9 +151,10 @@ class ToolbarGestureHandler( private fun getDestination(): Destination { val isLtr = activity.resources.configuration.layoutDirection == View.LAYOUT_DIRECTION_LTR val currentTab = store.state.selectedTab ?: return Destination.None - val currentIndex = store.state.getNormalOrPrivateTabs(currentTab.content.private).indexOfFirst { - it.id == currentTab.id - } + val currentIndex = + store.state.getNormalOrPrivateTabs(currentTab.content.private).indexOfFirst { + it.id == currentTab.id + } return if (currentIndex == -1) { Destination.None @@ -255,11 +256,13 @@ class ToolbarGestureHandler( tabPreview.animate() .alpha(0f) .setDuration(shortAnimationDuration.toLong()) - .setListener(object : AnimatorListenerAdapter() { - override fun onAnimationEnd(animation: Animator?) { - tabPreview.isVisible = false - } - }) + .setListener( + object : AnimatorListenerAdapter() { + override fun onAnimationEnd(animation: Animator?) { + tabPreview.isVisible = false + } + }, + ) } }.start() } diff --git a/app/src/main/java/org/mozilla/fenix/browser/browsingmode/BrowsingModeManager.kt b/app/src/main/java/org/mozilla/fenix/browser/browsingmode/BrowsingModeManager.kt index f117b45215..1b31d596e0 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/browsingmode/BrowsingModeManager.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/browsingmode/BrowsingModeManager.kt @@ -37,7 +37,7 @@ interface BrowsingModeManager { class DefaultBrowsingModeManager( private var _mode: BrowsingMode, private val settings: Settings, - private val modeDidChange: (BrowsingMode) -> Unit + private val modeDidChange: (BrowsingMode) -> Unit, ) : BrowsingModeManager { override var mode: BrowsingMode diff --git a/app/src/main/java/org/mozilla/fenix/browser/infobanner/DynamicInfoBanner.kt b/app/src/main/java/org/mozilla/fenix/browser/infobanner/DynamicInfoBanner.kt index e341634b21..72e296fc62 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/infobanner/DynamicInfoBanner.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/infobanner/DynamicInfoBanner.kt @@ -26,16 +26,24 @@ class DynamicInfoBanner( actionText: String? = null, dismissByHiding: Boolean = false, dismissAction: (() -> Unit)? = null, - actionToPerform: (() -> Unit)? = null + actionToPerform: (() -> Unit)? = null, ) : InfoBanner( - context, container, message, dismissText, actionText, dismissByHiding, dismissAction, actionToPerform + context, + container, + message, + dismissText, + actionText, + dismissByHiding, + dismissAction, + actionToPerform, ) { override fun showBanner() { super.showBanner() if (shouldScrollWithTopToolbar) { (binding.root.layoutParams as CoordinatorLayout.LayoutParams).behavior = DynamicInfoBannerBehavior( - context, null + context, + null, ) } } diff --git a/app/src/main/java/org/mozilla/fenix/browser/infobanner/DynamicInfoBannerBehavior.kt b/app/src/main/java/org/mozilla/fenix/browser/infobanner/DynamicInfoBannerBehavior.kt index 752826248f..8fe1fd44b2 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/infobanner/DynamicInfoBannerBehavior.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/infobanner/DynamicInfoBannerBehavior.kt @@ -22,7 +22,7 @@ import mozilla.components.browser.toolbar.BrowserToolbar */ class DynamicInfoBannerBehavior( context: Context?, - attrs: AttributeSet? + attrs: AttributeSet?, ) : CoordinatorLayout.Behavior(context, attrs) { @VisibleForTesting internal var toolbarHeight: Int = 0 diff --git a/app/src/main/java/org/mozilla/fenix/browser/infobanner/InfoBanner.kt b/app/src/main/java/org/mozilla/fenix/browser/infobanner/InfoBanner.kt index db2bd06465..6e8061ad6f 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/infobanner/InfoBanner.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/infobanner/InfoBanner.kt @@ -35,7 +35,7 @@ open class InfoBanner( @VisibleForTesting internal val dismissAction: (() -> Unit)? = null, @VisibleForTesting - internal val actionToPerform: (() -> Unit)? = null + internal val actionToPerform: (() -> Unit)? = null, ) { @SuppressLint("InflateParams") @VisibleForTesting diff --git a/app/src/main/java/org/mozilla/fenix/browser/readermode/ReaderModeController.kt b/app/src/main/java/org/mozilla/fenix/browser/readermode/ReaderModeController.kt index bc24e7dfb8..cfb2081d3f 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/readermode/ReaderModeController.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/readermode/ReaderModeController.kt @@ -25,7 +25,7 @@ class DefaultReaderModeController( private val readerViewFeature: ViewBoundFeatureWrapper, private val readerViewControlsBar: View, private val isPrivate: Boolean = false, - private val onReaderModeChanged: () -> Unit = {} + private val onReaderModeChanged: () -> Unit = {}, ) : ReaderModeController { override fun hideReaderView() { onReaderModeChanged() @@ -52,29 +52,29 @@ class DefaultReaderModeController( private fun themeReaderViewControlsForPrivateMode(view: View) = with(view) { listOf( R.id.mozac_feature_readerview_font_size_decrease, - R.id.mozac_feature_readerview_font_size_increase + R.id.mozac_feature_readerview_font_size_increase, ).map { findViewById