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

Commit

Permalink
Merge #4544 #4545 #4547
Browse files Browse the repository at this point in the history
4544:  GeckoView update (beta) (20190926-142130) r=pocmo a=MickeyMoz



4545:  GeckoView update (nightly) (20190926-142132) r=pocmo a=MickeyMoz



4547: Hide custom tab close button in PWAs r=jonalmeida a=NotWoods

The close button destroys the entire PWA, which isn't what we want. Let's hide the button for now.



Co-authored-by: MickeyMoz <sebastian@mozilla.com>
Co-authored-by: Tiger Oakes <toakes@mozilla.com>
  • Loading branch information
3 people committed Sep 26, 2019
4 parents 7c62d36 + 1863b29 + 69f0b59 + ff9ee21 commit 9af4fdd
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/Gecko.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ internal object GeckoVersions {
/**
* GeckoView Nightly Version.
*/
const val nightly_version = "71.0.20190925095053"
const val nightly_version = "71.0.20190926094200"

/**
* GeckoView Beta Version.
*/
const val beta_version = "70.0.20190923100040"
const val beta_version = "70.0.20190926005616"

/**
* GeckoView Release Version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import java.util.UUID
* @property closeButtonIcon Custom icon of the back button on the toolbar.
* @property enableUrlbarHiding Enables the toolbar to hide as the user scrolls down on the page.
* @property actionButtonConfig Custom action button on the toolbar.
* @property showCloseButton Specifies whether the close button will be shown on the toolbar.
* @property showShareMenuItem Specifies whether a default share button will be shown in the menu.
* @property menuItems Custom overflow menu items.
* @property exitAnimations Bundle containing custom exit animations for the tab.
Expand All @@ -33,6 +34,7 @@ data class CustomTabConfig(
val closeButtonIcon: Bitmap? = null,
val enableUrlbarHiding: Boolean = false,
val actionButtonConfig: CustomTabActionButtonConfig? = null,
val showCloseButton: Boolean = true,
val showShareMenuItem: Boolean = false,
val menuItems: List<CustomTabMenuItem> = emptyList(),
val exitAnimations: Bundle? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class CustomTabsToolbarFeature(
updateToolbarColor(config.toolbarColor, config.navigationBarColor)

// Add navigation close action
addCloseButton(session, config.closeButtonIcon)
if (config.showCloseButton) {
addCloseButton(session, config.closeButtonIcon)
}

// Add action button
addActionButton(session, config.actionButtonConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class CustomTabsToolbarFeatureTest {
fun `initialize calls addCloseButton`() {
val session: Session = mock()
val toolbar = BrowserToolbar(testContext)
`when`(session.customTabConfig).thenReturn(mock())
`when`(session.customTabConfig).thenReturn(CustomTabConfig())

val feature = spy(CustomTabsToolbarFeature(mock(), toolbar, "") {})

Expand All @@ -190,6 +190,19 @@ class CustomTabsToolbarFeatureTest {
verify(feature).addCloseButton(session, null)
}

@Test
fun `initialize doesn't call addCloseButton if the button should be hidden`() {
val session: Session = mock()
val toolbar = BrowserToolbar(testContext)
`when`(session.customTabConfig).thenReturn(CustomTabConfig(showCloseButton = false))

val feature = spy(CustomTabsToolbarFeature(mock(), toolbar, "") {})

feature.initialize(session)

verify(feature, never()).addCloseButton(session, null)
}

@Test
fun `close button invokes callback and removes session`() {
val session: Session = mock()
Expand All @@ -198,7 +211,7 @@ class CustomTabsToolbarFeatureTest {
var closeClicked = false
val feature = spy(CustomTabsToolbarFeature(sessionManager, toolbar, "") { closeClicked = true })

`when`(session.customTabConfig).thenReturn(mock())
`when`(session.customTabConfig).thenReturn(CustomTabConfig())

feature.initialize(session)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ fun WebAppManifest.toCustomTabConfig(): CustomTabConfig {
closeButtonIcon = null,
enableUrlbarHiding = true,
actionButtonConfig = null,
showCloseButton = false,
showShareMenuItem = true,
menuItems = emptyList()
)
Expand Down

0 comments on commit 9af4fdd

Please sign in to comment.