Skip to content

Commit

Permalink
Merge pull request #25 from SuddenH4X/release/2.2.1
Browse files Browse the repository at this point in the history
Release/2.2.1
  • Loading branch information
SuddenH4X authored Oct 18, 2020
2 parents 5339add + 94307ff commit 7d41a44
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 33 deletions.
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This library:
- uses AndroidX
- uses no third party dependencies
- is easy debuggable
- is Android Q (API 29) ready
- is Android 11 (API 30) ready
- is easy to use

## How to use
Expand All @@ -40,7 +40,7 @@ The library supports API level 14 and higher. You can simply include it in your
```groovy
dependencies {
...
implementation 'com.suddenh4x.ratingdialog:awesome-app-rating:2.2.0'
implementation 'com.suddenh4x.ratingdialog:awesome-app-rating:2.2.1'
}
```

Expand Down Expand Up @@ -107,6 +107,27 @@ You should also add a `completeListener` which gets called if the in-app review

Note: After the first in-app review flow was completed successfully the `toShowAgain` conditions will be used. For example `.setMinimumLaunchTimesToShowAgain(launchTimesToShowAgain: Int)` instead of `.setMinimumLaunchTimes(launchTimes: Int)`.

##### Current issues with in-app review

Testing the Google in-app review isn't as easy as it should be. There is an open issue in the issuetracker of Google: https://issuetracker.google.com/issues/167352813

Follow these tips on stackoverflow to maximize your chance of testing it successfully:

```
- Use only one account in the device
- Ensure that account has installed the app (appears in the app & games > Library section in Play Store)
- The account is a GMAIL one, not a GSuit
- You can review with the account if you go to the app play listing page.
- The account has not reviewed
- If you intend to use the Internal Test Track ensure the account has joined the test track.
- When switching between different accounts and testing things out, sometimes might be helpful to "Clear Data" from the Play Store app.
- Try all the above with different account
Source: https://stackoverflow.com/a/63950373
```

You should consider to wait with implementing it and use the normal rating dialog instead until Google has fixed the issue(s).

#### When to show up

- Change the number of days the app has to be installed
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.4.0'
ext.kotlin_version = '1.4.10'
repositories {
google()
jcenter()
Expand Down
10 changes: 5 additions & 5 deletions exampleapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
compileSdkVersion 30
defaultConfig {
applicationId "com.suddenh4x.ratingdialog.exampleapp"
minSdkVersion 14
Expand All @@ -27,12 +27,12 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation project(':library')

testImplementation 'junit:junit:4.13'

androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.view.View
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.res.ResourcesCompat
import androidx.lifecycle.MutableLiveData
import com.suddenh4x.ratingdialog.AppRating
import com.suddenh4x.ratingdialog.buttons.CustomFeedbackButtonClickListener
import com.suddenh4x.ratingdialog.preferences.MailSettings
Expand All @@ -16,6 +17,10 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
AppRating.reset(this)

toastLiveData.observe(this) { toastString ->
Toast.makeText(this, toastString, Toast.LENGTH_LONG).show()
}
}

fun onResetButtonClicked(@Suppress("UNUSED_PARAMETER") view: View) {
Expand All @@ -27,11 +32,7 @@ class MainActivity : AppCompatActivity() {
AppRating.Builder(this)
.useGoogleInAppReview()
.setGoogleInAppReviewCompleteListener { successful ->
Toast.makeText(
this@MainActivity,
"Google in-app review completed (successful: $successful)",
Toast.LENGTH_LONG
).show()
toastLiveData.postValue("Google in-app review completed (successful: $successful)")
}
.setDebug(true)
.showIfMeetsConditions()
Expand Down Expand Up @@ -71,11 +72,7 @@ class MainActivity : AppCompatActivity() {
.setUseCustomFeedback(true)
.setCustomFeedbackButtonClickListener(object : CustomFeedbackButtonClickListener {
override fun onClick(userFeedbackText: String) {
Toast.makeText(
this@MainActivity,
"Feedback: $userFeedbackText",
Toast.LENGTH_LONG
).show()
toastLiveData.postValue("Feedback: $userFeedbackText")
}
})
.showIfMeetsConditions()
Expand Down Expand Up @@ -136,4 +133,9 @@ class MainActivity : AppCompatActivity() {
.setNoFeedbackButtonTextId(R.string.button_no_feedback)
.showIfMeetsConditions()
}

companion object {
// The livedata is used so that no context is given into the click listeners. (NotSerializableException)
private val toastLiveData: MutableLiveData<String> = MutableLiveData()
}
}
12 changes: 6 additions & 6 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ apply plugin: 'kotlin-android-extensions'
apply plugin: "de.mannodermaus.android-junit5"
apply plugin: 'com.novoda.bintray-release'

def version = "2.2.0"
def version = "2.2.1"

android {
compileSdkVersion 29
compileSdkVersion 30
defaultConfig {
minSdkVersion 14
versionCode 3
Expand All @@ -31,13 +31,13 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.annotation:annotation:1.1.0'

// needed for in-app review
implementation 'com.google.android.play:core:1.8.0'
implementation 'com.google.android.play:core:1.8.2'
implementation 'com.google.android.play:core-ktx:1.8.1'

testImplementation "org.junit.jupiter:junit-jupiter-api:5.5.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package com.suddenh4x.ratingdialog.buttons

import androidx.annotation.StringRes
import java.io.Serializable

internal class RateButton(@StringRes var textId: Int, var rateDialogClickListener: RateDialogClickListener?)
internal class RateButton(
@StringRes var textId: Int,
var rateDialogClickListener: RateDialogClickListener?
) : Serializable

internal class ConfirmButton(
@StringRes var textId: Int,
var confirmButtonClickListener: ConfirmButtonClickListener?
)
) : Serializable

internal class CustomFeedbackButton(
@StringRes var textId: Int,
var customFeedbackButtonClickListener: CustomFeedbackButtonClickListener?
)
) : Serializable
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package com.suddenh4x.ratingdialog.buttons

fun interface RateDialogClickListener {
import java.io.Serializable

fun interface RateDialogClickListener : Serializable {
fun onClick()
}

fun interface ConfirmButtonClickListener {
fun interface ConfirmButtonClickListener : Serializable {
fun onClick(userRating: Float)
}

fun interface CustomFeedbackButtonClickListener {
fun interface CustomFeedbackButtonClickListener : Serializable {
fun onClick(userFeedbackText: String)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import com.suddenh4x.ratingdialog.preferences.RatingThreshold
import java.io.Serializable

internal class DialogOptions : Serializable {

@Transient
var iconDrawable: Drawable? = null
var rateLaterButton: RateButton = RateButton(R.string.rating_dialog_button_rate_later, null)
var rateNeverButton: RateButton? = null
Expand Down Expand Up @@ -40,7 +42,8 @@ internal class DialogOptions : Serializable {
// rating dialog feedback
@StringRes
var feedbackTitleTextId = R.string.rating_dialog_feedback_title
var noFeedbackButton: RateButton = RateButton(R.string.rating_dialog_feedback_button_cancel, null)
var noFeedbackButton: RateButton =
RateButton(R.string.rating_dialog_feedback_button_cancel, null)

// rating dialog mail feedback
@StringRes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.suddenh4x.ratingdialog.preferences

import java.io.Serializable

data class MailSettings(
val mailAddress: String,
val subject: String,
val text: String? = null,
val errorToastMessage: String? = null
)
) : Serializable
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.suddenh4x.ratingdialog.preferences

enum class RatingThreshold {
import java.io.Serializable

enum class RatingThreshold : Serializable {
NONE, HALF, ONE, ONE_AND_A_HALF, TWO, TWO_AND_A_HALF, THREE, THREE_AND_A_HALF, FOUR, FOUR_AND_A_HALF, FIVE;
}

Expand Down

0 comments on commit 7d41a44

Please sign in to comment.