Skip to content

Commit

Permalink
Merge pull request #667 from manuel-martos/2.x-rename-integration-point
Browse files Browse the repository at this point in the history
Appyx 2.x - Rename integration point
  • Loading branch information
zsoltk authored Feb 12, 2024
2 parents 0bd6e47 + 245219a commit e18d59c
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AppyxTestScenario<T : Node<*>>(
decorator {
NodeHost(
lifecycle = AndroidLifecycle(LocalLifecycleOwner.current.lifecycle),
integrationPoint = activity.appyxV2IntegrationPoint,
integrationPoint = activity.appyxIntegrationPoint,
) { nodeContext ->
node = nodeFactory.create(nodeContext)
awaitNode.countDown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ open class ActivityIntegrationPoint(
"Activity ${activity::class.qualifiedName} does not implement IntegrationPointProvider"
)

return integrationPointProvider.appyxV2IntegrationPoint as? AndroidIntegrationPoint
return integrationPointProvider.appyxIntegrationPoint as? AndroidIntegrationPoint
?: error(
"Activity ${activity::class.qualifiedName} does not provide AndroidIntegrationPoint"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.appcompat.app.AppCompatActivity
* See [NodeComponentActivity] for building upon [ComponentActivity].
*
* Also offers base functionality to satisfy dependencies of Android-related functionality
* down the tree via [appyxV2IntegrationPoint]:
* down the tree via [appyxIntegrationPoint]:
* - [ActivityStarter]
* - [PermissionRequester]
*
Expand All @@ -19,7 +19,7 @@ import androidx.appcompat.app.AppCompatActivity
*/
open class NodeActivity : AppCompatActivity(), IntegrationPointProvider {

override lateinit var appyxV2IntegrationPoint: ActivityIntegrationPoint
override lateinit var appyxIntegrationPoint: ActivityIntegrationPoint
protected set

protected open fun createIntegrationPoint(savedInstanceState: Bundle?) =
Expand All @@ -30,12 +30,12 @@ open class NodeActivity : AppCompatActivity(), IntegrationPointProvider {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
appyxV2IntegrationPoint = createIntegrationPoint(savedInstanceState)
appyxIntegrationPoint = createIntegrationPoint(savedInstanceState)
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
appyxV2IntegrationPoint.onActivityResult(requestCode, resultCode, data)
appyxIntegrationPoint.onActivityResult(requestCode, resultCode, data)
}

override fun onRequestPermissionsResult(
Expand All @@ -44,12 +44,12 @@ open class NodeActivity : AppCompatActivity(), IntegrationPointProvider {
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
appyxV2IntegrationPoint.onRequestPermissionsResult(requestCode, permissions, grantResults)
appyxIntegrationPoint.onRequestPermissionsResult(requestCode, permissions, grantResults)
}

override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
appyxV2IntegrationPoint.onSaveInstanceState(outState)
appyxIntegrationPoint.onSaveInstanceState(outState)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.activity.ComponentActivity
* See [NodeActivity] for building upon [AppCompatActivity]
*
* Also offers base functionality to satisfy dependencies of Android-related functionality
* down the tree via [appyxV2IntegrationPoint]:
* down the tree via [appyxIntegrationPoint]:
* - [ActivityStarter]
* - [PermissionRequester]
*
Expand All @@ -19,7 +19,7 @@ import androidx.activity.ComponentActivity
*/
open class NodeComponentActivity : ComponentActivity(), IntegrationPointProvider {

override lateinit var appyxV2IntegrationPoint: ActivityIntegrationPoint
override lateinit var appyxIntegrationPoint: ActivityIntegrationPoint
protected set

protected open fun createIntegrationPoint(savedInstanceState: Bundle?) =
Expand All @@ -30,13 +30,13 @@ open class NodeComponentActivity : ComponentActivity(), IntegrationPointProvider

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
appyxV2IntegrationPoint = createIntegrationPoint(savedInstanceState)
appyxIntegrationPoint = createIntegrationPoint(savedInstanceState)
}

@Suppress("OVERRIDE_DEPRECATION")
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
appyxV2IntegrationPoint.onActivityResult(requestCode, resultCode, data)
appyxIntegrationPoint.onActivityResult(requestCode, resultCode, data)
}

@Suppress("OVERRIDE_DEPRECATION")
Expand All @@ -46,11 +46,11 @@ open class NodeComponentActivity : ComponentActivity(), IntegrationPointProvider
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
appyxV2IntegrationPoint.onRequestPermissionsResult(requestCode, permissions, grantResults)
appyxIntegrationPoint.onRequestPermissionsResult(requestCode, permissions, grantResults)
}

override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
appyxV2IntegrationPoint.onSaveInstanceState(outState)
appyxIntegrationPoint.onSaveInstanceState(outState)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package com.bumble.appyx.navigation.integration

interface IntegrationPointProvider {

val appyxV2IntegrationPoint: IntegrationPoint
val appyxIntegrationPoint: IntegrationPoint
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MainActivity : NodeActivity() {
) {
NodeHost(
lifecycle = AndroidLifecycle(LocalLifecycleOwner.current.lifecycle),
integrationPoint = appyxV2IntegrationPoint,
integrationPoint = appyxIntegrationPoint,
) {
MosaicNode(
nodeContext = it,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class MainActivity : NodeActivity() {
) {
NodeHost(
lifecycle = AndroidLifecycle(LocalLifecycleOwner.current.lifecycle),
integrationPoint = appyxV2IntegrationPoint,
integrationPoint = appyxIntegrationPoint,
) {
AppyxMaterial3NavNode(
nodeContext = it,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class MainActivity : NodeActivity() {
CompositionLocalProvider(LocalNavigator provides navigator) {
NodeHost(
lifecycle = AndroidLifecycle(LocalLifecycleOwner.current.lifecycle),
integrationPoint = appyxV2IntegrationPoint,
integrationPoint = appyxIntegrationPoint,
) {
RootNode(
nodeContext = it,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ComposeNavigationRootTest {
// 'integrationPoint' must be provided to ensure it can be accessed from within the
// Jetpack compose navigation graph.
CompositionLocalProvider(
LocalIntegrationPoint provides appyxTestActivity.appyxV2IntegrationPoint,
LocalIntegrationPoint provides appyxTestActivity.appyxIntegrationPoint,
) {
ComposeNavigationRoot()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MainActivity : NodeActivity() {
Surface(color = MaterialTheme.colorScheme.background) {
NodeHost(
lifecycle = AndroidLifecycle(LocalLifecycleOwner.current.lifecycle),
integrationPoint = appyxV2IntegrationPoint,
integrationPoint = appyxIntegrationPoint,
) {
MainNavNode(
nodeContext = it,
Expand Down
21 changes: 0 additions & 21 deletions documentation/2.x/migrationguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,27 +80,6 @@ Artifacts have a `utils-` prefix:
```


### MainActivity

```diff
-import com.bumble.appyx.core.integration.NodeHost
-import com.bumble.appyx.core.integrationpoint.NodeActivity

+import com.bumble.appyx.navigation.integration.NodeHost
+import com.bumble.appyx.navigation.integration.NodeActivity

class MainActivity : NodeActivity() {
super.onCreate(savedInstanceState)
setContent {
HelloAppyxTheme {
- NodeHost(integrationPoint = appyxIntegrationPoint) {
+ NodeHost(integrationPoint = appyxV2IntegrationPoint) {
RootNode(it)
}
}
}
```

### Usage site (RootNode)

```diff
Expand Down
2 changes: 1 addition & 1 deletion documentation/navigation/multiplatform.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class MainActivity : NodeActivity() {
YourAppTheme {
NodeHost(
lifecycle = AndroidLifecycle(LocalLifecycleOwner.current.lifecycle),
integrationPoint = appyxV2IntegrationPoint
integrationPoint = appyxIntegrationPoint
) {
RootNode(nodeContext = it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppyxRibsInteropActivity : InteropActivity() {

override fun createRib(savedInstanceState: Bundle?): Rib =
RibsNodeBuilder()
.build(BuildContext.root(savedInstanceState), appyxV2IntegrationPoint)
.build(BuildContext.root(savedInstanceState), appyxIntegrationPoint)
.also { ribsNode = it }

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.bumble.appyx.navigation.integration.IntegrationPointProvider

abstract class InteropActivity : RibActivity(), IntegrationPointProvider {

override lateinit var appyxV2IntegrationPoint: ActivityIntegrationPoint
override lateinit var appyxIntegrationPoint: ActivityIntegrationPoint

protected open fun createAppyxIntegrationPoint(savedInstanceState: Bundle?) =
ActivityIntegrationPoint(
Expand All @@ -19,13 +19,13 @@ abstract class InteropActivity : RibActivity(), IntegrationPointProvider {
override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate() creates RIB with AppyxNode inside. It's important to have
// appyxIntegrationPoint ready before we create a root node
appyxV2IntegrationPoint = createAppyxIntegrationPoint(savedInstanceState)
appyxIntegrationPoint = createAppyxIntegrationPoint(savedInstanceState)
super.onCreate(savedInstanceState)
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
appyxV2IntegrationPoint.onActivityResult(requestCode, resultCode, data)
appyxIntegrationPoint.onActivityResult(requestCode, resultCode, data)
}

override fun onRequestPermissionsResult(
Expand All @@ -34,12 +34,12 @@ abstract class InteropActivity : RibActivity(), IntegrationPointProvider {
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
appyxV2IntegrationPoint.onRequestPermissionsResult(requestCode, permissions, grantResults)
appyxIntegrationPoint.onRequestPermissionsResult(requestCode, permissions, grantResults)
}

override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
appyxV2IntegrationPoint.onSaveInstanceState(outState)
appyxIntegrationPoint.onSaveInstanceState(outState)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ open class AppyxActivityTestRule<T : Node<*>>(
decorator {
NodeHost(
lifecycle = AndroidLifecycle(LocalLifecycleOwner.current.lifecycle),
integrationPoint = activity.appyxV2IntegrationPoint,
integrationPoint = activity.appyxIntegrationPoint,
) { nodeContext ->
node = nodeFactory.create(nodeContext)
node
Expand Down

0 comments on commit e18d59c

Please sign in to comment.