Add alternative buy button labels

This commit is contained in:
Moez Bhatti
2018-08-02 17:27:36 -04:00
parent 8f2a83feaa
commit a68997ba69
7 changed files with 131 additions and 2 deletions
@@ -34,6 +34,7 @@ import com.moez.QKSMS.common.util.extensions.setBackgroundTint
import com.moez.QKSMS.common.util.extensions.setTint
import com.moez.QKSMS.common.util.extensions.setVisible
import com.moez.QKSMS.common.widget.PreferenceView
import com.moez.QKSMS.feature.plus.experiment.UpgradeButtonExperiment
import dagger.android.AndroidInjection
import kotlinx.android.synthetic.main.collapsing_toolbar.*
import kotlinx.android.synthetic.main.preference_view.view.*
@@ -43,6 +44,7 @@ import javax.inject.Inject
class PlusActivity : QkThemedActivity(), PlusView {
@Inject lateinit var fontProvider: FontProvider
@Inject lateinit var upgradeButtonExperiment: UpgradeButtonExperiment
@Inject lateinit var viewModelFactory: ViewModelProvider.Factory
private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory)[PlusViewModel::class.java] }
@@ -87,7 +89,7 @@ class PlusActivity : QkThemedActivity(), PlusView {
override fun render(state: PlusState) {
description.text = getString(R.string.qksms_plus_description_summary, state.upgradePrice)
upgrade.text = getString(R.string.qksms_plus_upgrade, state.upgradePrice, state.currency)
upgrade.text = getString(upgradeButtonExperiment.variant.value, state.upgradePrice, state.currency)
upgradeDonate.text = getString(R.string.qksms_plus_upgrade_donate, state.upgradeDonatePrice, state.currency)
val fdroid = BuildConfig.FLAVOR == "noAnalytics"
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
*
* This file is part of QKSMS.
*
* QKSMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QKSMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.moez.QKSMS.feature.plus.experiment
import android.content.Context
import androidx.annotation.StringRes
import com.moez.QKSMS.R
import com.moez.QKSMS.experiment.Experiment
import com.moez.QKSMS.experiment.Variant
import com.moez.QKSMS.manager.AnalyticsManager
import javax.inject.Inject
class UpgradeButtonExperiment @Inject constructor(
context: Context,
analytics: AnalyticsManager
) : Experiment<@StringRes Int>(context, analytics) {
override val key: String = "Upgrade Button"
override val variants: List<Variant<Int>> = listOf(
Variant("variant_a", R.string.qksms_plus_upgrade),
Variant("variant_b", R.string.qksms_plus_upgrade_b),
Variant("variant_c", R.string.qksms_plus_upgrade_c),
Variant("variant_d", R.string.qksms_plus_upgrade_d))
override val default: Int = R.string.qksms_plus_upgrade
}
@@ -228,6 +228,9 @@
<string name="qksms_plus_description_title">Support development, unlock everything</string>
<string name="qksms_plus_description_summary">You can save a starving developer for just %s</string>
<string name="qksms_plus_upgrade">Lifetime upgrade for %1$s %2$s</string>
<string name="qksms_plus_upgrade_b">Unlock for %1$s %2$s</string>
<string name="qksms_plus_upgrade_c">Unlock forever for %1$s %2$s</string>
<string name="qksms_plus_upgrade_d">One-time purchase of %1$s %2$s</string>
<string name="qksms_plus_upgrade_donate">Unlock + donate for %1$s %2$s</string>
<string name="qksms_plus_thanks_title">Thank you for supporting QKSMS!</string>
<string name="qksms_plus_thanks_summary">You now have access to all QKSMS+ features</string>