Closed Monabr closed 3 years ago
Here is my code
AppRating.Builder(this)
.setTitleTextId(R.string.main_rate_message)
.setConfirmButtonTextId(R.string.confirm)
.setRateLaterButtonTextId(R.string.rate_later)
.setRateNowButtonTextId(R.string.rate_now)
.setShowOnlyFullStars(true)
.setFeedbackTitleTextId(R.string.title_feedback)
.setMailFeedbackMessageTextId(R.string.feedback_message)
.setMailFeedbackButtonTextId(R.string.send_feedback)
.setNoFeedbackButtonTextId(R.string.not_send_feedback)
.setStoreRatingTitleTextId(R.string.google_play_rating)
.setStoreRatingMessageTextId(R.string.google_play_rating_text)
.showRateNeverButtonAfterNTimes(R.string.never, null, 1)
.setAdditionalRateNowButtonClickListener {
CustomLogger.log()
}
.setConfirmButtonClickListener { rating ->
if (rating < 4) {
CustomLogger.log()
} else {
CustomLogger.log()
}
}
.setUseCustomFeedback(true)
.setCustomFeedbackMessageTextId(R.string.custom_feedback_message)
.setCustomFeedbackButtonClickListener{ feedback ->
CustomLogger.log(feedback)
}
.setRatingThreshold(RatingThreshold.FOUR)
.setMinimumLaunchTimes(remoteConfig.getLong("param1").toInt())
.setMinimumDays(remoteConfig.getLong("param2").toInt())
.setMinimumLaunchTimesToShowAgain(3)
.setMinimumDaysToShowAgain(3)
.setCancelable(true)
.showIfMeetsConditions()
I start to get this bug after add this lines of code
.setConfirmButtonClickListener { rating ->
if (rating < 4) {
CustomLogger.log()
} else {
CustomLogger.log()
}
}
.setUseCustomFeedback(true)
.setCustomFeedbackMessageTextId(R.string.custom_feedback_message)
.setCustomFeedbackButtonClickListener{ feedback ->
CustomLogger.log(feedback)
}
.setMinimumLaunchTimes(remoteConfig.getLong("param1").toInt())
.setMinimumDays(remoteConfig.getLong("param2").toInt())
Try to fix it by using
viewModel.liveData.postValue("value")
but still get this exception
Hi @Monabr,
the issue is related to #48. Probably your CustomLogger
or the remoteConfig
has a reference to your class MainContainerActivity
. To fix it you can extract the remote config values to a local variable:
val param1 = remoteConfig.getLong("param1").toInt()
val param2 = remoteConfig.getLong("param2").toInt()
AppRating.Builder(this)
...
.setMinimumLaunchTimes(param1)
.setMinimumDays(param2)
...
.showIfMeetsConditions()
If your CustomLogger
has a reference to the Activity too you can use livedata/flow/... for that.
it can't be used like in your example in project i tryed to use it with viewmodel but it's also cause the problem. Maybe you can refactored code to LiveData so i could just observe the values and than use it?
I also can provide you code for make liveData works only once
Can you send me a sample project, so I can look into the issue? With the currently provided information it's hard to identify the exact problem.
@SuddenH4X What are you speaking about? I just said about 3 situations: a non-working test case, a suggestion to add a lifedate for the result or a flow, and the third one - I can give a code of a lifedate that will work only 1 time as an event.
You've posted a stacktrace and I suggested you a solution which you said isn't working. I tried to reproduce your issue but couldn't get it to crash (with my suggestion applied). Therefore I asked you to send me a sample project, so I can look into the exact issue.
I don't think it's useful to add a livedata/flow in this specific case. And I'm not sure what you mean/want exactly with "a livedata that will work only 1 time as an event". But if you have a code snippet it will help me to understand your suggestion/issue.
Duplicate of #48.
I am facing the same issue with 2.5.0 y5.k as name results of using proguard, which is in fact:
com.suddenh4x.ratingdialog.dialog.DialogOptions -> y5.k: