Skip to content

Commit

Permalink
Merge pull request #86 from LachlanMcKee/issue-85-improve-interop-vie…
Browse files Browse the repository at this point in the history
…w-error-message

[#85] Improved InteropViewImpl error messaging
  • Loading branch information
LachlanMcKee authored Aug 18, 2022
2 parents 8fdd910 + 9bb0473 commit 11172e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [#81](https://github.com/bumble-tech/appyx/issues/81) – Added: Support integration point for multiple roots
- [#65](https://github.com/bumble-tech/appyx/pull/65) – Added: `InteropBuilderStub` and `InteropSimpleBuilderStub` testing util classes
- [#47](https://github.com/bumble-tech/appyx/issues/47) – Updated: The 'customisations' module is now pure Java/Kotlin.
- [#85](https://github.com/bumble-tech/appyx/issues/85) – Updated: Improved `InteropView` error messaging when `Activity` does not implement `IntegrationPointAppyxProvider`


## 1.0-alpha03
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.bumble.appyx.interop.ribs

import android.app.Activity
import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.runtime.Composable
import com.badoo.ribs.compose.ComposeRibView
import com.badoo.ribs.compose.ComposeView
Expand Down Expand Up @@ -46,9 +46,13 @@ internal class InteropViewImpl private constructor(
}

private fun retrieveIntegrationPoint(): IntegrationPoint {
val activity = context.findActivity<AppCompatActivity>()
val activity = context.findActivity<Activity>()
check(activity != null) {
"Could not find an activity from the context: $context"
}
check(activity is IntegrationPointAppyxProvider) {
"Activity where InteropNode is used must implement IntegrationPointAppyxProvider"
"Activity where InteropNode is used must implement IntegrationPointAppyxProvider. " +
"Activity: '${activity::class.java.name}', Node: '${appyxNode::class.java.name}'"
}
return activity.integrationPointAppyx
}
Expand Down

0 comments on commit 11172e3

Please sign in to comment.