1
0
Fork 0

Copione merged onto master

master
blallo 2020-08-08 16:51:31 +02:00
commit f61f59b296
16 changed files with 117 additions and 75 deletions

View File

@ -42,7 +42,7 @@ object FeatureFlags {
/**
* Enables the new search experience
*/
val newSearchExperience = Config.channel.isDebug
val newSearchExperience = Config.channel.isNightlyOrDebug
/**
* Enables wait til first contentful paint

View File

@ -272,7 +272,8 @@ class Core(private val context: Context) {
private val passwordsEncryptionKey by lazy {
getSecureAbove22Preferences().getString(PASSWORDS_KEY)
?: generateEncryptionKey(KEY_STRENGTH).also {
if (context.settings().passwordsEncryptionKeyGenerated) {
if (context.settings().passwordsEncryptionKeyGenerated &&
isSentryEnabled()) {
// We already had previously generated an encryption key, but we have lost it
Sentry.capture("Passwords encryption key for passwords storage was lost and we generated a new one")
}

View File

@ -383,8 +383,10 @@ class HomeFragment : Fragment() {
}
}
val args by navArgs<HomeFragmentArgs>()
if (view.context.settings().accessibilityServicesEnabled &&
bundleArgs.getBoolean(FOCUS_ON_ADDRESS_BAR)
args.focusOnAddressBar
) {
// We cannot put this in the fragment_home.xml file as it breaks tests
view.toolbar_wrapper.isFocusableInTouchMode = true
@ -413,6 +415,10 @@ class HomeFragment : Fragment() {
}
updateTabCounter(requireComponents.core.store.state)
if (args.focusOnAddressBar && requireContext().settings().useNewSearchExperience) {
navigateToSearch()
}
}
private fun removeAllTabsAndShowSnackbar(sessionCode: String) {

View File

@ -173,6 +173,8 @@ class SearchFragment : Fragment(), UserInteractionHandler {
)
)
awesomeBarView.view.setOnEditSuggestionListener(toolbarView.view::setSearchTerms)
val urlView = toolbarView.view
.findViewById<InlineAutocompleteEditText>(R.id.mozac_browser_toolbar_edit_url_view)
urlView?.importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO

View File

@ -126,7 +126,14 @@ class ToolbarView(
/* Only set the search terms if pasted text is null so that the search term doesn't
overwrite pastedText when view enters `editMode` */
if (searchState.pastedText.isNullOrEmpty()) {
view.setSearchTerms(searchState.searchTerms)
// If we're in edit mode, setting the search term will update the toolbar,
// so we make sure we have the correct term/query to show.
val termOrQuery = if (searchState.searchTerms.isNotEmpty()) {
searchState.searchTerms
} else {
searchState.query
}
view.setSearchTerms(termOrQuery)
}
// We must trigger an onTextChanged so when search terms are set when transitioning to `editMode`

View File

@ -4,11 +4,16 @@
package org.mozilla.fenix.searchdialog
import android.app.Dialog
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatDialogFragment
import androidx.constraintlayout.widget.ConstraintProperties.BOTTOM
import androidx.constraintlayout.widget.ConstraintProperties.PARENT_ID
import androidx.constraintlayout.widget.ConstraintProperties.TOP
import androidx.constraintlayout.widget.ConstraintSet
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import kotlinx.android.synthetic.main.fragment_search.view.*
@ -16,9 +21,11 @@ import kotlinx.android.synthetic.main.fragment_search_dialog.*
import kotlinx.coroutines.ExperimentalCoroutinesApi
import mozilla.components.browser.state.selector.findTab
import mozilla.components.lib.state.ext.consumeFrom
import mozilla.components.support.base.feature.UserInteractionHandler
import mozilla.components.support.ktx.android.view.hideKeyboard
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.components.toolbar.ToolbarPosition
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.settings
@ -40,7 +47,7 @@ fun Settings.shouldShowSearchSuggestions(isPrivate: Boolean): Boolean {
}
}
class SearchDialogFragment : AppCompatDialogFragment() {
class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
private lateinit var interactor: SearchDialogInteractor
private lateinit var store: SearchDialogFragmentStore
@ -52,6 +59,14 @@ class SearchDialogFragment : AppCompatDialogFragment() {
setStyle(STYLE_NO_TITLE, R.style.SearchDialogStyle)
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return object : Dialog(requireContext(), this.theme) {
override fun onBackPressed() {
this@SearchDialogFragment.onBackPressed()
}
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
@ -97,6 +112,27 @@ class SearchDialogFragment : AppCompatDialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (view.context.settings().toolbarPosition == ToolbarPosition.BOTTOM) {
ConstraintSet().apply {
clone(search_wrapper)
clear(toolbar.id, TOP)
connect(toolbar.id, BOTTOM, PARENT_ID, BOTTOM)
clear(awesomeBar.id, TOP)
clear(awesomeBar.id, BOTTOM)
connect(awesomeBar.id, TOP, PARENT_ID, TOP)
connect(awesomeBar.id, BOTTOM, toolbar.id, TOP)
applyTo(search_wrapper)
}
}
search_wrapper.setOnClickListener {
it.hideKeyboard()
dismissAllowingStateLoss()
}
consumeFrom(store) {
awesomeBar?.visibility = if (it.query.isEmpty()) View.INVISIBLE else View.VISIBLE
toolbarView.update(it)
@ -104,6 +140,13 @@ class SearchDialogFragment : AppCompatDialogFragment() {
}
}
override fun onBackPressed(): Boolean {
view?.hideKeyboard()
dismissAllowingStateLoss()
return true
}
private fun setUpState(): SearchFragmentState {
val activity = activity as HomeActivity
val settings = activity.settings()

View File

@ -2,10 +2,13 @@
<!-- 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/. -->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/search_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="?attr/scrimBackground"
xmlns:app="http://schemas.android.com/apk/res-auto">
<mozilla.components.browser.toolbar.BrowserToolbar
android:id="@+id/toolbar"
@ -25,29 +28,22 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<androidx.core.widget.NestedScrollView
<mozilla.components.browser.awesomebar.BrowserAwesomeBar
xmlns:mozac="http://schemas.android.com/apk/res-auto"
android:id="@+id/awesomeBar"
android:layout_width="0dp"
android:layout_height="0dp"
android:id="@+id/scrollView"
android:background="?attr/scrimBackground"
android:fadingEdge="horizontal"
android:fadingEdgeLength="40dp"
android:nestedScrollingEnabled="false"
android:requiresFadingEdge="vertical"
android:background="?attr/foundation"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar"
android:scrollbars="vertical">
<mozilla.components.browser.awesomebar.BrowserAwesomeBar
xmlns:mozac="http://schemas.android.com/apk/res-auto"
android:id="@+id/awesomeBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fadingEdge="horizontal"
android:fadingEdgeLength="40dp"
android:nestedScrollingEnabled="false"
android:requiresFadingEdge="vertical"
android:background="?attr/foundation"
android:visibility="invisible"
mozac:awesomeBarChipBackgroundColor="@color/photonGreen50"
mozac:awesomeBarDescriptionTextColor="?secondaryText"
mozac:awesomeBarTitleTextColor="?primaryText" />
</androidx.core.widget.NestedScrollView>
mozac:awesomeBarChipBackgroundColor="@color/photonGreen50"
mozac:awesomeBarDescriptionTextColor="?secondaryText"
mozac:awesomeBarTitleTextColor="?primaryText" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -171,8 +171,8 @@
<!-- Search Fragment -->
<!-- Button in the search view that lets a user search by scanning a QR code -->
<string name="search_scan_button">Skannaa</string>
<!-- Button in the search view that lets a user search by using a shortcut -->
<string name="search_engines_shortcut_button">Hakukone</string>
<!-- Button in the search view that lets a user change their search engine -->
<string name="search_engine_button">Hakukone</string>
<!-- Button in the search view when shortcuts are displayed that takes a user to the search engine settings -->
<string name="search_shortcuts_engine_settings">Hakukoneasetukset</string>
<!-- Header displayed when selecting a shortcut search engine -->
@ -1471,9 +1471,7 @@
<string name="saved_login_duplicate">Kirjautumistieto tällä käyttäjänimellä on jo olemassa</string>
<!-- Synced Tabs -->
<!-- Text displayed when user is not logged into a Firefox Account -->
<string name="synced_tabs_connect_to_sync_account">Yhdistä Firefox-tilillä.</string>
<!-- Text displayed to ask user to connect another device as no devices found with account -->
<!-- Text displayed to ask user to connect another device as no devices found with account -->
<string name="synced_tabs_connect_another_device">Yhdistä toinen laite.</string>
<!-- Text displayed asking user to re-authenticate -->
<string name="synced_tabs_reauth">Tunnistaudu uudelleen.</string>
@ -1494,13 +1492,4 @@
<!-- Confirmation dialog button text when top sites limit is reached. -->
<string name="top_sites_max_limit_confirmation_button">Selvä</string>
<!-- DEPRECATED STRINGS -->
<!-- Button in the search view that lets a user search by using a shortcut -->
<string name="search_shortcuts_button">Oikopolut</string>
<!-- DEPRECATED: Header displayed when selecting a shortcut search engine -->
<string name="search_shortcuts_search_with">Hae hakukoneella</string>
<!-- Header displayed when selecting a shortcut search engine -->
<string name="search_shortcuts_search_with_2">Tällä kertaa käytä hakuun:</string>
<!-- Preference title for switch preference to show search shortcuts -->
<string name="preferences_show_search_shortcuts">Näytä hakuoikopolut</string>
</resources>

View File

@ -1264,7 +1264,7 @@
<!-- Paste the text in the clipboard -->
<string name="browser_toolbar_long_press_popup_paste">붙여넣기</string>
<!-- Snackbar message shown after an URL has been copied to clipboard. -->
<string name="browser_toolbar_url_copied_to_clipboard_snackbar">클립보드에 URL 복사됨</string>
<string name="browser_toolbar_url_copied_to_clipboard_snackbar">URL이 클립보드에 복사됨</string>
<!-- Title text for the Add To Homescreen dialog -->
<string name="add_to_homescreen_title">홈 화면에 추가</string>

View File

@ -113,7 +113,7 @@
<!-- Browser menu button that opens a user's library -->
<string name="browser_menu_library">Bibliotecă</string>
<!-- Browser menu toggle that requests a desktop site -->
<string name="browser_menu_desktop_site">Versiune site pentru calculator</string>
<string name="browser_menu_desktop_site">Versiune site de desktop</string>
<!-- Browser menu toggle that adds a shortcut to the site on the device home screen. -->
<string name="browser_menu_add_to_homescreen">Adaugă în ecranul de start</string>
<!-- Browser menu toggle that installs a Progressive Web App shortcut to the site on the device home screen. -->
@ -167,8 +167,8 @@
<!-- Search Fragment -->
<!-- Button in the search view that lets a user search by scanning a QR code -->
<string name="search_scan_button">Scanează</string>
<!-- Button in the search view that lets a user search by using a shortcut -->
<string name="search_engines_shortcut_button">Motor de căutare</string>
<!-- Button in the search view that lets a user change their search engine -->
<string name="search_engine_button">Motor de căutare</string>
<!-- Button in the search view when shortcuts are displayed that takes a user to the search engine settings -->
<string name="search_shortcuts_engine_settings">Setări pentru motorul de căutare</string>
<!-- Header displayed when selecting a shortcut search engine -->
@ -1451,9 +1451,7 @@
<string name="saved_login_duplicate">Există un set de date de autentificare cu acest nume de utilizator</string>
<!-- Synced Tabs -->
<!-- Text displayed when user is not logged into a Firefox Account -->
<string name="synced_tabs_connect_to_sync_account">Conectare cu un cont Firefox.</string>
<!-- Text displayed to ask user to connect another device as no devices found with account -->
<!-- Text displayed to ask user to connect another device as no devices found with account -->
<string name="synced_tabs_connect_another_device">Conectează alt dispozitiv.</string>
<!-- Text displayed asking user to re-authenticate -->
<string name="synced_tabs_reauth">Te rugăm să te autentifici din nou.</string>
@ -1474,13 +1472,4 @@
<!-- Confirmation dialog button text when top sites limit is reached. -->
<string name="top_sites_max_limit_confirmation_button">Ok, am înțeles</string>
<!-- DEPRECATED STRINGS -->
<!-- Button in the search view that lets a user search by using a shortcut -->
<string name="search_shortcuts_button">Comenzi rapide</string>
<!-- DEPRECATED: Header displayed when selecting a shortcut search engine -->
<string name="search_shortcuts_search_with">Căutare cu</string>
<!-- Header displayed when selecting a shortcut search engine -->
<string name="search_shortcuts_search_with_2">De data aceasta, caută cu:</string>
<!-- Preference title for switch preference to show search shortcuts -->
<string name="preferences_show_search_shortcuts">Afișează comenzile rapide pentru căutări</string>
</resources>

View File

@ -65,7 +65,7 @@
<!-- Private mode shortcut "contextual feature recommendation" (CFR) -->
<!-- Text for the main message -->
<string name="cfr_message">Ana ekranınızdan gizli sekme açmak için bir kısayol ekleyin.</string>
<string name="cfr_message">Ana ekranınızdan gizli sekme açmak için kısayol ekleyebilirsiniz.</string>
<!-- Text for the positive button -->
<string name="cfr_pos_button_text">Kısayol ekle</string>
<!-- Text for the negative button -->

View File

@ -746,6 +746,13 @@
<!-- Text shown in snackbar when user closes all tabs -->
<string name="snackbar_tabs_closed">Varaqlar yopildi</string>
<!-- Tab collection deletion prompt dialog option to cancel deleting the collection -->
<string name="tab_collection_dialog_negative">Bekor qilish</string>
<!-- Text displayed in a notification when the user enters full screen mode -->
<string name="full_screen_notification">Toʻliq ekran rejimiga oʻtmoqda</string>
<!-- Message for copying the URL via long press on the toolbar -->
<string name="url_copied">Manzildan nusxa olindi</string>
<!-- Accessibility description text for a completed migration item -->
<string name="migration_icon_description">Koʻchirish tugadi</string>
<!--Text on list of migrated items (e.g. Settings, History, etc.)-->

View File

@ -106,15 +106,26 @@ class ToolbarViewTest {
view.update(defaultState)
view.update(defaultState)
verify(exactly = 1) { toolbar.url = any() }
verify(exactly = 1) { toolbar.setSearchTerms(any()) }
verify(exactly = 1) { interactor.onTextChanged(any()) }
// editMode gets called when the view is initialized. So it is called twice in this test
verify(exactly = 2) { toolbar.editMode() }
assertTrue(view.isInitialized)
}
@Test
fun `search term updates the url`() {
val view = buildToolbarView(false)
view.update(defaultState)
view.update(defaultState)
view.update(defaultState)
// editMode gets called when the view is initialized.
verify(exactly = 2) { toolbar.editMode() }
// search term changes update the url and invoke the interactor.
verify(exactly = 2) { toolbar.url = any() }
verify(exactly = 2) { interactor.onTextChanged(any()) }
}
@Test
fun `URL gets set to the states query`() {
val toolbarView = buildToolbarView(false)

View File

@ -190,13 +190,13 @@ tasks.register("listRepositories") {
}
tasks.register("githubTestDetails", GithubDetailsTask) {
text = "### [Unit Test Results](/reports/test/testGeckoNightlyDebugUnitTest/index.html)"
text = "### [Unit Test Results]({reportsUrl}/test/testDebugUnitTest/index.html)"
}
tasks.register("githubLintDetektDetails", GithubDetailsTask) {
text = "### [Detekt Results](/reports/detekt.html)"
text = "### [Detekt Results]({reportsUrl}/detekt.html)"
}
tasks.register("githubLintAndroidDetails", GithubDetailsTask) {
text = "### [Android Lint Results](/reports/lint-results-geckoNightlyDebug.html)"
text = "### [Android Lint Results]({reportsUrl}/lint-results-geckoNightlyDebug.html)"
}

View File

@ -3,5 +3,5 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
object AndroidComponents {
const val VERSION = "53.0.20200804130112"
const val VERSION = "54.0.20200807130552"
}

View File

@ -26,20 +26,11 @@ open class GithubDetailsTask : DefaultTask() {
private val detailsFile = File("/builds/worker/github/customCheckRunText.md")
private val suffix = "\n\n_(404 if compilation failed)_"
/**
* Captures the link name and URL in a markdown link.
* i.e. "### [Hello](/world.html)" -> "/world.html"
*/
private val markdownLinkRegex = """\[(.*)]\((.*)\)""".toRegex()
@TaskAction
fun writeFile() {
val taskId = System.getenv("TASK_ID")
val url = "https://firefoxci.taskcluster-artifacts.net/$taskId/0/public"
val replaced = text.replace(markdownLinkRegex) { match ->
val (_, linkName, linkUrl) = match.groupValues
"[$linkName](${url + linkUrl})"
}
val reportsUrl = "https://firefoxci.taskcluster-artifacts.net/$taskId/0/public/reports"
val replaced = text.replace("{reportsUrl}", reportsUrl)
project.mkdir("/builds/worker/github")
detailsFile.writeText(replaced + suffix)