implementing the dialog to be shown before rating

This commit is contained in:
tibbi 2020-01-16 14:04:27 +01:00
parent ee66f711e3
commit bd3a5fa4a0
4 changed files with 24 additions and 6 deletions

View file

@ -7,7 +7,7 @@ buildscript {
propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '5.21.22'
propVersionName = '5.21.23'
kotlin_version = '1.3.61'
}

View file

@ -9,6 +9,7 @@ import android.text.method.LinkMovementMethod
import android.view.Menu
import android.view.View
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.dialogs.ConfirmationAdvancedDialog
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.*
@ -76,7 +77,7 @@ class AboutActivity : BaseSimpleActivity() {
about_email.movementMethod = LinkMovementMethod.getInstance()
about_email.setOnClickListener(null)
val msg = "${getString(R.string.before_asking_question_read_faq)}\n\n${getString(R.string.make_sure_latest)}"
ConfirmationDialog(this, msg, 0, R.string.read_it, R.string.skip) {
ConfirmationDialog(this, msg, 0, R.string.read_faq, R.string.skip) {
about_faq_label.performClick()
}
}
@ -146,10 +147,22 @@ class AboutActivity : BaseSimpleActivity() {
about_rate_us.visibility = View.GONE
} else {
about_rate_us.setOnClickListener {
try {
launchViewIntent("market://details?id=${packageName.removeSuffix(".debug")}")
} catch (ignored: ActivityNotFoundException) {
launchViewIntent(getStoreUrl())
if (baseConfig.wasBeforeRateShown) {
try {
launchViewIntent("market://details?id=${packageName.removeSuffix(".debug")}")
} catch (ignored: ActivityNotFoundException) {
launchViewIntent(getStoreUrl())
}
} else {
baseConfig.wasBeforeRateShown = true
val msg = "${getString(R.string.before_rate_read_faq)}\n\n${getString(R.string.make_sure_latest)}"
ConfirmationAdvancedDialog(this, msg, 0, R.string.read_faq, R.string.skip) {
if (it) {
about_faq_label.performClick()
} else {
about_rate_us.performClick()
}
}
}
}
}

View file

@ -305,6 +305,10 @@ open class BaseConfig(val context: Context) {
get() = prefs.getBoolean(WAS_BEFORE_ASKING_SHOWN, false)
set(wasBeforeAskingShown) = prefs.edit().putBoolean(WAS_BEFORE_ASKING_SHOWN, wasBeforeAskingShown).apply()
var wasBeforeRateShown: Boolean
get() = prefs.getBoolean(WAS_BEFORE_RATE_SHOWN, false)
set(wasBeforeRateShown) = prefs.edit().putBoolean(WAS_BEFORE_RATE_SHOWN, wasBeforeRateShown).apply()
var wasInitialUpgradeToProShown: Boolean
get() = prefs.getBoolean(WAS_INITIAL_UPGRADE_TO_PRO_SHOWN, false)
set(wasInitialUpgradeToProShown) = prefs.edit().putBoolean(WAS_INITIAL_UPGRADE_TO_PRO_SHOWN, wasInitialUpgradeToProShown).apply()

View file

@ -109,6 +109,7 @@ const val WIDGET_ID_TO_MEASURE = "widget_id_to_measure"
const val WAS_ORANGE_ICON_CHECKED = "was_orange_icon_checked"
const val WAS_APP_ON_SD_SHOWN = "was_app_on_sd_shown"
const val WAS_BEFORE_ASKING_SHOWN = "was_before_asking_shown"
const val WAS_BEFORE_RATE_SHOWN = "was_before_rate_shown"
const val WAS_INITIAL_UPGRADE_TO_PRO_SHOWN = "was_initial_upgrade_to_pro_shown"
const val WAS_APP_ICON_CUSTOMIZATION_WARNING_SHOWN = "was_app_icon_customization_warning_shown"
const val APP_SIDELOADING_STATUS = "app_sideloading_status"