Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

For #11753 - Update compose to 1.1.0 and Kotlin to 1.6.10 #11754

Merged
merged 2 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// Synchronized version numbers for dependencies used by (some) modules
object Versions {
const val kotlin = "1.5.31"
const val kotlin = "1.6.10"
const val coroutines = "1.5.2"

const val junit = "4.12"
Expand Down Expand Up @@ -35,7 +35,7 @@ object Versions {

const val material = "1.2.1"

const val compose_version = "1.0.5"
const val compose_version = "1.1.0"

object AndroidX {
const val activityCompose = "1.4.0"
Expand All @@ -54,7 +54,7 @@ object Versions {
const val test = "1.3.0"
const val test_ext = "1.1.2"
const val espresso = "3.3.0"
const val room = "2.3.0"
const val room = "2.4.1"
const val paging = "2.1.2"
const val palette = "1.0.0"
const val preferences = "1.1.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,9 @@ class GeckoEngineSession(
onLaunchIntentRequest(url = url, appIntent = appIntent)
}
}
else -> {
// no-op
}
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ internal fun PopupWindow.displayPopup(currentData: MenuPositioningData) {

is BrowserMenuPlacement.AnchoredToTop.ManualAnchoring,
is BrowserMenuPlacement.AnchoredToBottom.ManualAnchoring -> showAtAnchorLocation(currentData)
else -> {
// no-op
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ internal class LinkingMiddleware(
is EngineAction.UnlinkEngineSessionAction -> {
unlink(context, action)
}
else -> {
// no-op
}
}

next(action)
Expand All @@ -58,6 +61,9 @@ internal class LinkingMiddleware(
engineObserver = link(context, action.engineSession, tab, action.skipLoading)
}
}
else -> {
// no-op
}
}

engineObserver?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ internal class TabsRemovedMiddleware(
is CustomTabListAction.RemoveCustomTabAction -> context.state.findCustomTab(action.tabId)?.let {
onTabsRemoved(context, listOf(it))
}
else -> {
// no-op
}
}

next(action)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ internal class WebExtensionMiddleware : Middleware<BrowserState, BrowserAction>
activeTab?.engineState?.engineSession?.markActiveForWebExtensions(false)
}
}
else -> {
// no-op
}
}

next(action)
Expand All @@ -43,6 +46,9 @@ internal class WebExtensionMiddleware : Middleware<BrowserState, BrowserAction>
is EngineAction.LinkEngineSessionAction -> {
switchActiveStateIfNeeded(context)
}
else -> {
// no-op
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,8 @@ class TabsRemovedMiddlewareTest {
is TabListAction.RemoveTabAction,
is CustomTabListAction.RemoveAllCustomTabsAction,
is CustomTabListAction.RemoveCustomTabAction -> return
else -> next(action)
}

next(action)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class ThumbnailsMiddleware(
is TabListAction.RemoveTabsAction -> {
action.tabIds.forEach { thumbnailStorage.deleteThumbnail(it) }
}
else -> {
// no-op
}
}

next(action)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class ContainerMiddleware(
is InitAction -> initializeContainers(context.store)
is ContainerAction.AddContainerAction -> addContainer(action)
is ContainerAction.RemoveContainerAction -> removeContainer(context.store, action)
else -> {
// no-op
}
}

next(action)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class OnDeviceDownloadStorageTest {
private lateinit var database: DownloadsDatabase

@get:Rule
@Suppress("DEPRECATION")
val helper: MigrationTestHelper = MigrationTestHelper(
InstrumentationRegistry.getInstrumentation(),
DownloadsDatabase::class.java.canonicalName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class DownloadMiddleware(
return
}
}
else -> {
// no-op
}
}

next(action)
Expand All @@ -84,6 +87,9 @@ class DownloadMiddleware(
}
is DownloadAction.AddDownloadAction -> sendDownloadIntent(action.download)
is DownloadAction.RestoreDownloadStateAction -> sendDownloadIntent(action.download)
else -> {
// no-op
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import mozilla.components.feature.downloads.ui.DownloadCancelDialogFragment
import mozilla.components.support.test.mock
import mozilla.components.support.test.robolectric.testContext
import org.junit.Assert
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.doReturn
import org.mockito.Mockito.spy
import org.mockito.Mockito.verify
import org.robolectric.annotation.Config

@RunWith(AndroidJUnit4::class)
Expand All @@ -33,12 +33,14 @@ class DownloadCancelDialogFragmentTest {
spy(DownloadCancelDialogFragment.newInstance(2)).apply {
doReturn(testContext).`when`(this).requireContext()
doReturn(mockFragmentManager()).`when`(this).parentFragmentManager
var wasAcceptClicked = false
onAcceptClicked = { _, _ -> wasAcceptClicked = true }

with(onCreateDialog(null)) {
findViewById<Button>(R.id.accept_button).apply { performClick() }
}

verify(this).onAcceptClicked
assertTrue(wasAcceptClicked)
}
}

Expand All @@ -47,12 +49,14 @@ class DownloadCancelDialogFragmentTest {
spy(DownloadCancelDialogFragment.newInstance(2)).apply {
doReturn(testContext).`when`(this).requireContext()
doReturn(mockFragmentManager()).`when`(this).parentFragmentManager
var wasDenyCalled = false
onDenyClicked = { wasDenyCalled = true }

with(onCreateDialog(null)) {
findViewById<Button>(R.id.deny_button).apply { performClick() }
}

verify(this).onDenyClicked
assertTrue(wasDenyCalled)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class LoginExceptionStorageTest {
var instantTaskExecutorRule = InstantTaskExecutorRule()

@get:Rule
@Suppress("DEPRECATION")
val helper: MigrationTestHelper = MigrationTestHelper(
InstrumentationRegistry.getInstrumentation(),
LoginExceptionStorage::class.java.canonicalName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ class PromptFeature private constructor(
it.onDeny()
}
is Dismissible -> it.onDismiss()
else -> {
// no-op
}
}
}
}
Expand Down Expand Up @@ -502,6 +505,9 @@ class PromptFeature private constructor(
}

is Repost -> it.onConfirm()
else -> {
// no-op
}
}
}
}
Expand All @@ -517,6 +523,9 @@ class PromptFeature private constructor(
store.consumePromptFrom(sessionId, promptRequestUID, activePrompt) {
when (it) {
is TimeSelection -> it.onClear()
else -> {
// no-op
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class PromptMiddleware : Middleware<BrowserState, BrowserAction> {
return
}
}
else -> {
// no-op
}
}

next(action)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ internal class SaveLoginDialogFragment : PromptDialogFragment() {
context?.getString(R.string.mozac_feature_prompt_update_confirmation)
)
}
else -> {
// no-op
}
}
}
validateStateUpdate?.invokeOnCompletion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ManifestDatabaseMigrationTest {
private val TEST_DB = "migration-test"

@Rule @JvmField
@Suppress("DEPRECATION")
val helper: MigrationTestHelper = MigrationTestHelper(
InstrumentationRegistry.getInstrumentation(),
ManifestDatabase::class.java.canonicalName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ class ReaderViewMiddleware : Middleware<BrowserState, BrowserAction> {
context.dispatch(ContentAction.UpdateUrlAction(tab.id, url))
}
}
else -> {
// no-op
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class RecentlyClosedMiddleware(
is InitAction -> {
initializeRecentlyClosed(context.store)
}
else -> {
// no-op
}
}

next(action)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class SearchMiddleware(
is SearchAction.UpdateCustomSearchEngineAction -> saveCustomSearchEngine(action)
is SearchAction.RemoveCustomSearchEngineAction -> removeCustomSearchEngine(action)
is SearchAction.SelectSearchEngineAction -> updateSearchEngineSelection(action)
else -> {
// no-op
}
}

next(action)
Expand All @@ -65,6 +68,9 @@ class SearchMiddleware(
updateHiddenSearchEngines(context.state.search.hiddenSearchEngines)
is SearchAction.AddAdditionalSearchEngineAction, is SearchAction.RemoveAdditionalSearchEngineAction ->
updateAdditionalSearchEngines(context.state.search.additionalSearchEngines)
else -> {
// no-op
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class LastAccessMiddleware : Middleware<BrowserState, BrowserAction> {
context.dispatchUpdateActionForId(action.sessionId)
}
}
else -> {
// no-op
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class OnDeviceSitePermissionsStorageTest {
private lateinit var database: SitePermissionsDatabase

@get:Rule
@Suppress("DEPRECATION")
val helper: MigrationTestHelper = MigrationTestHelper(
InstrumentationRegistry.getInstrumentation(),
SitePermissionsDatabase::class.java.canonicalName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,9 @@ class SitePermissionsFeature(
is ContentAudioCapture, is ContentAudioMicrophone -> {
systemPermissions.add(RECORD_AUDIO)
}
else -> {
// no-op
}
}
}
return systemPermissions.all { context.isPermissionGranted((it)) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ internal interface TabCollectionDao {
)
fun getTabCollections(): Flow<List<TabCollectionWithTabs>>

@Transaction
Copy link
Member

@gabrielluong gabrielluong Feb 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we intentionally adding @Transaction for this query because the returned list could be fairly big and therefore want consistent result or for some other reason?

Copy link
Contributor

@jonalmeida jonalmeida Feb 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably for consistency. The Room upgrade must have added a new lint rule/failure to ensure we were always adding the @Transaction annotation.

It probably came in from here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, thanks Jonathan.
After updating to a new room version we'd get a warning here saying

The return value includes a POJO with a @relation. It is usually desired to annotate this method with @transaction to avoid possibility of inconsistent results between the POJO and its relations.

@Query(
"""
SELECT *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ class WindowFeature(
)
windowRequest.start()
}
else -> {
// no-op
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class OnDevicePinnedSitesStorageTest {
var instantTaskExecutorRule = InstantTaskExecutorRule()

@get:Rule
@Suppress("DEPRECATION")
val helper: MigrationTestHelper = MigrationTestHelper(
InstrumentationRegistry.getInstrumentation(),
TopSiteDatabase::class.java.canonicalName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class LocaleMiddleware(
when (action) {
is LocaleAction.RestoreLocaleStateAction -> restoreLocale(context.store)
is LocaleAction.UpdateLocaleAction -> updateLocale(action.locale)
else -> {
// no-op
}
}

next(action)
Expand Down