mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-11 13:11:01 +00:00
Bug 1838859 - Remove no op utility for exhaustive when
This commit is contained in:
parent
b121502ff2
commit
75e724284b
@ -49,7 +49,6 @@ import org.mozilla.fenix.ext.nav
|
||||
import org.mozilla.fenix.ext.navigateSafe
|
||||
import org.mozilla.fenix.ext.openSetDefaultBrowserOption
|
||||
import org.mozilla.fenix.settings.deletebrowsingdata.deleteAndQuit
|
||||
import org.mozilla.fenix.utils.Do
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
|
||||
/**
|
||||
@ -95,7 +94,7 @@ class DefaultBrowserToolbarMenuController(
|
||||
val customTabUseCases = activity.components.useCases.customTabsUseCases
|
||||
trackToolbarItemInteraction(item)
|
||||
|
||||
Do exhaustive when (item) {
|
||||
when (item) {
|
||||
// TODO: These can be removed for https://github.com/mozilla-mobile/fenix/issues/17870
|
||||
// todo === Start ===
|
||||
is ToolbarMenu.Item.InstallPwaToHomeScreen -> {
|
||||
|
@ -9,7 +9,6 @@ import mozilla.components.concept.storage.BookmarkNodeType
|
||||
import mozilla.telemetry.glean.private.NoExtras
|
||||
import org.mozilla.fenix.GleanMetrics.BookmarksManagement
|
||||
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
||||
import org.mozilla.fenix.utils.Do
|
||||
|
||||
/**
|
||||
* Interactor for the Bookmarks screen.
|
||||
@ -113,7 +112,7 @@ class BookmarkFragmentInteractor(
|
||||
}
|
||||
|
||||
override fun open(item: BookmarkNode) {
|
||||
Do exhaustive when (item.type) {
|
||||
when (item.type) {
|
||||
BookmarkNodeType.ITEM -> {
|
||||
bookmarksController.handleBookmarkTapped(item)
|
||||
BookmarksManagement.open.record(NoExtras())
|
||||
|
@ -23,7 +23,6 @@ import org.mozilla.fenix.library.bookmarks.BookmarkItemMenu
|
||||
import org.mozilla.fenix.library.bookmarks.BookmarkPayload
|
||||
import org.mozilla.fenix.library.bookmarks.BookmarkViewInteractor
|
||||
import org.mozilla.fenix.library.bookmarks.inRoots
|
||||
import org.mozilla.fenix.utils.Do
|
||||
|
||||
/**
|
||||
* Base class for bookmark node view holders.
|
||||
@ -39,7 +38,7 @@ class BookmarkNodeViewHolder(
|
||||
init {
|
||||
menu = BookmarkItemMenu(containerView.context) { menuItem ->
|
||||
val item = this.item ?: return@BookmarkItemMenu
|
||||
Do exhaustive when (menuItem) {
|
||||
when (menuItem) {
|
||||
BookmarkItemMenu.Item.Edit -> interactor.onEditPressed(item)
|
||||
BookmarkItemMenu.Item.Copy -> interactor.onCopyPressed(item)
|
||||
BookmarkItemMenu.Item.Share -> interactor.onSharePressed(item)
|
||||
|
@ -17,7 +17,6 @@ import org.mozilla.fenix.library.history.HistoryFragmentState
|
||||
import org.mozilla.fenix.library.history.HistoryInteractor
|
||||
import org.mozilla.fenix.library.history.HistoryItemTimeGroup
|
||||
import org.mozilla.fenix.selection.SelectionHolder
|
||||
import org.mozilla.fenix.utils.Do
|
||||
|
||||
class HistoryListItemViewHolder(
|
||||
view: View,
|
||||
@ -67,7 +66,7 @@ class HistoryListItemViewHolder(
|
||||
|
||||
binding.historyLayout.titleView.text = item.title
|
||||
|
||||
binding.historyLayout.urlView.text = Do exhaustive when (item) {
|
||||
binding.historyLayout.urlView.text = when (item) {
|
||||
is History.Regular -> item.url
|
||||
is History.Metadata -> item.url
|
||||
is History.Group -> {
|
||||
|
@ -31,7 +31,6 @@ import org.mozilla.fenix.settings.about.AboutItemType.PRIVACY_NOTICE
|
||||
import org.mozilla.fenix.settings.about.AboutItemType.RIGHTS
|
||||
import org.mozilla.fenix.settings.about.AboutItemType.SUPPORT
|
||||
import org.mozilla.fenix.settings.about.AboutItemType.WHATS_NEW
|
||||
import org.mozilla.fenix.utils.Do
|
||||
import org.mozilla.fenix.whatsnew.WhatsNew
|
||||
import org.mozilla.geckoview.BuildConfig as GeckoViewBuildConfig
|
||||
|
||||
@ -189,7 +188,7 @@ class AboutFragment : Fragment(), AboutPageListener {
|
||||
}
|
||||
|
||||
override fun onAboutItemClicked(item: AboutItem) {
|
||||
Do exhaustive when (item) {
|
||||
when (item) {
|
||||
is AboutItem.ExternalLink -> {
|
||||
when (item.type) {
|
||||
WHATS_NEW -> {
|
||||
|
@ -14,7 +14,6 @@ import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.databinding.AccountShareListItemBinding
|
||||
import org.mozilla.fenix.share.ShareToAccountDevicesInteractor
|
||||
import org.mozilla.fenix.share.listadapters.SyncShareOption
|
||||
import org.mozilla.fenix.utils.Do
|
||||
|
||||
class AccountDeviceViewHolder(
|
||||
itemView: View,
|
||||
@ -31,7 +30,7 @@ class AccountDeviceViewHolder(
|
||||
|
||||
private fun bindClickListeners(option: SyncShareOption) {
|
||||
itemView.setOnClickListener {
|
||||
Do exhaustive when (option) {
|
||||
when (option) {
|
||||
SyncShareOption.SignIn -> interactor.onSignIn()
|
||||
SyncShareOption.AddNewDevice -> interactor.onAddNewDevice()
|
||||
is SyncShareOption.SendAll -> interactor.onShareToAllDevices(option.devices)
|
||||
|
@ -9,7 +9,6 @@ import androidx.annotation.VisibleForTesting
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import mozilla.components.browser.menu.BrowserMenuBuilder
|
||||
import mozilla.components.browser.state.store.BrowserStore
|
||||
import org.mozilla.fenix.utils.Do
|
||||
|
||||
/**
|
||||
* A wrapper class that building the tabs tray menu that handles item clicks.
|
||||
@ -40,7 +39,7 @@ class MenuIntegration(
|
||||
|
||||
@VisibleForTesting
|
||||
internal fun handleMenuClicked(item: TabsTrayMenu.Item) {
|
||||
Do exhaustive when (item) {
|
||||
when (item) {
|
||||
is TabsTrayMenu.Item.ShareAllTabs ->
|
||||
navigationInteractor.onShareTabsOfTypeClicked(isPrivateMode)
|
||||
is TabsTrayMenu.Item.OpenAccountSettings ->
|
||||
|
@ -8,7 +8,6 @@ import android.content.Context
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import mozilla.components.browser.menu.BrowserMenuBuilder
|
||||
import org.mozilla.fenix.tabstray.TabsTrayInteractor
|
||||
import org.mozilla.fenix.utils.Do
|
||||
|
||||
class SelectionMenuIntegration(
|
||||
private val context: Context,
|
||||
@ -25,7 +24,7 @@ class SelectionMenuIntegration(
|
||||
|
||||
@VisibleForTesting
|
||||
internal fun handleMenuClicked(item: SelectionMenu.Item) {
|
||||
Do exhaustive when (item) {
|
||||
when (item) {
|
||||
is SelectionMenu.Item.BookmarkTabs -> {
|
||||
interactor.onBookmarkSelectedTabsClicked()
|
||||
}
|
||||
|
@ -1,18 +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.utils
|
||||
|
||||
object Do {
|
||||
|
||||
/**
|
||||
* Indicates to the linter that the following when statement should be exhaustive.
|
||||
*
|
||||
* @sample Do exhaustive when (bool) {
|
||||
* true -> Unit
|
||||
* false -> Unit
|
||||
* }
|
||||
*/
|
||||
inline infix fun <reified T> exhaustive(any: T?) = any
|
||||
}
|
Loading…
Reference in New Issue
Block a user