Remove deprecated LevelConfiguration#name.

Co-authored-by: Alex Hart <alex@signal.org>
This commit is contained in:
Chris Eager
2024-10-17 07:25:24 -05:00
committed by Greyson Parrelli
parent 200132e623
commit ba34a74e2d
21 changed files with 56 additions and 105 deletions

View File

@@ -115,7 +115,7 @@ class GiftFlowConfirmationFragment :
val continueButton = requireView().findViewById<MaterialButton>(R.id.continue_button)
continueButton.setOnClickListener {
lifecycleDisposable += viewModel.insertInAppPayment(requireContext()).subscribe { inAppPayment ->
lifecycleDisposable += viewModel.insertInAppPayment().subscribe { inAppPayment ->
findNavController().safeNavigate(
GiftFlowConfirmationFragmentDirections.actionGiftFlowConfirmationFragmentToGatewaySelectorBottomSheet(
inAppPayment

View File

@@ -1,11 +1,9 @@
package org.thoughtcrime.securesms.badges.gifts.flow
import android.content.Context
import io.reactivex.rxjava3.core.Single
import io.reactivex.rxjava3.schedulers.Schedulers
import org.signal.core.util.money.FiatMoney
import org.signal.donations.InAppPaymentType
import org.thoughtcrime.securesms.R
import org.thoughtcrime.securesms.badges.Badges
import org.thoughtcrime.securesms.badges.models.Badge
import org.thoughtcrime.securesms.components.settings.app.subscription.DonationSerializationHelper.toFiatValue
@@ -25,7 +23,7 @@ import java.util.Locale
*/
class GiftFlowRepository {
fun insertInAppPayment(context: Context, giftSnapshot: GiftFlowState): Single<InAppPaymentTable.InAppPayment> {
fun insertInAppPayment(giftSnapshot: GiftFlowState): Single<InAppPaymentTable.InAppPayment> {
return Single.fromCallable {
SignalDatabase.inAppPayments.insert(
type = InAppPaymentType.ONE_TIME_GIFT,
@@ -34,7 +32,6 @@ class GiftFlowRepository {
endOfPeriod = null,
inAppPaymentData = InAppPaymentData(
badge = Badges.toDatabaseBadge(giftSnapshot.giftBadge!!),
label = context.getString(R.string.preferences__one_time),
amount = giftSnapshot.giftPrices[giftSnapshot.currency]!!.toFiatValue(),
level = giftSnapshot.giftLevel!!,
recipientId = giftSnapshot.recipient!!.id.serialize(),

View File

@@ -1,6 +1,5 @@
package org.thoughtcrime.securesms.badges.gifts.flow
import android.content.Context
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
@@ -104,9 +103,9 @@ class GiftFlowViewModel(
)
}
fun insertInAppPayment(context: Context): Single<InAppPaymentTable.InAppPayment> {
fun insertInAppPayment(): Single<InAppPaymentTable.InAppPayment> {
val giftSnapshot = snapshot
return giftFlowRepository.insertInAppPayment(context, giftSnapshot)
return giftFlowRepository.insertInAppPayment(giftSnapshot)
.doOnSuccess { inAppPayment ->
store.update { it.copy(inAppPaymentId = inAppPayment.id) }
}