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

Fixes #1970 - Guards the close listener #1972

Merged
merged 1 commit into from
Feb 6, 2019

Conversation

boek
Copy link
Contributor

@boek boek commented Feb 6, 2019

Pull Request checklist

  • Quality: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry or does not need one
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features

Copy link
Contributor

@pocmo pocmo left a comment

Choose a reason for hiding this comment

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

with test and changelog 💯

@@ -134,6 +134,10 @@ class CustomTabsToolbarFeature(
* Should be called when the back button is pressed.
*/
fun onBackPressed(): Boolean {
if (!initialized) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Heh, I was just fixing this but I think your solution works as well.

fun onBackPressed() = sessionManager.runWithSession(sessionId) {
    closeListener.invoke()
    remove(it)
    true
}

@pocmo
Copy link
Contributor

pocmo commented Feb 6, 2019

It looks like this broke one test though:

mozilla.components.feature.customtabs.CustomTabsToolbarFeatureTest > onBackPressed removes session FAILED
    java.lang.AssertionError at CustomTabsToolbarFeatureTest.kt:323

(And there's a changelog conflict now :()

@codecov
Copy link

codecov bot commented Feb 6, 2019

Codecov Report

Merging #1972 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1972      +/-   ##
============================================
- Coverage      84.2%   84.19%   -0.01%     
+ Complexity     2081     2079       -2     
============================================
  Files           261      261              
  Lines          8642     8638       -4     
  Branches       1294     1294              
============================================
- Hits           7277     7273       -4     
  Misses          826      826              
  Partials        539      539
Impacted Files Coverage Δ Complexity Δ
...nts/feature/customtabs/CustomTabsToolbarFeature.kt 93.22% <100%> (ø) 17 <0> (ø) ⬇️
...illa/components/service/glean/BooleanMetricType.kt 100% <0%> (ø) 7% <0%> (-2%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91bfcf5...5b992e0. Read the comment docs.

@pocmo pocmo merged commit a540d32 into mozilla-mobile:master Feb 6, 2019
@boek boek deleted the i1970-noop_onbackpressed branch February 6, 2019 19:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants