2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-11 13:11:01 +00:00
Sawyer Blatz 2019-08-07 14:00:53 -07:00 committed by GitHub
parent 96f42368b3
commit 8bd4dc98d2
17 changed files with 48 additions and 15 deletions

View File

@ -25,8 +25,8 @@ import kotlinx.coroutines.launch
import mozilla.components.browser.search.SearchEngine
import mozilla.components.browser.session.Session
import mozilla.components.browser.session.SessionManager
import mozilla.components.browser.session.intent.EXTRA_SESSION_ID
import mozilla.components.concept.engine.EngineView
import mozilla.components.feature.intent.IntentProcessor
import mozilla.components.lib.crash.Crash
import mozilla.components.support.base.feature.BackHandler
import mozilla.components.support.ktx.kotlin.isUrl
@ -206,7 +206,7 @@ open class HomeActivity : AppCompatActivity(), ShareFragment.TabsSharedCallback
var customTabSessionId: String? = null
if (isCustomTab) {
customTabSessionId = SafeIntent(intent).getStringExtra(IntentProcessor.ACTIVE_SESSION_ID)
customTabSessionId = SafeIntent(intent).getStringExtra(EXTRA_SESSION_ID)
}
openToBrowser(BrowserDirection.FromGlobal, customTabSessionId)

View File

@ -21,7 +21,9 @@ import kotlinx.android.synthetic.main.component_search.*
import kotlinx.android.synthetic.main.fragment_browser.view.*
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.Job
import kotlinx.coroutines.ObsoleteCoroutinesApi
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import mozilla.appservices.places.BookmarkRoot
@ -29,7 +31,6 @@ import mozilla.components.browser.session.Session
import mozilla.components.browser.session.SessionManager
import mozilla.components.feature.readerview.ReaderViewFeature
import mozilla.components.feature.session.ThumbnailsFeature
import mozilla.components.feature.tab.collections.TabCollection
import mozilla.components.lib.state.ext.consumeFrom
import mozilla.components.support.base.feature.BackHandler
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
@ -46,6 +47,7 @@ import org.mozilla.fenix.customtabs.CustomTabsIntegration
import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.home.sessioncontrol.SessionControlChange
import org.mozilla.fenix.home.sessioncontrol.TabCollection
import org.mozilla.fenix.mvi.getManagedEmitter
import org.mozilla.fenix.quickactionsheet.DefaultQuickActionSheetController
import org.mozilla.fenix.quickactionsheet.QuickActionSheetView
@ -85,12 +87,15 @@ class BrowserFragment : BaseBrowserFragment(), BackHandler {
return view
}
@Suppress("LongMethod", "ComplexMethod")
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val sessionManager = requireComponents.core.sessionManager
getSessionById()?.let { session ->
getSessionById()?.let {
quickActionSheetView = QuickActionSheetView(view.nestedScrollQuickAction, browserInteractor)
customTabSessionId?.let { customTabSessionId ->

View File

@ -39,9 +39,6 @@ class BrowserToolbarView(
val toolbarIntegration: ToolbarIntegration
init {
// We need access to the customSessionId. We don't directly have access since we aren't passing session id in
// So we need to access it through the store...?
with(container.context) {
val sessionManager = components.core.sessionManager
val isCustomTabSession = currentSession.isCustomTabSession()
@ -100,7 +97,6 @@ class BrowserToolbarView(
toolbarIntegration = ToolbarIntegration(
this,
view,
container,
menuToolbar,
ShippedDomainsProvider().also { it.initialize(this) },
components.core.historyStorage,
@ -111,8 +107,9 @@ class BrowserToolbarView(
}
}
@Suppress("UNUSED_PARAMETER")
fun update(state: BrowserState) {
// TODO Leaving this as a stub for now since we don't actually have anything to update ever...?
// Intentionally leaving this as a stub for now since we don't actually want to update currently
}
companion object {

View File

@ -5,7 +5,6 @@
package org.mozilla.fenix.components.toolbar
import android.content.Context
import android.view.ViewGroup
import androidx.navigation.NavOptions
import androidx.navigation.Navigation
import mozilla.components.browser.domains.autocomplete.DomainAutocompleteProvider
@ -28,7 +27,6 @@ import org.mozilla.fenix.utils.Settings
class ToolbarIntegration(
context: Context,
toolbar: BrowserToolbar,
browserLayout: ViewGroup,
toolbarMenu: ToolbarMenu,
domainAutocompleteProvider: DomainAutocompleteProvider,
historyStorage: HistoryStorage,

View File

@ -14,6 +14,8 @@ import androidx.lifecycle.lifecycleScope
import kotlinx.android.synthetic.main.fragment_exceptions.view.*
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
import mozilla.components.lib.state.ext.consumeFrom
@ -53,6 +55,8 @@ class ExceptionsFragment : Fragment() {
return view
}
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
consumeFrom(exceptionsStore) {

View File

@ -23,7 +23,9 @@ import androidx.navigation.fragment.findNavController
import kotlinx.android.synthetic.main.fragment_bookmark.view.*
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.Job
import kotlinx.coroutines.ObsoleteCoroutinesApi
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import mozilla.appservices.places.BookmarkRoot
@ -95,6 +97,8 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), BackHandler, Accou
return view
}
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
consumeFrom(bookmarkStore) {

View File

@ -21,6 +21,8 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.lifecycleScope
import kotlinx.android.synthetic.main.fragment_history.view.*
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import kotlinx.coroutines.launch
import mozilla.components.lib.state.ext.consumeFrom
import mozilla.components.support.base.feature.BackHandler
@ -105,6 +107,8 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), BackHandler {
}
}
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

View File

@ -21,6 +21,8 @@ import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import kotlinx.android.synthetic.main.fragment_search.*
import kotlinx.android.synthetic.main.fragment_search.view.*
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import mozilla.components.concept.storage.HistoryStorage
import mozilla.components.feature.qr.QrFeature
import mozilla.components.lib.state.ext.consumeFrom
@ -102,6 +104,8 @@ class SearchFragment : Fragment(), BackHandler {
return view
}
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

View File

@ -4,9 +4,11 @@
package org.mozilla.fenix
import kotlinx.coroutines.ObsoleteCoroutinesApi
import org.mozilla.fenix.components.Components
import org.mozilla.fenix.components.TestComponents
@ObsoleteCoroutinesApi
class TestApplication : FenixApplication() {
override val components: Components

View File

@ -6,6 +6,7 @@ package org.mozilla.fenix.components
import androidx.fragment.app.Fragment
import androidx.fragment.app.testing.launchFragmentInContainer
import kotlinx.coroutines.ObsoleteCoroutinesApi
import mozilla.components.lib.state.Action
import mozilla.components.lib.state.State
import mozilla.components.lib.state.Store
@ -18,6 +19,7 @@ import org.mozilla.fenix.TestApplication
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
@ObsoleteCoroutinesApi
@RunWith(RobolectricTestRunner::class)
@Config(application = TestApplication::class)
class StoreProviderTest {

View File

@ -6,7 +6,9 @@ package org.mozilla.fenix.components
import android.content.Context
import io.mockk.mockk
import kotlinx.coroutines.ObsoleteCoroutinesApi
@ObsoleteCoroutinesApi
class TestComponents(private val context: Context) : Components(context) {
override val backgroundServices by lazy {
mockk<BackgroundServices>(relaxed = true)

View File

@ -16,10 +16,9 @@ import io.mockk.mockkStatic
import io.mockk.slot
import io.mockk.spyk
import io.mockk.verify
import junit.framework.Assert.assertEquals
import junit.framework.Assert.assertNull
import kotlinx.coroutines.runBlocking
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test
import org.mockito.ArgumentMatchers.any
import org.mockito.ArgumentMatchers.anyString

View File

@ -4,6 +4,7 @@
package org.mozilla.fenix.components.metrics
import kotlinx.coroutines.ObsoleteCoroutinesApi
import mozilla.components.browser.search.SearchEngine
import mozilla.components.browser.search.SearchEngineManager
import mozilla.components.browser.search.provider.AssetsSearchEngineProvider
@ -20,6 +21,7 @@ import org.mozilla.fenix.components.FenixLocaleSearchLocalizationProvider
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
@ObsoleteCoroutinesApi
@RunWith(RobolectricTestRunner::class)
@Config(application = TestApplication::class)
class PerformedSearchTest {

View File

@ -5,10 +5,11 @@
package org.mozilla.fenix.ext
import androidx.core.content.ContextCompat
import junit.framework.Assert.assertEquals
import kotlinx.coroutines.ObsoleteCoroutinesApi
import mozilla.components.feature.tab.collections.TabCollection
import mozilla.components.support.test.mock
import mozilla.components.support.test.robolectric.testContext
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotEquals
import org.junit.Test
import org.junit.runner.RunWith
@ -18,6 +19,7 @@ import org.mozilla.fenix.TestApplication
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
@ObsoleteCoroutinesApi
@RunWith(RobolectricTestRunner::class)
@Config(application = TestApplication::class)
class TabCollectionTest {

View File

@ -7,6 +7,7 @@ package org.mozilla.fenix.library.bookmarks
import io.mockk.mockk
import io.mockk.spyk
import io.mockk.verifyOrder
import kotlinx.coroutines.ObsoleteCoroutinesApi
import mozilla.components.concept.storage.BookmarkNode
import mozilla.components.concept.storage.BookmarkNodeType
import org.junit.Before
@ -16,6 +17,7 @@ import org.mozilla.fenix.TestApplication
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
@ObsoleteCoroutinesApi
@RunWith(RobolectricTestRunner::class)
@Config(application = TestApplication::class)
internal class BookmarkAdapterTest {

View File

@ -5,6 +5,7 @@
package org.mozilla.fenix.utils
import androidx.test.ext.junit.runners.AndroidJUnit4
import kotlinx.coroutines.ObsoleteCoroutinesApi
import mozilla.components.feature.sitepermissions.SitePermissionsRules
import mozilla.components.feature.sitepermissions.SitePermissionsRules.Action.ASK_TO_ALLOW
import mozilla.components.feature.sitepermissions.SitePermissionsRules.Action.BLOCKED
@ -19,6 +20,7 @@ import org.mozilla.fenix.TestApplication
import org.mozilla.fenix.ext.clearAndCommit
import org.robolectric.annotation.Config
@ObsoleteCoroutinesApi
@RunWith(AndroidJUnit4::class)
@Config(application = TestApplication::class)
class SettingsTest {

View File

@ -35,6 +35,10 @@ allprojects {
}
jcenter()
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions.allWarningsAsErrors = true
kotlinOptions.freeCompilerArgs += ["-Xuse-experimental=kotlin.Experimental", "-Xskip-runtime-version-check"]
}
}
task clean(type: Delete) {