Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Merge branch 'main' into 21078
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Aug 31, 2021
2 parents eae5a67 + 13fd069 commit cd6c8d8
Show file tree
Hide file tree
Showing 40 changed files with 303 additions and 1,074 deletions.
697 changes: 41 additions & 656 deletions app/metrics.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,6 @@ class SettingsBasicsTest {
}
}

@Test
fun changeCloseTabsSetting() {
// Goes through the settings and verified the close tabs setting options.
homeScreen {
}.openThreeDotMenu {
}.openSettings {
}.openTabsSubMenu {
verifyOptions()
}
}

@Test
fun changeAccessibiltySettings() {
// Goes through the settings and changes the default text on a webpage, then verifies if the text has changed.
Expand Down
4 changes: 3 additions & 1 deletion app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1499,11 +1499,13 @@ class SmokeTest {
}

@Test
fun startOnHomeSettingsMenuItemsTest() {
fun tabsSettingsMenuItemsTest() {
homeScreen {
}.openThreeDotMenu {
}.openSettings {
}.openTabsSubMenu {
verifyTabViewOptions()
verifyCloseTabsOptions()
verifyStartOnHomeOptions()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class HistoryRobot {
}

fun clickDeleteHistoryButton() {
mDevice.waitNotNull(Until.findObject(By.text("Delete history")), waitingTime)
deleteAllHistoryButton().click()
}

Expand Down Expand Up @@ -117,7 +116,7 @@ private fun threeDotMenu() = onView(withId(R.id.overflow_menu))

private fun snackBarText() = onView(withId(R.id.snackbar_text))

private fun deleteAllHistoryButton() = onView(withId(R.id.delete_button))
private fun deleteAllHistoryButton() = onView(withId(R.id.history_delete_all))

private fun assertHistoryMenuView() {
onView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import org.mozilla.fenix.helpers.click
*/
class SettingsSubMenuTabsRobot {

fun verifyOptions() = assertOptions()
fun verifyTabViewOptions() = assertTabViewOptions()

fun verifyCloseTabsOptions() = assertCloseTabsOptions()

fun verifyStartOnHomeOptions() = assertStartOnHomeOptions()

Expand All @@ -42,10 +44,21 @@ class SettingsSubMenuTabsRobot {
}
}

private fun assertOptions() {
afterOneDayToggle()
private fun assertTabViewOptions() {
tabViewHeading()
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
listToggle()
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
gridToggle()
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
}

private fun assertCloseTabsOptions() {
closeTabsHeading()
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
manuallyToggle()
.check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
manualToggle()
afterOneDayToggle()
.check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
afterOneWeekToggle()
.check(ViewAssertions.matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
Expand All @@ -64,7 +77,15 @@ private fun assertStartOnHomeOptions() {
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
}

private fun manualToggle() = onView(withText("Manually"))
private fun tabViewHeading() = onView(withText("Tab view"))

private fun listToggle() = onView(withText("List"))

private fun gridToggle() = onView(withText("Grid"))

private fun closeTabsHeading() = onView(withText("Close tabs"))

private fun manuallyToggle() = onView(withText("Manually"))

private fun afterOneDayToggle() = onView(withText("After one day"))

Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/org/mozilla/fenix/FenixApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,6 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
bookmarksSuggestion.set(settings.shouldShowBookmarkSuggestions)
clipboardSuggestionsEnabled.set(settings.shouldShowClipboardSuggestions)
searchShortcutsEnabled.set(settings.shouldShowSearchShortcuts)
openLinksInPrivate.set(settings.openLinksInAPrivateTab)
privateSearchSuggestions.set(settings.shouldShowSearchSuggestionsInPrivate)
voiceSearchEnabled.set(settings.shouldShowVoiceSearch)
openLinksInAppEnabled.set(settings.openLinksInExternalApp)
signedInSync.set(settings.signedInFxaAccount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,16 +486,14 @@ abstract class BaseBrowserFragment :
val dynamicDownloadDialog = DynamicDownloadDialog(
context = context,
downloadState = downloadState,
metrics = requireComponents.analytics.metrics,
didFail = downloadJobStatus == DownloadState.Status.FAILED,
tryAgain = downloadFeature::tryAgain,
onCannotOpenFile = {
showCannotOpenFileError(binding.browserLayout, context, it)
},
binding = binding.viewDynamicDownloadDialog,
toolbarHeight = toolbarHeight,
onDismiss = { sharedViewModel.downloadDialogState.remove(downloadState.sessionId) }
)
toolbarHeight = toolbarHeight
) { sharedViewModel.downloadDialogState.remove(downloadState.sessionId) }

dynamicDownloadDialog.show()
browserToolbarView.expand()
Expand Down Expand Up @@ -887,7 +885,6 @@ abstract class BaseBrowserFragment :
DynamicDownloadDialog(
context = context,
downloadState = savedDownloadState.first,
metrics = requireComponents.analytics.metrics,
didFail = savedDownloadState.second,
tryAgain = onTryAgain,
onCannotOpenFile = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifAnyChanged
import org.mozilla.fenix.R
import org.mozilla.fenix.browser.infobanner.DynamicInfoBanner
import org.mozilla.fenix.browser.infobanner.InfoBanner
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.Event.BannerOpenInAppGoToSettings
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.utils.Settings

Expand Down Expand Up @@ -93,7 +90,6 @@ class OpenInAppOnboardingObserver(
infoBanner?.showBanner()
sessionDomainForDisplayedBanner = url.tryGetHostFromUrl()
settings.shouldShowOpenInAppBanner = false
context.components.analytics.metrics.track(Event.BannerOpenInAppDisplayed)
}
}

Expand All @@ -105,18 +101,12 @@ 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,
dismissAction = ::dismissAction
shouldScrollWithTopToolbar = shouldScrollWithTopToolbar
) {
val directions = BrowserFragmentDirections.actionBrowserFragmentToSettingsFragment(
preferenceToScrollTo = context.getString(R.string.pref_key_open_links_in_external_app)
)
context.components.analytics.metrics.track(BannerOpenInAppGoToSettings)
navController.nav(R.id.browserFragment, directions)
}
}

private fun dismissAction() {
context.components.analytics.metrics.track(Event.BannerOpenInAppDismissed)
}
}
51 changes: 0 additions & 51 deletions app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import org.mozilla.fenix.GleanMetrics.Onboarding
import org.mozilla.fenix.GleanMetrics.ProgressiveWebApp
import org.mozilla.fenix.GleanMetrics.SearchShortcuts
import org.mozilla.fenix.GleanMetrics.TabsTray
import org.mozilla.fenix.GleanMetrics.Tip
import org.mozilla.fenix.GleanMetrics.ToolbarSettings
import org.mozilla.fenix.GleanMetrics.TopSites
import org.mozilla.fenix.GleanMetrics.TrackingProtection
Expand Down Expand Up @@ -53,7 +52,6 @@ sealed class Event {
object CustomTabsClosed : Event()
object CustomTabsActionTapped : Event()
object CustomTabsMenuOpened : Event()
object UriOpened : Event()
object NormalAndPrivateUriOpened : Event()
object SyncAuthOpened : Event()
object SyncAuthClosed : Event()
Expand Down Expand Up @@ -97,35 +95,13 @@ sealed class Event {
object CollectionRenamePressed : Event()
object SearchWidgetNewTabPressed : Event()
object SearchWidgetVoiceSearchPressed : Event()
object FindInPageOpened : Event()
object FindInPageClosed : Event()
object FindInPageSearchCommitted : Event()
object PrivateBrowsingSnackbarUndoTapped : Event()
object PrivateBrowsingNotificationTapped : Event()
object PrivateBrowsingCreateShortcut : Event()
object PrivateBrowsingAddShortcutCFR : Event()
object PrivateBrowsingCancelCFR : Event()
object PrivateBrowsingPinnedShortcutPrivateTab : Event()
object PrivateBrowsingStaticShortcutTab : Event()
object PrivateBrowsingStaticShortcutPrivateTab : Event()
object TabMediaPlay : Event()
object TabMediaPause : Event()
object MediaPlayState : Event()
object MediaPauseState : Event()
object MediaStopState : Event()
object MediaFullscreenState : Event()
object MediaPictureInPictureState : Event()
object InAppNotificationDownloadOpen : Event()
object InAppNotificationDownloadTryAgain : Event()
object NotificationDownloadCancel : Event()
object NotificationDownloadOpen : Event()
object NotificationDownloadPause : Event()
object NotificationDownloadResume : Event()
object NotificationDownloadTryAgain : Event()
object DownloadAdded : Event()
object DownloadsScreenOpened : Event()
object DownloadsItemOpened : Event()
object DownloadsItemDeleted : Event()
object NotificationMediaPlay : Event()
object NotificationMediaPause : Event()
object TopSiteOpenDefault : Event()
Expand All @@ -148,12 +124,7 @@ sealed class Event {
object EditLogin : Event()
object EditLoginSave : Event()
object ViewLoginPassword : Event()
object CustomEngineAdded : Event()
object CustomEngineDeleted : Event()
object PrivateBrowsingShowSearchSuggestions : Event()
object WhatsNewTapped : Event()
object SupportTapped : Event()
object PrivacyNoticeTapped : Event()
object PocketTopSiteClicked : Event()
object PocketTopSiteRemoved : Event()
object FennecToFenixMigrated : Event()
Expand Down Expand Up @@ -198,9 +169,6 @@ sealed class Event {
object ProgressiveWebAppOpenFromHomescreenTap : Event()
object ProgressiveWebAppInstallAsShortcut : Event()

object MasterPasswordMigrationSuccess : Event()
object MasterPasswordMigrationDisplayed : Event()

object TabSettingsOpened : Event()

object CopyUrlUsed : Event()
Expand All @@ -211,10 +179,6 @@ sealed class Event {
object HaveOpenTabs : Event()
object HaveNoOpenTabs : Event()

object BannerOpenInAppDisplayed : Event()
object BannerOpenInAppDismissed : Event()
object BannerOpenInAppGoToSettings : Event()

object ContextMenuCopyTapped : Event()
object ContextMenuSearchTapped : Event()
object ContextMenuSelectAllTapped : Event()
Expand Down Expand Up @@ -371,21 +335,6 @@ sealed class Event {
get() = hashMapOf(Addons.openAddonSettingKeys.addonId to addonId)
}

data class TipDisplayed(val identifier: String) : Event() {
override val extras: Map<Tip.displayedKeys, String>?
get() = hashMapOf(Tip.displayedKeys.identifier to identifier)
}

data class TipPressed(val identifier: String) : Event() {
override val extras: Map<Tip.pressedKeys, String>?
get() = hashMapOf(Tip.pressedKeys.identifier to identifier)
}

data class TipClosed(val identifier: String) : Event() {
override val extras: Map<Tip.closedKeys, String>?
get() = hashMapOf(Tip.closedKeys.identifier to identifier)
}

data class ToolbarPositionChanged(val position: Position) : Event() {
enum class Position { TOP, BOTTOM }

Expand Down
Loading

0 comments on commit cd6c8d8

Please sign in to comment.