For #7503 - Show Start browsing cfr at fresh install #7705
Conversation
61ccf4d
to
08dc7d6
Compare
fun `GIVEN app fresh install WHEN input toolbar integration is starting THEN start browsing scope is populated`() { | ||
inputToolbarIntegration.start() | ||
|
||
assertNotEquals(null, inputToolbarIntegration.startBrowsingCfrScope) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertNotEquals(null, inputToolbarIntegration.startBrowsingCfrScope) | |
assertNotNull(inputToolbarIntegration.startBrowsingCfrScope) |
nit: We could verify that the scope was null
before the inputToolbarIntegration.start()
call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
fun `GIVEN app fresh install WHEN input toolbar integration is stoping THEN start browsing scope is canceled`() { | ||
inputToolbarIntegration.stop() | ||
|
||
assertEquals(null, inputToolbarIntegration.startBrowsingCfrScope?.cancel()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it looks like we are asserting that startBrowsingCfrScope?.cancel()
returns null.
If we need to test that inputToolbarIntegration.stop()
stopped the scope we could use something similar to
assertFalse(inputToolbarIntegration.startBrowsingCfrScope?.isActive ?: true)
in which case a previous
assertTrue(inputToolbarIntegration.startBrowsingCfrScope?.isActive ?: false)
would also help adding mroe confidence in the assert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
shippedDomainsProvider, | ||
customDomainProviderResult, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Seems like these are simple mocks needed just to be able to build InputToolbarIntegration
. They could be initialized in place with mock()
calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
@Before | ||
fun setUp() { | ||
Dispatchers.setMain(testDispatcher) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this is needed (together with UnconfinedTestDispatcher
and code from onAfter
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
app/src/main/res/values/strings.xml
Outdated
@@ -964,6 +964,9 @@ | |||
!-- This is the title of promote search widget dialog. --> | |||
<string name="promote_search_widget_dialog_title">Browsing history cleared! 🎉</string> | |||
|
|||
<!-- CFR for Start your private browsing session--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally it is preferred to avoid acronyms. Maybe localizers don't know these internal namings.
Would be useful to reformulate this to avoid the CFR
or at least offer more context. I see for other such strings that the comment contains (Banner Info Message)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -187,6 +188,13 @@ private fun showEraseTabsCfrChanged(state: AppState, action: AppAction.ShowErase | |||
return state.copy(showEraseTabsCfr = action.value) | |||
} | |||
|
|||
/** | |||
* The state of start browsing CFR changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This comment provides little useful info. If a comment is really needed "Update whether the start browsing CFR should be shown or not" may be just a little bit better.
I see that there are many comments which follow this structure so maybe a separate ticket to update the documentation for all these methods would be nice for a good first issue
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -105,9 +123,60 @@ class InputToolbarIntegration( | |||
override fun start() { | |||
useCustomDomainProvider = settings.shouldAutocompleteFromCustomDomainList() | |||
useShippedDomainProvider = settings.shouldAutocompleteFromShippedDomainList() | |||
observeStartBrowserCfrVisibility() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Since the new CFR is to be shown just once we could avoid always observing the store with another if (showStartBrowsingCfr)
check here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
fontSize = 16.sp, | ||
letterSpacing = 0.5.sp, | ||
lineHeight = 24.sp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this configuration is common to all CFRs.
Could it be extracted in a new typography?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
5b19511
to
e654619
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one question about the dismiss behavior and a few proposed changes about the cfr text typographies.
onDismiss = { onDismissStartBrowsingCfr() }, | ||
text = { | ||
Text( | ||
style = focusTypography.cfrTextStyle, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This style should be applied to all CFRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
package org.mozilla.focus.browser.integration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing newline between this and the license text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -121,4 +122,10 @@ val focusTypography: FocusTypography | |||
fontSize = 14.sp, | |||
color = PhotonColors.LightGrey05, | |||
), | |||
cfrTextStyle = TextStyle( | |||
fontFamily = metropolis, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
), | ||
popupVerticalOffset = 0.dp, | ||
), | ||
onDismiss = { onDismissStartBrowsingCfr() }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The onDismiss
callback informs of the user taped on the X button or not - maybe the CFR was dismissed by pressing outside of it.
Do we need to consider these separate scenarios?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done . Based on this bug #7653 cfrs should not be dismissed if the users taps anywhere on the screen.
7cdadc4
to
0b7c73e
Compare
b77c489
to
35fa6cc
Compare
Verified as implemented on a local Focus Nightly build 108.0a1 with the following devices:
After dismissing the new onboarding, the start browsing CFR is displayed. |
@Mergifyio backport releases_v107.0 |
✅ Backports have been created
|
Pull Request checklist
QA
To download an APK when reviewing a PR:
Show All Checks
,Details
next tobuild-focus-debug
orbuild-klar-debug
for changes targeting Klar,View task in Taskcluster
,Artifacts
row,GitHub Automation
Fixes #7503