Skip to content

Commit

Permalink
Merge pull request #673 from marekpdev/canHandleBackPressTypo
Browse files Browse the repository at this point in the history
Fix canHandeBackPress typo
  • Loading branch information
zsoltk authored Feb 5, 2024
2 parents a7b6c3e + 21c149d commit 8cc35ab
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Pending changes

- [#670](https://github.com/bumble-tech/appyx/pull/670) - Fixes ios lifecycle
- [#673](https://github.com/bumble-tech/appyx/pull/673) – Fix canHandeBackPress typo

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface AppyxComponent<InteractionTarget : Any, ModelState : Any> : SavesInsta

fun onRemovedFromComposition()

fun canHandeBackPress(): StateFlow<Boolean>
fun canHandleBackPress(): StateFlow<Boolean>

fun handleBackPress(): Boolean

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ open class BaseAppyxComponent<InteractionTarget : Any, ModelState : Any>(

override fun handleBackPress(): Boolean = backPressStrategy.handleBackPress()

override fun canHandeBackPress(): StateFlow<Boolean> = backPressStrategy.canHandleBackPress
override fun canHandleBackPress(): StateFlow<Boolean> = backPressStrategy.canHandleBackPress

override fun saveInstanceState(state: MutableSavedStateMap) {
model.saveInstanceState(state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ class CombinedAppyxComponent<InteractionTarget : Any>(

override fun handleBackPress(): Boolean {
appyxComponents.forEach { appyxComponent ->
if (appyxComponent.canHandeBackPress().value)
if (appyxComponent.canHandleBackPress().value)
return appyxComponent.handleBackPress()
}
return false
}

override fun canHandeBackPress(): StateFlow<Boolean> =
combineState(appyxComponents.map { it.canHandeBackPress() }, scope) { array ->
override fun canHandleBackPress(): StateFlow<Boolean> =
combineState(appyxComponents.map { it.canHandleBackPress() }, scope) { array ->
array.any { it }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EmptyAppyxComponent<InteractionTarget : Any> : AppyxComponent<InteractionT

override fun onRemovedFromComposition() = Unit

override fun canHandeBackPress(): StateFlow<Boolean> = MutableStateFlow(false)
override fun canHandleBackPress(): StateFlow<Boolean> = MutableStateFlow(false)

override fun handleBackPress(): Boolean = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class PermanentAppyxComponent<InteractionTarget : Any>(
instant.operation(operation)
}

override fun canHandeBackPress(): StateFlow<Boolean> = MutableStateFlow(false)
override fun canHandleBackPress(): StateFlow<Boolean> = MutableStateFlow(false)

override fun handleBackPress(): Boolean = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ abstract class Node<NavTarget : Any>(
private fun BackHandler() {
//todo support delegating to plugins
val canHandleBack = appyxComponent
.canHandeBackPress()
.canHandleBackPress()
.collectAsState(initial = false)
PlatformBackHandler(enabled = canHandleBack.value) {
appyxComponent.handleBackPress()
Expand Down
14 changes: 14 additions & 0 deletions documentation/releases/2.0.0-alpha11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: 2.0.0-alpha11 – Migration guide
---

# 2.0.0-alpha11 – Migration guide

## Fixed `canHandeBackPress` typo

```diff
interface AppyxComponent /*...*/ {
/*...*/
- fun canHandeBackPress(): StateFlow<Boolean>
+ fun canHandleBackPress(): StateFlow<Boolean>
```

0 comments on commit 8cc35ab

Please sign in to comment.