SuddenH4X / awesome-app-rating

An Android library providing a dialog, which asks the user to rate the app or give feedback. You can also use the library to show the Google in-app review easily under certain conditions.
Apache License 2.0
231 stars 39 forks source link

Add compose support #93

Open rosenpin opened 1 year ago

rosenpin commented 1 year ago

The README currently falsely claims that this library has jetpack compose support.
You also mention later in the README that to use this library with jetpack compose users should use an AppCompatActivity instead of a ComponentActivity, but the latter is required to use compose.
To add proper compose support we should create a dialog view specifically for compose

SuddenH4X commented 1 year ago

Hi @rosenpin, you don't have to use a ComponentActivity for Jetpack Compose. Instead it is the minimum required type of activity but you can also use a AppCompatActivity or FragmentActivity (because AppCompatActivity extends FragmentActivity which extends ComponentActivity).

rosenpin commented 1 year ago

That's not the case AFAIK. The ComponentActivity you inherit to use Jetpack compose is different from the regular base ComponentActivity which in turn inherits directly from Activity. See here
image

They are named the same which is hella confusing, but the compose ComponentActivity, the one that supplies the setContent method required to set compose views as your layout is not the same as the ComponentActivity that FragmentActivity and AppCompatActivity inherit from

When trying to show the rating dialog from the compose component activity I get this error: image

rosenpin commented 1 year ago

Actually seems like adding this library allows the use of setContent in an AppCompatActivity.
implementation "androidx.compose.ui:ui:1.5.1"
https://developer.android.com/jetpack/androidx/releases/compose-ui#1.5.1

Might be worth adding it to the README :)