Remove check for whether google pay is available.

fork-5.53.8
Alex Hart 2021-11-03 16:03:20 -03:00 zatwierdzone przez Greyson Parrelli
rodzic 8af8468f4d
commit f73b8a7fd2
2 zmienionych plików z 14 dodań i 42 usunięć

Wyświetl plik

@ -102,7 +102,7 @@ class BoostFragment : DSLSettingsBottomSheetFragment(
lifecycleDisposable.bindTo(viewLifecycleOwner.lifecycle)
lifecycleDisposable += viewModel.events.subscribe { event: DonationEvent ->
when (event) {
is DonationEvent.GooglePayUnavailableError -> onGooglePayUnavailable(event.throwable)
is DonationEvent.GooglePayUnavailableError -> Unit
is DonationEvent.PaymentConfirmationError -> onPaymentError(event.throwable)
is DonationEvent.PaymentConfirmationSuccess -> onPaymentConfirmed(event.badge)
DonationEvent.RequestTokenError -> onPaymentError(null)
@ -169,16 +169,14 @@ class BoostFragment : DSLSettingsBottomSheetFragment(
)
)
if (state.isGooglePayAvailable) {
space(DimensionUnit.DP.toPixels(16f).toInt())
space(DimensionUnit.DP.toPixels(16f).toInt())
customPref(
GooglePayButton.Model(
onClick = this@BoostFragment::onGooglePayButtonClicked,
isEnabled = state.stage == BoostState.Stage.READY
)
customPref(
GooglePayButton.Model(
onClick = this@BoostFragment::onGooglePayButtonClicked,
isEnabled = state.stage == BoostState.Stage.READY
)
}
)
secondaryButtonNoOutline(
text = DSLSettingsText.from(R.string.SubscribeFragment__more_payment_options),
@ -225,18 +223,6 @@ class BoostFragment : DSLSettingsBottomSheetFragment(
}
}
private fun onGooglePayUnavailable(throwable: Throwable?) {
Log.w(TAG, "Google Pay error", throwable)
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.DonationsErrors__google_pay_unavailable)
.setMessage(R.string.DonationsErrors__you_have_to_set_up_google_pay_to_donate_in_app)
.setPositiveButton(android.R.string.ok) { dialog, _ ->
dialog.dismiss()
findNavController().popBackStack()
}
.show()
}
private fun startAnimationAboveSelectedBoost(view: View) {
val animationView = getAnimationContainer(view)
val viewProjection = Projection.relativeToViewRoot(view, null)

Wyświetl plik

@ -80,7 +80,7 @@ class SubscribeFragment : DSLSettingsFragment(
lifecycleDisposable.bindTo(viewLifecycleOwner.lifecycle)
lifecycleDisposable += viewModel.events.subscribe {
when (it) {
is DonationEvent.GooglePayUnavailableError -> onGooglePayUnavailable(it.throwable)
is DonationEvent.GooglePayUnavailableError -> Unit
is DonationEvent.PaymentConfirmationError -> onPaymentError(it.throwable)
is DonationEvent.PaymentConfirmationSuccess -> onPaymentConfirmed(it.badge)
DonationEvent.RequestTokenError -> onPaymentError(null)
@ -203,16 +203,14 @@ class SubscribeFragment : DSLSettingsFragment(
}
)
} else {
if (state.isGooglePayAvailable) {
space(DimensionUnit.DP.toPixels(16f).toInt())
space(DimensionUnit.DP.toPixels(16f).toInt())
customPref(
GooglePayButton.Model(
onClick = this@SubscribeFragment::onGooglePayButtonClicked,
isEnabled = areFieldsEnabled && state.selectedSubscription != null
)
customPref(
GooglePayButton.Model(
onClick = this@SubscribeFragment::onGooglePayButtonClicked,
isEnabled = areFieldsEnabled && state.selectedSubscription != null
)
}
)
secondaryButtonNoOutline(
text = DSLSettingsText.from(R.string.SubscribeFragment__more_payment_options),
@ -259,18 +257,6 @@ class SubscribeFragment : DSLSettingsFragment(
}
}
private fun onGooglePayUnavailable(throwable: Throwable?) {
Log.w(TAG, "Google Pay error", throwable)
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.DonationsErrors__google_pay_unavailable)
.setMessage(R.string.DonationsErrors__you_have_to_set_up_google_pay_to_donate_in_app)
.setPositiveButton(android.R.string.ok) { dialog, _ ->
dialog.dismiss()
findNavController().popBackStack()
}
.show()
}
private fun onSubscriptionCancelled() {
Snackbar.make(requireView(), R.string.SubscribeFragment__your_subscription_has_been_cancelled, Snackbar.LENGTH_LONG)
.setTextColor(Color.WHITE)