Default to 'Name your price' screen

pull/1305/head
Alex Baker 3 years ago
parent d5354af20a
commit cd1e129386

@ -66,7 +66,9 @@ class PurchaseDialog : DialogFragment(), OnPurchasesUpdated {
binding = ActivityPurchaseBinding.inflate(layoutInflater)
ButterKnife.bind(this, binding.root)
if (savedInstanceState != null) {
if (savedInstanceState == null) {
nameYourPrice = !isTasksPayment
} else {
binding.slider.value = savedInstanceState.getFloat(EXTRA_PRICE)
priceChanged = savedInstanceState.getBoolean(EXTRA_PRICE_CHANGED)
nameYourPrice = savedInstanceState.getBoolean(EXTRA_NAME_YOUR_PRICE)
@ -195,10 +197,14 @@ _${getString(R.string.upgrade_tasks_no_account)}_
@OnClick(R.id.pay_other)
fun nameYourPrice() {
nameYourPrice = !nameYourPrice
setWaitScreen(false)
binding.scroll.scrollTo(0, 0)
updateSubscribeButton()
if (isTasksPayment) {
dismiss()
} else {
nameYourPrice = !nameYourPrice
setWaitScreen(false)
binding.scroll.scrollTo(0, 0)
updateSubscribeButton()
}
}
override fun onSaveInstanceState(outState: Bundle) {
@ -213,13 +219,11 @@ _${getString(R.string.upgrade_tasks_no_account)}_
val generic = BuildConfig.FLAVOR == "generic"
binding.sliderContainer.isVisible = !isWaitScreen && nameYourPrice
binding.payOther.isVisible = !isWaitScreen
if (nameYourPrice) {
binding.payOther.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0)
binding.payOther.setText(R.string.back)
} else {
binding.payOther.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, R.drawable.ic_keyboard_arrow_right_24px, 0)
binding.payOther.setText(R.string.more_options)
}
binding.payOther.setText(when {
isTasksPayment -> R.string.cancel
nameYourPrice -> R.string.upgrade_tasks_account
else -> R.string.back
})
binding.tasksOrgButtonPanel.isVisible = !isWaitScreen && !generic
binding.screenWait.isVisible = isWaitScreen && !generic
binding.sponsor.isVisible = generic
@ -359,8 +363,12 @@ _${getString(R.string.upgrade_tasks_no_account)}_
return dialog
}
fun newPurchaseDialog(target: Fragment, rc: Int): PurchaseDialog {
val dialog = PurchaseDialog()
fun newPurchaseDialog(
target: Fragment,
rc: Int,
tasksPayment: Boolean = false
): PurchaseDialog {
val dialog = newPurchaseDialog(tasksPayment)
dialog.setTargetFragment(target, rc)
return dialog
}

@ -107,7 +107,7 @@ class ColorPalettePicker : DialogFragment() {
if (inventory.purchasedThemes()) {
builder.setNegativeButton(R.string.cancel, null)
} else {
builder.setPositiveButton(R.string.button_subscribe) { _: DialogInterface?, _: Int ->
builder.setPositiveButton(R.string.upgrade_to_pro) { _: DialogInterface?, _: Int ->
newPurchaseDialog().show(parentFragmentManager, FRAG_TAG_PURCHASE_DIALOG)
}
}

@ -49,7 +49,7 @@ class ColorWheelPicker : DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
selected = savedInstanceState?.getInt(EXTRA_SELECTED) ?: requireArguments().getInt(EXTRA_SELECTED, 0)
val button = if (inventory.purchasedThemes()) R.string.ok else R.string.button_subscribe
val button = if (inventory.purchasedThemes()) R.string.ok else R.string.upgrade_to_pro
val builder = ColorPickerDialogBuilder
.with(activity)
.wheelType(ColorPickerView.WHEEL_TYPE.CIRCLE)

@ -64,7 +64,7 @@ public class IconPickerDialog extends DialogFragment {
dialogBuilder.newDialog().setNegativeButton(R.string.cancel, null).setView(view);
if (!inventory.getHasPro()) {
builder.setPositiveButton(
R.string.button_subscribe,
R.string.upgrade_to_pro,
(dialog, which) -> newPurchaseDialog()
.show(getParentFragmentManager(), PurchaseDialog.getFRAG_TAG_PURCHASE_DIALOG()));
}

@ -123,7 +123,7 @@ class ThemePickerDialog : DialogFragment() {
val stringRes = if (available()) {
R.string.cancel
} else {
R.string.button_subscribe
R.string.upgrade_to_pro
}
dialog?.getButton(AlertDialog.BUTTON_POSITIVE)?.text = getString(stringRes)

@ -26,6 +26,7 @@ import org.tasks.billing.PurchaseDialog.Companion.newPurchaseDialog
import org.tasks.preferences.Preferences
import java.io.BufferedReader
import javax.inject.Inject
import kotlin.random.Random
@AndroidEntryPoint
class WhatsNewDialog : DialogFragment() {
@ -56,9 +57,10 @@ class WhatsNewDialog : DialogFragment() {
changelog.movementMethod = LinkMovementMethod.getInstance()
changelog.text = markwon.toMarkdown(text)
val begForSubscription = firebase.noChurn() && !inventory.hasPro
val begForRating = !preferences.getBoolean(R.string.p_clicked_rate, false)
&& (inventory.purchasedThemes() || firebase.noChurn())
val begForSubscription = firebase.noChurn() && !inventory.hasPro
&& (!begForSubscription || Random.nextBoolean())
when {
BuildConfig.FLAVOR == "generic" -> {
@ -74,7 +76,7 @@ class WhatsNewDialog : DialogFragment() {
begForSubscription -> {
displayedSubscribe = true
actionText.text = getString(R.string.support_development_subscribe)
actionButton.text = getString(R.string.button_subscribe)
actionButton.text = getString(R.string.name_your_price)
actionButton.setOnClickListener { onSubscribeClick() }
}
else -> {

@ -179,7 +179,7 @@ class FilterProvider @Inject constructor(
}
.plusIf(!inventory.hasPro) {
NavigationDrawerAction(
context.getString(R.string.upgrade_to_pro),
context.getString(R.string.name_your_price),
R.drawable.ic_outline_attach_money_24px,
NavigationDrawerFragment.REQUEST_PURCHASE)
}

@ -122,7 +122,7 @@ class TasksAccount : InjectingPreferenceFragment() {
private fun showPurchaseDialog(): Boolean {
PurchaseDialog
.newPurchaseDialog(this, REQUEST_PURCHASE)
.newPurchaseDialog(this, REQUEST_PURCHASE, tasksPayment = true)
.show(parentFragmentManager, PurchaseDialog.FRAG_TAG_PURCHASE_DIALOG)
return false
}

@ -32,7 +32,7 @@
<!-- Eventually these should be moved to strings.xml for translation -->
<string name="upgrade_tasks_account">Tasks.org account</string>
<string name="upgrade_tasks_no_account">Tasks.org account not included with \'Name your price\' subscriptions</string>
<string name="upgrade_tasks_no_account">Not included with \'Name your price\' subscriptions</string>
<string name="upgrade_sync_self_hosted">Sync with third-party apps and services</string>
<string name="upgrade_third_party_apps">Compatible with Outlook, Thunderbird, Apple Reminders, and more</string>
<string name="upgrade_coming_soon">Many new features coming soon!</string>

Loading…
Cancel
Save