1
0
Fork 0

Copione merged onto master
continuous-integration/drone/push Build is passing Details

master
blallo 2020-06-24 00:00:24 +02:00
commit dcb6b76469
64 changed files with 615 additions and 264 deletions

View File

@ -484,6 +484,7 @@ dependencies {
implementation Deps.mozilla_feature_media
implementation Deps.mozilla_feature_prompts
implementation Deps.mozilla_feature_push
implementation Deps.mozilla_feature_privatemode
implementation Deps.mozilla_feature_pwa
implementation Deps.mozilla_feature_qr
implementation Deps.mozilla_feature_search

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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/. -->
<resources>
<color name="ic_launcher_background">#ff20123a</color>
</resources>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- 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/. -->
<resources>
<!-- Name of the application -->
<string name="app_name" translatable="false">Firefox</string>
</resources>

View File

@ -58,7 +58,6 @@ import org.mozilla.fenix.components.metrics.BreadcrumbsRecorder
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.exceptions.ExceptionsFragmentDirections
import org.mozilla.fenix.ext.alreadyOnDestination
import org.mozilla.fenix.ext.checkAndUpdateScreenshotPermission
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.settings
@ -140,7 +139,6 @@ open class HomeActivity : LocaleAwareAppCompatActivity() {
components.publicSuffixList.prefetch()
setupThemeAndBrowsingMode(getModeFromIntentOrLastKnown(intent))
checkAndUpdateScreenshotPermission(settings())
setContentView(R.layout.activity_home)
// Must be after we set the content view
@ -182,7 +180,6 @@ open class HomeActivity : LocaleAwareAppCompatActivity() {
@CallSuper
override fun onResume() {
checkAndUpdateScreenshotPermission(settings())
super.onResume()
components.backgroundServices.accountManagerAvailableQueue.runIfReadyOrQueue {

View File

@ -23,6 +23,7 @@ import androidx.navigation.fragment.findNavController
import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.fragment_browser.*
import kotlinx.android.synthetic.main.fragment_browser.view.*
import kotlinx.android.synthetic.main.fragment_installed_add_on_details.*
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.ExperimentalCoroutinesApi
@ -52,6 +53,7 @@ import mozilla.components.feature.downloads.DownloadsFeature
import mozilla.components.feature.downloads.manager.FetchDownloadManager
import mozilla.components.feature.intent.ext.EXTRA_SESSION_ID
import mozilla.components.feature.media.fullscreen.MediaFullscreenOrientationFeature
import mozilla.components.feature.privatemode.feature.SecureWindowFeature
import mozilla.components.feature.prompts.PromptFeature
import mozilla.components.feature.prompts.share.ShareDelegate
import mozilla.components.feature.readerview.ReaderViewFeature
@ -144,6 +146,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
private val swipeRefreshFeature = ViewBoundFeatureWrapper<SwipeRefreshFeature>()
private val webchannelIntegration = ViewBoundFeatureWrapper<FxaWebChannelFeature>()
private val sitePermissionWifiIntegration = ViewBoundFeatureWrapper<SitePermissionsWifiIntegration>()
private val secureWindowFeature = ViewBoundFeatureWrapper<SecureWindowFeature>()
private var fullScreenMediaFeature = ViewBoundFeatureWrapper<MediaFullscreenOrientationFeature>()
private var pipFeature: PictureInPictureFeature? = null
@ -313,6 +316,18 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
view = view
)
val allowScreenshotsInPrivateMode = context.settings().allowScreenshotsInPrivateMode
secureWindowFeature.set(
feature = SecureWindowFeature(
window = requireActivity().window,
store = store,
customTabId = customTabSessionId,
isSecure = { !allowScreenshotsInPrivateMode && it.content.private }
),
owner = this,
view = view
)
fullScreenMediaFeature.set(
feature = MediaFullscreenOrientationFeature(
requireActivity(),

View File

@ -7,6 +7,7 @@ package org.mozilla.fenix.components.searchengine
import android.content.Context
import androidx.annotation.VisibleForTesting
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.async
@ -17,6 +18,7 @@ import mozilla.components.browser.search.provider.AssetsSearchEngineProvider
import mozilla.components.browser.search.provider.SearchEngineList
import mozilla.components.browser.search.provider.SearchEngineProvider
import mozilla.components.browser.search.provider.filter.SearchEngineFilter
import mozilla.components.browser.search.provider.localization.LocaleSearchLocalizationProvider
import mozilla.components.browser.search.provider.localization.SearchLocalizationProvider
import mozilla.components.service.location.LocationService
import mozilla.components.service.location.MozillaLocationService
@ -49,6 +51,13 @@ open class FenixSearchEngineProvider(
AssetsSearchEngineProvider(localizationProvider).loadSearchEngines(context)
}
// https://github.com/mozilla-mobile/fenix/issues/9935
// Adds a Locale search engine provider as a fallback in case the MLS lookup takes longer
// than the time it takes for a user to try to search.
private val fallBackEngines = async {
AssetsSearchEngineProvider(LocaleSearchLocalizationProvider()).loadSearchEngines(context)
}
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
open val bundledSearchEngines = async {
val defaultEngineIdentifiers = baseSearchEngines.await().list.map { it.identifier }.toSet()
@ -71,6 +80,17 @@ open class FenixSearchEngineProvider(
private var loadedSearchEngines = refreshAsync()
// https://github.com/mozilla-mobile/fenix/issues/9935
// Create new getter that will return the fallback SearchEngineList if
// the main one hasn't completed yet
private val searchEngines: Deferred<SearchEngineList>
get() =
if (loadedSearchEngines.isCompleted) {
loadedSearchEngines
} else {
fallBackEngines
}
fun getDefaultEngine(context: Context): SearchEngine {
val engines = installedSearchEngines(context)
val selectedName = context.settings().defaultSearchEngineName
@ -84,7 +104,7 @@ open class FenixSearchEngineProvider(
*/
fun installedSearchEngines(context: Context): SearchEngineList = runBlocking {
val installedIdentifiers = installedSearchEngineIdentifiers(context)
val engineList = loadedSearchEngines.await()
val engineList = searchEngines.await()
engineList.copy(
list = engineList.list.filter {

View File

@ -7,7 +7,6 @@ package org.mozilla.fenix.ext
import android.app.Activity
import android.view.View
import android.view.WindowManager
import org.mozilla.fenix.utils.Settings
/**
* Attempts to call immersive mode using the View to hide the status bar and navigation buttons.
@ -23,19 +22,3 @@ fun Activity.enterToImmersiveMode() {
or View.SYSTEM_UI_FLAG_FULLSCREEN
or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY)
}
/**
* Prevents or allows screenshots from being taken in private mode based on the user preferences.
*
* The default setting is set to true (screenshots are allowed to be taken in private mode), as
* described in #2768
*/
fun Activity.checkAndUpdateScreenshotPermission(settings: Settings) {
if (!settings.allowScreenshotsInPrivateMode &&
settings.lastKnownMode.isPrivate
) {
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
} else {
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
}
}

View File

@ -11,6 +11,7 @@ import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.os.StrictMode
import android.view.Display.FLAG_SECURE
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
@ -47,6 +48,7 @@ import kotlinx.android.synthetic.main.fragment_home.*
import kotlinx.android.synthetic.main.fragment_home.view.*
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@ -84,10 +86,10 @@ import org.mozilla.fenix.ext.hideToolbar
import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.resetPoliciesAfter
import org.mozilla.fenix.ext.sessionsOfType
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.ext.toTab
import org.mozilla.fenix.ext.resetPoliciesAfter
import org.mozilla.fenix.home.sessioncontrol.DefaultSessionControlController
import org.mozilla.fenix.home.sessioncontrol.SessionControlInteractor
import org.mozilla.fenix.home.sessioncontrol.SessionControlView
@ -106,7 +108,8 @@ import java.lang.ref.WeakReference
import kotlin.math.abs
import kotlin.math.min
@SuppressWarnings("TooManyFunctions", "LargeClass")
@ExperimentalCoroutinesApi
@Suppress("TooManyFunctions", "LargeClass")
class HomeFragment : Fragment() {
private val args by navArgs<HomeFragmentArgs>()
@ -382,6 +385,12 @@ class HomeFragment : Fragment() {
view.toolbar_wrapper?.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED)
}
}
if (browsingModeManager.mode.isPrivate) {
requireActivity().window.addFlags(FLAG_SECURE)
} else {
requireActivity().window.clearFlags(FLAG_SECURE)
}
}
override fun onDestroyView() {
@ -389,6 +398,7 @@ class HomeFragment : Fragment() {
_sessionControlInteractor = null
sessionControlView = null
requireView().homeAppBar.removeOnOffsetChangedListener(homeAppBarOffSetListener)
requireActivity().window.clearFlags(FLAG_SECURE)
}
override fun onStart() {

View File

@ -8,7 +8,6 @@ import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.annotation.StringRes
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
@ -19,7 +18,7 @@ import org.mozilla.fenix.home.OnboardingState
import org.mozilla.fenix.home.Tab
import org.mozilla.fenix.home.sessioncontrol.viewholders.CollectionHeaderViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.CollectionViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.NoContentMessageViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.NoCollectionsMessageViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.PrivateBrowsingDescriptionViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TabInCollectionViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.TopSiteViewHolder
@ -42,10 +41,7 @@ sealed class AdapterItem(@LayoutRes val viewType: Int) {
ButtonTipViewHolder.LAYOUT_ID)
data class TopSiteList(val topSites: List<TopSite>) : AdapterItem(TopSiteViewHolder.LAYOUT_ID)
object PrivateBrowsingDescription : AdapterItem(PrivateBrowsingDescriptionViewHolder.LAYOUT_ID)
data class NoContentMessage(
@StringRes val header: Int,
@StringRes val description: Int
) : AdapterItem(NoContentMessageViewHolder.LAYOUT_ID)
object NoCollectionsMessage : AdapterItem(NoCollectionsMessageViewHolder.LAYOUT_ID)
object CollectionHeader : AdapterItem(CollectionHeaderViewHolder.LAYOUT_ID)
data class CollectionItem(
@ -123,7 +119,7 @@ class SessionControlAdapter(
ButtonTipViewHolder.LAYOUT_ID -> ButtonTipViewHolder(view, interactor)
TopSiteViewHolder.LAYOUT_ID -> TopSiteViewHolder(view, interactor)
PrivateBrowsingDescriptionViewHolder.LAYOUT_ID -> PrivateBrowsingDescriptionViewHolder(view, interactor)
NoContentMessageViewHolder.LAYOUT_ID -> NoContentMessageViewHolder(view)
NoCollectionsMessageViewHolder.LAYOUT_ID -> NoCollectionsMessageViewHolder(view, interactor)
CollectionHeaderViewHolder.LAYOUT_ID -> CollectionHeaderViewHolder(view)
CollectionViewHolder.LAYOUT_ID -> CollectionViewHolder(view, interactor)
TabInCollectionViewHolder.LAYOUT_ID -> TabInCollectionViewHolder(view, interactor, differentLastItem = true)
@ -155,10 +151,6 @@ class SessionControlAdapter(
is TopSiteViewHolder -> {
holder.bind((item as AdapterItem.TopSiteList).topSites)
}
is NoContentMessageViewHolder -> {
val (header, description) = item as AdapterItem.NoContentMessage
holder.bind(header, description)
}
is CollectionViewHolder -> {
val (collection, expanded) = item as AdapterItem.CollectionItem
holder.bindSession(collection, expanded)

View File

@ -120,6 +120,11 @@ interface SessionControlController {
fun handleToggleCollectionExpanded(collection: TabCollection, expand: Boolean)
fun handleCloseTip(tip: Tip)
/**
* @see [CollectionInteractor.onAddTabsToCollectionTapped]
*/
fun handleCreateCollection()
}
@SuppressWarnings("TooManyFunctions", "LargeClass")
@ -301,6 +306,10 @@ class DefaultSessionControlController(
navController.nav(R.id.homeFragment, directions)
}
override fun handleCreateCollection() {
showCollectionCreationFragment(step = SaveCollectionStep.SelectTabs)
}
private fun showShareFragment(data: List<ShareData>) {
val directions = HomeFragmentDirections.actionGlobalShareFragment(
data = data.toTypedArray()

View File

@ -88,6 +88,11 @@ interface CollectionInteractor {
* @param expand True if the given tab collection should be expanded or collapse if false.
*/
fun onToggleCollectionExpanded(collection: TabCollection, expand: Boolean)
/**
* Opens the collection creator
*/
fun onAddTabsToCollectionTapped()
}
/**
@ -219,6 +224,10 @@ class SessionControlInteractor(
controller.handleToggleCollectionExpanded(collection, expand)
}
override fun onAddTabsToCollectionTapped() {
controller.handleCreateCollection()
}
override fun onCloseTip(tip: Tip) {
controller.handleCloseTip(tip)
}

View File

@ -19,11 +19,6 @@ import org.mozilla.fenix.home.Mode
import org.mozilla.fenix.home.OnboardingState
import org.mozilla.fenix.components.tips.Tip
val noCollectionMessage = AdapterItem.NoContentMessage(
R.string.no_collections_header1,
R.string.no_collections_description1
)
// This method got a little complex with the addition of the tab tray feature flag
// When we remove the tabs from the home screen this will get much simpler again.
@SuppressWarnings("LongParameterList", "ComplexMethod")
@ -43,7 +38,7 @@ private fun normalModeAdapterItems(
if (collections.isEmpty()) {
items.add(AdapterItem.CollectionHeader)
items.add(noCollectionMessage)
items.add(AdapterItem.NoCollectionsMessage)
} else {
showCollections(collections, expandedCollections, items)
}

View File

@ -0,0 +1,26 @@
/* 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.fenix.home.sessioncontrol.viewholders
import android.view.View
import kotlinx.android.synthetic.main.no_collections_message.view.*
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.ViewHolder
import org.mozilla.fenix.home.sessioncontrol.CollectionInteractor
open class NoCollectionsMessageViewHolder(
view: View,
interactor: CollectionInteractor
) : ViewHolder(view) {
init {
view.add_tabs_to_collections_button.setOnClickListener {
interactor.onAddTabsToCollectionTapped()
}
}
companion object {
const val LAYOUT_ID = R.layout.no_collections_message
}
}

View File

@ -1,28 +0,0 @@
/* 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.fenix.home.sessioncontrol.viewholders
import android.view.View
import androidx.annotation.StringRes
import kotlinx.android.synthetic.main.no_content_message.*
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.ViewHolder
open class NoContentMessageViewHolder(view: View) : ViewHolder(view) {
fun bind(
@StringRes header: Int,
@StringRes description: Int
) {
with(itemView.context) {
no_content_header.text = getString(header)
no_content_description.text = getString(description)
}
}
companion object {
const val LAYOUT_ID = R.layout.no_content_message
}
}

View File

@ -8,6 +8,7 @@ import androidx.annotation.UiThread
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import mozilla.components.service.glean.private.NoReasonCodes
@ -75,12 +76,13 @@ object StartupTimeline {
*/
internal class StartupHomeActivityLifecycleObserver(
private val frameworkStartMeasurement: StartupFrameworkStartMeasurement,
private val startupTimeline: PingType<NoReasonCodes> = Pings.startupTimeline
private val startupTimeline: PingType<NoReasonCodes> = Pings.startupTimeline,
private val scope: CoroutineScope = GlobalScope
) : LifecycleObserver {
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
fun onStop() {
GlobalScope.launch { // use background thread due to expensive metrics.
scope.launch { // use background thread due to expensive metrics.
// Ensure any last metrics are set before submission.
frameworkStartMeasurement.setExpensiveMetric()

View File

@ -11,7 +11,6 @@ import androidx.preference.SwitchPreference
import org.mozilla.fenix.R
import org.mozilla.fenix.components.PrivateShortcutCreateManager
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.checkAndUpdateScreenshotPermission
import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.ext.showToolbar
@ -45,12 +44,7 @@ class PrivateBrowsingFragment : PreferenceFragmentCompat() {
}
requirePreference<SwitchPreference>(R.string.pref_key_allow_screenshots_in_private_mode).apply {
onPreferenceChangeListener = object : SharedPreferenceUpdater() {
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
return super.onPreferenceChange(preference, newValue).also {
requireActivity().checkAndUpdateScreenshotPermission(requireActivity().settings()) }
}
}
onPreferenceChangeListener = SharedPreferenceUpdater()
}
}
}

View File

@ -8,7 +8,6 @@ import android.content.Context
import androidx.annotation.VisibleForTesting
import androidx.navigation.NavController
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import mozilla.components.browser.session.Session
import mozilla.components.feature.session.SessionUseCases.ReloadUrlUseCase
@ -54,7 +53,7 @@ interface QuickSettingsController {
* @param context [Context] used for various Android interactions.
* @param quickSettingsStore [QuickSettingsFragmentStore] holding the State for all Views displayed
* in this Controller's Fragment.
* @param coroutineScope [CoroutineScope] used for structed concurrency.
* @param ioScope [CoroutineScope] with an IO dispatcher used for structured concurrency.
* @param navController NavController] used for navigation.
* @param session [Session]? current browser state.
* @param sitePermissions [SitePermissions]? list of website permissions and their status.
@ -71,7 +70,7 @@ interface QuickSettingsController {
class DefaultQuickSettingsController(
private val context: Context,
private val quickSettingsStore: QuickSettingsFragmentStore,
private val coroutineScope: CoroutineScope,
private val ioScope: CoroutineScope,
private val navController: NavController,
private val session: Session?,
private var sitePermissions: SitePermissions?,
@ -143,7 +142,7 @@ class DefaultQuickSettingsController(
*/
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
fun handlePermissionsChange(updatedPermissions: SitePermissions) {
coroutineScope.launch(Dispatchers.IO) {
ioScope.launch {
permissionStorage.updateSitePermissions(updatedPermissions)
reload(session)
}

View File

@ -27,7 +27,9 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import kotlinx.android.synthetic.main.fragment_quick_settings_dialog_sheet.*
import kotlinx.android.synthetic.main.fragment_quick_settings_dialog_sheet.view.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.plus
import mozilla.components.lib.state.ext.consumeFrom
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.HomeActivity
@ -75,7 +77,7 @@ class QuickSettingsSheetDialogFragment : AppCompatDialogFragment() {
quickSettingsController = DefaultQuickSettingsController(
context = context,
quickSettingsStore = quickSettingsStore,
coroutineScope = viewLifecycleOwner.lifecycleScope,
ioScope = viewLifecycleOwner.lifecycleScope + Dispatchers.IO,
navController = findNavController(),
session = context.components.core.sessionManager.findSessionById(args.sessionId),
sitePermissions = args.sitePermissions,

View File

@ -184,7 +184,7 @@ class SitePermissionsManagePhoneFeatureFragment : Fragment() {
AUTOPLAY_ALLOW_ALL,
AUTOPLAY_ALLOW_ON_WIFI -> {
settings.setAutoplayUserSetting(AUTOPLAY_ALLOW_ON_WIFI)
return
BLOCKED to BLOCKED
}
AUTOPLAY_BLOCK_AUDIBLE -> BLOCKED to ALLOWED
AUTOPLAY_BLOCK_ALL -> BLOCKED to BLOCKED

View File

@ -6,6 +6,7 @@ package org.mozilla.fenix.tabtray
import android.content.Context
import android.view.LayoutInflater
import mozilla.components.browser.tabstray.TabViewHolder
import mozilla.components.browser.tabstray.TabsAdapter
import mozilla.components.concept.tabstray.Tabs
import mozilla.components.support.images.loader.ImageLoader
@ -26,9 +27,17 @@ class FenixTabsAdapter(
}
) {
var onTabsUpdated: (() -> Unit)? = null
var tabCount = 0
override fun updateTabs(tabs: Tabs) {
super.updateTabs(tabs)
onTabsUpdated?.invoke()
tabCount = tabs.list.size
}
override fun onBindViewHolder(holder: TabViewHolder, position: Int) {
super.onBindViewHolder(holder, position)
val newIndex = tabCount - position - 1
(holder as TabTrayViewHolder).updateAccessibilityRowIndex(holder.itemView, newIndex)
}
}

View File

@ -94,6 +94,7 @@ class TabTrayDialogFragment : AppCompatDialogFragment() {
tabTrayView.setTopOffset(isLandscape)
if (isLandscape) {
tabTrayView.dismissMenu()
tabTrayView.expand()
}
}

View File

@ -21,6 +21,7 @@ import kotlinx.android.synthetic.main.component_tabstray_fab.view.*
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import mozilla.components.browser.menu.BrowserMenu
import mozilla.components.browser.menu.BrowserMenuBuilder
import mozilla.components.browser.menu.item.SimpleBrowserMenuItem
import mozilla.components.browser.state.selector.normalTabs
@ -54,7 +55,8 @@ class TabTrayView(
private val behavior = BottomSheetBehavior.from(view.tab_wrapper)
private var tabTrayItemMenu: TabTrayItemMenu
private val tabTrayItemMenu: TabTrayItemMenu
private var menu: BrowserMenu? = null
private var hasLoaded = false
@ -115,6 +117,9 @@ class TabTrayView(
TabsTouchHelper(tray.tabsAdapter).attachToRecyclerView(tray)
(tray.tabsAdapter as? FenixTabsAdapter)?.also { adapter ->
adapter.onTabsUpdated = {
if (hasAccessibilityEnabled) {
adapter.notifyDataSetChanged()
}
if (!hasLoaded) {
hasLoaded = true
tray.layoutManager?.scrollToPosition(selectedBrowserTabIndex)
@ -149,10 +154,9 @@ class TabTrayView(
}
view.tab_tray_overflow.setOnClickListener {
tabTrayItemMenu.menuBuilder
.build(view.context)
.show(anchor = it)
.also { pu ->
menu = tabTrayItemMenu.menuBuilder.build(container.context)
menu?.show(it)
?.also { pu ->
(pu.contentView as? CardView)?.setCardBackgroundColor(ContextCompat.getColor(
view.context,
R.color.foundation_normal_theme
@ -241,6 +245,10 @@ class TabTrayView(
behavior.setExpandedOffset(topOffset)
}
fun dismissMenu() {
menu?.dismiss()
}
companion object {
private const val DEFAULT_TAB_ID = 0
private const val PRIVATE_TAB_ID = 1

View File

@ -5,6 +5,7 @@
package org.mozilla.fenix.tabtray
import android.view.View
import android.view.accessibility.AccessibilityNodeInfo
import android.widget.ImageButton
import android.widget.TextView
import androidx.annotation.VisibleForTesting
@ -176,6 +177,28 @@ class TabTrayViewHolder(
closeView.context.getString(R.string.close_tab_title, title)
}
internal fun updateAccessibilityRowIndex(item: View, newIndex: Int) {
item.setAccessibilityDelegate(object : View.AccessibilityDelegate() {
override fun onInitializeAccessibilityNodeInfo(
host: View?,
info: AccessibilityNodeInfo?
) {
super.onInitializeAccessibilityNodeInfo(host, info)
info?.let {
val initialInfo = info.collectionItemInfo
info.collectionItemInfo = AccessibilityNodeInfo.CollectionItemInfo.obtain(
newIndex,
initialInfo.rowSpan,
initialInfo.columnIndex,
initialInfo.columnSpan,
false,
initialInfo.isSelected
)
}
}
})
}
companion object {
private const val PLAY_PAUSE_BUTTON_EXTRA_DPS = 24
}

View File

@ -21,15 +21,26 @@ class SitePermissionsWifiIntegration(
) : LifecycleAwareFeature {
/**
* Adds listener for autplay setting [AUTOPLAY_ALLOW_ON_WIFI]. Sets all autoplay to allowed when
* Adds listener for autoplay setting [AUTOPLAY_ALLOW_ON_WIFI]. Sets all autoplay to allowed when
* WIFI is connected, blocked otherwise.
*/
private val wifiConnectedListener: ((Boolean) -> Unit) by lazy {
{ connected: Boolean ->
val setting =
if (connected) SitePermissionsRules.Action.ALLOWED else SitePermissionsRules.Action.BLOCKED
settings.setSitePermissionsPhoneFeatureAction(PhoneFeature.AUTOPLAY_AUDIBLE, setting)
settings.setSitePermissionsPhoneFeatureAction(PhoneFeature.AUTOPLAY_INAUDIBLE, setting)
if (settings.getAutoplayUserSetting(default = AUTOPLAY_BLOCK_ALL) == AUTOPLAY_ALLOW_ON_WIFI) {
settings.setSitePermissionsPhoneFeatureAction(
PhoneFeature.AUTOPLAY_AUDIBLE,
setting
)
settings.setSitePermissionsPhoneFeatureAction(
PhoneFeature.AUTOPLAY_INAUDIBLE,
setting
)
} else {
// The autoplay setting has changed, we can remove the listener
removeWifiConnectedListener()
}
}
}
@ -55,7 +66,11 @@ class SitePermissionsWifiIntegration(
// only works while WIFI is active, so we are not using AUTOPLAY_ALLOW_ON_WIFI (or this class).
// Once that is fixed, [start] and [maybeAddWifiConnectedListener] will need to be called on
// activity startup.
override fun start() { wifiConnectionMonitor.start() }
override fun start() {
wifiConnectionMonitor.start()
}
override fun stop() { wifiConnectionMonitor.stop() }
override fun stop() {
wifiConnectionMonitor.stop()
}
}

View File

@ -2,7 +2,7 @@
<!-- 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/. -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/bookmarks_wrapper"
@ -38,14 +38,20 @@
style="@style/NeutralButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="16dp"
android:text="@string/bookmark_sign_in_button" />
android:text="@string/bookmark_sign_in_button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/bookmark_list"
app:layout_constraintVertical_bias="0.0" />
<ProgressBar
android:id="@+id/bookmarks_progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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/. -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/no_collections_wrapper"
android:background="@drawable/empty_session_control_background"
android:layout_marginBottom="12dp"
android:padding="16dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/no_collections_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_collections_header1"
tools:drawableEnd="@drawable/ic_tab_collection"
android:textAppearance="@style/HeaderTextStyle"
android:textSize="16sp"
app:fontFamily="@font/metropolis_semibold" />
<TextView
android:id="@+id/no_collections_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/no_collections_description1"
android:textColor="?primaryText"
android:textSize="14sp"
android:textAlignment="viewStart"
app:fontFamily="@font/metropolis_medium" />
<com.google.android.material.button.MaterialButton
android:id="@+id/add_tabs_to_collections_button"
style="@style/PositiveButton"
app:icon="@drawable/ic_tab_collection"
android:text="@string/tabs_menu_save_to_collection1"
android:layout_marginTop="8dp"/>
</LinearLayout>

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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/. -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/no_content_wrapper"
android:background="@drawable/empty_session_control_background"
android:layout_marginBottom="12dp"
android:padding="16dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/no_content_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@tools:sample/lorem"
tools:drawableEnd="@drawable/ic_tab_collection"
android:textAppearance="@style/HeaderTextStyle"
android:textSize="16sp"
app:fontFamily="@font/metropolis_semibold" />
<TextView
android:id="@+id/no_content_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
tools:text="@tools:sample/lorem"
android:textColor="?primaryText"
android:textSize="14sp"
android:textAlignment="viewStart"
app:fontFamily="@font/metropolis_medium" />
</LinearLayout>

View File

@ -1,44 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!-- 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/. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/no_content_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:background="@drawable/empty_session_control_background"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:id="@+id/no_content_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:textAppearance="@style/HeaderTextStyle"
android:textSize="16sp"
tools:text="@tools:sample/lorem" />
<TextView
android:id="@+id/no_content_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:textAlignment="viewStart"
android:textColor="?primaryText"
android:textSize="14sp"
android:textStyle="normal"
tools:text="@tools:sample/lorem" />
<com.google.android.material.button.MaterialButton
android:id="@+id/add_new_tab_button"
style="@style/NeutralButton"
android:layout_marginTop="6dp"
android:visibility="gone"
tools:icon="@drawable/ic_new"
tools:text="@string/home_screen_shortcut_open_new_tab_2"
tools:visibility="visible" />
</LinearLayout>

View File

@ -15,6 +15,11 @@
<!-- Placeholder text shown in the search bar before a user enters text -->
<string name="search_hint">Увядзіце запыт або адрас</string>
<!-- No Open Tabs Message Description -->
<string name="no_open_tabs_description">Тут будуць паказаны вашы адкрытыя карткі.</string>
<!-- No Private Tabs Message Description -->
<string name="no_private_tabs_description">Тут будуць паказаны вашы прыватныя карткі.</string>
<!-- Private Browsing -->
<!-- Title for private session option -->
<string name="private_browsing_title">Вы ў прыватным сеансе</string>
@ -22,6 +27,8 @@
<!-- Delete session button to erase your history in a private session -->
<string name="private_browsing_delete_session">Выдаліць сеанс</string>
<!-- Text for the positive button -->
<string name="cfr_pos_button_text">Дадаць цэтлік</string>
<!-- Text for the negative button -->
<string name="cfr_neg_button_text">Не, дзякуй</string>
@ -100,6 +107,8 @@
<string name="a11y_selected_locale_content_description">Абраная мова</string>
<!-- Content description for search icon -->
<string name="a11y_search_icon_content_description">Пошук</string>
<!-- Text for default locale item -->
<string name="default_locale_text">Мова прылады</string>
<!-- Placeholder text shown in the search bar before a user enters text -->
<string name="locale_search_hint">Пошук мовы</string>
@ -224,6 +233,8 @@
<string name="preferences_search_bookmarks">Пошук у закладках</string>
<!-- Preference for account settings -->
<string name="preferences_account_settings">Налады ўліковага запісу</string>
<!-- Preference for open links in third party apps -->
<string name="preferences_open_links_in_apps">Адкрываць спасылкі ў праграмах</string>
<!-- Preference for add_ons -->
<string name="preferences_addons">Дадаткі</string>
@ -319,6 +330,9 @@
<!-- Preference for using dark theme -->
<string name="preference_dark_theme">Цёмная</string>
<!-- Preference for using following device theme -->
<string name="preference_follow_device_theme">Тэма прылады</string>
<!-- Library -->
<!-- Option in Library to open Sessions page -->
<string name="library_sessions">Сеансы</string>
@ -377,6 +391,8 @@
<string name="tab_tray_menu_open_new_tab">Новая картка</string>
<!-- Shortcut action to open the home screen -->
<string name="tab_tray_menu_home">Дадому</string>
<!-- Shortcut action to toggle private mode -->
<string name="tab_tray_menu_toggle">Пераключыць рэжым картак</string>
<!-- Content description (not visible, for screen readers etc.): Removes tab from collection button. Removes the selected tab from collection when pressed -->
<string name="remove_tab_from_collection">Выдаліць картку з калекцыі</string>
<!-- Content description (not visible, for screen readers etc.): Close tab button. Closes the current session when pressed -->
@ -452,6 +468,9 @@
<!-- Text for the header that groups the history older than the last month -->
<string name="history_older">Даўней</string>
<!-- Text shown when no history exists -->
<string name="history_empty_message">Няма гісторыі</string>
<!-- Send crash report checkbox text on the tab crash page -->
<string name="tab_crash_send_report">Адправіць справаздачу аб краху ў Mozilla</string>
<!-- Close tab button text on the tab crash page -->
@ -476,6 +495,8 @@
<string name="bookmark_delete_folder_confirmation_dialog">Вы ўпэўнены, што жадаеце выдаліць гэту папку?</string>
<!-- Snackbar title shown after a folder has been deleted. This first parameter is the name of the deleted folder -->
<string name="bookmark_delete_folder_snackbar">%1$s выдалена</string>
<!-- Screen title for adding a bookmarks folder -->
<string name="bookmark_add_folder">Дадаць папку</string>
<!-- deprecated: Snackbar title shown after a bookmark has been created. -->
<string name="bookmark_created_snackbar">Закладка створана.</string>
<!-- Snackbar title shown after a bookmark has been created. -->
@ -516,6 +537,8 @@
<string name="bookmark_add_folder_fragment_label">Дадаць папку</string>
<!-- Bookmark select folder screen title -->
<string name="bookmark_select_folder_fragment_label">Выбраць папку</string>
<!-- Bookmark editing error missing title -->
<string name="bookmark_empty_title_error">Павінна мець загаловак</string>
<!-- Bookmark editing error missing or improper URL -->
<string name="bookmark_invalid_url_error">Несапраўдны URL</string>
<!-- Bookmark screen message for empty bookmarks folder -->
@ -556,6 +579,8 @@
<string name="preference_phone_feature_location">Месцазнаходжанне</string>
<!-- Preference for altering the notification access for all websites -->
<string name="preference_phone_feature_notification">Абвестка</string>
<!-- Label that indicates that a permission must be asked always -->
<string name="preference_option_phone_feature_ask_to_allow">Запытваць дазвол</string>
<!--Label that indicates a permission is by the Android OS-->
<string name="phone_feature_blocked_by_android">Заблакавана Android</string>
<!-- Preference for showing a list of websites that the default configurations won't apply to them -->
@ -594,6 +619,8 @@
<string name="create_collection_select_all">Вылучыць усе</string>
<!-- Button to deselect all tabs in the "select tabs" step of the collection creator -->
<string name="create_collection_deselect_all">Адмяніць выбар усіх</string>
<!-- Text to prompt users to select the tabs to save in the "select tabs" step of the collection creator -->
<string name="create_collection_save_to_collection_empty">Выберыце карткі для захавання</string>
<!-- Text shown in snackbar when multiple tabs have been saved in a collection -->
<string name="create_collection_tabs_saved">Карткі захаваны!</string>
<!-- Text shown in snackbar when one tab has been saved in a collection -->
@ -724,8 +751,10 @@
<string name="preferences_delete_browsing_data_cookies">Кукі</string>
<!-- Title for the site permissions item in Delete browsing data -->
<string name="preferences_delete_browsing_data_site_permissions">Дазволы для сайтаў</string>
<!-- Category for history items to delete on quit in delete browsing data on quit -->
<string name="preferences_delete_browsing_data_on_quit_browsing_history">Гісторыя аглядання</string>
<!-- Text for the button to delete browsing data -->
<string name="preferences_delete_browsing_data_button">Выдаліць звесткі аглядання</string>
<!-- Title for the Delete browsing data on quit preference -->
<string name="preferences_delete_browsing_data_on_quit">Выдаляць звесткі аглядання пры выхадзе</string>
<!-- Action item in menu for the Delete browsing data on quit feature -->
<string name="delete_browsing_data_on_quit_action">Выйсці</string>
@ -909,16 +938,34 @@
<!-- Preference to access list of login exceptions that we never save logins for -->
<string name="preferences_passwords_exceptions">Выключэнні</string>
<!-- Learn more link that will link to a page with more information displayed when a connection is insecure and we detect the user is entering a password -->
<string name="logins_insecure_connection_warning_learn_more">Даведацца больш</string>
<!-- Title of the Add search engine screen -->
<string name="search_engine_add_custom_search_engine_title">Дадаць пашукавік</string>
<!-- Content description (not visible, for screen readers etc.): Title for the button to add a search engine in the action bar -->
<string name="search_engine_add_button_content_description">Дадаць</string>
<!-- Content description (not visible, for screen readers etc.): Title for the button to save a search engine in the action bar -->
<string name="search_engine_add_custom_search_engine_edit_button_content_description">Захаваць</string>
<!-- Text for the button to learn more about adding a custom search engine -->
<string name="search_add_custom_engine_learn_more_label">Падрабязней</string>
<!-- Accessibility description for the 'Learn more' link -->
<string name="search_add_custom_engine_learn_more_description">Спасылка на падрабязныя звесткі</string>
<!-- Text shown when a user leaves the name field empty -->
<string name="search_add_custom_engine_error_empty_name">Увядзіце назву пошукавай сістэмы</string>
<!-- Label that indicates a site is using a secure connection -->
<string name="quick_settings_sheet_secure_connection">Бяспечнае злучэнне</string>
<!-- Label that indicates a site is using a insecure connection -->
<string name="quick_settings_sheet_insecure_connection">Не бяспечнае злучэнне</string>
<!-- Synced Tabs -->
<!-- Text displayed when user is not logged into a Firefox Account -->
<string name="synced_tabs_connect_to_sync_account">Падключыцеся да ўліковага запісу Firefox.</string>
<!-- Confirmation dialog button text when top sites limit is reached. -->
<string name="top_sites_max_limit_confirmation_button">OK, зразумела</string>

View File

@ -22,6 +22,11 @@
<!-- No Private Tabs Message Description -->
<string name="no_private_tabs_description">プライベートタブがここに表示されます。</string>
<!-- Message announced to the user when tab tray is selected with 1 tab -->
<string name="open_tab_tray_single">開いているタブ 1 個。タップしてタブを切り替えます。</string>
<!-- Message announced to the user when tab tray is selected with 0 or 2+ tabs -->
<string name="open_tab_tray_plural">開いているタブ %1$s 個。タップしてタブを切り替えます。</string>
<!-- About content. The first parameter is the name of the application. (For example: Fenix) -->
<string name="about_content">%1$s は Mozilla の製品です。</string>
@ -711,6 +716,10 @@
<!-- Content description (not visible, for screen readers etc.): Opens the collection menu when pressed -->
<string name="collection_menu_button_content_description">コレクションメニュー</string>
<!-- No Open Tabs Message Header -->
<string name="no_collections_header1">あなたにとって関心のある事柄を集めましょう</string>
<!-- Label to describe what collections are to a new user without any collections -->
<string name="no_collections_description1">類似の検索結果、サイト、タブをグループ化して、後ですばやくアクセスできます。</string>
<!-- Title for the "select tabs" step of the collection creator -->
<string name="create_collection_select_tabs">タブの選択</string>
<!-- Title for the "select collection" step of the collection creator -->
@ -740,6 +749,9 @@
<!-- Button to save currently selected tabs in the "select tabs" step of the collection creator-->
<string name="create_collection_save">保存</string>
<!-- Snackbar action to view the collection the user just created or updated -->
<string name="create_collection_view">表示</string>
<!-- Default name for a new collection in "name new collection" step of the collection creator. %d is a placeholder for the number of collections-->
<string name="create_collection_default_name">コレクション %d</string>
@ -920,6 +932,9 @@
<string name="tip_firefox_preview_moved_description">Firefox Nightly は毎晩更新され、実験的な新しい機能がテストされています。
しかし、これは安定性に欠けるため、より安定したバージョンを使用したい場合はベータ版のダウンロードをおすすめします。</string>
<!-- text for firefox preview moving tip button. "Firefox for Android Beta" is intentionally hardcoded -->
<string name="tip_firefox_preview_moved_button_2">Android 版 Firefox Beta をダウンロード</string>
<!-- text for firefox preview moving tip header. "Firefox Nightly" is intentionally hardcoded -->
<string name="tip_firefox_preview_moved_header_preview_installed">Firefox Nightly は移転しました</string>
<!-- text for firefox preview moving tip description -->
@ -971,8 +986,21 @@
<string name="onboarding_firefox_account_sync_is_on">Sync が有効です</string>
<!-- text to display in the snackbar if automatic sign-in fails. user may try again -->
<string name="onboarding_firefox_account_automatic_signin_failed">ログインに失敗しました</string>
<!-- text for the tracking protection onboarding card header -->
<string name="onboarding_tracking_protection_header_2">自動プライバシー保護</string>
<!-- text for the tracking protection card description
The first parameter is the name of the app (e.g. Firefox Preview) -->
<string name="onboarding_tracking_protection_description_2">プライバシーとセキュリティの設定で、あなたを追跡するトラッカー、マルウェア、企業をブロックします。</string>
<!-- text for tracking protection radio button option for standard level of blocking -->
<string name="onboarding_tracking_protection_standard_button_2">標準 (既定)</string>
<!-- text for standard blocking option button description -->
<string name="onboarding_tracking_protection_standard_button_description_2">トラッカーのブロックを少なくします。ページが正常に読み込まれます。</string>
<!-- text for tracking protection radio button option for strict level of blocking -->
<string name="onboarding_tracking_protection_strict_button">厳格 (推奨)</string>
<!-- text for tracking protection radio button option for strict level of blocking -->
<string name="onboarding_tracking_protection_strict_option">厳格</string>
<!-- text for strict blocking option button description -->
<string name="onboarding_tracking_protection_strict_button_description_2">より多くのトラッカー、広告、ポップアップをブロックします。ページの読み込みが速くなりますが、一部の機能が動作しない場合があります。</string>
<!-- text for the toolbar position card header
In English this is an idiom for "choose a side as in an argument or fight"
but it is ok to make this more literally about "choosing a position in a physical space -->
@ -1056,14 +1084,22 @@
<string name="preference_enhanced_tracking_protection_explanation">個人データの収集を防止します。%s はオンラインでのあなたの行動を追跡するよく知られた数多くのトラッカーからあなたを守ります。</string>
<!-- Text displayed that links to website about enhanced tracking protection -->
<string name="preference_enhanced_tracking_protection_explanation_learn_more">詳細情報</string>
<!-- Preference for enhanced tracking protection for the standard protection settings -->
<string name="preference_enhanced_tracking_protection_standard_default_1">標準 (既定)</string>
<!-- Preference description for enhanced tracking protection for the standard protection settings -->
<string name="preference_enhanced_tracking_protection_standard_description_3">トラッカーのブロックを少なくします。ページが正常に読み込まれます。</string>
<!-- Accessibility text for the Standard protection information icon -->
<string name="preference_enhanced_tracking_protection_standard_info_button">標準のトラッキング防止でブロックされるもの</string>
<!-- Preference for enhanced tracking protection for the strict protection settings -->
<string name="preference_enhanced_tracking_protection_strict">厳格</string>
<!-- Preference description for enhanced tracking protection for the strict protection settings -->
<string name="preference_enhanced_tracking_protection_strict_description_2">より多くのトラッカー、広告、ポップアップをブロックします。ページの読み込みが速くなりますが、一部の機能が動作しない場合があります。</string>
<!-- Accessibility text for the Strict protection information icon -->
<string name="preference_enhanced_tracking_protection_strict_info_button">厳格なトラッキング防止でブロックされるもの</string>
<!-- Preference for enhanced tracking protection for the custom protection settings -->
<string name="preference_enhanced_tracking_protection_custom">カスタム</string>
<!-- Preference description for enhanced tracking protection for the strict protection settings -->
<string name="preference_enhanced_tracking_protection_custom_description_2">ブロックするトラッカーとスクリプトを選択します。</string>
<!-- Accessibility text for the Strict protection information icon -->
<string name="preference_enhanced_tracking_protection_custom_info_button">カスタム設定のトラッキング防止でブロックされるもの</string>
<!-- Header for categories that are being blocked by current Enhanced Tracking Protection settings -->
@ -1112,6 +1148,8 @@
<string name="etp_tracking_content_title">トラッキングコンテンツ</string>
<!-- Description of tracking content that can be blocked by Enhanced Tracking Protection -->
<string name="etp_tracking_content_description">追跡コードを含む外部の広告、動画、その他のコンテンツの読み込みを停止します。一部のウェブサイトの機能に影響する場合があります。</string>
<!-- Enhanced Tracking Protection Onboarding Message shown in a dialog above the toolbar. The first parameter is the name of the application (For example: Fenix) -->
<string name="etp_onboarding_cfr_message">盾アイコンが紫色になるたびに、%s がサイトのトラッカーをブロックしています。詳細情報はタップしてください。</string>
<!-- Enhanced Tracking Protection message that protection is currently on for this site -->
<string name="etp_panel_on">このサイトでは保護が有効になっています</string>
<!-- Enhanced Tracking Protection message that protection is currently off for this site -->
@ -1398,6 +1436,9 @@
<!-- Voice search prompt description displayed after the user presses the voice search button -->
<string name="voice_search_explainer">話してください</string>
<!-- The error message in edit login view when a duplicate username exists. -->
<string name="saved_login_duplicate">このユーザー名を持つログイン情報がすでに存在します。</string>
<!-- Synced Tabs -->
<!-- Text displayed when user is not logged into a Firefox Account -->
<string name="synced_tabs_connect_to_sync_account">Firefox アカウントで接続してください。</string>
@ -1406,4 +1447,21 @@
<!-- Text displayed asking user to re-authenticate -->
<string name="synced_tabs_reauth">再認証してください。</string>
</resources>
<!-- Text displayed when user has disabled tab syncing in Firefox Sync Account -->
<string name="synced_tabs_enable_tab_syncing">タブの同期を有効にしてください。</string>
<!-- Text displayed when user has no tabs that have been synced -->
<string name="synced_tabs_no_tabs">他の端末の Firefox で開いているタブはありません。</string>
<!-- Text displayed in the synced tabs screen when a user is not signed in to Firefox Sync describing Synced Tabs -->
<string name="synced_tabs_sign_in_message">他の端末のタブの一覧を表示できます。</string>
<!-- Text displayed on a button in the synced tabs screen to link users to sign in when a user is not signed in to Firefox Sync -->
<string name="synced_tabs_sign_in_button">Sync にログイン</string>
<!-- Top Sites -->
<!-- Title text displayed in the dialog when top sites limit is reached. -->
<string name="top_sites_max_limit_title">トップサイトの上限に達しました</string>
<!-- Content description text displayed in the dialog when top sites limit is reached. -->
<string name="top_sites_max_limit_content">新しいトップサイトを追加するには、いずれかを削除してください。サイトを長押しして削除を選択します。</string>
<!-- Confirmation dialog button text when top sites limit is reached. -->
<string name="top_sites_max_limit_confirmation_button">OK</string>
</resources>

View File

@ -870,8 +870,6 @@
<string name="preference_summary_delete_browsing_data_on_quit">Samodejno izbriše podatke brskanja, ko v glavnem meniju izberete &quot;Izhod&quot;</string>
<!-- Summary for the Delete browsing data on quit preference. "Quit" translation should match delete_browsing_data_on_quit_action translation. -->
<string name="preference_summary_delete_browsing_data_on_quit_2">Samodejno izbriše podatke brskanja, ko v glavnem meniju izberete \&quot;Izhod\&quot;</string>
<!-- Category for history items to delete on quit in delete browsing data on quit -->
<string name="preferences_delete_browsing_data_on_quit_browsing_history">Zgodovina brskanja</string>
<!-- Action item in menu for the Delete browsing data on quit feature -->
<string name="delete_browsing_data_on_quit_action">Izhod</string>
@ -1415,6 +1413,8 @@
<string name="synced_tabs_reauth">Ponovno se prijavite.</string>
<!-- Text displayed when user has disabled tab syncing in Firefox Sync Account -->
<string name="synced_tabs_enable_tab_syncing">Omogočite sinhronizacijo zavihkov.</string>
<!-- Text displayed when user has no tabs that have been synced -->
<string name="synced_tabs_no_tabs">V Firefoxu na drugih napravah nimate odprtih drugih zavihkov.</string>
<!-- Text displayed in the synced tabs screen when a user is not signed in to Firefox Sync describing Synced Tabs -->
<string name="synced_tabs_sign_in_message">Oglejte si seznam zavihkov drugih naprav.</string>

View File

@ -969,6 +969,41 @@
<!-- text for the firefox account onboarding card header
The first parameter is the name of the app (e.g. Firefox Preview) -->
<string name="onboarding_firefox_account_header">Nārì\' daran\' sa nīkāj %s.</string>
<!-- text for the firefox account onboarding card header when we detect you're already signed in to
another Firefox browser. (The word `Firefox` should not be translated)
The first parameter is the email of the detected user's account -->
<string name="onboarding_firefox_account_auto_signin_header_2">Ngà gayì\'ìt sēsiûn ngà %s riña a\'ngô sa nana\'ui\' Firefox riña aga\' nab. Ruhuât gāyi\'ìt sēsiûn ngà kuendâ nan anj.</string>
<!-- text for the button to confirm automatic sign-in -->
<string name="onboarding_firefox_account_auto_signin_confirm">Gā\'ue, gāyì\'ìj sēsiûn</string>
<!-- text for the automatic sign-in button while signing in is in process -->
<string name="onboarding_firefox_account_signing_in">Hīaj ayi\'ìj sēsiûn…</string>
<!-- text for the button to manually sign into Firefox account. The word "Firefox" should not be translated -->
<string name="onboarding_firefox_account_sign_in">Gāyì\'ì sēsiûn riña Firefox</string>
<!-- text for the button to stay signed out when presented with an option to automatically sign-in. -->
<string name="onboarding_firefox_account_stay_signed_out">Sī ginûnj riña sēsiûn</string>
<!-- text to display in the snackbar once account is signed-in -->
<string name="onboarding_firefox_account_sync_is_on">Ngà nanûn Sync</string>
<!-- text to display in the snackbar if automatic sign-in fails. user may try again -->
<string name="onboarding_firefox_account_automatic_signin_failed">Gire\' riña ayì\'ìt sēsiûn</string>
<!-- text for the tracking protection onboarding card header -->
<string name="onboarding_tracking_protection_header_2">Sa huì \'iaj sun man\'an</string>
<!-- text for the tracking protection card description
The first parameter is the name of the app (e.g. Firefox Preview) -->
<string name="onboarding_tracking_protection_description_2">Riña nagi\'iát sa huìi nī sa dugûmin naran riña nej sa naga\'nāj a, nej aplikasiûn kïj huaa nī nej sa yi\'ì nikò\' sò\'.</string>
<!-- text for tracking protection radio button option for standard level of blocking -->
<string name="onboarding_tracking_protection_standard_button_2">Sa huā chre\' (dàj huaj \'naj)</string>
<!-- text for standard blocking option button description -->
<string name="onboarding_tracking_protection_standard_button_description_2">Riña dòj sa naga\'nāj a naran. Dàj rû\' nayi\'nïnj riña pâjina nāyi\'nïn nīñanj.</string>
<!-- text for tracking protection radio button option for strict level of blocking -->
<string name="onboarding_tracking_protection_strict_button">Sa nùkuaj doj (dūgūnàj hua man)</string>
<!-- text for tracking protection radio button option for strict level of blocking -->
<string name="onboarding_tracking_protection_strict_option">Sa nùkuaj doj</string>
<!-- text for strict blocking option button description -->
<string name="onboarding_tracking_protection_strict_button_description_2">Narán man riña doj sa naga\'nāj a, nej nuguan\' nata\'a nī nej bēntanâ narugui\' man\'an. Hìo doj nayî\'nïnj riña nej pâjina, sanī huā sa sī ga\'ue gi\'iaj sun hue\'e.</string>
<!-- text for the toolbar position card header
In English this is an idiom for "choose a side as in an argument or fight"
but it is ok to make this more literally about "choosing a position in a physical space -->
<string name="onboarding_toolbar_position_header">Ni\'iāj dàj gānïn ruhuât</string>
<!-- Content description (not visible, for screen readers etc.): Close onboarding screen -->
<string name="onboarding_close">Nārán</string>

View File

@ -561,7 +561,8 @@
<item name="shapeAppearance">@style/BottomSheetShapeAppearance</item>
<item name="behavior_fitToContents">false</item>
<item name="behavior_expandedOffset">80</item>
<item name="behavior_skipCollapsed">true</item>
<item name="behavior_skipCollapsed">false</item>
<item name="behavior_halfExpandedRatio">0.4</item>
</style>
<style name="TabTrayFab" parent="Widget.MaterialComponents.ExtendedFloatingActionButton">

View File

@ -7,13 +7,10 @@ package org.mozilla.fenix.ext
import android.app.Activity
import android.view.View
import android.view.WindowManager
import mozilla.components.support.test.robolectric.testContext
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
import org.robolectric.Robolectric
import org.robolectric.Shadows.shadowOf
@ -42,67 +39,4 @@ class ActivityTest {
for (f in flags) assertEquals(f, window.decorView.systemUiVisibility and f)
assertTrue(shadowOf(window).getFlag(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON))
}
@Test
fun `testCheckAndUpdateScreenshotPermission adds flag in private mode when screenshots are not allowed `() {
// given
val activity = Robolectric.buildActivity(Activity::class.java).create().get()
val window = activity.window
testContext.settings().lastKnownMode = BrowsingMode.Private
testContext.settings().allowScreenshotsInPrivateMode = false
// when
activity.checkAndUpdateScreenshotPermission(activity.settings())
// then
assertTrue(shadowOf(window).getFlag(WindowManager.LayoutParams.FLAG_SECURE))
}
@Test
fun `testCheckAndUpdateScreenshotPermission removes flag in private mode when screenshots are allowed `() {
// given
val activity = Robolectric.buildActivity(Activity::class.java).create().get()
val window = activity.window
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
testContext.settings().lastKnownMode = BrowsingMode.Private
testContext.settings().allowScreenshotsInPrivateMode = true
// when
activity.checkAndUpdateScreenshotPermission(activity.settings())
// then
assertFalse(shadowOf(window).getFlag(WindowManager.LayoutParams.FLAG_SECURE))
}
@Test
fun `testCheckAndUpdateScreenshotPermission removes flag in normal mode when screenshots are allowed `() {
// given
val activity = Robolectric.buildActivity(Activity::class.java).create().get()
val window = activity.window
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
testContext.settings().lastKnownMode = BrowsingMode.Normal
testContext.settings().allowScreenshotsInPrivateMode = true
// when
activity.checkAndUpdateScreenshotPermission(activity.settings())
// then
assertFalse(shadowOf(window).getFlag(WindowManager.LayoutParams.FLAG_SECURE))
}
@Test
fun `testCheckAndUpdateScreenshotPermission removes flag when in normal mode screenshots are not allowed `() {
// given
val activity = Robolectric.buildActivity(Activity::class.java).create().get()
val window = activity.window
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
testContext.settings().lastKnownMode = BrowsingMode.Normal
testContext.settings().allowScreenshotsInPrivateMode = false
// when
activity.checkAndUpdateScreenshotPermission(activity.settings())
// then
assertFalse(shadowOf(window).getFlag(WindowManager.LayoutParams.FLAG_SECURE))
}
}

View File

@ -24,10 +24,13 @@ import org.junit.Before
import org.junit.Test
import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.collections.SaveCollectionStep
import org.mozilla.fenix.components.TabCollectionStorage
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.MetricController
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.home.sessioncontrol.DefaultSessionControlController
import org.mozilla.fenix.settings.SupportUtils
import mozilla.components.feature.tab.collections.Tab as ComponentTab
@ -204,4 +207,11 @@ class DefaultSessionControlControllerTest {
controller.handleToggleCollectionExpanded(collection, true)
verify { fragmentStore.dispatch(HomeFragmentAction.CollectionExpanded(collection, true)) }
}
@Test
fun handleCreateCollection() {
controller.handleCreateCollection()
val directions = HomeFragmentDirections.actionGlobalCollectionCreationFragment(saveCollectionStep = SaveCollectionStep.SelectTabs)
verify { navController.nav(R.id.homeFragment, directions) }
}
}

View File

@ -92,4 +92,10 @@ class SessionControlInteractorTest {
interactor.onToggleCollectionExpanded(collection, true)
verify { controller.handleToggleCollectionExpanded(collection, true) }
}
@Test
fun onAddTabsToCollection() {
interactor.onAddTabsToCollectionTapped()
verify { controller.handleCreateCollection() }
}
}

View File

@ -17,19 +17,19 @@ import org.junit.Test
@ExperimentalCoroutinesApi
class StartupHomeActivityLifecycleObserverTest {
private lateinit var observer: StartupHomeActivityLifecycleObserver
@MockK(relaxed = true) private lateinit var frameworkStartMeasurement: StartupFrameworkStartMeasurement
@MockK(relaxed = true) private lateinit var startupTimeline: PingType<NoReasonCodes>
@Before
fun setUp() {
MockKAnnotations.init(this)
observer = StartupHomeActivityLifecycleObserver(frameworkStartMeasurement, startupTimeline)
}
@Test
fun `WHEN onStop is called THEN the metrics are set and the ping is submitted`() = runBlockingTest {
val observer = StartupHomeActivityLifecycleObserver(frameworkStartMeasurement, startupTimeline, this)
observer.onStop()
verifySequence {
frameworkStartMeasurement.setExpensiveMetric()
startupTimeline.submit()

View File

@ -6,7 +6,6 @@ package org.mozilla.fenix.settings.quicksettings
import androidx.navigation.NavController
import androidx.navigation.NavDirections
import io.mockk.MockKMatcherScope
import io.mockk.Runs
import io.mockk.every
import io.mockk.just
@ -53,7 +52,7 @@ class DefaultQuickSettingsControllerTest {
private val controller = spyk(DefaultQuickSettingsController(
context = context,
quickSettingsStore = store,
coroutineScope = coroutinesScope,
ioScope = coroutinesScope,
navController = navController,
session = browserSession,
sitePermissions = sitePermissions,
@ -85,7 +84,7 @@ class DefaultQuickSettingsControllerTest {
controller.handlePermissionToggled(websitePermission)
verify {
controller.handleAndroidPermissionRequest(eqArray(cameraFeature.androidPermissionsList))
controller.handleAndroidPermissionRequest(cameraFeature.androidPermissionsList)
}
}
@ -117,7 +116,7 @@ class DefaultQuickSettingsControllerTest {
val invalidSitePermissionsController = DefaultQuickSettingsController(
context = context,
quickSettingsStore = store,
coroutineScope = coroutinesScope,
ioScope = coroutinesScope,
navController = navController,
session = browserSession,
sitePermissions = null,
@ -166,7 +165,7 @@ class DefaultQuickSettingsControllerTest {
controller.handleAndroidPermissionRequest(testPermissions)
verify { requestPermissions(eqArray(testPermissions)) }
verify { requestPermissions(testPermissions) }
}
@Test
@ -175,13 +174,11 @@ class DefaultQuickSettingsControllerTest {
val testPermissions = mockk<SitePermissions>()
controller.handlePermissionsChange(testPermissions)
advanceUntilIdle()
verifyOrder {
permissionStorage.updateSitePermissions(testPermissions)
reload(browserSession)
}
}
private inline fun <reified T> MockKMatcherScope.eqArray(value: Array<T>): Array<T> =
match { it contentEquals value }
}

View File

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

View File

@ -102,6 +102,7 @@ object Deps {
const val mozilla_feature_storage = "org.mozilla.components:feature-storage:${Versions.mozilla_android_components}"
const val mozilla_feature_prompts = "org.mozilla.components:feature-prompts:${Versions.mozilla_android_components}"
const val mozilla_feature_push = "org.mozilla.components:feature-push:${Versions.mozilla_android_components}"
const val mozilla_feature_privatemode = "org.mozilla.components:feature-privatemode:${Versions.mozilla_android_components}"
const val mozilla_feature_pwa = "org.mozilla.components:feature-pwa:${Versions.mozilla_android_components}"
const val mozilla_feature_toolbar = "org.mozilla.components:feature-toolbar:${Versions.mozilla_android_components}"
const val mozilla_feature_findinpage = "org.mozilla.components:feature-findinpage:${Versions.mozilla_android_components}"

View File

@ -50,6 +50,11 @@ jobs:
gradlew: [detekt]
treeherder:
symbol: detekt
worker:
artifacts:
- name: public/reports
path: /builds/worker/checkouts/src/build/reports
type: directory
ktlint:
description: 'Running ktlint over all modules'
run:
@ -64,3 +69,8 @@ jobs:
gradlew: ['lintGeckoNightlyDebug']
treeherder:
symbol: lint
worker:
artifacts:
- name: public/reports
path: /builds/worker/checkouts/src/app/build/reports
type: directory

View File

@ -56,3 +56,6 @@ jobs:
- name: public/reports/index.html
path: /builds/worker/checkouts/src/app/build/reports/tests/testGeckoNightlyDebugUnitTest/index.html
type: file
- name: public/reports/test
path: /builds/worker/checkouts/src/app/build/reports/tests
type: directory