Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appyx 2.x - Rename integration point #667

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
}
}
```

Comment on lines -83 to -103
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it's better if instead of removing this block we update it. After merging #668, let's make a new release in the scope of 1.x

Then we could update this above block to say something like:

"If you migrate all of your codebase from 1.x to 2.x in a single go, you should skip this step. However, if you intend to keep them in parallel for a gradual migration, you must do the following:

  1. Update your 1.x version to [release containing Appyx 1.x - Rename integration point #668]
  2. Rename appyxIntegrationPoint usage in 1.x code to appyxV1IntegrationPoint:

(include the above code but for 1.x)

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's do this as a standalone PR for documentation when we have the 1.x version out. Merging this ticket now to close API.

### 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
Loading