mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Add in-chat payment messages.
This commit is contained in:
committed by
Greyson Parrelli
parent
28193c2f61
commit
1dc29fda12
@@ -107,6 +107,7 @@ public final class FeatureFlags {
|
||||
public static final String CREDIT_CARD_DISABLED_REGIONS = "global.donations.ccDisabledRegions";
|
||||
public static final String PAYPAL_DISABLED_REGIONS = "global.donations.paypalDisabledRegions";
|
||||
private static final String CDS_HARD_LIMIT = "android.cds.hardLimit";
|
||||
private static final String PAYMENTS_IN_CHAT_MESSAGES = "android.payments.inChatMessages";
|
||||
|
||||
/**
|
||||
* We will only store remote values for flags in this set. If you want a flag to be controllable
|
||||
@@ -166,7 +167,8 @@ public final class FeatureFlags {
|
||||
CREDIT_CARD_DISABLED_REGIONS,
|
||||
PAYPAL_DISABLED_REGIONS,
|
||||
KEEP_MUTED_CHATS_ARCHIVED,
|
||||
CDS_HARD_LIMIT
|
||||
CDS_HARD_LIMIT,
|
||||
PAYMENTS_IN_CHAT_MESSAGES
|
||||
);
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -231,7 +233,8 @@ public final class FeatureFlags {
|
||||
CREDIT_CARD_PAYMENTS,
|
||||
PAYMENTS_REQUEST_ACTIVATE_FLOW,
|
||||
KEEP_MUTED_CHATS_ARCHIVED,
|
||||
CDS_HARD_LIMIT
|
||||
CDS_HARD_LIMIT,
|
||||
PAYMENTS_IN_CHAT_MESSAGES
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -565,6 +568,11 @@ public final class FeatureFlags {
|
||||
return getBoolean(PAYMENTS_REQUEST_ACTIVATE_FLOW, false);
|
||||
}
|
||||
|
||||
/** Whether client supports processing a payment notification as a in-chat message */
|
||||
public static boolean paymentsInChatMessages() {
|
||||
return getBoolean(PAYMENTS_IN_CHAT_MESSAGES, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether users can enable keeping conversations with incoming messages archived if the conversation is muted.
|
||||
*/
|
||||
|
||||
@@ -42,17 +42,11 @@ fun MessageRecord.hasThumbnail(): Boolean =
|
||||
isMms && (this as MmsMessageRecord).slideDeck.thumbnailSlide != null
|
||||
|
||||
fun MessageRecord.isStoryReaction(): Boolean =
|
||||
isMms && MmsSmsColumns.Types.isStoryReaction((this as MmsMessageRecord).type)
|
||||
isMms && MmsSmsColumns.Types.isStoryReaction(type)
|
||||
|
||||
fun MessageRecord.isStory(): Boolean =
|
||||
isMms && (this as MmsMessageRecord).storyType.isStory
|
||||
|
||||
fun MessageRecord.isPaymentActivationRequest(): Boolean =
|
||||
isMms && MmsSmsColumns.Types.isRequestToActivatePayments((this as MmsMessageRecord).type)
|
||||
|
||||
fun MessageRecord.isPaymentsActivated(): Boolean =
|
||||
isMms && MmsSmsColumns.Types.isPaymentsActivated((this as MmsMessageRecord).type)
|
||||
|
||||
fun MessageRecord.isBorderless(context: Context): Boolean {
|
||||
return isCaptionlessMms(context) &&
|
||||
hasThumbnail() &&
|
||||
@@ -142,7 +136,8 @@ fun MessageRecord.isTextOnly(context: Context): Boolean {
|
||||
!hasSharedContact() &&
|
||||
!hasSticker() &&
|
||||
!isCaptionlessMms(context) &&
|
||||
!hasGiftBadge()
|
||||
!hasGiftBadge() &&
|
||||
!isPaymentNotification()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public final class RemoteDeleteUtil {
|
||||
(!message.getRecipient().isGroup() || message.getRecipient().isActiveGroup()) &&
|
||||
!message.isRemoteDelete() &&
|
||||
!MessageRecordUtil.hasGiftBadge(message) &&
|
||||
!message.isPaymentNotification() &&
|
||||
(((currentTime - message.getDateSent()) < SEND_THRESHOLD) || message.getRecipient().isSelf());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user