Update Kotlin dependency (#10806)
parent
4153c11ea8
commit
d0e9f1f165
|
@ -13,7 +13,6 @@ import androidx.appcompat.app.AppCompatDelegate
|
|||
import androidx.core.content.getSystemService
|
||||
import kotlinx.coroutines.Deferred
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -67,7 +66,6 @@ open class FenixApplication : LocaleAwareApplication() {
|
|||
var visibilityLifecycleCallback: VisibilityLifecycleCallback? = null
|
||||
private set
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
|
@ -116,7 +114,6 @@ open class FenixApplication : LocaleAwareApplication() {
|
|||
Log.addSink(AndroidLogSink())
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
@CallSuper
|
||||
open fun setupInMainProcessOnly() {
|
||||
run {
|
||||
|
|
|
@ -29,6 +29,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import kotlinx.android.synthetic.main.activity_home.*
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.launch
|
||||
import mozilla.components.browser.search.SearchEngine
|
||||
import mozilla.components.browser.session.Session
|
||||
|
@ -104,6 +105,7 @@ import org.mozilla.fenix.utils.RunWhenReadyQueue
|
|||
* - home screen
|
||||
* - browser screen
|
||||
*/
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@SuppressWarnings("TooManyFunctions", "LargeClass")
|
||||
open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
|
||||
|
||||
|
|
|
@ -9,15 +9,14 @@ import androidx.recyclerview.widget.ItemTouchHelper
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kotlinx.android.extensions.LayoutContainer
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import mozilla.components.feature.tab.collections.TabCollection
|
||||
import mozilla.components.feature.top.sites.TopSite
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.tips.Tip
|
||||
import org.mozilla.fenix.home.HomeFragmentState
|
||||
import org.mozilla.fenix.home.HomeScreenViewModel
|
||||
import org.mozilla.fenix.home.Mode
|
||||
import org.mozilla.fenix.home.OnboardingState
|
||||
import org.mozilla.fenix.components.tips.Tip
|
||||
|
||||
// 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.
|
||||
|
@ -110,7 +109,6 @@ private fun collectionTabItems(collection: TabCollection) = collection.tabs.mapI
|
|||
AdapterItem.TabInCollectionItem(collection, tab, index == collection.tabs.lastIndex)
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
class SessionControlView(
|
||||
override val containerView: View?,
|
||||
interactor: SessionControlInteractor,
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
* 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
|
||||
package org.mozilla.fenix.migration
|
||||
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import mozilla.components.lib.state.ext.flowScoped
|
||||
import mozilla.components.support.base.log.logger.Logger
|
||||
|
@ -16,6 +17,8 @@ class MigrationTelemetryListener(
|
|||
private val metrics: MetricController,
|
||||
private val store: MigrationStore
|
||||
) {
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
fun start() {
|
||||
// Observe for migration completed.
|
||||
store.flowScoped { flow ->
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
package org.mozilla.fenix.search.telemetry
|
||||
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
@ -85,6 +86,7 @@ abstract class BaseSearchTelemetry {
|
|||
internal fun getProviderForUrl(url: String): SearchProviderModel? =
|
||||
providerList.find { provider -> provider.regexp.containsMatchIn(url) }
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
internal fun installWebExtension(
|
||||
engine: Engine,
|
||||
store: BrowserStore,
|
||||
|
|
|
@ -19,6 +19,7 @@ import kotlinx.android.synthetic.main.component_tabstray.view.*
|
|||
import kotlinx.android.synthetic.main.component_tabstray_fab.view.*
|
||||
import kotlinx.android.synthetic.main.fragment_tab_tray_dialog.*
|
||||
import kotlinx.android.synthetic.main.fragment_tab_tray_dialog.view.*
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import mozilla.components.browser.session.Session
|
||||
import mozilla.components.browser.session.SessionManager
|
||||
import mozilla.components.browser.state.selector.normalTabs
|
||||
|
@ -110,6 +111,7 @@ class TabTrayDialogFragment : AppCompatDialogFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val isPrivate = (activity as HomeActivity).browsingModeManager.mode.isPrivate
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.content.Context
|
|||
import kotlinx.coroutines.runBlocking
|
||||
import mozilla.components.support.migration.FennecMigrator
|
||||
import org.mozilla.fenix.session.PerformanceActivityLifecycleCallbacks
|
||||
import org.mozilla.fenix.migration.MigrationTelemetryListener
|
||||
|
||||
/**
|
||||
* An application class which knows how to migrate Fennec data.
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
package org.mozilla.fenix
|
||||
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import mozilla.components.concept.push.PushProcessor
|
||||
import mozilla.components.lib.state.ext.flowScoped
|
||||
|
@ -18,6 +19,8 @@ class MigrationPushRenewer(
|
|||
private val service: PushProcessor?,
|
||||
private val store: MigrationStore
|
||||
) {
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
fun start() {
|
||||
// Observe for migration completed.
|
||||
store.flowScoped { flow ->
|
||||
|
|
|
@ -69,7 +69,7 @@ import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
|||
import org.mozilla.fenix.home.Tab
|
||||
import org.mozilla.fenix.settings.deletebrowsingdata.deleteAndQuit
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@RunWith(FenixRobolectricTestRunner::class)
|
||||
class DefaultBrowserToolbarControllerTest {
|
||||
|
||||
|
|
|
@ -9,18 +9,16 @@ import io.mockk.every
|
|||
import io.mockk.mockk
|
||||
import io.mockk.mockkStatic
|
||||
import io.mockk.verify
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.newSingleThreadContext
|
||||
import kotlinx.coroutines.test.resetMain
|
||||
import kotlinx.coroutines.test.setMain
|
||||
import kotlinx.coroutines.test.TestCoroutineDispatcher
|
||||
import mozilla.components.browser.session.SessionManager
|
||||
import mozilla.components.concept.engine.Engine
|
||||
import mozilla.components.feature.tab.collections.TabCollection
|
||||
import mozilla.components.feature.tabs.TabsUseCases
|
||||
import org.junit.After
|
||||
import mozilla.components.support.test.rule.MainCoroutineRule
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.mozilla.fenix.BrowserDirection
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
|
@ -35,10 +33,12 @@ import org.mozilla.fenix.home.sessioncontrol.DefaultSessionControlController
|
|||
import org.mozilla.fenix.settings.SupportUtils
|
||||
import mozilla.components.feature.tab.collections.Tab as ComponentTab
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
class DefaultSessionControlControllerTest {
|
||||
|
||||
private val mainThreadSurrogate = newSingleThreadContext("UI thread")
|
||||
@get:Rule
|
||||
val coroutinesTestRule = MainCoroutineRule(TestCoroutineDispatcher())
|
||||
|
||||
private val activity: HomeActivity = mockk(relaxed = true)
|
||||
private val fragmentStore: HomeFragmentStore = mockk(relaxed = true)
|
||||
private val navController: NavController = mockk(relaxed = true)
|
||||
|
@ -62,7 +62,6 @@ class DefaultSessionControlControllerTest {
|
|||
|
||||
@Before
|
||||
fun setup() {
|
||||
Dispatchers.setMain(mainThreadSurrogate)
|
||||
mockkStatic("org.mozilla.fenix.ext.ContextKt")
|
||||
every { activity.components.core.engine } returns engine
|
||||
every { activity.components.core.sessionManager } returns sessionManager
|
||||
|
@ -91,12 +90,6 @@ class DefaultSessionControlControllerTest {
|
|||
)
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
Dispatchers.resetMain() // reset main dispatcher to the original Main dispatcher
|
||||
mainThreadSurrogate.close()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun handleCollectionAddTabTapped() {
|
||||
val collection: TabCollection = mockk(relaxed = true)
|
||||
|
|
|
@ -10,39 +10,30 @@ import io.mockk.every
|
|||
import io.mockk.just
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.newSingleThreadContext
|
||||
import kotlinx.coroutines.test.resetMain
|
||||
import kotlinx.coroutines.test.TestCoroutineDispatcher
|
||||
import kotlinx.coroutines.test.runBlockingTest
|
||||
import kotlinx.coroutines.test.setMain
|
||||
import mozilla.components.concept.engine.Engine
|
||||
import org.junit.After
|
||||
import mozilla.components.support.test.rule.MainCoroutineRule
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.mozilla.fenix.ext.components
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
class DefaultDeleteBrowsingDataControllerTest {
|
||||
|
||||
private val mainThreadSurrogate = newSingleThreadContext("UI thread")
|
||||
@get:Rule
|
||||
val coroutinesTestRule = MainCoroutineRule(TestCoroutineDispatcher())
|
||||
|
||||
private val context: Context = mockk(relaxed = true)
|
||||
private lateinit var controller: DefaultDeleteBrowsingDataController
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
Dispatchers.setMain(mainThreadSurrogate)
|
||||
|
||||
every { context.components.core.engine.clearData(any()) } just Runs
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
Dispatchers.resetMain() // reset main dispatcher to the original Main dispatcher
|
||||
mainThreadSurrogate.close()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun deleteTabs() = runBlockingTest {
|
||||
controller = DefaultDeleteBrowsingDataController(context, coroutineContext)
|
||||
|
|
|
@ -6,24 +6,21 @@
|
|||
|
||||
package org.mozilla.fenix.settings.deletebrowsingdata
|
||||
|
||||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import io.mockk.verifyOrder
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.newSingleThreadContext
|
||||
import kotlinx.coroutines.test.resetMain
|
||||
import kotlinx.coroutines.test.TestCoroutineDispatcher
|
||||
import kotlinx.coroutines.test.runBlockingTest
|
||||
import kotlinx.coroutines.test.setMain
|
||||
import mozilla.components.browser.storage.sync.PlacesHistoryStorage
|
||||
import mozilla.components.concept.engine.Engine
|
||||
import mozilla.components.feature.tabs.TabsUseCases
|
||||
import mozilla.components.support.test.robolectric.testContext
|
||||
import org.junit.After
|
||||
import mozilla.components.support.test.rule.MainCoroutineRule
|
||||
import org.junit.Before
|
||||
import org.junit.Ignore
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
|
@ -31,13 +28,15 @@ import org.mozilla.fenix.components.FenixSnackbar
|
|||
import org.mozilla.fenix.components.PermissionStorage
|
||||
import org.mozilla.fenix.ext.clearAndCommit
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@RunWith(FenixRobolectricTestRunner::class)
|
||||
class DeleteAndQuitTest {
|
||||
|
||||
private val mainThreadSurrogate = newSingleThreadContext("UI thread")
|
||||
@get:Rule
|
||||
val coroutinesTestRule = MainCoroutineRule(TestCoroutineDispatcher())
|
||||
|
||||
private var activity: HomeActivity = mockk(relaxed = true)
|
||||
lateinit var settings: Settings
|
||||
|
@ -54,8 +53,6 @@ class DeleteAndQuitTest {
|
|||
clear()
|
||||
}
|
||||
|
||||
Dispatchers.setMain(mainThreadSurrogate)
|
||||
|
||||
every { activity.components.core.historyStorage } returns historyStorage
|
||||
every { activity.components.core.permissionStorage } returns permissionStorage
|
||||
every { activity.components.useCases.tabsUseCases } returns tabUseCases
|
||||
|
@ -63,12 +60,6 @@ class DeleteAndQuitTest {
|
|||
every { activity.components.core.engine } returns engine
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
Dispatchers.resetMain() // reset main dispatcher to the original Main dispatcher
|
||||
mainThreadSurrogate.close()
|
||||
}
|
||||
|
||||
private fun Settings.clear() {
|
||||
preferences.clearAndCommit()
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
object Versions {
|
||||
const val kotlin = "1.3.30"
|
||||
const val kotlin = "1.3.72"
|
||||
const val coroutines = "1.3.3"
|
||||
const val android_gradle_plugin = "3.5.0"
|
||||
const val sentry = "1.7.10"
|
||||
|
|
Loading…
Reference in New Issue