Skip to content

Commit

Permalink
Update donations strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-signal committed Jan 11, 2023
1 parent 429f89c commit 3543a5e
Show file tree
Hide file tree
Showing 19 changed files with 70 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ object ExpiredGiftSheetConfiguration {
private fun DSLConfiguration.expiredSheet(onMakeAMonthlyDonation: () -> Unit, onNotNow: () -> Unit) {
textPref(
title = DSLSettingsText.from(
stringId = R.string.ExpiredGiftSheetConfiguration__your_gift_badge_has_expired,
stringId = R.string.ExpiredGiftSheetConfiguration__your_badge_has_expired,
DSLSettingsText.CenterModifier, DSLSettingsText.TitleLargeModifier
)
)

textPref(
title = DSLSettingsText.from(
stringId = R.string.ExpiredGiftSheetConfiguration__your_gift_badge_has_expired_and_is,
stringId = R.string.ExpiredGiftSheetConfiguration__your_badge_has_expired_and_is,
DSLSettingsText.CenterModifier
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import org.thoughtcrime.securesms.badges.BadgeImageView
import org.thoughtcrime.securesms.badges.gifts.Gifts.formatExpiry
import org.thoughtcrime.securesms.database.model.databaseprotos.GiftBadge
import org.thoughtcrime.securesms.mms.GlideRequests
import org.thoughtcrime.securesms.recipients.Recipient

/**
* Displays a gift badge sent to or received from a user, and allows the user to
Expand Down Expand Up @@ -49,16 +50,17 @@ class GiftMessageView @JvmOverloads constructor(
}
}

fun setGiftBadge(glideRequests: GlideRequests, giftBadge: GiftBadge, isOutgoing: Boolean, callback: Callback) {
titleView.setText(R.string.GiftMessageView__gift_badge)
fun setGiftBadge(glideRequests: GlideRequests, giftBadge: GiftBadge, isOutgoing: Boolean, callback: Callback, recipient: Recipient) {
descriptionView.text = giftBadge.formatExpiry(context)
actionView.icon = null
actionView.setOnClickListener { callback.onViewGiftBadgeClicked() }
actionView.isEnabled = true

if (isOutgoing) {
actionView.setText(R.string.GiftMessageView__view)
titleView.text = context.getString(R.string.GiftMessageView__donation_to_s, recipient.getDisplayName(context))
} else {
titleView.text = context.getString(R.string.GiftMessageView__s_donated_to_signal_on, recipient.getShortDisplayName(context))
when (giftBadge.redemptionState) {
GiftBadge.RedemptionState.REDEEMED -> {
stopAnimationIfNeeded()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import org.thoughtcrime.securesms.util.navigation.safeNavigate
*/
class GiftFlowConfirmationFragment :
DSLSettingsFragment(
titleId = R.string.GiftFlowConfirmationFragment__confirm_gift,
titleId = R.string.GiftFlowConfirmationFragment__confirm_donation,
layoutId = R.layout.gift_flow_confirmation_fragment
),
EmojiKeyboardPageFragment.Callback,
Expand Down Expand Up @@ -221,7 +221,7 @@ class GiftFlowConfirmationFragment :
)

textPref(
summary = DSLSettingsText.from(R.string.GiftFlowConfirmationFragment__your_gift_will_be_sent_in)
summary = DSLSettingsText.from(R.string.GiftFlowConfirmationFragment__the_recipient_will_be_notified)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class GiftFlowStartFragment : DSLSettingsFragment(

noPadTextPref(
title = DSLSettingsText.from(
R.string.GiftFlowStartFragment__gift_a_badge,
R.string.GiftFlowStartFragment__donate_for_a_friend,
DSLSettingsText.CenterModifier,
DSLSettingsText.TextAppearanceModifier(R.style.Signal_Text_Headline)
)
Expand All @@ -79,7 +79,7 @@ class GiftFlowStartFragment : DSLSettingsFragment(
space(DimensionUnit.DP.toPixels(16f).toInt())

noPadTextPref(
title = DSLSettingsText.from(R.string.GiftFlowStartFragment__gift_someone_a_badge, DSLSettingsText.CenterModifier)
title = DSLSettingsText.from(resources.getQuantityString(R.plurals.GiftFlowStartFragment__support_signal_by, 30, 30), DSLSettingsText.CenterModifier)
)

space(DimensionUnit.DP.toPixels(16f).toInt())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object GiftRowItem {
override fun bind(model: Model) {
binding.check.visible = false
binding.badge.setBadge(model.giftBadge)
binding.tagline.setText(R.string.GiftRowItem__send_a_gift_badge)
binding.tagline.visible = false

val price = FiatMoneyUtil.format(
context.resources,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class GiftThanksSheet : DSLSettingsBottomSheetFragment() {

noPadTextPref(
title = DSLSettingsText.from(
getString(R.string.GiftThanksSheet__youve_gifted_a_badge_to_s, recipient.getDisplayName(requireContext())),
getString(R.string.GiftThanksSheet__youve_made_a_donation, recipient.getDisplayName(requireContext())),
DSLSettingsText.CenterModifier
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class ViewReceivedGiftBottomSheet : DSLSettingsBottomSheetFragment() {
if (state.recipient != null && !isGiftBadgeRedeemed(state.giftBadge)) {
noPadTextPref(
title = DSLSettingsText.from(
charSequence = requireContext().getString(R.string.ViewReceivedGiftBottomSheet__s_sent_you_a_gift, state.recipient.getShortDisplayName(requireContext())),
charSequence = requireContext().getString(R.string.ViewReceivedGiftBottomSheet__s_made_a_donation_for_you, state.recipient.getShortDisplayName(requireContext())),
DSLSettingsText.CenterModifier, DSLSettingsText.TitleLargeModifier
)
)
Expand All @@ -179,7 +179,7 @@ class ViewReceivedGiftBottomSheet : DSLSettingsBottomSheetFragment() {
private fun DSLConfiguration.presentSubheading(recipient: Recipient) {
noPadTextPref(
title = DSLSettingsText.from(
charSequence = requireContext().getString(R.string.ViewReceivedGiftBottomSheet__youve_received_a_gift_badge, recipient.getDisplayName(requireContext())),
charSequence = requireContext().getString(R.string.ViewReceivedGiftBottomSheet__s_made_a_donation_to_signal, recipient.getShortDisplayName(requireContext())),
DSLSettingsText.CenterModifier
)
)
Expand All @@ -206,7 +206,8 @@ class ViewReceivedGiftBottomSheet : DSLSettingsBottomSheetFragment() {
else -> {
customPref(
BadgeDisplay112.Model(
badge = badge
badge = badge,
withDisplayText = false
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class ViewSentGiftBottomSheet : DSLSettingsBottomSheetFragment() {
if (state.recipient != null) {
noPadTextPref(
title = DSLSettingsText.from(
charSequence = getString(R.string.ViewSentGiftBottomSheet__youve_gifted_a_badge, state.recipient.getDisplayName(requireContext())),
charSequence = getString(R.string.ViewSentGiftBottomSheet__youve_made_a_donation_to_signal, state.recipient.getDisplayName(requireContext())),
DSLSettingsText.CenterModifier
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void setQuote(GlideRequests glideRequests,
}

private @Nullable CharSequence resolveBody(@Nullable CharSequence body, @NonNull QuoteModel.Type quoteType) {
return quoteType == QuoteModel.Type.GIFT_BADGE ? getContext().getString(R.string.QuoteView__gift) : body;
return quoteType == QuoteModel.Type.GIFT_BADGE ? getContext().getString(R.string.QuoteView__donation_for_a_friend) : body;
}

public void setTopCornerSizes(boolean topLeftLarge, boolean topRightLarge) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class GatewaySelectorBottomSheet : DSLSettingsBottomSheetFragment() {
space(6.dp)
noPadTextPref(
title = DSLSettingsText.from(
R.string.GatewaySelectorBottomSheet__send_a_gift_badge,
R.string.GatewaySelectorBottomSheet__donate_for_a_friend,
DSLSettingsText.CenterModifier,
DSLSettingsText.BodyLargeModifier,
DSLSettingsText.ColorModifier(ContextCompat.getColor(context, R.color.signal_colorOnSurfaceVariant))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class DonationErrorParams<V> private constructor(
private fun <V> getGenericRedemptionError(context: Context, genericError: DonationError.BadgeRedemptionError.GenericError, callback: Callback<V>): DonationErrorParams<V> {
return when (genericError.source) {
DonationErrorSource.GIFT -> DonationErrorParams(
title = R.string.DonationsErrors__failed_to_send_gift_badge,
message = R.string.DonationsErrors__could_not_send_gift_badge,
title = R.string.DonationsErrors__donation_failed,
message = R.string.DonationsErrors__your_payment_was_processed_but,
positiveAction = callback.onContactSupport(context),
negativeAction = null
)
Expand All @@ -74,14 +74,14 @@ class DonationErrorParams<V> private constructor(
private fun <V> getVerificationErrorParams(context: Context, verificationError: DonationError.GiftRecipientVerificationError, callback: Callback<V>): DonationErrorParams<V> {
return when (verificationError) {
is DonationError.GiftRecipientVerificationError.FailedToFetchProfile -> DonationErrorParams(
title = R.string.DonationsErrors__couldnt_send_gift,
message = R.string.DonationsErrors__please_check_your_network_connection,
title = R.string.DonationsErrors__cannot_send_donation,
message = R.string.DonationsErrors__your_donation_could_not_be_sent,
positiveAction = callback.onOk(context),
negativeAction = null
)
else -> DonationErrorParams(
title = R.string.DonationsErrors__cant_send_gift,
message = R.string.DonationsErrors__target_does_not_support_gifting,
title = R.string.DonationsErrors__cannot_send_donation,
message = R.string.DonationsErrors__this_user_cant_receive_donations_until,
positiveAction = callback.onOk(context),
negativeAction = null
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class ManageDonationsFragment :

if (FeatureFlags.giftBadgeSendSupport() && Recipient.self().giftBadgesCapability == Recipient.Capability.SUPPORTED) {
clickPref(
title = DSLSettingsText.from(R.string.ManageDonationsFragment__gift_a_badge),
title = DSLSettingsText.from(R.string.ManageDonationsFragment__donate_for_a_friend),
icon = DSLSettingsIcon.from(R.drawable.ic_gift_24),
onClick = {
startActivity(Intent(requireContext(), GiftFlowActivity::class.java))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class DonationReceiptDetailFragment : DSLSettingsFragment(layoutId = R.layout.do
val type: String = when (record.type) {
DonationReceiptRecord.Type.RECURRING -> getString(R.string.DonationReceiptDetailsFragment__s_dash_s, subscriptionName, getString(R.string.DonationReceiptListFragment__recurring))
DonationReceiptRecord.Type.BOOST -> getString(R.string.DonationReceiptListFragment__one_time)
DonationReceiptRecord.Type.GIFT -> getString(R.string.DonationReceiptListFragment__gift)
DonationReceiptRecord.Type.GIFT -> getString(R.string.DonationReceiptListFragment__donation_for_a_friend)
}
val datePaid: String = DateUtils.formatDate(Locale.getDefault(), record.timestamp)

Expand Down Expand Up @@ -142,7 +142,7 @@ class DonationReceiptDetailFragment : DSLSettingsFragment(layoutId = R.layout.do
when (record.type) {
DonationReceiptRecord.Type.RECURRING -> getString(R.string.DonationReceiptDetailsFragment__s_dash_s, subscriptionName, getString(R.string.DonationReceiptListFragment__recurring))
DonationReceiptRecord.Type.BOOST -> getString(R.string.DonationReceiptListFragment__one_time)
DonationReceiptRecord.Type.GIFT -> getString(R.string.DonationReceiptListFragment__gift)
DonationReceiptRecord.Type.GIFT -> getString(R.string.DonationReceiptListFragment__donation_for_a_friend)
}
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DonationReceiptListFragment : Fragment(R.layout.donation_receipt_list_frag
0 -> R.string.DonationReceiptListFragment__all
1 -> R.string.DonationReceiptListFragment__recurring
2 -> R.string.DonationReceiptListFragment__one_time
3 -> R.string.DonationReceiptListFragment__gift
3 -> R.string.DonationReceiptListFragment__donation_for_a_friend
else -> error("Unsupported index $position")
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object DonationReceiptListItem {
when (model.record.type) {
DonationReceiptRecord.Type.RECURRING -> R.string.DonationReceiptListFragment__recurring
DonationReceiptRecord.Type.BOOST -> R.string.DonationReceiptListFragment__one_time
DonationReceiptRecord.Type.GIFT -> R.string.DonationReceiptListFragment__gift
DonationReceiptRecord.Type.GIFT -> R.string.DonationReceiptListFragment__donation_for_a_friend
}
)
moneyView.text = FiatMoneyUtil.format(context.resources, model.record.amount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ private void setMediaAttributes(@NonNull MessageRecord messageRe
paymentViewStub.setVisibility(View.GONE);

MmsMessageRecord mmsMessageRecord = (MmsMessageRecord) messageRecord;
giftViewStub.get().setGiftBadge(glideRequests, Objects.requireNonNull(mmsMessageRecord.getGiftBadge()), messageRecord.isOutgoing(), giftMessageViewCallback);
giftViewStub.get().setGiftBadge(glideRequests, Objects.requireNonNull(mmsMessageRecord.getGiftBadge()), messageRecord.isOutgoing(), giftMessageViewCallback, messageRecord.getRecipient());
giftViewStub.get().setVisibility(VISIBLE);

footer.setVisibility(VISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ private ThreadBodyUtil() {

private static @NonNull String getGiftSummary(@NonNull Context context, @NonNull MessageRecord messageRecord) {
if (messageRecord.isOutgoing()) {
return context.getString(R.string.ThreadRecord__you_sent_a_gift);
return context.getString(R.string.ThreadRecord__you_donated_for_s, messageRecord.getRecipient().getShortDisplayName(context));
} else if (messageRecord.getViewedReceiptCount() > 0) {
return context.getString(R.string.ThreadRecord__you_redeemed_a_gift_badge);
return context.getString(R.string.ThreadRecord__you_redeemed_a_badge);
} else {
return context.getString(R.string.ThreadRecord__you_received_a_gift);
return context.getString(R.string.ThreadRecord__s_donated_for_you, messageRecord.getRecipient().getShortDisplayName(context));
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/redeeming_gift_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
android:layout_marginTop="20dp"
android:layout_marginEnd="16dp"
android:gravity="center"
android:text="@string/ViewReceivedGiftSheet__redeeming_gift"
android:text="@string/ViewReceivedGiftSheet__redeeming_badge"
android:textAppearance="@style/Signal.Text.Body"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down

0 comments on commit 3543a5e

Please sign in to comment.