GitXplorerGitXplorer
m

compose-inappreviews

public
18 stars
0 forks
0 issues

Commits

List of commits on branch master.
Verified
03a4db460ee3f797b86f197d82ded2edeb4b3fb9

Update README.md

mmertceyhan committed 2 years ago
Unverified
d751a1cfc599f261a455733950a7605d45b916b0

Add a support for sharing the library on mavenCentral()

mmertceyhan committed 2 years ago
Unverified
ca536c61200957e4b09935ece9424a0893baf990

Add a support for sharing the library on mavenCentral()

mmertceyhan committed 2 years ago
Verified
d52436840cc44b7880360e1a84509564bff7531f

Create LICENSE.md

mmertceyhan committed 2 years ago
Unverified
ae7da06364625bf6cec4e44c0876fdfc00140f44

Update README.md

mmertceyhan committed 2 years ago
Unverified
4d96f3d96a7a089c48d1309f5fb458d768105428

Release v1.0.0

mmertceyhan committed 2 years ago

README

The README file for this repository.

In-App Reviews for Jetpack Compose

This library provides an interface and a default implementation to make it easy to use Android's In-App Reviews API in a Jetpack Compose project.

How it Works

The InAppReviewManager interface defines a method launchReviewFlow that can be used to launch the In-App Review flow. The DefaultInAppReviewManager class provides a default implementation of the interface that uses the Android's In-App Reviews API to launch the review flow.

Example Usage

To use this library in your Jetpack Compose project, first add it as a dependency:

dependencies {
    implementation 'io.github.mertceyhan:compose-inappreviews:1.0.0'
}

Then, in your Composable function, call rememberInAppReviewManager to retrieve an instance of the InAppReviewManager. You can then call the launchReviewFlow method on this instance to launch the In-App Review flow.

@Composable
fun MyScreen() {
    // Get Activity
    val activity = (LocalContext.current as Activity)

    // Remember an InAppReviewManager
    val inAppReviewManager = rememberInAppReviewManager()

    Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
        Button(onClick = {
            inAppReviewManager.launchReviewFlow(activity = activity, onReviewRequestSuccess = {
                // Handle successful review request
                // Note that Android's In-App Reviews API says;
                //  "The flow has finished. The API does not indicate whether the user
                //  reviewed or not, or even whether the review dialog was shown. Thus, no
                //  matter the result, we continue our app flow."
                // @see [Launch the in-app review flow](https://developer.android.com/guide/playcore/in-app-review/kotlin-java#launch-review-flow)
            }, onReviewRequestFail = {
                // Handle review request failure
            })
        }) {
            Text(text = "Launch Review Flow")
        }
    }
}

How to Test

To test the In-App Review flow, you can follow the instructions in the official Android documentation here.

Contributing

Contributions are welcome! If you would like to contribute to this library, please submit a pull request.