Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
Bug 1877526 - Add Share and Reload icons on toolbar in the right order
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah541 committed Mar 14, 2024
1 parent 3c4f3a5 commit 3d9e934
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ internal class ActionContainer @JvmOverloads constructor(
ToolbarActionIdentifier.READER_MODE,
ToolbarActionIdentifier.TRANSLATION,
ToolbarActionIdentifier.REVIEW_QUALITY_CHECK,
ToolbarActionIdentifier.SHARE,
ToolbarActionIdentifier.RELOAD,
)

init {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,4 +561,6 @@ enum class ToolbarActionIdentifier {
READER_MODE,
TRANSLATION,
REVIEW_QUALITY_CHECK,
SHARE,
RELOAD,
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import mozilla.components.browser.state.state.CustomTabSessionState
import mozilla.components.browser.state.state.createCustomTab
import mozilla.components.concept.toolbar.AutocompleteDelegate
import mozilla.components.concept.toolbar.Toolbar
import mozilla.components.concept.toolbar.ToolbarActionIdentifier
import mozilla.components.support.test.ThrowProperty
import mozilla.components.support.test.mock
import org.junit.Assert.assertEquals
Expand Down Expand Up @@ -82,6 +83,7 @@ class CustomTabSessionTitleObserverTest {
override fun removeBrowserAction(action: Toolbar.Action) = Unit
override fun invalidateActions() = Unit
override fun addPageAction(action: Toolbar.Action) = Unit
override fun addPageActionInOrder(action: Toolbar.Action, identifier: ToolbarActionIdentifier) = Unit
override fun removePageAction(action: Toolbar.Action) = Unit
override fun addNavigationAction(action: Toolbar.Action) = Unit
override fun removeNavigationAction(action: Toolbar.Action) = Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import mozilla.components.concept.toolbar.AutocompleteDelegate
import mozilla.components.concept.toolbar.AutocompleteProvider
import mozilla.components.concept.toolbar.AutocompleteResult
import mozilla.components.concept.toolbar.Toolbar
import mozilla.components.concept.toolbar.ToolbarActionIdentifier
import mozilla.components.support.test.any
import mozilla.components.support.test.argumentCaptor
import mozilla.components.support.test.eq
Expand Down Expand Up @@ -83,6 +84,13 @@ class ToolbarAutocompleteFeatureTest {
fail()
}

override fun addPageActionInOrder(
action: Toolbar.Action,
identifier: ToolbarActionIdentifier,
) {
fail()
}

override fun addNavigationAction(action: Toolbar.Action) {
fail()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package mozilla.components.feature.toolbar
import mozilla.components.concept.engine.EngineSession
import mozilla.components.concept.toolbar.AutocompleteDelegate
import mozilla.components.concept.toolbar.Toolbar
import mozilla.components.concept.toolbar.ToolbarActionIdentifier
import mozilla.components.feature.session.SessionUseCases
import org.junit.Assert.assertEquals
import org.junit.Assert.fail
Expand Down Expand Up @@ -66,6 +67,13 @@ class ToolbarInteractorTest {
fail()
}

override fun addPageActionInOrder(
action: Toolbar.Action,
identifier: ToolbarActionIdentifier,
) {
fail()
}

override fun addNavigationAction(action: Toolbar.Action) {
fail()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
listener = { browserToolbarInteractor.onShareActionClicked() },
)

browserToolbarView.view.addPageAction(sharePageAction)
browserToolbarView.view.addPageActionInOrder(sharePageAction, ToolbarActionIdentifier.SHARE)
}

private fun initTranslationsAction(context: Context, view: View) {
Expand Down Expand Up @@ -410,7 +410,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
)

refreshAction?.let {
browserToolbarView.view.addPageAction(it)
browserToolbarView.view.addPageActionInOrder(it, ToolbarActionIdentifier.RELOAD)
}
}

Expand Down

0 comments on commit 3d9e934

Please sign in to comment.