Fix clickable link in donation thanks sheet.
This commit is contained in:
parent
d4fba5f3c7
commit
fd00ed71b5
3 changed files with 18 additions and 10 deletions
|
@ -30,6 +30,7 @@ import org.thoughtcrime.securesms.components.settings.DSLSettingsText
|
||||||
import org.thoughtcrime.securesms.components.settings.app.subscription.boost.Boost
|
import org.thoughtcrime.securesms.components.settings.app.subscription.boost.Boost
|
||||||
import org.thoughtcrime.securesms.components.settings.app.subscription.models.CurrencySelection
|
import org.thoughtcrime.securesms.components.settings.app.subscription.models.CurrencySelection
|
||||||
import org.thoughtcrime.securesms.components.settings.app.subscription.models.NetworkFailure
|
import org.thoughtcrime.securesms.components.settings.app.subscription.models.NetworkFailure
|
||||||
|
import org.thoughtcrime.securesms.components.settings.app.subscription.thanks.ThanksForYourSupportBottomSheetDialogFragment
|
||||||
import org.thoughtcrime.securesms.components.settings.configure
|
import org.thoughtcrime.securesms.components.settings.configure
|
||||||
import org.thoughtcrime.securesms.database.InAppPaymentTable
|
import org.thoughtcrime.securesms.database.InAppPaymentTable
|
||||||
import org.thoughtcrime.securesms.databinding.DonateToSignalFragmentBinding
|
import org.thoughtcrime.securesms.databinding.DonateToSignalFragmentBinding
|
||||||
|
@ -50,7 +51,8 @@ class DonateToSignalFragment :
|
||||||
DSLSettingsFragment(
|
DSLSettingsFragment(
|
||||||
layoutId = R.layout.donate_to_signal_fragment
|
layoutId = R.layout.donate_to_signal_fragment
|
||||||
),
|
),
|
||||||
DonationCheckoutDelegate.Callback {
|
DonationCheckoutDelegate.Callback,
|
||||||
|
ThanksForYourSupportBottomSheetDialogFragment.Callback {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val TAG = Log.tag(DonateToSignalFragment::class.java)
|
private val TAG = Log.tag(DonateToSignalFragment::class.java)
|
||||||
|
@ -490,4 +492,8 @@ class DonateToSignalFragment :
|
||||||
override fun navigateToDonationPending(inAppPayment: InAppPaymentTable.InAppPayment) {
|
override fun navigateToDonationPending(inAppPayment: InAppPaymentTable.InAppPayment) {
|
||||||
findNavController().safeNavigate(DonateToSignalFragmentDirections.actionDonateToSignalFragmentToDonationPendingBottomSheet(inAppPayment))
|
findNavController().safeNavigate(DonateToSignalFragmentDirections.actionDonateToSignalFragmentToDonationPendingBottomSheet(inAppPayment))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onBoostThanksSheetDismissed() {
|
||||||
|
findNavController().popBackStack()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.core.text.method.LinkMovementMethodCompat
|
||||||
import com.airbnb.lottie.LottieAnimationView
|
import com.airbnb.lottie.LottieAnimationView
|
||||||
import com.airbnb.lottie.LottieDrawable
|
import com.airbnb.lottie.LottieDrawable
|
||||||
import com.google.android.material.button.MaterialButton
|
import com.google.android.material.button.MaterialButton
|
||||||
|
@ -25,6 +25,7 @@ import org.thoughtcrime.securesms.components.settings.app.AppSettingsActivity
|
||||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient
|
import org.thoughtcrime.securesms.recipients.Recipient
|
||||||
import org.thoughtcrime.securesms.util.SpanUtil
|
import org.thoughtcrime.securesms.util.SpanUtil
|
||||||
|
import org.thoughtcrime.securesms.util.fragments.findListener
|
||||||
import org.thoughtcrime.securesms.util.visible
|
import org.thoughtcrime.securesms.util.visible
|
||||||
|
|
||||||
class ThanksForYourSupportBottomSheetDialogFragment : FixedRoundedCornerBottomSheetDialogFragment() {
|
class ThanksForYourSupportBottomSheetDialogFragment : FixedRoundedCornerBottomSheetDialogFragment() {
|
||||||
|
@ -67,6 +68,7 @@ class ThanksForYourSupportBottomSheetDialogFragment : FixedRoundedCornerBottomSh
|
||||||
if (Recipient.self().badges.any { !it.isBoost() }) {
|
if (Recipient.self().badges.any { !it.isBoost() }) {
|
||||||
subhead.setText(R.string.SubscribeThanksForYourSupportBottomSheetDialogFragment__youve_earned_a_donor_badge)
|
subhead.setText(R.string.SubscribeThanksForYourSupportBottomSheetDialogFragment__youve_earned_a_donor_badge)
|
||||||
} else {
|
} else {
|
||||||
|
subhead.movementMethod = LinkMovementMethodCompat.getInstance()
|
||||||
subhead.text = SpannableStringBuilder(getString(R.string.SubscribeThanksForYourSupportBottomSheetDialogFragment__youve_earned_a_donor_badge))
|
subhead.text = SpannableStringBuilder(getString(R.string.SubscribeThanksForYourSupportBottomSheetDialogFragment__youve_earned_a_donor_badge))
|
||||||
.append(" ")
|
.append(" ")
|
||||||
.append(getString(R.string.SubscribeThanksForYourSupportBottomSheetDialogFragment__you_can_also))
|
.append(getString(R.string.SubscribeThanksForYourSupportBottomSheetDialogFragment__you_can_also))
|
||||||
|
@ -106,7 +108,7 @@ class ThanksForYourSupportBottomSheetDialogFragment : FixedRoundedCornerBottomSh
|
||||||
controlState = ControlState.DISPLAY
|
controlState = ControlState.DISPLAY
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.isBoost) {
|
if (args.badge.isBoost()) {
|
||||||
badgeView.visibility = View.INVISIBLE
|
badgeView.visibility = View.INVISIBLE
|
||||||
lottie.visible = true
|
lottie.visible = true
|
||||||
lottie.playAnimation()
|
lottie.playAnimation()
|
||||||
|
@ -146,15 +148,19 @@ class ThanksForYourSupportBottomSheetDialogFragment : FixedRoundedCornerBottomSh
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.isBoost) {
|
if (args.badge.isSubscription()) {
|
||||||
findNavController().popBackStack()
|
|
||||||
} else {
|
|
||||||
requireActivity().finish()
|
requireActivity().finish()
|
||||||
requireActivity().startActivity(AppSettingsActivity.manageSubscriptions(requireContext()))
|
requireActivity().startActivity(AppSettingsActivity.manageSubscriptions(requireContext()))
|
||||||
|
} else {
|
||||||
|
findListener<Callback>()?.onBoostThanksSheetDismissed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val TAG = Log.tag(ThanksForYourSupportBottomSheetDialogFragment::class.java)
|
private val TAG = Log.tag(ThanksForYourSupportBottomSheetDialogFragment::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Callback {
|
||||||
|
fun onBoostThanksSheetDismissed()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,10 +122,6 @@
|
||||||
app:argType="org.thoughtcrime.securesms.badges.models.Badge"
|
app:argType="org.thoughtcrime.securesms.badges.models.Badge"
|
||||||
app:nullable="false" />
|
app:nullable="false" />
|
||||||
|
|
||||||
<argument
|
|
||||||
android:name="isBoost"
|
|
||||||
android:defaultValue="false"
|
|
||||||
app:argType="boolean" />
|
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
<dialog
|
<dialog
|
||||||
|
|
Loading…
Add table
Reference in a new issue